npx skills add ...
npx skills add affaan-m/ecc --skill 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. Use when auditing or writing Solidity AMM, liquidity pool, or swap code.
npx skills add affaan-m/ecc --skill defi-amm-security
Critical vulnerability patterns and hardened implementations for Solidity AMM contracts, LP vaults, and swap functions.
token.balanceOf(address(this)) in share or reserve mathUse this as a checklist-plus-pattern library. Review every user entrypoint against the categories below and prefer the hardened examples over hand-rolled variants.
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.
Vulnerable:
Safe:
Do not write your own guard when a hardened library exists.
Using token.balanceOf(address(this)) directly for share math lets attackers manipulate the denominator by sending tokens to the contract outside the intended path.
Track internal accounting and measure actual tokens received.
Spot prices are flash-loan manipulable. Prefer TWAP.
Every swap path needs caller-provided slippage and a deadline.
For large reserve math, avoid naive a * b / c when overflow risk exists.
Prefer explicit acceptance for ownership transfer and gate every privileged path.
nonReentrantbalanceOf(address(this))SafeERC20amountOutMin and deadlinemulDiv