solidity-guide
Installation
SKILL.md
Solidity Guide
Applies to: Solidity 0.8.20+, Ethereum, EVM-compatible chains, DeFi, NFTs
Core Principles
- Security First: Every function is a potential attack surface. Assume adversarial callers.
- Gas Efficiency: On-chain computation is expensive. Optimize storage access and minimize state changes.
- Explicit Over Implicit: Use explicit visibility, explicit types, and named return values.
- Immutability by Default: Prefer
immutableandconstantfor values that do not change after deployment. - Standards Compliance: Use OpenZeppelin for ERC standards. Do not roll your own token logic.
Guardrails
Compiler Version
- ALWAYS specify pragma version range:
pragma solidity ^0.8.20; - Do NOT use floating pragmas in production (e.g.,
>=0.8.0). Pin to a minor range. - Enable the optimizer with at least 200 runs for production deployments.
Related skills