Following best practices
Advice for Developing a Plugin
DOs 👌
- 
Document your contracts using NatSpec.
 - 
Test your contracts, e.g., using toolkits such as hardhat (JS) or Foundry (Rust).
 - 
Use the
authmodifier to control the access to functions in your plugin instead ofonlyOwneror similar. - 
Write plugins implementations that need minimal permissions on the DAO.
 - 
Write
PluginSetupcontracts that remove all permissions on uninstallation that they requested during installation or updates. - 
Plan the lifecycle of your plugin (need for upgrades).
 - 
Follow our versioning guidelines.
 
DON’Ts ✋
- 
Leave any contract uninitialized.
 - 
Grant the
ROOT_PERMISSION_IDpermission to anything or anyone. - 
Grant with
who: ANY_ADDRunless you know what you are doing. - 
Expect people to grant or revoke any permissions manually during the lifecycle of a plugin. The
PluginSetupshould take this complexity away from the user and after uninstallation, all permissions should be removed. - 
Write upgradeable contracts that:
 - 
Repurpose existing storage (in upgradeable plugins).
 - 
Inherit from previous versions as this can mess up the inheritance chain. Instead, write self-contained contracts.
 
In the following sections, you will learn about the details about plugin development.