Back to Skills

defi-amm-security

Security checklist for Solidity AMM contracts, liquidity pools, and swap flows. Covers reentrancy, CEI ordering, donation or inflation attacks, oracle manipulation, slippage, admin controls, and integer math.

192,557stars29,794forksUpdated 5/26/2026

Security Assessment

Safe(100/100)
Security Score100/100

About defi-amm-security

The defi-amm-security skill provides a security-focused checklist and implementation reference for Solidity-based automated market maker (AMM) contracts, liquidity pools, LP vaults, and swap flows. It is designed to help developers and auditors identify common vulnerability patterns in DeFi protocols, including reentrancy, unsafe reserve accounting, oracle manipulation, slippage issues, and insecure administrative controls. The skill emphasizes hardened implementation patterns over custom or hand-rolled approaches, helping teams reduce the risk of exploitable smart contract behavior in systems that manage token balances and liquidity operations.

The skill includes practical examples of vulnerable and safer Solidity implementations for core DeFi operations such as deposits, withdrawals, swaps, and accounting logic. It highlights best practices such as checks-effects-interactions (CEI) ordering, use of established libraries like OpenZeppelin ReentrancyGuard and SafeERC20, internal asset accounting instead of direct balance-based calculations, and caller-provided slippage protection with deadlines. It also addresses flash-loan-resistant oracle design through TWAP-based pricing patterns and provides operational guidance for safely running local audit commands and fuzzing workflows.

This skill is intended for Solidity developers, smart contract auditors, protocol security reviewers, and DeFi engineering teams building or reviewing AMMs and liquidity systems. It is especially useful during contract development, code review, security hardening, and audit preparation phases. Teams implementing token swaps, vault shares, mint and burn mechanics, or privileged admin functions can use this skill as a structured security review framework before deployment.

FAQ

What types of contracts is this skill designed for?

This skill is designed for Solidity AMM contracts, liquidity pools, LP vaults, and swap-related functions that manage token balances or reserve accounting.

Does this skill provide complete production-ready contracts?

No. The skill provides security checklists, vulnerability explanations, and hardened implementation examples, but it is not a complete contract framework.

What security issues does the skill focus on?

The skill focuses on reentrancy protection, CEI ordering, donation or inflation attacks, oracle manipulation, slippage protection, integer math considerations, and safe admin control patterns.

Are external libraries recommended in the examples?

Yes. The examples recommend using hardened libraries such as OpenZeppelin ReentrancyGuard and SafeERC20 instead of custom-built implementations.

Can this skill help with oracle-related risks in DeFi protocols?

Yes. The skill discusses the risks of flash-loan manipulation on spot prices and demonstrates a TWAP-based oracle approach using Uniswap V3 observations.

Install defi-amm-security

Download and extract the skill files to your .claude/skills/ directory.

Quick Setup:

  1. Copy the skill folder to .claude/skills/
  2. Claude will automatically detect and use the skill