solidity
Installation
SKILL.md
Solidity Smart Contract Development
Decision Points
Toolchain: Foundry (preferred) for new projects. Hardhat for existing JS/TS ecosystems.
Base contracts: Always start with OpenZeppelin when pattern exists (tokens, access control, upgrades).
Solidity version: Use ^0.8.20 minimum. Named imports: import {ERC20} from "...";
Security-First Mindset
CEI Pattern (Checks-Effects-Interactions):
- Checks - Validate all conditions and inputs first
- Effects - Update contract state
- Interactions - External calls LAST
This order prevents reentrancy. If external call happens before state update, attacker can re-enter and exploit stale state. Use ReentrancyGuard as additional protection.