Agent skill

Foundry Testing

by ccashwell in ccashwell/evm-cortex

A skill your agent uses when writing Solidity tests with Foundry/Forge.

MITAuto-check passedBackend & APIs

Install Foundry Testing

skills CLI
$ npx skills add ccashwell/evm-cortex --skill foundry-testing -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install ccashwell/evm-cortex foundry-testing --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/ccashwell/evm-cortex.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/foundry-testing .claude/skills/foundry-testing && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
foundry-testing
GitHub stars
131
Token cost
~1.4k tokens
SKILL.md length
87 words
Files
1
Skills in repo
89
Repo updated
First seen
Licence
MIT

At a glance

A skill your agent uses when writing Solidity tests with Foundry/Forge.

  • Writing Solidity tests with Foundry/Forge
  • SKILL.md covers Test File Template, Essential Cheatcodes, Fork Testing and Gas Reporting, plus 3 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Tasks that involve Smart contracts

What it does

Foundry Testing is an agent skill from ccashwell/evm-cortex. Use when writing Solidity tests with Foundry/Forge. Covers cheatcodes, assertions, fork testing, gas reporting, event testing, and test organization patterns.

Its SKILL.md is about 1.4k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Backend & APIs, covering Smart contracts. It works with Solidity. The repository describes itself as: Ethereum protocol engineering squad for AI coding assistants. The licence is MIT.

When your agent uses it

  • Writing Solidity tests with Foundry/Forge
  • Tasks that involve Smart contracts

Example prompts

  • “/foundry-testing”

What it can do on your machine

Read from SKILL.md and the folder at commit f8f3301. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are solidity).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Foundry Testing loads about 1.4k tokens when it runs. Until then it costs about 44 tokens; SKILL.md has 87 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~44
When it runs · the whole SKILL.md, loaded when a task matches
~1.4k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from ccashwell/evm-cortex at commit f8f3301, republished under its MIT licence (© ccashwell). 87 words, ~1,427 tokens.

