forge-fuzz-testing

Automate property-based fuzz and invariant testing of Solidity contracts with Foundry.

Updated Jan 21, 2026
One-click install
npx skills add https://github.com/cyotee/foundry-skills --skill forge-fuzz-testing
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: forge-fuzz-testing
Source: https://github.com/cyotee/foundry-skills/tree/main/skills/forge-fuzz-testing
Command: npx skills add https://github.com/cyotee/foundry-skills --skill forge-fuzz-testing

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Fuzz testing for smart contracts to systematically exercise inputs and reveal edge-case bugs.

Core Features & Use Cases

  • Property-based fuzzing across Solidity tests with the Foundry fuzzer.
  • Invariant testing patterns and fixture-driven scenarios to validate contract behavior under varied inputs.
  • Use case: verify arithmetic safety and state transitions across sequences of interactions.

Quick Start

Run forge test to execute fuzz and invariant tests across your Solidity contracts.

Frequently Asked Questions about forge-fuzz-testing

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

FAQPage Schema
How do I write property-based fuzz tests for Solidity smart contracts using Foundry?

To write property-based fuzz tests in Foundry, you define test functions that accept parameters and use the built-in fuzzer to automatically generate random inputs, exposing edge-case bugs in your Solidity smart contracts. This Skill automates configuring these fuzz tests and applying input constraints.

What is invariant testing and how does it validate state transitions in smart contracts?

Invariant testing validates that smart contracts maintain expected state conditions across sequences of random interactions. This Skill applies Foundry invariant testing patterns and fixture-driven scenarios to verify arithmetic safety and ensure contract behavior holds under varied inputs.

How do I constrain random inputs in Foundry fuzz tests using vm.assume and bound?

You constrain random inputs in Foundry fuzz tests by applying vm.assume to filter out invalid values and bound to restrict parameters to specific ranges. This Skill automates the configuration of these input constraints for systematic property-based testing.

Can I use this Skill to set up fuzz testing fixtures and configuration for Foundry?

Yes, this Skill satisfies fuzz configuration and fixture-driven scenarios for Foundry tests. It automates the setup required to execute property-based and invariant tests across your Solidity contracts.

What is the best way to automate fuzz and invariant testing across Solidity contracts?

The best way to automate fuzz and invariant testing is to configure Foundry's built-in fuzzer with proper test fixtures and input constraints. This Skill automates that setup, allowing you to run forge test to systematically exercise inputs and reveal edge-case bugs.

When should I use constraint-driven testing instead of standard unit tests for smart contracts?

Use constraint-driven fuzz testing when you need to systematically exercise varied inputs and validate contract behavior under edge-case conditions. This Skill applies property-based testing patterns to reveal arithmetic safety issues and state transition bugs that standard unit tests might miss.