Chef cookbooks

Cookbooks are the way to us to group our Recipes into a set of configuration instructions, give a version number and track changes in the future. A cookbook allows us to describe what a set of configuration instructions are meant to accomplish. They contain also any supporting components that the recipes might access to, such as static configuration files, templates and version control.
Generate a cookbook:

chef generate cookbook cookbooks/workstation
cookbooks/workstation - the directory where the cookbook is stored
$ tree  cookbooks/
`-- workstation
    |-- Berksfile
    |-- chefignore
    |-- metadata.rb
    |-- recipes
    |   `-- default.rb
    |-- spec
    |   |-- spec_helper.rb
    |   `-- unit
    |       `-- recipes
    |           `-- default_spec.rb
    `-- test
        `-- recipes
	    `-- default_test.rb
Berksfile - This file is used to manage dependencies for cookbook
chefignore - very simlar to gitignore and dockerignore, the directories that you will like to exclude from your Chef server. These usually are the directories spec/ and test/ - directories used for testing cookbook locally.
metadata.rb - contains just common information about the version, maintainer of the cookbook, licencing information, short description about how to use cookbook. Also, we can store dependencies inside the metadata file - essentially you should think about them as libraries: cookbooks can call other cookbooks and utilize recipes outside of another cookbook. - you can put here how to utilize this cookbook using Markdown syntax. When you will look in cookbooks in the Supermarket or a Github repository - you'll see the README display.
recipes - this directory intuitively contains all your recipes. There is a default recipe.
spec/ and test/ - in the future you might want to take a Test Driven approach to building your cookbooks and your infrastructure. That's what these directories are for: spec/ is for unit testing your cookbooks using a common Unit testing framework called RSpec for Ruby and RSpec can be used to test functionality pieces of your code do. In addition to this we have integration testing (test/ - directory) using a framework called Test Kitchen. These are common directories to include in your chefignore file