Use the snippet in the Magento 2 module creator.
Mage2Gen is an easy to use open source module generator for Magento 2. With the extensive interface the user can easily generate base code for a Magento 2 module.
The following parts can be generated by Mage2Gen: controllers, models, blocks, template files, plugins (the new rewrites), observer, console scripts and product attributes. Even more will be added in future updates.
Once logged in, you can save all of the generated modules. This enables you to go back to a module and generate a part that you possibly forgot when you initially created the module.
When the module is complete, you can download it as a zipfile or immediately install it with the provided wget shell command!
You can help Mage2Gen by reporting bugs, suggesting features, sharing it with others or by creating a pull request with fixes or features.
If you want to create you own snippet, check out this blog how to create a Mage2Gen snippet.