Loading...
Loading...
[AUTO-INVOKE] MUST be invoked BEFORE writing or modifying any Solidity contract (.sol files). Covers private key handling, access control, reentrancy prevention, gas safety, and pre-audit checklists. Trigger: any task involving creating, editing, or reviewing .sol source files.
npx skill4agent add 0xlayerghost/solidity-agent-kit solidity-security.envsource .env.env.example.env.gitignoregit status| Situation | Required Action |
|---|---|
| External ETH/token transfer | Use |
| ERC20 token interaction | Use |
| Owner-only function | Inherit |
| Multi-role access | Use |
| Token approval | Use |
| Price data needed | Use Chainlink |
| Upgradeable contract | Prefer UUPS ( |
| Solidity version < 0.8.0 | Must use |
| Emergency scenario | Inherit |
| Whitelist / airdrop | Use |
| Signature-based auth | Use |
| Signature content | Signature must bind |
| Cross-chain bridge / third-party dependency | Audit all inherited third-party contract code — never assume dependencies are safe |
| Deprecated / legacy contracts | Permanently |
| UUPS upgrade pattern | |
| Multi-contract trust boundary | Router/Registry relay calls must verify source contract authorization; never trust caller identity inside flash loan callbacks — EVMbench/noya H-08 |
| Counter/ID + external call | All counter increments and ID assignments must complete before external calls; ETH refunds must be last — EVMbench/phi H-06 |
ReentrancyGuardnonReentrant@openzeppelin/contracts/security/ReentrancyGuard.solReentrancyGuardrequireaddress(0)--gas-limitforge test --gas-reportfoundry.tomloptimizer = trueoptimizer_runs = 200nonReentranttx.originmsg.senderdelegatecallOwnable2StepOwnablePausablepause()unpause()_authorizeUpgradeonlyOwner_disableInitializers()SafeERC20safeTransfersafeTransferFromtoken.transfer()require(token.transfer())safeIncreaseAllowanceapproveexternal call.env.gitignoreforge testforge coverage# Run all tests with gas report
forge test --gas-report
# Fuzz testing with higher runs for critical functions
forge test --fuzz-runs 10000
# Check test coverage
forge coverage
# Dry-run deployment to verify no runtime errors
forge script script/Deploy.s.sol --fork-url $RPC_URL -vvvv
# Static analysis (if slither installed locally)
slither src/slither| Approach | When to Use |
|---|---|
| Quick local scan, raw terminal output |
slither MCP | Structured results with impact/confidence filtering, AI can parse and reason about findings |
slither MCP | Understanding contract structure before reviewing code |
slither MCP | Locating exact function implementations faster than grep |
forge test --fuzz-runs 10000