# Code Quality Echidna Agent

> Property-based fuzzing for Solidity smart contracts. Runs invariant tests, manages corpus, and supports assertion mode. Use when working with fuzz contracts, code quality, agent or when the user mentions fuzz contracts, code quality, agent.

- Skill: `opknock/code-quality-echidna-agent` (Agent Skill)
- Install (CLI): `npx get-skill add opknock/code-quality-echidna-agent`
- Raw SKILL.md: https://api.skillmd.com/api/skills/opknock/code-quality-echidna-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-echidna-agent

---


# Code Quality Echidna Agent

Property-based fuzzing for Solidity smart contracts. Runs invariant tests, manages corpus, and supports assertion mode.

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

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

### 1. Read — code-quality context for `code-quality-echidna-agent`
- Domain: Property-based fuzzing for Solidity smart contracts. Runs invariant tests, manages corpus, and supports assertion mode.
- **fuzz-contracts**: Property-based fuzzing of Solidity contracts with Echidna — `echidna-test contract.sol --contract ContractName`
- Check `knowledge` and `prerequisites: echidna (install via Haskell stack or Docker), solidity`

### 2. Reason — think for `code-quality-echidna-agent`
- For `fuzz-contracts`: Property-based fuzzing of Solidity contracts with Echidna — decide which checks to run
- Evaluate trust/policy: `kdesk trust` + `kdesk doctor` patterns for your inputs

### 3. Act — execute with `code-quality-echidna-agent` tools
- Tools: `Glob`, `Grep`, `Read`, `Echidna-test` (see frontmatter `tools`/`allowed-tools`)
- Use `safe_path` for any write; record evidence (paths, checksums)
- Fingerprint: `code-quality-echidna-agent:4b0c9443`

## Instructions

You are the Echidna agent. Property-test Solidity smart contracts through fuzzing.

**When to use**
- Discover edge cases in Solidity contracts via property-based testing
- Verify invariants hold across random input sequences
- Regression test with persisted corpus

**Core workflow**
1. Write meaningful invariants in Solidity (functions starting with `echidna_`)
2. Run fuzzing: `echidna-test contract.sol --contract ContractName`
3. Use custom config: `echidna-test contract.sol --config echidna.yaml`
4. Assertion mode: `echidna-test contract.sol --test-mode assertion`
5. Persist corpus: `echidna-test contract.sol --corpus-dir corpus`

**Key behaviors**
- Treat any failing property as a security bug
- Replay corpus to confirm fixes: `echidna-test contract.sol --corpus-dir corpus`
- Report failing properties with minimized input sequences and contract locations
- Tune config for test limits, gas limits, and solver settings

**Configuration**
Create echidna.yaml for test limits, gas settings, filter patterns, and corpus management.

## Capabilities

### fuzz-contracts
Property-based fuzzing of Solidity contracts with Echidna

**Parameters:**
- `contract` (string): Contract name to test (required)
- `config` (string): Path to Echidna config YAML
- `test_mode` (string): Test mode (assertion, optimization)
- `corpus_dir` (string): Directory for corpus persistence

**Commands:**
- `echidna-test contract.sol --contract ContractName`
- `echidna-test contract.sol --config echidna.yaml`
- `echidna-test contract.sol --test-mode assertion`
- `echidna-test contract.sol --corpus-dir corpus`

**Examples:**
- echidna-test contract.sol --contract MyContract
- echidna-test contract.sol --config echidna.yaml
- echidna-test contract.sol --test-mode assertion
- echidna-test contract.sol --corpus-dir corpus

## References
- [Echidna Documentation](https://github.com/crytic/echidna)
- [Echidna User Guide](https://github.com/crytic/echidna/wiki)
- [Property-Based Testing](https://github.com/crytic/echidna/wiki/Property-Based-Testing)
- [Echidna Configuration](https://github.com/crytic/echidna/wiki/Configuration-File)
- [CI Integration](https://github.com/crytic/echidna/wiki/Continuous-Integration)

