Agent skill

Foundry Setup

by ccashwell in ccashwell/evm-cortex

A skill your agent uses when setting up a Foundry project from scratch or configuring foundry.toml.

MITAuto-check: notesDevelopment

Install Foundry Setup

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

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

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

At a glance

A skill your agent uses when setting up a Foundry project from scratch or configuring foundry.toml.

  • Setting up a Foundry project from scratch
  • SKILL.md covers Quick Start, Directory Structure, foundry.toml Template and Remappings, plus 6 more sections
  • Reaches api.basescan.org and api-optimistic.etherscan.io; needs ETHERSCAN_API_KEY and BASESCAN_API_KEY
  • Configuring foundry.toml

What it does

Foundry Setup is an agent skill from ccashwell/evm-cortex. Use when setting up a Foundry project from scratch or configuring foundry.toml. Covers forge init, solc configuration, optimizer settings, via-ir, remappings, directory structure, and dependency management.

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 Development, covering Dependency management. 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

  • Setting up a Foundry project from scratch
  • Configuring foundry.toml

Example prompts

  • “/foundry-setup”

Requirements

  • A credential in ETHERSCAN_API_KEY
  • A credential in BASESCAN_API_KEY

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, toml, json and gitignore).

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

  • Network

    Hosts in commands or code, which the agent is likely to contact:

    • api.basescan.org
    • api-optimistic.etherscan.io
    • api.arbiscan.io
    • eth-mainnet.g.alchemy.com
    • eth-sepolia.g.alchemy.com

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

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • ETHERSCAN_API_KEY
    • BASESCAN_API_KEY
    • OPSCAN_API_KEY
    • ARBISCAN_API_KEY
    • DEPLOYER_PRIVATE_KEY

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

Context cost

Foundry Setup loads about 1.3k tokens when it runs. Until then it costs about 55 tokens; SKILL.md has 88 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~55
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: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NoteMentions a .env fileSKILL.md:217
    .env
  • NoteMentions a .env fileSKILL.md:227
    # .env (never commit)
  • NoteMentions a .env fileSKILL.md:236
    source .env

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). 88 words, ~1,335 tokens.

