There is no need to start from scratch building a plugin, the Yeoman generator will generate all the boilerplate code you need based on your configuration.
To generate a new plugin, create the folder that will contain the skeleton of our plugin and, once inside the folder, run:
npx -p yo -p generator-datocms-plugin -c 'yo datocms-plugin'
The generator will prompt the following configuration questions:
Watch the example video to see the generator running.
Read the tutorial on how to build a custom plugin using the generator.
To add a plugin to a project, once inside the plugin's folder, run:
yarn addToProject
The generator will prompt you to pick the project on which you want to install the plugin and it will set everything up for you.
If you are re-installing a plugin, remember to manually uninstall first.