Basic steps to get you started.
1) gem install knife-spec
More info about knife-spec – https://github.com/sethvargo/knife-spec
2) knife cookbook create my-cookbook
Run the above knife command. You will see that the basic cookbook template is created.
** Creating cookbook my-cookbook
** Creating README for cookbook: my-cookbook
** Creating CHANGELOG for cookbook: my-cookbook
** Creating metadata for cookbook: my-cookbook
** Creating specs for cookbook: my-cookbook
3) Create a new repo on your github
https://github.com/UserOrOrgName => Create a new repo.
You can select a Readme or License and make other settings to your new repo. Name the repo as “my-cookbook”
4) git clone https://github.com/UserOrOrgName/my-cookbook
5) Copy all your files created in step 2 to your new git repo
6) git add, git commit, git push
You have a basic template of your cookbook on git!
Note- This is a dummies guide to start with writing Chef Cookbooks. There are better ways to manage cookbooks – try out Berkshelf (berkshelf.com) !