web3-testing

Test Solidity smart contracts with Hardhat and Foundry frameworks.

38.6k|4.1k|Updated Jul 24, 2025
One-click install
npx skills add https://github.com/wshobson/agents --skill web3-testing-wshobson
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: web3-testing
Source: https://github.com/wshobson/agents/tree/main/plugins/blockchain-web3/skills/web3-testing
Command: npx skills add https://github.com/wshobson/agents --skill web3-testing-wshobson

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill provides a comprehensive framework for testing smart contracts, ensuring their reliability, security, and efficiency through various testing methodologies.

Core Features & Use Cases

  • Unit & Integration Testing: Write and execute detailed unit and integration tests for Solidity smart contracts.
  • Advanced Testing Patterns: Utilize Hardhat and Foundry features like mainnet forking, snapshotting, and account impersonation for realistic testing scenarios.
  • Gas Optimization & Coverage: Analyze gas usage and track test coverage to optimize contract performance and identify untested code paths.
  • Contract Verification: Automate the process of verifying deployed contracts on block explorers like Etherscan.
  • Use Case: You have developed a new DeFi protocol smart contract and need to ensure it functions correctly under various conditions, is gas-efficient, and has high test coverage before deployment.

Quick Start

Use the web3-testing skill to set up a Hardhat project for testing Solidity smart contracts.

Frequently Asked Questions about web3-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I test smart contracts using Hardhat and Foundry?

Testing smart contracts with Hardhat and Foundry involves writing unit and integration tests for Solidity. The framework supports gas optimization analysis, coverage reporting, and contract verification on block explorers to ensure contract reliability and efficiency.

Can I use mainnet forking and account impersonation for testing Solidity contracts?

Yes, you can use mainnet forking and account impersonation for testing Solidity contracts. These advanced testing patterns allow you to create realistic testing scenarios by simulating mainnet states and specific account behaviors within your testing environment.

What is the best way to analyze gas usage and track test coverage for smart contracts?

The best way to analyze gas usage and track test coverage for smart contracts is using a comprehensive testing framework. This approach helps optimize contract performance and identifies untested code paths to ensure efficiency before deployment.

Does this web3 testing approach work for DeFi protocol smart contract verification on Etherscan?

Yes, this web3 testing approach works for DeFi protocol smart contract verification on Etherscan. It automates the process of verifying deployed contracts on block explorers, ensuring your protocol functions correctly and is verified before deployment.

How do I set up a Hardhat project to start testing my Solidity smart contracts?

To set up a Hardhat project for testing Solidity smart contracts, you utilize the testing framework to initialize your environment. This enables you to start writing detailed unit and integration tests, perform snapshotting, and run gas optimization analysis.