using-foundry
БесплатноБез исполняемых скриптовНе проверенUse when starting, configuring, or doing day-to-day work in a Foundry project. Covers forge init, build, test, fmt, project layout, remappings, foundry.toml…
от idchain-world★ 19 звёзд на GitHubОб этом скилле
Using Foundry
You are working on a Foundry project. Foundry is the toolchain (forge, cast, anvil, chisel) that compiles, tests, and deploys Solidity. This skill encodes the project-hygiene defaults you must follow on every session.
The Iron Laws
- NO COMMIT WITHOUT
forge fmt --checkANDforge buildCLEAN. If either fails, fix before committing. Do not commit "just the tests" or "just the config" to work around a formatter or compiler error. - NO
forge testWITHOUT-vvvON FAILURE. If a test fails at default verbosity, re-run the same test with-vvv(or-vvvvfor opcode traces) before you start guessing. The trace is the diagnosis. - NO NEW DEPENDENCY WITHOUT PINNING.
forge installa dependency, then record the exact tag or commit in the install command (forge install OpenZeppelin/[email protected]). Never install frommaster/mainfor production work. - NO EDITING
remappings.txtORfoundry.tomlWITHOUT A REASON STATED IN THE COMMIT MESSAGE. These files control the entire toolchain. A silent change here breaks every contributor. - NEVER DELETE
lib/ORout/TO "FIX" A BUILD. Ifforge buildfails, read the error.forge cleanis the escape hatch, notrm -rf lib.
Project layout
Standard Foundry layout, produced by forge init <name>:
my-project/
├── foundry.toml # toolchain config
├── remappings.txt # optional, overrides auto-remappings
├── .gitignore # must include out/, cache/, broadcast/
├── src/ # production contracts
├── test/ # *.t.sol test files
├── script/ # *.s.sol deploy + ops scripts
└── lib/ # forge-std and other git-submodule deps
Do not rename these directories. foundry.toml can redirect them, but every Foundry-literate engineer expects src/ / test/ / script/ / lib/. Surprising layouts cost onboarding time.
First-contact workflow
When you open a Foundry project you have never seen before, run in this order:
cat foundry.toml— read the profile, Solidity version, EVM version, remappings, fuzz runs.cat remappings.txt(if it exists) — understand how imports resolve.ls lib/— see which dependencies are vendored.forge build— confirm the project compiles as-is before you touch anything.forge test --fail-fast— confirm tests pass as-is.
If step 4 or 5 fails on a clean checkout, stop and report to the user. Do not try to "fix" a broken baseline. You cannot tell which failures are new versus pre-existing.
foundry.toml essentials
Pin three things at minimum:
[profile.default]
src = "src"
out = "out"
libs = ["lib"]
solc_version = "0.8.26"
evm_version = "cancun"
optimizer = true
optimizer_runs = 200
via_ir = false
[fmt]
line_length = 120
tab_width = 4
bracket_spacing = true
int_types = "long"
[fuzz]
runs = 256
[invariant]
runs = 256
depth = 15
Rule: solc_version is pinned, not floating. solc = "^0.8.20" is wrong for a foundry.toml. Use an exact version so every contributor and CI run compiles with the same compiler. (Source: https://book.getfoundry.sh/config/)
Remappings
Foundry auto-derives remappings from lib/. You only need remappings.txt when you want to override them — usually to flatten OpenZeppelin's deep path or to alias a fork.
DO:
@openzeppelin/=lib/openzeppelin-contracts/
forge-std/=lib/forge-std/src/
solady/=lib/solady/src/
DON'T:
# Rely on implicit remappings and then wonder why an import fails
# in one tool (forge) but works in another (hardhat).
If you edit remappings.txt, also run forge remappings > remappings.txt once to see what Foundry derives today, and then decide which to override.
Dependency management
Three options. In order of preference for a new project:
Option A: forge install + git submodules (default)
forge install OpenZeppelin/[email protected]
forge install transmissions11/solmate@v7
- Installs as a git submodule under
lib/. - Pros: canonical, zero extra tooling, the Foundry Book assumes this.
- Cons: git submodules are clunky. Collaborators must run
git submodule update --init --recursive.
Option B: Soldeer (forge soldeer)
forge soldeer install @openzeppelin-contracts~5.0.2
- Installs into
dependencies/with a lockfile insoldeer.lock. - Pros: real package manager, reproducible, no submodule headaches.
- Cons: younger ecosystem, some libraries still publish only to GitHub.
Option C: npm / pnpm
Only if the project also ships a JS SDK in the same monorepo. Otherwise don't mix.
Rule: pick one per project. Do not mix lib/ submodules and dependencies/ soldeer in the same repo without a comment in the README explaining why.
The forge CLI commands you use every day
| Command | When | Key flags |
|---|---|---|
forge init |
Once per project | --no-commit if you'll init git yourself |
| `forge |
Установить using-foundry в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл using-foundry?
Use when starting, configuring, or doing day-to-day work in a Foundry project. Covers forge init, build, test, fmt, project layout, remappings, foundry.toml, and dependency management with forge install / soldeer / git submodules. Load before any other Foundry skill when the project is unfamiliar.
Как установить скилл using-foundry?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл using-foundry запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic