Agent skill

Anvil Patterns

by ccashwell in ccashwell/evm-cortex

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

MITAuto-check passedBackend & APIs

Install Anvil Patterns

skills CLI
$ npx skills add ccashwell/evm-cortex --skill anvil-patterns -a claude-code

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

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

At a glance

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

  • Running a local Ethereum node with Anvil
  • SKILL.md covers Basic Usage, Forking, Impersonation and Mining Modes, plus 7 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Anvil Patterns is an agent skill from ccashwell/evm-cortex. Use when running a local Ethereum node with Anvil. Covers forking, impersonation, mining modes, state snapshots, storage manipulation, RPC methods, and chain configuration.

Its SKILL.md is about 1.3k 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. It works with Ethereum. The repository describes itself as: Ethereum protocol engineering squad for AI coding assistants. The licence is MIT.

When your agent uses it

  • Running a local Ethereum node with Anvil

Example prompts

  • “/anvil-patterns”

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 bash and 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

Anvil Patterns loads about 1.3k tokens when it runs. Until then it costs about 47 tokens; SKILL.md has 188 words of instructions outside code blocks.

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

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). 188 words, ~1,345 tokens.

Download SKILL.mdSave it as .claude/skills/anvil-patterns/SKILL.md (or your agent's skills folder).
name
anvil-patterns
description
Use when running a local Ethereum node with Anvil. Covers forking, impersonation, mining modes, state snapshots, storage manipulation, RPC methods, and chain configuration.

Anvil Local Node Patterns

Basic Usage

bash
# Start default local node (8545)
anvil

# Custom port and chain ID
anvil --port 8546 --chain-id 31337

# With specific number of accounts and balance
anvil --accounts 20 --balance 10000

# Specific mnemonic (reproducible addresses)
anvil --mnemonic "test test test test test test test test test test test junk"

# Specific block base fee
anvil --block-base-fee-per-gas 0

Forking

Fork mainnet or any chain at the current or a specific block:

bash
# Fork mainnet (latest block)
anvil --fork-url $ETH_RPC_URL

# Fork at specific block (reproducible state)
anvil --fork-url $ETH_RPC_URL --fork-block-number 18000000

# Fork Base
anvil --fork-url $BASE_RPC_URL --chain-id 8453

# Fork with retry and rate limiting
anvil --fork-url $ETH_RPC_URL --fork-retry-backoff 3 --compute-units-per-second 100

# No storage caching (fresh state each time)
anvil --fork-url $ETH_RPC_URL --no-storage-caching

Impersonation

Send transactions as any address without its private key:

bash
# Impersonate an address via RPC
cast rpc anvil_impersonateAccount 0xWhaleAddress

# Send tx as the impersonated address
cast send 0xToken "transfer(address,uint256)" 0xRecipient 1000000000000000000 \
  --from 0xWhaleAddress --unlocked --rpc-url http://127.0.0.1:8545

# Stop impersonating
cast rpc anvil_stopImpersonatingAccount 0xWhaleAddress

In Foundry tests, use vm.prank() instead:

solidity
vm.prank(0xWhaleAddress);
token.transfer(recipient, amount);

Mining Modes

bash
# Auto-mine (default): mine a block for each transaction
anvil

# Interval mining: mine every N seconds
anvil --block-time 12

# Manual mining: no auto-mining
anvil --no-mining

# Mine a single block manually
cast rpc evm_mine --rpc-url http://127.0.0.1:8545

# Mine N blocks
cast rpc anvil_mine 10 --rpc-url http://127.0.0.1:8545

# Mine with specific timestamp
cast rpc evm_mine "0x$(printf '%x' 1700000000)" --rpc-url http://127.0.0.1:8545

State Manipulation

bash
# Set ETH balance
cast rpc anvil_setBalance 0xAddress "0xDE0B6B3A7640000" # 1 ETH in hex

# Set ERC-20 balance (write to storage slot directly)
# First find the balance slot: for most tokens, balanceOf mapping is slot 0 or slot 2
SLOT=$(cast index address 0xAddress 0)
cast rpc anvil_setStorageAt 0xTokenAddress $SLOT \
  "0x0000000000000000000000000000000000000000000000000DE0B6B3A7640000"

# Set nonce
cast rpc anvil_setNonce 0xAddress "0x10"

# Set contract code
cast rpc anvil_setCode 0xAddress "0x608060405234..."

# Set block timestamp
cast rpc evm_setNextBlockTimestamp "0x$(printf '%x' $(date +%s))"

# Increase time by N seconds
cast rpc evm_increaseTime 3600  # +1 hour

State Snapshots

Save and restore chain state:

bash
# Take snapshot (returns snapshot ID)
SNAP_ID=$(cast rpc evm_snapshot --rpc-url http://127.0.0.1:8545)

# ... make changes ...

# Revert to snapshot
cast rpc evm_revert $SNAP_ID --rpc-url http://127.0.0.1:8545

Anvil RPC Methods

MethodDescription
anvil_impersonateAccountAct as any address
anvil_stopImpersonatingAccountStop impersonation
anvil_setBalanceSet ETH balance
anvil_setCodeSet contract bytecode
anvil_setNonceSet account nonce
anvil_setStorageAtSet storage slot
anvil_mineMine N blocks
anvil_resetReset fork to block
anvil_dumpStateDump full state
anvil_loadStateLoad state dump
evm_snapshotSnapshot state
evm_revertRevert to snapshot
evm_setNextBlockTimestampSet next block time
evm_increaseTimeAdvance time
evm_mineMine one block
evm_setAutomineToggle auto-mining

State Dump and Load

Persist local state across sessions:

bash
# Dump state to file
cast rpc anvil_dumpState --rpc-url http://127.0.0.1:8545 > state.json

# Later, start anvil and load state
anvil &
cast rpc anvil_loadState "$(cat state.json)" --rpc-url http://127.0.0.1:8545

Fork Testing Pattern

bash
# Terminal 1: Start fork
anvil --fork-url $ETH_RPC_URL --fork-block-number 18000000

# Terminal 2: Run tests against fork
forge test --fork-url http://127.0.0.1:8545

# Or script against fork
forge script script/Simulate.s.sol --fork-url http://127.0.0.1:8545

Anvil with Forge Tests

solidity
// Fork in test setup
function setUp() public {
    // fork mainnet at specific block
    vm.createSelectFork("mainnet", 18_000_000);
}

function test_swapOnUniswap() public {
    address whale = 0xWhaleAddress;
    vm.startPrank(whale);
    // ... interact with real mainnet contracts
    vm.stopPrank();
}

Tips

  • Fork block pinning (--fork-block-number) ensures reproducible tests
  • Use --steps-tracing for detailed EVM execution traces
  • anvil --silent suppresses log output
  • --host 0.0.0.0 makes anvil accessible from other machines/containers
  • Combine --block-time 1 with --no-mining for manual control with fallback
  • State dumps are base64-encoded; large forks produce large dump files
  • anvil_reset with --fork-url and --fork-block-number lets you re-fork without restart

© 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/anvil-patterns of ccashwell/evm-cortex.

Open the folder on GitHubat commit f8f3301

Compare with similar skills

Anvil Patterns 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.

Anvil Patterns compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Anvil Patterns this skillccashwell/evm-cortex131—~1.3kAutomated safety check: PassMIT
NEAR Intents Swap Integrationinternet-court/internet-court-skill6.4k2 repos~939Automated safety check: PassCustom licence
Deposit QrSuperior-Trade/superior-skills2141 repos~1.1kAutomated safety check: PassMIT
Explorer Contract Verificationsablier-labs/evm-monorepo353—~1.9kAutomated safety check: PassCustom licence
Abi EncodingNethereum/Nethereum2.3k—~1.3kAutomated safety check: PassMIT
Developing Smart ContractsLFDT-Lineth/lineth-monorepo126—~1.4kAutomated safety check: PassAGPL-3.0

Similar skills

  • NEAR Intents Swap Integration

    internet-court/internet-court-skill

    Builds cross-chain token swaps and bridge flows with the NEAR Intents 1Click API: quotes, deposit addresses, per-chain deposits and status polling.

    6.4k GitHub starsUsed in 2 repos~939 tokens
    Backend & APIsAuto-check passed
  • Deposit Qr

    Superior-Trade/superior-skills

    A skill your agent uses when a user needs a QR code or wallet payment URI to fund a Superior-managed EVM wallet on a specific chain before using Lighter, Polymarket, Hyperliquid, or other Superior…

    214 GitHub starsUsed in 1 repo~1.1k tokens
    Backend & APIsAuto-check passed
  • Explorer Contract Verification

    sablier-labs/evm-monorepo

    Verify smart contracts on Etherscan, Routescan, and Blockscout block explorers.

    353 GitHub stars~1.9k tokensUpdated today
    Backend & APIsAuto-check passed
  • Abi Encoding

    Nethereum/Nethereum

    Encode and decode Ethereum ABI data with Nethereum. An agent skill from Nethereum/Nethereum.

    2.3k GitHub stars~1.3k tokensUpdated 3 days ago
    Backend & APIsAuto-check passed
  • Developing Smart Contracts

    LFDT-Lineth/lineth-monorepo

    Solidity smart contract development guidelines for Lineth blockchain.

    126 GitHub stars~1.4k tokensUpdated today
    Backend & APIsAuto-check passed
  • Squash Bugbot

    LFDT-Lineth/lineth-monorepo

    Triage unresolved bot review comments on a GitHub PR. An agent skill from LFDT-Lineth/lineth-monorepo.

    126 GitHub stars~3.3k tokensUpdated today
    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 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
  • 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
  • Audit Prep

    ccashwell/evm-cortex

    A skill your agent uses when preparing a codebase for security audit.

    131 GitHub stars~1.4k tokensUpdated 8 days ago
    Auto-check passed

Works with

Categories

Questions about Anvil Patterns

What does Anvil Patterns do?

A skill your agent uses when running a local Ethereum node with Anvil. Anvil Patterns is an agent skill from ccashwell/evm-cortex. Use when running a local Ethereum node with Anvil.

When should I use Anvil Patterns?

Anvil Patterns fits situations like: running a local Ethereum node with Anvil.

How do I install Anvil Patterns in Claude Code?

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

How do I install Anvil Patterns in Codex?

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

Can I use Anvil Patterns 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 anvil-patterns -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/anvil-patterns, .gemini/skills/anvil-patterns, .github/skills/anvil-patterns and .opencode/skills/anvil-patterns in your project.

What does Anvil Patterns need to run?

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

Does Anvil Patterns 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 Anvil Patterns 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 Anvil Patterns use?

Anvil Patterns 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 Anvil Patterns use?

About 1.3k tokens (SKILL.md is roughly 5.4k 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 Anvil Patterns?

Skills that share tags, products or a category with Anvil Patterns: NEAR Intents Swap Integration (internet-court/internet-court-skill, 6.4k stars), Deposit Qr (Superior-Trade/superior-skills, 214 stars), Explorer Contract Verification (sablier-labs/evm-monorepo, 353 stars) and Abi Encoding (Nethereum/Nethereum, 2.3k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Anvil Patterns?

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.