foundry

Build, test, deploy, and debug Solidity smart contracts with the Foundry toolkit.

1|1|Updated May 21, 2026
One-click install
npx skills add https://github.com/naruto11eth/cryptoskills --skill foundry-naruto11eth
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: foundry
Source: https://github.com/naruto11eth/cryptoskills/tree/main/skills/foundry
Command: npx skills add https://github.com/naruto11eth/cryptoskills --skill foundry-naruto11eth

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? LLMs frequently produce outdated or incorrect Foundry usage — wrong deployment patterns, confused cast commands, stale assertion syntax, and missing configuration for common errors like "stack too deep". This Skill provides current, correct guidance for the entire Foundry workflow: forge (build/test), cast (chain interaction), anvil (local node), and chisel (REPL) on any EVM chain. ## Core Features & Use Cases - Testing Patterns: Complete templates for unit, fuzz, invariant, and fork tests, including cheatcode usage (vm.prank, vm.deal, vm.expectRevert, snapshots) and handler-based invariant design with ghost variables. - Deployment & Verification: Production-grade forge script workflows with broadcast artifacts, CREATE2 deterministic deployment, hardware wallet support, resume-after-failure, and Etherscan verification. - Chain Interaction & Debugging: Full cast command reference for reading state, sending transactions, ABI encoding/decoding, plus troubleshooting guides for compilation errors, RPC rate limiting, and gas issues. - Use Case: You need to test a vault contract against real mainnet USDC state. Use the fork testing patterns to impersonate a whale account, pin a block number for determinism, and verify balances — then deploy with a scripted, verified broadcast. ## Quick Start Ask the agent to scaffold a new Foundry project with testing and deployment configuration using the foundry skill.

Frequently Asked Questions about foundry

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

FAQPage Schema
How do I deploy a Solidity contract with Foundry?▼

Write a script extending forge-std's Script contract with vm.startBroadcast around your deployments, then run forge script with --rpc-url, --broadcast, and --verify flags. Use --slow on mainnet to wait for confirmations between transactions.

How to write fuzz tests in Foundry?▼

Add parameters to any test function and Foundry auto-generates random inputs. Use bound() to clamp values to realistic ranges instead of vm.assume, and configure runs in the [fuzz] section of foundry.toml.

What is the difference between cast call and cast send?▼

cast call simulates a function and returns its value without sending a transaction or costing gas. cast send submits a real state-changing transaction and returns a transaction receipt, not the function's return value.

How do I fix the stack too deep error in Solidity?▼

Add via_ir = true under [profile.default] in foundry.toml to enable the IR-based compilation pipeline. If the error persists, refactor the function to use fewer local variables or split it into internal helpers.

Does Foundry support testing against mainnet state?▼

Yes, fork testing via vm.createSelectFork lets tests read and write real mainnet state. Pin a block number for deterministic results and use vm.prank to impersonate accounts like token whales.

Why do my Foundry fork tests hang or fail in CI?▼

Fork tests make many RPC calls and free-tier providers throttle aggressively. Use a dedicated RPC provider, pin block numbers to enable Foundry's fork cache, and separate fork tests from unit tests in CI runs.