Download SKILL.mdSave it as .claude/skills/foundry-setup/SKILL.md (or your agent's skills folder).
name
foundry-setup
description
Use when setting up a Foundry project from scratch or configuring foundry.toml. Covers forge init, solc configuration, optimizer settings, via-ir, remappings, directory structure, and dependency management.

Foundry Project Setup

Quick Start

bash
# New project
forge init my-protocol
cd my-protocol

# Or init in existing directory
forge init --force .

# Install dependencies
forge install OpenZeppelin/openzeppelin-contracts
forge install OpenZeppelin/openzeppelin-contracts-upgradeable
forge install foundry-rs/forge-std

Directory Structure

my-protocol/
├── foundry.toml          # Project configuration
├── remappings.txt        # Import remappings (auto-generated)
├── src/                  # Contract source files
│   ├── MyContract.sol
│   └── interfaces/
├── test/                 # Test files
│   ├── MyContract.t.sol
│   ├── invariants/       # Invariant/fuzz tests
│   └── mocks/
├── script/               # Deployment scripts
│   ├── Deploy.s.sol
│   └── Upgrade.s.sol
├── lib/                  # Git submodule dependencies
│   ├── forge-std/
│   └── openzeppelin-contracts/
└── out/                  # Build artifacts (gitignored)

foundry.toml Template

toml
[profile.default]
src = "src"
out = "out"
libs = ["lib"]
test = "test"
script = "script"

# Solidity compiler
solc_version = "0.8.28"
evm_version = "cancun"       # Latest EVM target
optimizer = true
optimizer_runs = 200          # Balance deploy vs runtime gas
via_ir = false                # Enable for complex contracts / stack too deep

# Compilation
auto_detect_solc = false
build_info = true
extra_output = ["storageLayout"]  # For upgrade safety checks

# Testing
ffi = false                   # Disable FFI by default (security)
verbosity = 2                 # 0=minimal, 3=traces, 5=everything
fuzz = { runs = 256, seed = "0x1" }
invariant = { runs = 256, depth = 50 }
gas_reports = ["*"]

# Formatter
[fmt]
line_length = 100
tab_width = 4
bracket_spacing = false
int_types = "long"            # uint256 not uint
multiline_func_header = "params_first"
number_underscore = "thousands"
single_line_statement_blocks = "preserve"
sort_imports = true

[rpc_endpoints]
mainnet = "${ETH_RPC_URL}"
sepolia = "${SEPOLIA_RPC_URL}"
base = "${BASE_RPC_URL}"
optimism = "${OPTIMISM_RPC_URL}"
arbitrum = "${ARBITRUM_RPC_URL}"
anvil = "http://127.0.0.1:8545"

[etherscan]
mainnet = { key = "${ETHERSCAN_API_KEY}" }
sepolia = { key = "${ETHERSCAN_API_KEY}" }
base = { key = "${BASESCAN_API_KEY}", url = "https://api.basescan.org/api" }
optimism = { key = "${OPSCAN_API_KEY}", url = "https://api-optimistic.etherscan.io/api" }
arbitrum = { key = "${ARBISCAN_API_KEY}", url = "https://api.arbiscan.io/api" }

# CI profile: more fuzz runs
[profile.ci]
fuzz = { runs = 10000 }
invariant = { runs = 1000, depth = 100 }

Remappings

Auto-generate remappings:

bash
forge remappings > remappings.txt

Typical remappings.txt:

@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/
@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/
forge-std/=lib/forge-std/src/

For VS Code / Solidity extension, add to settings.json:

json
{
  "solidity.remappings": [
    "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
    "forge-std/=lib/forge-std/src/"
  ]
}

Dependency Management

bash
# Install a dependency (adds as git submodule)
forge install OpenZeppelin/openzeppelin-contracts

# Install specific version
forge install OpenZeppelin/openzeppelin-contracts@v5.1.0

# Update all dependencies
forge update

# Update specific dependency
forge update lib/openzeppelin-contracts

# Remove dependency
forge remove openzeppelin-contracts

Common Build Commands

bash
# Build
forge build

# Build with sizes
forge build --sizes

# Clean and rebuild
forge clean && forge build

# Inspect storage layout
forge inspect MyContract storageLayout

# Inspect ABI
forge inspect MyContract abi

# Check contract sizes (24KB limit)
forge build --sizes | grep -E "Contract|─"

# Generate gas snapshot
forge snapshot

Optimizer Settings

optimizer_runsOptimize forUse case
1Deployment costRarely called contracts
200Balanced (default)Most contracts
1000+Runtime costFrequently called (DEX, vaults)
1000000Maximum runtimeHot paths

via-ir Pipeline

Enable via_ir = true when:

  • Hitting "stack too deep" errors
  • Complex contracts with many local variables
  • Need advanced optimizations

Tradeoff: significantly slower compilation (~5-10x).

toml
# Per-profile override for complex contracts
[profile.via-ir]
via_ir = true
optimizer_runs = 200
bash
FOUNDRY_PROFILE=via-ir forge build

.gitignore

gitignore
# Foundry
out/
cache/
broadcast/*/31337/  # Local anvil broadcasts
broadcast/**/dry-run/

# Environment
.env

# Coverage
lcov.info
coverage/

Environment Setup

bash
# .env (never commit)
ETH_RPC_URL=https://eth-mainnet.g.alchemy.com/v2/YOUR_KEY
SEPOLIA_RPC_URL=https://eth-sepolia.g.alchemy.com/v2/YOUR_KEY
ETHERSCAN_API_KEY=YOUR_KEY
DEPLOYER_PRIVATE_KEY=0x...

Load in scripts:

bash
source .env
forge script script/Deploy.s.sol --rpc-url $ETH_RPC_URL --broadcast

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

Open the folder on GitHubat commit f8f3301

Compare with similar skills

Foundry Setup 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 Setup compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Foundry Setup this skillccashwell/evm-cortex131—~1.3kAutomated safety check: NotesMIT
Add TTS Engine to Voiceboxjamiepine/voicebox57k—~1.3kAutomated safety check: PassMIT
Dep Updatestrufflesecurity/trufflehog28k—~1.3kAutomated safety check: PassAGPL-3.0
Merge Dependabot PRsonyx-dot-app/onyx32k1 repos~2.2kAutomated safety check: PassMIT
Senior Architect Toolkitmaslennikov-ig/claude-code-orchestrator-kit2608 repos~1.2kAutomated safety check: NotesCustom licence
Update .NET OS Packagesdotnet/core22k—~2.3kAutomated safety check: PassMIT

Similar skills

  • Add TTS Engine to Voicebox

    jamiepine/voicebox

    Walks through adding a new text-to-speech engine to Voicebox end to end: dependency audit, backend, frontend wiring, PyInstaller bundling and frozen-build testing.

    57k GitHub stars~1.3k tokensUpdated yesterday
    DevelopmentAuto-check passed
  • Dep Updates

    trufflesecurity/trufflehog

    Plan and apply Go dependency updates, including advisory-driven bumps, Trivy/govulncheck validation, and supply-chain review.

    28k GitHub stars~1.3k tokensUpdated today
    DevelopmentAuto-check passed
  • Merge Dependabot PRs

    onyx-dot-app/onyx

    Triages and lands a batch of open Dependabot PRs in the Onyx repo, where main is gated exclusively by GitHub's merge queue: approves and enqueues green PRs, closes superseded duplicates, fixes…

    32k GitHub starsUsed in 1 repo~2.2k tokens
    DevelopmentAuto-check passed
  • Senior Architect Toolkit

    maslennikov-ig/claude-code-orchestrator-kit

    Comprehensive software architecture skill for designing scalable, maintainable systems using ReactJS, NextJS, NodeJS, Express, React Native, Swift, Kotlin…

    260 GitHub starsUsed in 8 repos~1.2k tokens
    DevelopmentAuto-check: notes
  • Official

    Audits and updates os-packages.json files listing the Linux packages each .NET release needs per distro, then regenerates the Markdown from the JSON.

    22k GitHub stars~2.3k tokensUpdated today
    DevelopmentAuto-check passed
  • Pnpm Engine

    teambit/bit

    Work on the pnpm Rust engine (@pnpm/napi, the pacquet crates) that bit install runs through.

    18k GitHub stars~1.9k tokensUpdated today
    DevelopmentAuto-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

Works with

Categories

Questions about Foundry Setup

What does Foundry Setup do?

A skill your agent uses when setting up a Foundry project from scratch or configuring foundry.toml. Foundry Setup is an agent skill from ccashwell/evm-cortex.toml.

When should I use Foundry Setup?

Foundry Setup fits situations like: setting up a Foundry project from scratch; configuring foundry.toml.

How do I install Foundry Setup in Claude Code?

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

How do I install Foundry Setup in Codex?

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

Can I use Foundry Setup 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-setup -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-setup, .gemini/skills/foundry-setup, .github/skills/foundry-setup and .opencode/skills/foundry-setup in your project.

What does Foundry Setup need to run?

Going by SKILL.md and its folder, Foundry Setup needs credentials named ETHERSCAN_API_KEY, BASESCAN_API_KEY, OPSCAN_API_KEY and ARBISCAN_API_KEY. Our summary lists: A credential in ETHERSCAN_API_KEY; A credential in BASESCAN_API_KEY.

Does Foundry Setup access the network?

SKILL.md names 5 domains. In commands or code: api.basescan.org, api-optimistic.etherscan.io, api.arbiscan.io, eth-mainnet.g.alchemy.com and eth-sepolia.g.alchemy.com; the agent is likely to contact these when it follows the instructions. This is read from the text; nothing was executed.

Is Foundry Setup safe to install?

Our automated static check of SKILL.md found notes only (mentions a .env file), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.

What licence does Foundry Setup use?

Foundry Setup 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 Setup use?

About 1.3k tokens (SKILL.md is roughly 5.3k 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 Setup?

Skills that share tags, products or a category with Foundry Setup: Add TTS Engine to Voicebox (jamiepine/voicebox, 57k stars), Dep Updates (trufflesecurity/trufflehog, 28k stars), Merge Dependabot PRs (onyx-dot-app/onyx, 32k stars) and Senior Architect Toolkit (maslennikov-ig/claude-code-orchestrator-kit, 260 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Foundry Setup?

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.