defi-amm-security

defi-amm-security is a skill for Claude Code, Codex from Jamkris/everything-gemini-code. It costs 48 tokens per session (1,123 once invoked), scanned A, a copy of defi-amm-security, MIT.

A security checklist and code-pattern guide for Solidity AMM contracts. An AMM, or automated market maker, is a blockchain exchange that prices swaps from token pools rather than an order book.

In plain words
What is it for?
Use it to write or audit liquidity pools, swaps, deposits, withdrawals, LP vaults, and administrative functions in DeFi contracts.
Why use it?
It helps identify flaws that could let attackers steal funds, manipulate prices, or misuse administrative controls. The checklist covers reentrancy, reserve calculations, slippage, oracles, and integer arithmetic.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to write or audit liquidity pools, swaps, deposits, withdrawals, LP vaults, and administrative functions in DeFi contracts.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/jamkris/everything-gemini-code/defi-amm-security
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add Jamkris/everything-gemini-code --skill defi-amm-security
Clone the repo
git clone --depth 1 https://github.com/Jamkris/everything-gemini-code

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for defi-amm-security

README.md
[![agentmods](https://agentmods.dev/badge/skills/jamkris/everything-gemini-code/defi-amm-security/github.svg)](https://agentmods.dev/skills/jamkris/everything-gemini-code/defi-amm-security)
Your own site
<a href="https://agentmods.dev/skills/jamkris/everything-gemini-code/defi-amm-security"><img src="https://agentmods.dev/badge/skills/jamkris/everything-gemini-code/defi-amm-security/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for defi-amm-security

Your own site · 80×15
<a href="https://agentmods.dev/skills/jamkris/everything-gemini-code/defi-amm-security"><img src="https://agentmods.dev/badge/skills/jamkris/everything-gemini-code/defi-amm-security.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 48 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,123 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin 86% copy Near-identical to another mod in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00048 $0.01123
Opus 5 $0.00024 $0.00562
Sonnet 5 $0.00010 $0.00225
Haiku 4.5 $0.00005 $0.00112

Measured 6d ago against content hash 0d3fd55d9536, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

defi-amm-security scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

This is a copy

86% identical to defi-amm-security — 34 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

skills/defi-amm-security/SKILL.md · 161 lines

How it starts

The opening of the file, as written. The whole thing — 161 lines — stays where its author put it; the contents beside it link to each section on GitHub.

DeFi AMM Security

Critical vulnerability patterns and hardened implementations for Solidity AMM contracts, LP vaults, and swap functions.

When to Use

  • Writing or auditing a Solidity AMM or liquidity-pool contract
  • Implementing swap, deposit, withdraw, mint, or burn flows that hold token balances
  • Reviewing any contract that uses token.balanceOf(address(this)) in share or reserve math
  • Adding fee setters, pausers, oracle updates, or other admin functions to a DeFi protocol

How It Works

Use this as a checklist-plus-pattern library. Review every user entrypoint against the categories below and prefer the hardened examples over hand-rolled variants.

Examples

Reentrancy: enforce CEI order

Vulnerable:

function withdraw(uint256 amount) external {
    require(balances[msg.sender] >= amount);
    token.transfer(msg.sender, amount);
    balances[msg.sender] -= amount;
}

Safe:

import {ReentrancyGuard} from "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

using SafeERC20 for IERC20;

function withdraw(uint256 amount) external nonReentrant {
    require(balances[msg.sender] >= amount, "Insufficient");
    balances[msg.sender] -= amount;
    token.safeTransfer(msg.sender, amount);
}

Do not write your own guard when a hardened library exists.

Donation or inflation attacks

Using token.balanceOf(address(this)) directly for share math lets attackers manipulate the denominator by sending tokens to the contract outside the intended path.

// Vulnerable
function deposit(uint256 assets) external returns (uint256 shares) {
    shares = (assets * totalShares) / token.balanceOf(address(this));
}
// Safe
uint256 private _totalAssets;

function deposit(uint256 assets) external nonReentrant returns (uint256 shares) {
    uint256 balBefore = token.balanceOf(address(this));
    token.safeTransferFrom(msg.sender, address(this), assets);
    uint256 received = token.balanceOf(address(this)) - balBefore;

    shares = totalShares == 0 ? received : (received * totalShares) / _totalAssets;
    _totalAssets += received;
    totalShares += shares;
}

Read the full file on GitHub · 161 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 161 lines · 48 tokens per session scan A 0d3fd55d9536

Subscribe to this mod's changes

defi-amm-security is a skill published in the GitHub repository Jamkris/everything-gemini-code (88 stars, last pushed 3mo ago), licensed MIT. It adds 48 tokens to every session and 1,123 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. It is 86% identical to defi-amm-security, differing in 34 lines, and is treated as a copy.

Related

Other skills, from other repositories

codeck

Route explicit requests from a host coding agent to one or more locally configured AI executors through Codeck, attach Markdown or other project files, moderate cross-model consultation, expose disagreements, and synthesize traceable results. Use when the user explicitly names Codeck or asks to consult, compare, or…

isdou/codeck · 108 tokens

scan

Scan your AI coding tool ecosystem — Gemini CLI, Claude Code, Antigravity (Desktop, CLI, IDE), Continue, Windsurf, JetBrains AI, OpenCode. Produces a maturity score, advisory recommendations, and optionally generates reusable SKILL.md files from your conversation patterns. Use when the user asks to audit their…

pauldatta/gemini-cli-scanner · 82 tokens

review-work

Post-implementation review orchestrator. Launches 5 parallel background sub-agents: Oracle (goal/constraint verification), Oracle (code quality), Oracle (security), unspecified-high (hands-on QA execution), unspecified-high (context mining from GitHub/git/Slack/Notion). All must pass for review to pass. MUST USE after…

daeryundf2-prog/LAZYANTIGRAVITY · 116 tokens

image-prompt

A Korean-language skill that turns a rough image idea into a detailed prompt for gpt-image-2, OpenAI’s image-generation model.

daeryundf2-prog/LAZYANTIGRAVITY · 651 tokens

archify

Create polished, validated architecture, workflow, sequence, data-flow, and lifecycle/state diagrams as explorable standalone HTML with inline SVG, dark/light themes, optional trace motion, and PNG/JPEG/WebP/SVG/WebM export. Accept plain-language requirements or pasted Mermaid flowchart, sequenceDiagram, and…

daeryundf2-prog/LAZYANTIGRAVITY · 0 tokens

visual-qa

Rigorous visual QA for any UI you built or changed, across BOTH web/page UIs and TUI/terminal UIs. MUST USE after building or changing any UI to verify it visually before declaring it done. Captures objective reference evidence with a bundled diff script (image-diff for screenshots, tui-check for terminal captures)…

daeryundf2-prog/LAZYANTIGRAVITY · 212 tokens