Agent skill

Fork Testing

by ccashwell in ccashwell/evm-cortex

A skill your agent uses when testing against live protocol state on mainnet or L2 forks.

MITAuto-check passedBusiness, Finance & HR

Install Fork Testing

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

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

GitHub CLI
$ gh skill install ccashwell/evm-cortex fork-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/fork-testing .claude/skills/fork-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
fork-testing
GitHub stars
131
Token cost
~1.5k tokens
SKILL.md length
136 words
Files
1
Skills in repo
89
Repo updated
First seen
Licence
MIT

At a glance

A skill your agent uses when testing against live protocol state on mainnet or L2 forks.

  • Testing against live protocol state on mainnet
  • SKILL.md covers Overview, Basic Fork Setup, RPC Configuration and Impersonating Accounts, plus 6 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Tasks that involve Integration testing

What it does

Fork Testing is an agent skill from ccashwell/evm-cortex. Use when testing against live protocol state on mainnet or L2 forks. Covers vm.createFork, account impersonation, block pinning, token dealing, and patterns for DeFi integration testing.

Its SKILL.md is about 1.5k 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 Business, Finance & HR, covering Integration testing and Crypto and DeFi analysis. The repository describes itself as: Ethereum protocol engineering squad for AI coding assistants. The licence is MIT.

When your agent uses it

  • Testing against live protocol state on mainnet
  • Tasks that involve Integration testing
  • Tasks that involve Crypto and DeFi analysis

Example prompts

  • “/fork-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, toml and bash).

    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

Fork Testing loads about 1.5k tokens when it runs. Until then it costs about 50 tokens; SKILL.md has 136 words of instructions outside code blocks.

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

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). 136 words, ~1,545 tokens.

