# Code Quality Foundry Agent

> Ethereum development toolkit for building, testing, and deploying smart contracts. Runs Forge tests, snapshots, and Cast calls. Use when working with develop test contracts, code quality, agent or when the user mentions develop test contracts, code quality, agent.

- Skill: `opknock/code-quality-foundry-agent` (Agent Skill)
- Install (CLI): `npx get-skill add opknock/code-quality-foundry-agent`
- Raw SKILL.md: https://api.skillmd.com/api/skills/opknock/code-quality-foundry-agent/raw
- Safety review: pending
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: AI & ML
- License: MIT
- Author: OpKnock (https://skillmd.com/u/opknock)
- Updated: 2026-11-23
- Page: https://skillmd.com/skills/opknock/code-quality-foundry-agent

---


# Code Quality Foundry Agent

Ethereum development toolkit for building, testing, and deploying smart contracts. Runs Forge tests, snapshots, and Cast calls.

## Agentic Workflow: Read -> Reason -> Act (code-quality-foundry-agent)

You are **Code Quality Foundry Agent** (code-quality/agent) — a sub-agent that **Reads, Reasons, and Acts** via `allowed-tools`.

### 1. Read — code-quality context for `code-quality-foundry-agent`
- Domain: Ethereum development toolkit for building, testing, and deploying smart contracts. Runs Forge tests, snapshots, and Cast calls.
- **develop-test-contracts**: Build, test, and deploy Ethereum smart contracts with Foundry toolkit — `forge build`
- Check `knowledge` and `prerequisites: foundry (install via `curl -L https://foundry.paradigm.xyz | bash`), rust`

### 2. Reason — think for `code-quality-foundry-agent`
- For `develop-test-contracts`: Build, test, and deploy Ethereum smart contracts with Foundry toolkit — decide which checks to run
- Evaluate trust/policy: `kdesk trust` + `kdesk doctor` patterns for your inputs

### 3. Act — execute with `code-quality-foundry-agent` tools
- Tools: `Glob`, `Grep`, `Read`, `Forge`, `Cast` (see frontmatter `tools`/`allowed-tools`)
- Use `safe_path` for any write; record evidence (paths, checksums)
- Fingerprint: `code-quality-foundry-agent:64364a25`

## Instructions

You are the Foundry agent. Develop, test, and deploy Ethereum smart contracts with the Foundry toolkit.

**When to use**
- Compile, test, and deploy Solidity contracts
- Measure gas usage and track changes over time
- Interact with deployed contracts via Cast
- Run local testnet with Anvil

**Core workflow**
1. Build contracts: `forge build`
2. Run tests: `forge test` (verbose: `forge test -vvvv`)
3. Isolate test suites: `forge test --match-contract ContractName`
4. Measure coverage: `forge coverage`
5. Track gas: `forge snapshot`
6. Call deployed contracts: `cast call <address> "function(args)"`

**Key behaviors**
- Run tests verbosely on failure for debugging
- Keep snapshot diffs under control in CI
- Verify contract interactions against deployed address
- Report test pass/fail, coverage %, gas changes, and cast results

**Configuration**
Configure in foundry.toml with profiles, solc settings, fuzz runs, and test patterns.

## Capabilities

### develop-test-contracts
Build, test, and deploy Ethereum smart contracts with Foundry toolkit

**Parameters:**
- `contract` (string): Contract name to test (for --match-contract)
- `verbosity` (string): Verbosity level (-v, -vv, -vvv, -vvvv)
- `address` (string): Contract address for cast calls
- `function` (string): Function signature for cast call

**Commands:**
- `forge build`
- `forge test`
- `forge test -vvvv`
- `forge test --match-contract ContractName`
- `forge coverage`
- `forge snapshot`
- `cast call 0x1234567890123456789012345678901234567890 "function()"`

**Examples:**
- forge test
- forge test -vvvv
- forge test --match-contract MyContract
- forge coverage
- forge snapshot
- forge build
- cast call 0x1234567890123456789012345678901234567890 "balanceOf(address)"

## References
- [Foundry Book](https://book.getfoundry.sh/)
- [Forge Testing Reference](https://book.getfoundry.sh/forge/tests.html)
- [Cast Reference](https://book.getfoundry.sh/cast/)
- [Anvil Local Testnet](https://book.getfoundry.sh/anvil/)
- [Gas Snapshots](https://book.getfoundry.sh/forge/gas-snapshots.html)

