
Defi invariant check
Authors and falsifies DeFi invariants for AMMs, lending, vaults and perps
Defi invariant check is an open-source agent skill for security. It is available on Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose.
- Scripts
- None
- Platforms
- Claude Code, Codex, Cursor
- GitHub stars
- 227
- Last commit
- License
- MIT
- Listing updated
Similar skills
About Defi invariant check
This skill guides an agent auditing a DeFi protocol through property-based testing. It covers the economic properties that generic fuzzing campaigns tend to miss, including token conservation, constant-product behavior, share accounting, collateralization, and oracle deviation checks. The workflow has the agent write Echidna properties, run Echidna and then Medusa, simulate flash-loan attack sequences in Forge, test oracle and NAV manipulation, check timelock and role-change bypasses, and fuzz rounding at zero-supply and dust boundaries.
The skill is written for a sub-workflow inside a broader EVM audit flow and assumes the native host CLIs (echidna, medusa, forge, halmos) run in the target project directory. It also points to halmos for bounded formal checks on critical properties and warns against invariants that pass only by construction or against treating a fuzzer's clean run as proof.
It expects a Solidity project with access to those tools and a protocol whose class (AMM, lending, vault, bridge, stablecoin or perps) is known before starting. The skill is a single SKILL.md file with no bundled scripts.
When your agent uses it
Use when the audit target is a DeFi protocol — AMM, lending market, yield vault, stablecoin, or perps — and you must author the economic properties generic campaigns miss, such as token-conservation, constant-product k, share accounting, collateralization, and oracle-deviation invariants, then falsify them.
From the skill's SKILL.md. Your agent reads this description to decide when to load the skill.
What it can access
From a static check of its 1 file (10 KB) on GitHub on 3 December 2026. Nothing was run. Read the files before you install a skill: it can tell your agent to run anything its tools allow.
Check another skill before you install it.
Install
Copy the skill folder to ~/.claude/skills/defi-invariant-check to use it in all your projects:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/mtarcure/claude-vibe-squad.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/defi-invariant-check &&
cp -R "$tmp/.agents/skills/defi-invariant-check" ~/.claude/skills/defi-invariant-check &&
rm -rf "$tmp"For one project only, put the folder in .claude/skills/defi-invariant-check inside it instead.
Copy the skill folder to ~/.agents/skills/defi-invariant-check to use it in every repository:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/mtarcure/claude-vibe-squad.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/defi-invariant-check &&
cp -R "$tmp/.agents/skills/defi-invariant-check" ~/.agents/skills/defi-invariant-check &&
rm -rf "$tmp"For one repository only, put the folder in .agents/skills/defi-invariant-check inside it instead.
Copy the skill folder to ~/.cursor/skills/defi-invariant-check to use it in every project:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/mtarcure/claude-vibe-squad.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/defi-invariant-check &&
cp -R "$tmp/.agents/skills/defi-invariant-check" ~/.cursor/skills/defi-invariant-check &&
rm -rf "$tmp"For one project only, put the folder in .cursor/skills/defi-invariant-check inside it instead.
Run in a terminal (add --scope workspace to install it for the current workspace only):
gemini skills install https://github.com/mtarcure/claude-vibe-squad.git --path .agents/skills/defi-invariant-checkOr copy the folder to ~/.gemini/skills/defi-invariant-check yourself.
For GitHub Copilot in VS Code, copy the skill folder to ~/.copilot/skills/defi-invariant-check:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/mtarcure/claude-vibe-squad.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/defi-invariant-check &&
cp -R "$tmp/.agents/skills/defi-invariant-check" ~/.copilot/skills/defi-invariant-check &&
rm -rf "$tmp"For one project only, put the folder in .github/skills/defi-invariant-check inside it instead.
Get the folder:
git clone --depth 1 https://github.com/mtarcure/claude-vibe-squad.gitThen copy claude-vibe-squad/.agents/skills/defi-invariant-check into your agent's skills folder as defi-invariant-check. Agents that support SKILL.md read one folder per skill.
What it does
- Token accounting invariants
- Checklists for supply conservation, constant-product k, lending solvency and vault share consistency.
- Oracle manipulation checks
- Guidance for spot versus TWAP divergence, thin-market collateral and NAV manipulation bounds.
- Governance timelock tests
- Steps to queue privileged operations and confirm delays and role changes cannot be bypassed.
- Rounding and dust fuzzing
- Covers zero-supply initialization, one-unit deposits and division boundaries in share math.
- Flash-loan attack simulation
- Instructions for building a Forge attacker contract and checking invariants after the attack sequence.
- Fuzzer workflow and pivots
- Ordered steps for running Echidna and Medusa, with fixes for setup and vacuous properties.
Good for
- Audit an AMM for constant-product violations under flash-loan attacks
- Check a lending market for bad debt created by liquidations
- Write Echidna properties for a yield vault's share accounting
- Test whether a DeFi protocol's oracle can be manipulated to borrow unsafely
- Verify that a protocol's timelock delay cannot be shortened by role changes
Defi invariant check FAQ
What tools does Defi invariant check require?
It runs the native echidna, medusa, forge and halmos CLIs in the target project directory, with no wrapper layer.
Which DeFi protocol types does Defi invariant check cover?
AMMs, lending markets, yield vaults, stablecoins, perps, and bridges are named as protocol classes.
Does Defi invariant check prove a protocol is correct?
No. The skill states that Echidna is a fuzzer rather than a prover and recommends halmos for bounded formal checks on critical properties.
Is Defi invariant check a standalone skill?
It is described as a sub-skill used during an evm-audit-flow when the target is a DeFi protocol.
How do I install Defi invariant check in Claude Code?
Copy the skill folder from GitHub to ~/.claude/skills/defi-invariant-check to use it in all your projects, or to .claude/skills/defi-invariant-check in one project.
Does Defi invariant check run scripts?
No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.
Which AI agents can use Defi invariant check?
Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, Windsurf and Goose. Each reads skills in the SKILL.md format from its own folder; the install steps on this page list them.
What are the best alternatives to Defi invariant check?
The closest alternatives to Defi invariant check are Defi amm security, Signature validation audit, Evm audit flow, Read only reentrancy check and Secure workflow guide.
Where this comes from
- Description: from the skill's own SKILL.md.
More from mtarcure/claude-vibe-squad

Writes alt text, timed captions and transcripts for images, footage and audio
- Open source
- 227 GitHub stars
- Design and media

Guides building product agent system prompts with eval-backed boundaries and output
- Open source
- 227 GitHub stars
- AI models and LLM tooling

Guides authorized adversarial testing of autonomous LLM agents for injection and approval
- Open source
- 227 GitHub stars
- Security

Writes a typed game-event to audio-cue map that hands adaptive audio designs to engines
- Open source
- 227 GitHub stars
- Developer tools

Generates missing README, CHANGELOG, LICENSE and agent-context files at project delivery
- Open source
- 227 GitHub stars
- Developer tools

Builds and proves multi-step exploit chains from weak bug-bounty findings
- Open source
- 227 GitHub stars
- Security




