I was working to create skeletal extension module through civix but unfortunately I am getting this exception "Failed to locate CMS. Please call civix from somewhere under the CMS root."
Maybe the standard wrong suggestion :-) but did you try the generate:module whilst in a subfolder of your website root?
The problem is resolved now, actually when I called civix from var/www/drupal I was getting this exception. Then after installing buildkit and setup of drupal-demo site, I again called civix but this time under the drupal-demo CMS root dir (viz. /opt/buildkit/build/dmaster/sites/all/modules). Now I am successfully able to generate a skeletal extension module.