defi-amm-security

Harden Solidity AMM contracts with security patterns for reentrancy, math, and oracles.

86|21|Updated Feb 9, 2026
One-click install
npx skills add https://github.com/Jamkris/everything-gemini-code --skill defi-amm-security-jamkris
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: defi-amm-security
Source: https://github.com/Jamkris/everything-gemini-code/tree/main/skills/defi-amm-security
Command: npx skills add https://github.com/Jamkris/everything-gemini-code --skill defi-amm-security-jamkris

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Solidity AMM contracts, liquidity pools, and swap flows are prone to critical vulnerabilities if patterns are not consistently applied; this Skill provides a security-first checklist and hardened implementations to reduce risk.

Core Features & Use Cases

  • Reentrancy protection with proper CEI ordering and OpenZeppelin patterns.
  • Safe reserve and accounting math, avoiding balance-based vulnerabilities.
  • Slippage protection, deadline checks, and robust admin controls (pauses and upgrades).
  • Oracle data handling with resistant sources like TWAP to prevent manipulation.
  • Audit-ready patterns and examples for common AMM flows (swap, deposit, withdraw).

Quick Start

Review an AMM function in your codebase and apply the appropriate hardened pattern to fix it.

Frequently Asked Questions about defi-amm-security

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I secure Solidity AMM contracts against reentrancy and reserve manipulation?

Secure Solidity AMM contracts by applying reentrancy protection with proper CEI ordering, OpenZeppelin patterns, and safe reserve math to prevent balance-based vulnerabilities during swaps and liquidity operations.

What is the best way to implement slippage protection and deadline checks in a DeFi swap function?

Implement slippage protection and deadline checks in DeFi swap functions by enforcing validation patterns that prevent front-running and stale transactions, ensuring executed prices match acceptable user-defined thresholds.

How does TWAP price oracle integration prevent AMM oracle manipulation?

TWAP price oracle integration prevents AMM oracle manipulation by averaging token prices over time, resisting flash loan attacks and ensuring external data feeds cannot be artificially skewed by single-block interventions.

Can I use OpenZeppelin patterns to add emergency pausing and guarded admin controls to an LP vault?

Yes, use OpenZeppelin patterns to add emergency pausing and guarded admin controls to LP vaults, enabling secure upgrades and circuit breakers that halt malicious withdrawals or unauthorized contract modifications.

When do I need safe ERC20 usage and audit-ready patterns for AMM liquidity pools?

You need safe ERC20 usage and audit-ready patterns for AMM liquidity pools whenever handling token deposits, withdrawals, or swaps to prevent silent transfer failures and ensure accounting math remains secure.