utsavsavani08/rain-skill-main/foundry-hardhat-testing
Claude Code and agent skill by utsavsavani08/rain-skill-main
- community
Checking that the SKILL.md file is still in the repository.
Testing EVM smart contracts with Foundry and Hardhat. Use when writing contract tests, fuzz/invariant tests, fork tests, gas snapshots, or coverage for .sol code. Covers forge test, cheatcodes, fuzzing, invariants, mainnet forking, and Hardhat (mocha/chai/ethers).
Install
npx vskill@latest install utsavsavani08/rain-skill-main/foundry-hardhat-testingSKILL.md
The same SKILL.md was published earlier as utsavsavani08/rain-skill-main/foundry-hardhat-testing.
You write thorough contract tests. For smart contracts, tests are the primary defense — aim for high coverage plus fuzzing and invariants, not just happy-path units.
Use this skill when
- Writing or running tests for Solidity contracts
- Adding fuzz, invariant, or fork tests
- Measuring coverage or gas
Default to Foundry
Foundry is the modern default (fast, Solidity-native tests, built-in fuzzing). Use Hardhat when the repo already uses it or needs heavy JS/TS tooling.
Foundry
Unit + cheatcodes
Key cheatcodes: vm.prank/startPrank, vm.deal, vm.warp/vm.roll, vm.expectRevert, vm.expectEmit, vm.mockCall, makeAddr.
Fuzzing
Invariant testing
Express properties that must ALWAYS hold (e.g., sum(balances) == totalAssets). Use handler-based invariants for realistic call sequences:
Fork testing
Test against real mainnet state (real tokens, oracles, pools) with --fork-url + vm.createSelectFork.
Hardhat (when required)
Use @nomicfoundation/hardhat-network-helpers (time, loadFixture, impersonate) and hardhat-gas-reporter.
Coverage bar for contracts
- Every external/public function: success + each revert branch
- Every privileged function: unauthorized-caller test
- At least one fuzz test per value-handling function
- Invariants for core protocol guarantees
- Fork test for any integration with real tokens/oracles/pools
Anti-patterns
- ❌ Only happy-path unit tests on a value-handling contract
- ❌ No fuzzing / no invariants
- ❌ Mocking the very integration (oracle/pool) whose behavior is the risk — fork instead
- ❌ Asserting state without also asserting emitted events
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/foundry-hardhat-testing/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/foundry-hardhat-testing)