smart-contract-testing

Automate Solidity smart contract test strategies with Foundry and Hardhat.

5|Updated May 2, 2026
One-click install
npx skills add https://github.com/nirholas/three-ui --skill smart-contract-testing
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: smart-contract-testing
Source: https://github.com/nirholas/three-ui/tree/main/data/skills/development/smart-contract-testing
Command: npx skills add https://github.com/nirholas/three-ui --skill smart-contract-testing

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Smart-contract bugs are often only revealed by edge cases, assumptions, or gas changes, so teams need reliable ways to validate correctness, invariants, and real-world behavior before deployment.

Core Features & Use Cases

  • Foundry unit testing patterns: Set up repeatable test fixtures, write clear passing and failing tests, and use Forge tooling effectively.
  • Fuzz, invariant, and fork testing: Expand coverage using randomized inputs, enforce properties that must always hold, and validate behavior against mainnet state.
  • Gas benchmarking and debugging: Detect regressions with snapshots and use tracing/logging to diagnose failing test cases quickly.

Quick Start

Use the smart-contract-testing skill to design a Foundry test suite with unit tests, fuzz tests, invariants, a fork-based scenario, and a gas snapshot check.

Frequently Asked Questions about smart-contract-testing

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

FAQPage Schema
How do I write invariant and fuzz tests for Solidity smart contracts?

Fuzz and invariant testing for smart contracts involves generating randomized inputs to expand coverage and enforcing properties that must always hold. Using Foundry or Hardhat, you can validate Solidity behavior, enforce bounded fuzz input, and prevent hidden edge-case regressions before deployment.

What's the best way to set up a reproducible Foundry test environment for mainnet state?

Setting up a reproducible Foundry test environment for mainnet state requires stable fork pinning. You can configure fork testing within your Solidity development workflow to validate real-world behavior against specific block states and ensure consistent test execution across runs.

How do I detect gas regressions in smart contracts using test snapshots?

Detecting smart contract gas regressions involves using gas snapshot comparisons for change detection. By capturing and comparing gas benchmarking snapshots during your testing workflow, you can quickly identify performance regressions introduced by new code changes before deployment.

Does this smart contract testing approach work with both Foundry and Hardhat workflows?

Yes, this smart contract testing approach supports both Foundry and Hardhat workflows. It automates the design and execution of test strategies, applying to Solidity development for unit tests, fuzz testing, invariant testing, fork testing, and gas benchmarking across both frameworks.

Why do my smart contract tests pass locally but fail on forked mainnet state?

Smart contract tests passing locally but failing on forked mainnet state often occur due to missing stable fork pinning or unbounded fuzz inputs. Ensuring reproducible setups, meaningful test naming, and bounded fuzz input helps validate real-world behavior and diagnose hidden edge-case failures accurately.