utsavsavani08/rain-skill-main/solidity-smart-contracts

Claude Code and agent skill by utsavsavani08/rain-skill-main

Trust tier 3
  • community
Source check pending

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-contracts

SKILL.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 .sol contracts 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

  1. Read the project first. Glob for existing .sol contracts, dependencies, and config (foundry.toml/hardhat.config) before generating anything. Integrate with what's there — don't replace it.
  2. 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.
  3. Apply the security defaults below as you write, not after.
  4. Write tests with foundry-hardhat-testing; run smart-contract-security before 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:

  1. 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 ``

  1. Generate a variant with the extra features toggled on (e.g. baseline ERC-20 vs. ERC-20 + Pausable + Permit).
  2. Diff the two to isolate the exact integration changes — imports, inheritance list, constructor params, storage, and function overrides.
  3. Apply that diff to the user's contract yourself with Edit. Never ask the user to make manual edits.
  4. 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 ReentrancyGuard where value moves.
  • Access control on every state-changing privileged function (Ownable2Step / AccessControl). Never leave initialize/admin functions unprotected.
  • Pull over push for payments; avoid sending ETH in loops.
  • Custom errors (error Unauthorized(); + revert Unauthorized();) instead of require strings — 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)

solidity
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;
import {Ownable2Step} from "@openzeppelin/contracts/access/Ownable2Step.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
contract Vault is Ownable2Step, ReentrancyGuard {
// type declarations / using
// state variables (group for storage packing — see gas-optimization)
// events
event Deposited(address indexed user, uint256 amount);
// custom errors
error ZeroAmount();
// modifiers
// constructor
constructor() Ownable(msg.sender) {}
// external / public
// internal / private
// view / pure last
}

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 _authorizeUpgrade with access control, and keep storage layout append-only. (OZ v5 uses ERC-7201 namespaced storage, which replaces the old __gap storage-gap technique.)
  • Events: emit on every state change; indexed the fields you'll filter on (max 3). Frontends and indexers depend on these.
  • Immutability: mark deploy-time constants immutable, compile-time constants constant.
  • NatSpec: @notice/@param/@dev on 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
  • ❌ require with floating pragma ^0.8.0 shipped to mainnet — pin it
  • ❌ Reordering storage variables in an upgradeable contract
  • ❌ Trusting transfer/transferFrom return values without SafeERC20
  • ❌ 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

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
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/utsavsavani08/rain-skill-main/solidity-smart-contracts/badge)](https://verified-skill.com/skills/utsavsavani08/rain-skill-main/solidity-smart-contracts)

Something wrong with this skill or its page? Tell us.