Back to Skills

web3-testing

ユニットテスト、統合テスト、メインネットフォークを使用してHardhatとFoundryでスマートコントラクトを包括的にテストします。Solidityコントラクトをテストする時、ブロックチェーンテストスイートをセットアップする時、またはDeFiプロトコルを検証する時に使用してください。

5stars1forksUpdated 3/10/2026

Security Assessment

Medium Risk(50/100)

Detected risks:

Secret Exposure([SKILL.md] PRIVATE_KEY, [SKILL.md] Token =, [SKILL.md] token =)
Sensitive File Access([SKILL.md] .env)
Security Score50/100

About web3-testing

The web3-testing skill provides a comprehensive framework for testing Ethereum smart contracts using Hardhat and Foundry. It enables developers to implement unit tests, integration tests, and realistic mainnet-forked scenarios to ensure the reliability, security, and efficiency of their Solidity contracts. By combining advanced testing patterns with blockchain-specific tooling, this skill helps developers identify issues such as incorrect token transfers, failed assertions, and gas inefficiencies before deploying contracts to live networks.

Key features include support for Hardhat configuration with network forking, gas reporting, and Etherscan verification, alongside reusable test fixtures for consistent deployment and state management. The skill demonstrates unit testing patterns for deployment validation, token transactions, event emissions, time-based operations, and gas optimization. Foundry integration allows for Solidity-native testing through Forge, expanding the range of testing options. This structured approach ensures that both functional correctness and performance metrics are verified, providing confidence in contract behavior across different environments.

This skill is particularly valuable for blockchain developers, DeFi protocol engineers, and QA teams responsible for smart contract validation. Use cases include writing unit and integration tests for token contracts, executing fuzz tests for edge cases, performing gas optimization checks, automating test coverage reports, and verifying contracts on Etherscan. It is also suitable for developers who want to simulate real-world scenarios using mainnet forks to validate interactions with live protocol contracts. Overall, it streamlines the process of building robust, secure, and efficient Ethereum smart contracts.

FAQ

How do I set up Hardhat to use this skill?

Install Hardhat and required plugins such as hardhat-toolbox, hardhat-etherscan, hardhat-gas-reporter, and solidity-coverage. Configure networks, forking, gas reporting, and Etherscan API keys as shown in the provided hardhat.config.js example.

Can this skill test contracts on a mainnet fork?

Yes, the skill includes configuration for Hardhat network forking, allowing developers to test contracts against a realistic mainnet state using an RPC URL and specific block number.

Is Foundry required to use this skill?

No, Foundry is optional. The skill demonstrates integration with both Hardhat and Foundry, giving developers the flexibility to choose their preferred testing framework.

What types of tests can I run with this skill?

You can run unit tests, integration tests, gas optimization tests, time-dependent tests, fuzz tests for edge cases, and automated test coverage reports.

Are there any limitations for smart contract versions?

The provided configurations target Solidity 0.8.x. Ensure that your contracts are compatible with this version or adjust the configuration accordingly.

Install web3-testing

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill