Loading...
Loading...
[AUTO-INVOKE] MUST be invoked BEFORE writing or modifying any Solidity contract (.sol files). Covers pragma version, naming conventions, project layout, and OpenZeppelin integration. Trigger: any task involving creating, editing, or reviewing .sol source files.
npx skill4agent add 0xlayerghost/solidity-agent-kit solidity-codingpragma solidity ^0.8.20;remappings.txtrequireerror InsufficientBalance(uint256 available, uint256 required);if (balance < amount) revert InsufficientBalance(balance, amount);publicexternal@notice@param@returnindexedaddressimmutableconstantuncheckedassembly| Element | Convention | Example |
|---|---|---|
| Contract / Library | PascalCase | |
| Interface | | |
| State variable / Function | lowerCamelCase | |
| Constant / Immutable | UPPER_SNAKE_CASE | |
| Event | PascalCase (past tense) | |
| Custom Error | PascalCase | |
| Function parameter | prefix | |
i/j/k| Situation | Rule |
|---|---|
| Cross-contract constants | Place in |
| Interface definitions | Place in |
| Simple on-chain queries | Use |
| Complex multi-step operations | Use |
| Import style | Use named imports: |
src/ — Contract source code
interfaces/ — Interface definitions (I*.sol)
common/ — Shared constants, types, errors (Const.sol, Types.sol)
test/ — Test files (*.t.sol)
script/ — Deployment & interaction scripts (*.s.sol)
config/ — Network config, parameters (*.json)
deployments/ — Deployment records (latest.env)
docs/ — Documentation, changelogs
lib/ — Dependencies (managed by forge install)config/*.jsondeployments/latest.envfoundry.toml# Create new project
forge init <project-name>
# Install dependency
forge install OpenZeppelin/openzeppelin-contracts@v4.9.6
# Build contracts
forge build
# Format code
forge fmt
# Update remappings
forge remappings > remappings.txt