Download SKILL.mdSave it as .claude/skills/fork-testing/SKILL.md (or your agent's skills folder).
name
fork-testing
description
Use when testing against live protocol state on mainnet or L2 forks. Covers vm.createFork, account impersonation, block pinning, token dealing, and patterns for DeFi integration testing.

Fork Testing Patterns

Overview

Fork testing runs your tests against a snapshot of a live blockchain. This lets you test interactions with real deployed contracts (Aave, Uniswap, Chainlink) without deploying mocks.

Basic Fork Setup

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

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

contract ForkTest is Test {
    uint256 mainnetFork;

    // Mainnet addresses
    address constant USDC = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;
    address constant WETH = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2;
    address constant AAVE_POOL = 0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2;

    function setUp() public {
        // Pin to a specific block for reproducibility
        mainnetFork = vm.createFork(vm.envString("ETH_RPC_URL"), 19_500_000);
        vm.selectFork(mainnetFork);
    }

    function test_forkIsActive() public view {
        assertEq(vm.activeFork(), mainnetFork);
        assertEq(block.number, 19_500_000);
    }
}

RPC Configuration

In foundry.toml:

toml
[rpc_endpoints]
mainnet = "${ETH_RPC_URL}"
arbitrum = "${ARBITRUM_RPC_URL}"
optimism = "${OPTIMISM_RPC_URL}"
base = "${BASE_RPC_URL}"

Usage: vm.createFork("mainnet", blockNumber)

Impersonating Accounts

solidity
// Impersonate a whale to get tokens
address USDC_WHALE = 0x47ac0Fb4F2D84898e4D9E7b4DaB3C24507a6D503; // Binance

function test_impersonateWhale() public {
    vm.prank(USDC_WHALE);
    IERC20(USDC).transfer(address(this), 1_000_000e6);
    assertEq(IERC20(USDC).balanceOf(address(this)), 1_000_000e6);
}

Dealing Tokens

solidity
// deal() writes directly to storage — works for standard ERC20s
function test_dealTokens() public {
    deal(USDC, address(this), 1_000_000e6);
    assertEq(IERC20(USDC).balanceOf(address(this)), 1_000_000e6);

    // For tokens with non-standard storage (e.g., USDT):
    deal(USDC, address(this), 1_000_000e6, true); // true = adjust totalSupply
}

// For complex tokens where deal() fails, impersonate a holder:
function _getTokens(address token, uint256 amount, address to) internal {
    address whale = _findWhale(token);
    vm.prank(whale);
    IERC20(token).transfer(to, amount);
}

DeFi Integration Test Pattern

solidity
contract AaveForkedTest is Test {
    IPool constant pool = IPool(0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2);

    function setUp() public {
        vm.createSelectFork("mainnet", 19_500_000);
    }

    function test_supplyAndBorrow() public {
        address user = makeAddr("user");

        // Give user WETH collateral
        deal(WETH, user, 10 ether);

        vm.startPrank(user);

        // Supply WETH as collateral
        IERC20(WETH).approve(address(pool), 10 ether);
        pool.supply(WETH, 10 ether, user, 0);

        // Borrow USDC against WETH
        pool.borrow(USDC, 5_000e6, 2, 0, user);

        assertEq(IERC20(USDC).balanceOf(user), 5_000e6);

        // Check health factor
        (,,,,,uint256 hf) = pool.getUserAccountData(user);
        assertGt(hf, 1e18, "should be healthy");

        vm.stopPrank();
    }

    function test_liquidation() public {
        address borrower = makeAddr("borrower");
        address liquidator = makeAddr("liquidator");

        // Setup underwater position using price manipulation
        _setupUnderwaterPosition(borrower);

        // Liquidate
        deal(USDC, liquidator, 10_000e6);
        vm.startPrank(liquidator);
        IERC20(USDC).approve(address(pool), 10_000e6);
        pool.liquidationCall(WETH, USDC, borrower, 5_000e6, false);
        vm.stopPrank();

        // Verify liquidator received collateral
        assertGt(IERC20(WETH).balanceOf(liquidator), 0);
    }
}

Multi-Fork Testing

Test cross-chain interactions:

solidity
function test_crossChainState() public {
    uint256 mainnetFork = vm.createFork("mainnet");
    uint256 arbitrumFork = vm.createFork("arbitrum");

    // Check mainnet state
    vm.selectFork(mainnetFork);
    uint256 mainnetBalance = IERC20(USDC).totalSupply();

    // Check Arbitrum state
    vm.selectFork(arbitrumFork);
    address ARB_USDC = 0xaf88d065e77c8cC2239327C5EDb3A432268e5831;
    uint256 arbBalance = IERC20(ARB_USDC).totalSupply();

    // Contracts deployed on a fork persist only on that fork
    vm.selectFork(mainnetFork);
    MyBridge bridge = new MyBridge();
    // bridge only exists on mainnetFork
}

Price Manipulation for Testing

solidity
// Mock Chainlink feed to simulate price crash
function _crashPrice(address feed, int256 newPrice) internal {
    // Find the storage slot for the latest answer
    // Or use vm.mockCall:
    vm.mockCall(
        feed,
        abi.encodeWithSelector(AggregatorV3Interface.latestRoundData.selector),
        abi.encode(uint80(1), newPrice, block.timestamp, block.timestamp, uint80(1))
    );
}

Running Fork Tests

bash
# Run all fork tests
forge test --fork-url $ETH_RPC_URL

# Run with specific block
forge test --fork-url $ETH_RPC_URL --fork-block-number 19500000

# Only fork tests (convention: separate test directory)
forge test --match-path "test/fork/*" --fork-url $ETH_RPC_URL

# Cache RPC calls for speed
forge test --fork-url $ETH_RPC_URL --fork-block-number 19500000
# Foundry auto-caches in ~/.foundry/cache/rpc/

Checklist

  • Pin fork to specific block number for reproducibility
  • Use vm.envString() for RPC URLs (never hardcode)
  • Prefer deal() over whale impersonation when possible
  • Label all addresses for readable stack traces
  • Cache fork data by pinning block numbers
  • Test both happy path and failure modes (liquidation, oracle failure)
  • Mock external calls only when necessary (prefer real state)
  • CI uses cached RPC or a dedicated node for reliability
  • Document which mainnet block and why it was chosen

© 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/fork-testing of ccashwell/evm-cortex.

Open the folder on GitHubat commit f8f3301

Compare with similar skills

Fork 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.

Fork Testing compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Fork Testing this skillccashwell/evm-cortex131—~1.5kAutomated safety check: PassMIT
Web3 Testingwshobson/agents40k11 repos~2kAutomated safety check: PassMIT
Technical Analysttradermonty/claude-trading-skills3k5 repos~4.6kAutomated safety check: PassMIT
Polyclawchainstacklabs/polyclaw3601 repos~2kAutomated safety check: PassApache-2.0
Longbridge Researchhelsome/folio2693 repos~2.1kAutomated safety check: PassMIT
Stock Analysis24mlight/StockClaw1012 repos~2kAutomated safety check: NotesMIT

Similar skills

  • Web3 Testing

    wshobson/agents

    Test smart contracts comprehensively using Hardhat and Foundry with unit tests, integration tests, and mainnet forking.

    40k GitHub starsUsed in 11 repos~2k tokens
    Testing & QAAuto-check passed
  • Technical Analyst

    tradermonty/claude-trading-skills

    This skill should be used when analyzing weekly price charts for stocks, stock indices, cryptocurrencies, or forex pairs.

    3k GitHub starsUsed in 5 repos~4.6k tokens
    Business, Finance & HRAuto-check passed
  • Polyclaw

    chainstacklabs/polyclaw

    Trade on Polymarket via split + CLOB execution. An agent skill from chainstacklabs/polyclaw.

    360 GitHub starsUsed in 1 repo~2k tokens
    Business, Finance & HRAuto-check passed
  • Longbridge Research

    helsome/folio

    Institution ratings, consensus price targets, EPS/revenue forecasts, finance calendar, shareholder data, fund holders, insider trades (SEC Form 4), short interest, industry rankings, peer group…

    269 GitHub starsUsed in 3 repos~2.1k tokens
    Business, Finance & HRAuto-check passed
  • Stock Analysis

    24mlight/StockClaw

    Analyze stocks and cryptocurrencies using Yahoo Finance data.

    101 GitHub starsUsed in 2 repos~2k tokens
    Business, Finance & HRAuto-check: notes
  • Swapper Deposit

    swapperfinance/swapper-toolkit

    Deposit and bridge funds into a wallet or protocol using Swapper Finance.

    852 GitHub stars~1.8k tokensUpdated 6 mo ago
    Business, Finance & HRAuto-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 8 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 8 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 8 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 8 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 8 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 8 days ago
    Auto-check passed

Questions about Fork Testing

What does Fork Testing do?

A skill your agent uses when testing against live protocol state on mainnet or L2 forks. Fork Testing is an agent skill from ccashwell/evm-cortex. Use when testing against live protocol state on mainnet or L2 forks.

When should I use Fork Testing?

Fork Testing fits situations like: testing against live protocol state on mainnet; tasks that involve Integration testing; tasks that involve Crypto and DeFi analysis.

How do I install Fork Testing in Claude Code?

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

How do I install Fork Testing in Codex?

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

Can I use Fork 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 fork-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/fork-testing, .gemini/skills/fork-testing, .github/skills/fork-testing and .opencode/skills/fork-testing in your project.

What does Fork Testing need to run?

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

Does Fork 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 Fork 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 Fork Testing use?

Fork 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 Fork Testing use?

About 1.5k tokens (SKILL.md is roughly 6.2k 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 Fork Testing?

Skills that share tags, products or a category with Fork Testing: Web3 Testing (wshobson/agents, 40k stars), Technical Analyst (tradermonty/claude-trading-skills, 3k stars), Polyclaw (chainstacklabs/polyclaw, 360 stars) and Longbridge Research (helsome/folio, 269 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Fork 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.