This section will help the Cacti plugin developer structure their plugins. However, the best way to create a plugin is to borrow someone elses. There are Cacti plugin examples on Cactis GitHub page and you can find them all over GitHub just by searching.
Use the following guidelines for creating your first plugin.
All plugins must use namespace isolation either through Classes, or using the plugin name in their functions. This prevents name space collisions.
An example plugin is provided here Example Plugin.
GitHub is the best place to publish your plugins. Learn to use it.