Download SKILL.mdSave it as .claude/skills/foundry-testing/SKILL.md (or your agent's skills folder).
name
foundry-testing
description
Use when writing Solidity tests with Foundry/Forge. Covers cheatcodes, assertions, fork testing, gas reporting, event testing, and test organization patterns.

Foundry Testing Patterns

Test File Template

solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;

import {Test, console2} from "forge-std/Test.sol";
import {MyContract} from "../src/MyContract.sol";
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";

contract MyContractTest is Test {
    MyContract public target;
    address public alice = makeAddr("alice");
    address public bob = makeAddr("bob");
    address public deployer = makeAddr("deployer");

    function setUp() public {
        vm.startPrank(deployer);
        target = new MyContract();
        vm.stopPrank();

        vm.deal(alice, 100 ether);
        vm.deal(bob, 100 ether);
    }

    function test_basicOperation() public {
        vm.prank(alice);
        target.doSomething(42);
        assertEq(target.value(), 42);
    }

    function test_revertOnUnauthorized() public {
        vm.prank(bob);
        vm.expectRevert("unauthorized");
        target.adminFunction();
    }
}

Essential Cheatcodes

Identity & Balance
solidity
// Set msg.sender for next call
vm.prank(alice);

// Set msg.sender for all subsequent calls until stopPrank()
vm.startPrank(alice);
// ... multiple calls as alice
vm.stopPrank();

// Set ETH balance
vm.deal(alice, 100 ether);

// Set ERC20 balance (writes to storage slot)
deal(address(usdc), alice, 1_000_000e6);

// Create labeled address
address alice = makeAddr("alice");

// Create address with private key
(address signer, uint256 pk) = makeAddrAndKey("signer");
Time & Block Manipulation
solidity
// Set block.timestamp
vm.warp(1700000000);

// Set block.number
vm.roll(18_000_000);

// Skip forward in time
skip(1 days);

// Rewind time
rewind(1 hours);
Revert Expectations
solidity
// Expect next call to revert with message
vm.expectRevert("insufficient balance");
target.withdraw(1000);

// Expect revert with custom error
vm.expectRevert(abi.encodeWithSelector(InsufficientBalance.selector, 1000, 500));
target.withdraw(1000);

// Expect revert with no message check
vm.expectRevert();
target.failingFunction();
Event Expectations
solidity
// expectEmit(checkTopic1, checkTopic2, checkTopic3, checkData)
vm.expectEmit(true, true, false, true);
emit Transfer(alice, bob, 100);
token.transfer(bob, 100);

// Alternative: expectEmit on specific emitter
vm.expectEmit(address(token));
emit Transfer(alice, bob, 100);
token.transfer(bob, 100);
Storage Manipulation
solidity
// Read storage slot
bytes32 value = vm.load(address(target), bytes32(uint256(0)));

// Write storage slot
vm.store(address(target), bytes32(uint256(0)), bytes32(uint256(42)));

// Record storage accesses
vm.record();
target.doSomething();
(bytes32[] memory reads, bytes32[] memory writes) = vm.accesses(address(target));
Snapshots
solidity
// Save state
uint256 snapshot = vm.snapshotState();

// Do some operations
target.modifyState();

// Revert to snapshot
vm.revertToState(snapshot);

Fork Testing

solidity
function setUp() public {
    // Fork mainnet at latest block
    uint256 forkId = vm.createFork("mainnet");
    vm.selectFork(forkId);

    // Or fork at specific block
    uint256 pinnedFork = vm.createFork("mainnet", 19_000_000);
}

function test_withFork() public {
    // Interact with real deployed contracts
    IERC20 usdc = IERC20(0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48);
    uint256 balance = usdc.balanceOf(0x47ac0Fb4F2D84898e4D9E7b4DaB3C24507a6D503); // Binance
    assertGt(balance, 0);
}

Gas Reporting

solidity
// Label addresses for gas reports
vm.label(address(target), "MyContract");
vm.label(address(token), "USDC");

// Measure gas manually
uint256 gasBefore = gasleft();
target.expensiveOperation();
uint256 gasUsed = gasBefore - gasleft();
console2.log("Gas used:", gasUsed);

Run with: forge test --gas-report

Test Organization

test/
├── unit/
│   ├── MyContract.t.sol           # Unit tests
│   └── MyToken.t.sol
├── integration/
│   ├── AaveIntegration.t.sol      # Protocol integration
│   └── UniswapSwap.t.sol
├── invariant/
│   ├── handlers/Handler.sol       # Invariant handlers
│   └── MyContract.invariant.t.sol
├── fork/
│   └── MainnetFork.t.sol          # Fork tests
└── helpers/
    ├── BaseTest.sol               # Shared setUp
    └── Tokens.sol                 # Token deployment helpers

Common Patterns

solidity
// Bound fuzz inputs to valid range
function testFuzz_deposit(uint256 amount) public {
    amount = bound(amount, 1e18, 1_000_000e18);
    // ...
}

// Test with multiple actors
function test_multipleUsers() public {
    for (uint256 i = 0; i < 10; i++) {
        address user = makeAddr(string.concat("user", vm.toString(i)));
        vm.deal(user, 1 ether);
        vm.prank(user);
        target.deposit{value: 1 ether}();
    }
}

// Expect multiple events in sequence
vm.expectEmit(true, true, false, true);
emit Deposit(alice, 100);
vm.expectEmit(true, true, false, true);
emit BalanceUpdated(alice, 100);
target.deposit(100);

Checklist

  • setUp() creates clean state for each test
  • Use makeAddr() for labeled test addresses
  • Use vm.expectRevert() to test failure paths
  • Use vm.expectEmit() to verify events
  • Fork tests pinned to specific block numbers for reproducibility
  • Gas report generated for critical functions
  • Fuzz tests use bound() to constrain inputs
  • Labels applied to addresses for readable traces

© ccashwell, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/foundry-testing of ccashwell/evm-cortex.

Open the folder on GitHubat commit f8f3301

Compare with similar skills

Foundry Testing next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Foundry Testing compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Foundry Testing this skillccashwell/evm-cortex131—~1.4kAutomated safety check: PassMIT
Fizz Convertpashov/skills1.2k2 repos~3.7kAutomated safety check: PassMIT
Feynman Auditor0xiehnnkta/nemesis-auditor2441 repos~11kAutomated safety check: PassMIT
Smart Contract Auditgreatpie/smart-contract-audit-skill101—~1.1kAutomated safety check: PassNone
RadarAuditware/radar154—~2.1kAutomated safety check: PassGPL-3.0
Solidity AuditorGabson0x/bountyforge443—~3.7kAutomated safety check: PassNone

Similar skills

  • Fizz Convert

    pashov/skills

    Convert English-language properties in PROPERTIES.md (produced by the Fizz skill) into Solidity assertions inside the existing fuzz harness, then flip their checkboxes.

    1.2k GitHub starsUsed in 2 repos~3.7k tokens
    Backend & APIsAuto-check passed
  • Feynman Auditor

    0xiehnnkta/nemesis-auditor

    Deep business logic bug finder using the Feynman technique. An agent skill from 0xiehnnkta/nemesis-auditor.

    244 GitHub starsUsed in 1 repo~11k tokens
    Backend & APIsAuto-check passed
  • Smart Contract Audit

    greatpie/smart-contract-audit-skill

    Script-backed, out-of-box auditing workflow for Solidity/EVM repositories based on EVMbench detect/patch/exploit methodology.

    101 GitHub stars~1.1k tokensUpdated 7 mo ago
    Backend & APIsAuto-check passed
  • Radar

    Auditware/radar

    Use radar for smart contract security analysis, AST generation, and detection template development.

    154 GitHub stars~2.1k tokensUpdated 1 mo ago
    Backend & APIsAuto-check passed
  • Solidity Auditor

    Gabson0x/bountyforge

    Security audit of Solidity code while you develop. An agent skill from Gabson0x/bountyforge.

    443 GitHub stars~3.7k tokensUpdated 20 days ago
    Backend & APIsAuto-check passed
  • Add Explorer

    lidofinance/diffyscan

    Adds or repairs Diffyscan explorer API routing and response adapters for a new host, chain or payload format.

    142 GitHub stars~1k tokensUpdated yesterday
    Backend & APIsAuto-check passed

More from ccashwell/evm-cortex

All 89 skills in this repo
  • Xray Pre Audit

    ccashwell/evm-cortex

    A skill your agent uses when preparing for a security audit, performing reconnaissance on a new codebase, or creating a protocol overview.

    131 GitHub stars~25k tokensUpdated 7 days ago
    Auto-check passed
  • Aave Integration

    ccashwell/evm-cortex

    A skill your agent uses when integrating with Aave V3 for lending, borrowing, flash loans, or building on top of Aave markets.

    131 GitHub stars~1.3k tokensUpdated 7 days ago
    Auto-check passed
  • Access Control Patterns

    ccashwell/evm-cortex

    Access control design patterns for Solidity protocols. An agent skill from ccashwell/evm-cortex.

    131 GitHub stars~1.8k tokensUpdated 7 days ago
    Auto-check passed
  • Anvil Patterns

    ccashwell/evm-cortex

    A skill your agent uses when running a local Ethereum node with Anvil.

    131 GitHub stars~1.3k tokensUpdated 7 days ago
    Auto-check passed
  • Audit Breadth Scan

    ccashwell/evm-cortex

    A skill your agent uses when performing systematic breadth-first review of all contracts during a security audit.

    131 GitHub stars~1.4k tokensUpdated 7 days ago
    Auto-check passed
  • Audit Depth Analysis

    ccashwell/evm-cortex

    A skill your agent uses when performing deep analysis of specific findings or high-risk areas during a security audit.

    131 GitHub stars~1.6k tokensUpdated 7 days ago
    Auto-check passed

Works with

Categories

Questions about Foundry Testing

What does Foundry Testing do?

A skill your agent uses when writing Solidity tests with Foundry/Forge. Foundry Testing is an agent skill from ccashwell/evm-cortex. Use when writing Solidity tests with Foundry/Forge.

When should I use Foundry Testing?

Foundry Testing fits situations like: writing Solidity tests with Foundry/Forge; tasks that involve Smart contracts.

How do I install Foundry Testing in Claude Code?

Run `npx skills add ccashwell/evm-cortex --skill foundry-testing -a claude-code`. Or copy the skill folder (skills/foundry-testing in ccashwell/evm-cortex) into .claude/skills/foundry-testing in your project. Claude Code loads it when a task matches its description.

How do I install Foundry Testing in Codex?

Run `npx skills add ccashwell/evm-cortex --skill foundry-testing -a codex`. Or copy the skill folder (skills/foundry-testing in ccashwell/evm-cortex) into .agents/skills/foundry-testing in your project. Codex loads it when a task matches its description.

Can I use Foundry Testing in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add ccashwell/evm-cortex --skill foundry-testing -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/foundry-testing, .gemini/skills/foundry-testing, .github/skills/foundry-testing and .opencode/skills/foundry-testing in your project.

What does Foundry Testing need to run?

SKILL.md names no scripts, command-line tools or credentials: Foundry Testing is instructions for the agent only.

Does Foundry Testing access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Foundry Testing safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Foundry Testing use?

Foundry Testing is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Foundry Testing use?

About 1.4k tokens (SKILL.md is roughly 5.7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Foundry Testing?

Skills that share tags, products or a category with Foundry Testing: Fizz Convert (pashov/skills, 1.2k stars), Feynman Auditor (0xiehnnkta/nemesis-auditor, 244 stars), Smart Contract Audit (greatpie/smart-contract-audit-skill, 101 stars) and Radar (Auditware/radar, 154 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Foundry Testing?

ccashwell (a GitHub user) maintains it in ccashwell/evm-cortex, which has 131 GitHub stars. The repository holds 89 skills in this directory. The repository was last updated on September 30, 2026.

Source: ccashwell/evm-cortex on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.