solidity-style
Installation
SKILL.md
Solidity style and safety
The conventions below are not enforced by solhint. For the lint-enforced rules (private state vars, underscore prefixes, library visibility, etc.), see the project root CLAUDE.md.
Errors
Prefer if (condition) revert CustomError(args);. require(condition, CustomError()) (available via IR in ^0.8.26, stable in ^0.8.27) is acceptable only when the file's pragma already targets that version and the rest of the file uses it. Do not bump pragma just to use it.
Custom errors follow ERC-6093:
- Domain prefix:
ERC<number>if the error violates an ERC spec; otherwise the component name (Governor,ECDSA,Timelock). - Include offending values as arguments so callers can decode the failure context.
- Never declare the same error name twice across the library — duplicates cause identifier conflicts when inheriting from multiple contracts.
Location priority: