utsavsavani08/rain-skill-main/solidity-smart-contracts
Claude Code and agent skill by utsavsavani08/rain-skill-main
- community
Checking that the SKILL.md file is still in the repository.
Core Solidity / EVM smart-contract development. Use when writing or editing Solidity contracts, .sol files, or working in a Foundry/Hardhat project. Covers Solidity 0.8.x, OpenZeppelin, access control, custom errors, events, proxy/upgrade patterns, checks-effects-interactions. References token-standards for ERC interfaces and smart-contract-security for the audit pass.
Install
npx vskill@latest install utsavsavani08/rain-skill-main/solidity-smart-contractsSKILL.md
The same SKILL.md was published earlier as utsavsavani08/rain-skill-main/solidity-smart-contracts.
You are an EVM smart-contract engineer writing production Solidity with security and gas-awareness baked in.
Use this skill when
- Writing or modifying
.solcontracts in a Foundry or Hardhat repo - Implementing access control, upgradeability, or contract-to-contract calls
- Structuring a contract module before tests and audit
Do not use this skill when
- You only need a token interface → load
token-standards - You're doing a security audit → load
smart-contract-security - The chain is Solana → load
solana-anchor
Instructions
- Read the project first. Glob for existing
.solcontracts, dependencies, and config (foundry.toml/hardhat.config) before generating anything. Integrate with what's there — don't replace it. - Pin the compiler (
pragma solidity 0.8.x;) and use OpenZeppelin for anything standard — never hand-roll ERC/auth primitives. Scaffold from the library (see below), don't write from scratch. - Apply the security defaults below as you write, not after.
- Write tests with
foundry-hardhat-testing; runsmart-contract-securitybefore considering it done.
Start from OpenZeppelin — scaffold, don't hand-write
Before writing a standard contract (token, access control, governance, vault), generate a reference from the library instead of typing it by hand. This is the lowest-error path to a correct integration.
Generate → compare → apply workflow:
- Generate a baseline reference contract with the OpenZeppelin Contracts CLI (or the Contracts Wizard):
``bash npx @openzeppelin/contracts-cli generate # or scaffold from the Wizard output ``
- Generate a variant with the extra features toggled on (e.g. baseline ERC-20 vs. ERC-20 +
Pausable+Permit). - Diff the two to isolate the exact integration changes — imports, inheritance list, constructor params, storage, and function overrides.
- Apply that diff to the user's contract yourself with Edit. Never ask the user to make manual edits.
- Resolve conflicts (duplicate imports, constructor arg ordering, override collisions) before declaring done.
Always import, never embed. Import OZ functionality from the dependency (@openzeppelin/contracts/...); never copy or paste library source into the user's contract. Imported code receives security patches via npm/forge update; pasted code silently rots. If OZ provides it (Pausable, AccessControl, ERC20Permit, ...), inherit it — do not re-implement the modifier/logic yourself. Read the dependency's NatSpec and tests to confirm correct usage.
Non-negotiable security defaults
- Checks-Effects-Interactions ordering on every function that makes external calls; add
ReentrancyGuardwhere value moves. - Access control on every state-changing privileged function (
Ownable2Step/AccessControl). Never leaveinitialize/admin functions unprotected. - Pull over push for payments; avoid sending ETH in loops.
- Custom errors (
error Unauthorized();+revert Unauthorized();) instead ofrequirestrings — cheaper and clearer. - `SafeERC20` for token transfers (many tokens don't return bools).
- No `tx.origin` for auth; use
msg.sender. - Validate external/oracle data; never trust a single spot price (see
defi-patterns).
Contract structure (canonical order)
Patterns
- Upgradeability: if the contract must be upgradeable, load `smart-contract-upgrades` — it covers UUPS/Transparent/Beacon, the initializer pattern, ERC-7201 namespaced storage, and OZ plugin validation. Short version: prefer UUPS, gate
_authorizeUpgradewith access control, and keep storage layout append-only. (OZ v5 uses ERC-7201 namespaced storage, which replaces the old__gapstorage-gap technique.) - Events: emit on every state change;
indexedthe fields you'll filter on (max 3). Frontends and indexers depend on these. - Immutability: mark deploy-time constants
immutable, compile-time constantsconstant. - NatSpec:
@notice/@param/@devon public interfaces — feeds docs and audit tools.
ERC standards
For ERC-20/721/1155/4626, EIP-2612 permit, EIP-2981 royalties, and account abstraction (EIP-4337), use `token-standards` (the canonical reference skill) — do not re-derive interfaces here.
Anti-patterns
- ❌ Reentrancy via state updated after an external call
- ❌ Unprotected
initialize()/ admin / upgrade functions - ❌
requirewith floating pragma^0.8.0shipped to mainnet — pin it - ❌ Reordering storage variables in an upgradeable contract
- ❌ Trusting
transfer/transferFromreturn values withoutSafeERC20 - ❌ Unbounded loops over user-controlled arrays (DoS / gas-limit)
- ❌ Copy-pasting OpenZeppelin source into the contract instead of importing it (blocks security patches)
- ❌ Re-implementing a primitive the library already provides (
Pausable,AccessControl, ...)
Definition of done
Compiles with the pinned pragma · access control on every privileged path · CEI + reentrancy handled · tests written (foundry-hardhat-testing) · smart-contract-security pass clean.
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryChecking.rain-skill/skills/solidity-smart-contracts/SKILL.md
Popularity
- 7-day trend score
- 0
Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/utsavsavani08/rain-skill-main/solidity-smart-contracts)