testing

Validate smart contracts with Foundry fuzz, fork, and invariant testing.

Updated Apr 8, 2026
One-click install
npx skills add https://github.com/mashharuki/flare-sample --skill testing-mashharuki
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: testing
Source: https://github.com/mashharuki/flare-sample/tree/main/.claude/skills/eth-testing
Command: npx skills add https://github.com/mashharuki/flare-sample --skill testing-mashharuki

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Smart contracts often fail in edge cases, under fuzzed inputs, or when interacting with live protocols; this Skill helps teams design tests that catch integration bugs, economic failures, and regressions before deployment. It shifts testing focus from trivial getters to failure modes, invariants, and real-world interactions that can lose funds.

Core Features & Use Cases

  • Unit testing patterns: clear assertion patterns, setup/teardown, and focused failure-mode tests.
  • Fuzz testing: strategies for bounding inputs, increasing fuzz runs, and detecting numeric and input-driven bugs.
  • Fork testing: guidance for running Foundry tests against forked mainnet state to validate integrations with Uniswap, Aave, and other deployed protocols.
  • Invariant testing: how to implement handlers and invariants to verify properties across thousands of randomized call sequences.
  • Use cases: vault accounting, AMM invariants, token edge cases, access-control and admin flow validation.

Quick Start

Run Foundry tests with fuzzing and a mainnet fork to validate contract behavior against live protocols.

Frequently Asked Questions about testing

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

FAQPage Schema
How do I test smart contracts for edge cases and integration bugs?

To test smart contracts for edge cases and integration bugs, apply unit tests, fuzzing, and invariant testing to validate failure modes, access-control flows, and economic invariants before deployment.

How do I run Foundry tests against forked mainnet state?

Running Foundry tests against forked mainnet state allows you to validate smart contract integrations with deployed DeFi protocols like Uniswap and Aave, catching live interaction bugs before deployment.

What is invariant testing and how does it detect property violations in smart contracts?

Invariant testing detects property violations by implementing handlers to verify contract invariants across thousands of randomized call sequences, exposing economic failures and logic bugs that standard tests miss.

Can I use fuzz testing to find numeric and input-driven bugs in Solidity contracts?

Yes, you can use fuzz testing to find numeric and input-driven bugs by bounding inputs and increasing fuzz runs to systematically expose edge cases in token logic and vault accounting.

Does Foundry testing support precise revert and event assertions?

Yes, Foundry testing supports precise revert and event assertions, satisfying requirements for robust test suites that verify exact failure modes and contract interactions across DeFi protocols.

What is the best way to validate AMM invariants and vault accounting logic?

Validating AMM invariants and vault accounting logic is best achieved through invariant testing with handlers, ensuring properties hold across randomized call sequences and detecting economic failures before deployment.