forge — Claude Code rule: what it does, how to install
The forge rule configures Foundry workflows for Abstract and tells Claude Code to use the ZKsync mode for Solidity projects.
no license ★ 1,064 updated 2026-01-21
.claude/rules/forge.mdWhat forge does
The rule targets *.sol files and foundry.toml. It sets a working convention for Abstract Chain: use foundry-zksync and add --zksync to Foundry commands for builds, tests, scripts, and contract deployment.
Its configuration covers RPC endpoints for Abstract Mainnet and Abstract Testnet, chain IDs, verification URLs, and etherscan entries. Deployment uses forge script with --broadcast; verification uses forge verify-contract. The explorer key is read from ABSCAN_API_KEY. Without --zksync, a Foundry command is in the wrong mode for this ZKsync-based chain.
Place the rule at .claude/rules/forge.md in a Claude Code project. It only matches Solidity files and foundry.toml, so unrelated project files are outside its scope.
What it helps with
- build Solidity code with the ZKsync Foundry mode
- run tests against the required command setup
- deploy a script to Abstract Testnet or Mainnet
- verify a deployed contract through Abstract’s explorer
- keep Abstract RPC and verifier settings in
foundry.toml
Example prompts for the agent
- Build the contracts with
forge build --zksync. - Run the test suite using
forge test --zksync. - Deploy
script/Deploy.s.solto Abstract Testnet, then verify the contract.
How to install forge
Manually: put the files in place
.claude/rules/forge.mdThe paths frontmatter field limits the files
AGENTS.md
Codex reads AGENTS.md: paste the rule text there
Manually: put the files in place
.cursor/rules/forge.mdcFrontmatter: description, globs, alwaysApply
Manually: put the files in place
.github/instructions/forge.instructions.mdThe applyTo field sets which files it applies to
Manually: put the files in place
.devin/rules/forge.mdManually: put the files in place
.clinerules/forge.mdStep by step, with commands for each platform: AGENTS.md vs CLAUDE.md: what they are and which one to use
Questions about forge
How do I install forge in Claude Code?
Add the rule file at .claude/rules/forge.md inside your Claude Code project.
What does forge do?
It tells Claude Code to use ZKsync-aware Foundry commands for Solidity files and foundry.toml, with Abstract network and verification settings.
What is required to verify an Abstract contract?
Set ABSCAN_API_KEY and use forge verify-contract with --zksync, the matching verifier URL, and the network chain ID.