defi-amm-security

defi-amm-security is a skill for Claude Code, Codex from userInner/SKILLS. It costs 64 tokens per session (1,244 once invoked), scanned A, a copy of defi-amm-security, Apache-2.0.

A security checklist for Solidity smart contracts that run automated market makers and liquidity pools in decentralised finance. It covers swap, deposit, withdrawal, token-balance, pricing, and administrator controls.

In plain words
What is it for?
Use it when writing or auditing Solidity contracts for token swaps, liquidity pools, LP vaults, deposits, withdrawals, fees, pauses, or price updates.
Why use it?
It helps catch attacks that can drain funds or miscalculate shares and prices, including reentrancy, oracle manipulation, slippage, and integer-math errors.

Skill for Claude CodeCodex

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

Good fit Use it when writing or auditing Solidity contracts for token swaps, liquidity pools, LP vaults, deposits, withdrawals, fees, pauses, or price updates.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/userinner/skills/defi-amm-security-affaan-m-ecc
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 userInner/SKILLS --skill defi-amm-security-affaan-m-ecc
Clone the repo
git clone --depth 1 https://github.com/userInner/SKILLS

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/userinner/skills/defi-amm-security-affaan-m-ecc/github.svg)](https://agentmods.dev/skills/userinner/skills/defi-amm-security-affaan-m-ecc)
Your own site
<a href="https://agentmods.dev/skills/userinner/skills/defi-amm-security-affaan-m-ecc"><img src="https://agentmods.dev/badge/skills/userinner/skills/defi-amm-security-affaan-m-ecc/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/userinner/skills/defi-amm-security-affaan-m-ecc"><img src="https://agentmods.dev/badge/skills/userinner/skills/defi-amm-security-affaan-m-ecc.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 64 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,244 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.00064 $0.01244
Opus 5 $0.00032 $0.00622
Sonnet 5 $0.00013 $0.00249
Haiku 4.5 $0.00006 $0.00124

Measured 7d ago against content hash 06f662a81b1f, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, 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 7d 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 — 29 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.

community-skills/engineering/defi-amm-security--affaan-m-ecc/SKILL.md · 168 lines

How it starts

The opening of the file, as written. The whole thing — 168 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.

Execution Safety

The shell commands in this skill are local audit examples. Run them only in a trusted checkout or disposable sandbox, and do not splice untrusted contract names, paths, RPC URLs, private keys, or user-supplied flags into shell commands. Ask before installing tools or running long fuzzing/static-analysis jobs that may consume significant local or paid resources.

Never include secrets, private keys, seed phrases, API tokens, or mainnet signing credentials in command examples, logs, or reports.

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.

Read the full file on GitHub · 168 lines

Files

What ships with it

3 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 7d ago First seen · 168 lines · 64 tokens per session scan A 06f662a81b1f

Subscribe to this mod's changes

defi-amm-security is a skill published in the GitHub repository userInner/SKILLS (3 stars, last pushed 4d ago), licensed Apache-2.0. It adds 64 tokens to every session and 1,244 once invoked, about $0.0003 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 29 lines, and is treated as a copy.

Related

Other skills, from other repositories

env-manager

An environment-variable manager for project settings stored outside the code, often in .env files. It checks variable definitions and usage while keeping secret values out of reports and terminal output.

laolaoshiren/claude-code-skills-zh · 22 tokens

perf-profiler

A performance investigation guide that uses repeatable measurements and profiling evidence to find where software spends time or resources. Profiling records runtime activity such as CPU use, memory use, database work, or network delays.

laolaoshiren/claude-code-skills-zh · 78 tokens

changelog-gen

A changelog generator that turns Git history into a version-by-version record of project changes. A changelog is a readable summary of new features, fixes, breaking changes, documentation, and other updates.

laolaoshiren/claude-code-skills-zh · 19 tokens

incident-slo-runbook

Create or audit SLOs, SLIs, alert rules, incident response steps, escalation paths, postmortems, operational runbooks, and customer-impact communication. Use when defining production reliability, preparing launch readiness, responding to an outage, writing a runbook, tuning alerts, or closing the loop after an…

majiayu000/spellbook · 70 tokens

okx-exchange-websocket-skill

Subscribe to OKX public exchange WebSocket channels through UXC raw WebSocket mode for ticker, trade, book, and candle events with explicit subscribe frames.

holon-run/uxc · 40 tokens

clanker

Plan and review ERC20 deployment with the Clanker SDK. Use for token configuration, vesting, airdrops, rewards, metadata, and transaction preparation on supported EVM chains.

aAAaqwq/AGI-Super-Team · 40 tokens