defi-protocols

defi-protocols is a skill for Claude Code, Codex from j4flmao/agent-skills. It costs 118 tokens per session (842 once invoked), scanned A, original, MIT.

A guide to decentralised finance, or DeFi, which provides financial services through blockchain programs instead of traditional intermediaries. It covers token swaps and lending pools.

In plain words
What is it for?
Use it to design or review automated market makers, lending pools, collateral checks, liquidation processes, and price-oracle integrations.
Why use it?
It explains the maths and safeguards behind common DeFi systems. This helps developers reason about exchange rates, borrowing risk, liquidations, and price data.

Skill for Claude CodeCodex

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

Good fit Use it to design or review automated market makers, lending pools, collateral checks, liquidation processes, and price-oracle integrations.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/j4flmao/agent-skills/defi-protocols
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 j4flmao/agent-skills --skill defi-protocols
Clone the repo
git clone --depth 1 https://github.com/j4flmao/agent-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-protocols

README.md
[![agentmods](https://agentmods.dev/badge/skills/j4flmao/agent-skills/defi-protocols/github.svg)](https://agentmods.dev/skills/j4flmao/agent-skills/defi-protocols)
Your own site
<a href="https://agentmods.dev/skills/j4flmao/agent-skills/defi-protocols"><img src="https://agentmods.dev/badge/skills/j4flmao/agent-skills/defi-protocols/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-protocols

Your own site · 80×15
<a href="https://agentmods.dev/skills/j4flmao/agent-skills/defi-protocols"><img src="https://agentmods.dev/badge/skills/j4flmao/agent-skills/defi-protocols.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 118 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 842 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. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found 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.00118 $0.00842
Opus 5.5 $0.00047 $0.00337
Sonnet 5.5 $0.00024 $0.00168
Haiku 4.5 $0.00012 $0.00084

Measured 8d ago against content hash 79e8756f4b5c, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

defi-protocols 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 8d 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.

skills/blockchain/defi-protocols/SKILL.md · 72 lines

How it starts

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

DeFi Protocols

Purpose

Explain the core on-chain primitives of DeFi: the constant-product AMM invariant and swap pricing (with fees), and over-collateralized lending with health-factor-driven liquidation. Provides correct reference formulas and minimal Solidity patterns for building or reviewing these protocols.

Agent Protocol

Trigger

User phrases: "AMM math", "x*y=k", "Uniswap swap formula", "lending pool", "health factor", "liquidation design".

Input Context

  • Protocol type (DEX/AMM vs lending) and token decimals.
  • Fee tier and oracle/price source.

Output Artifact

Formula/architecture explanation with minimal illustrative Solidity. No production deployment.

Response Format

Primitive: {AMM | lending}
Formula: {invariant / health factor}
Risk: {IL | liquidation | oracle}

AMM Math (Constant Product)

The fundamental formula for DEXes like Uniswap V2 is $x \times y = k$. With a 0.30% swap fee, the output for a given input is derived by keeping the product of reserves at least constant after the fee-adjusted input is added (the 997/1000 factors below encode the 0.30% fee).

contract SimpleAMM {
    uint public reserve0;
    uint public reserve1;

    function swap(uint amountIn, bool isToken0) external returns (uint amountOut) {
        require(amountIn > 0, "Invalid amount");
        (uint reserveIn, uint reserveOut) = isToken0 ? (reserve0, reserve1) : (reserve1, reserve0);
        
        // amountOut = (amountIn * 997 * reserveOut) / (reserveIn * 1000 + amountIn * 997)
        uint amountInWithFee = amountIn * 997;
        amountOut = (amountInWithFee * reserveOut) / (reserveIn * 1000 + amountInWithFee);
        
        // Update reserves...
    }
}

Lending Pool Architecture

Over-collateralized lending requires robust liquidation mechanisms. The Health Factor is (collateral_value * liquidation_threshold) / total_debt_value; when it drops below 1, the position is eligible for liquidation and a liquidator repays debt in exchange for discounted collateral (the liquidation bonus).

Read the full file on GitHub · 72 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. 8d ago Changed · +29 lines · +100 tokens per session 79e8756f4b5c
  2. 2mo ago First seen · 43 lines · 18 tokens per session scan A fe1d1566185a

Subscribe to this mod's changes

defi-protocols is a skill published in the GitHub repository j4flmao/agent-skills (38 stars, last pushed 2d ago), licensed MIT. It adds 118 tokens to every session and 842 once invoked, about $0.0005 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

Other skills, from other repositories

analyzing-ethereum-smart-contract-vulnerabilities

Perform static and symbolic analysis of Solidity smart contracts using Slither and Mythril to detect reentrancy, integer overflow, access control, and other vulnerability classes before deployment to Ethereum mainnet.

mukul975/Anthropic-Cybersecurity-Skills · 49 tokens

analyzing-ethereum-smart-contract-vulnerabilities

Perform static and symbolic analysis of Solidity smart contracts using Slither and Mythril to detect reentrancy, integer overflow, access control, and other vulnerability classes before deployment to Ethereum mainnet.

xalgorix/xalgorix · 49 tokens

starknet-defi

Execute DeFi operations on Starknet including token swaps via avnu aggregator, DCA recurring buys, STRK staking, and lending/borrowing. Supports gasless transactions.

keep-starknet-strange/starknet-agentic · 41 tokens

yield-optimization

Multi-chain yield optimization via yield.xyz (StakeKit). Discover 2,988+ yield opportunities across 75+ blockchains, build deposit/withdrawal transactions with shell scripts, and sign them with a MoonPay wallet. Use when the user wants to earn yield, find the best lending or staking rate, enter/exit a position, or…

moonpay/skills · 77 tokens

starknet-defi

Execute DeFi operations on Starknet including token swaps via avnu aggregator, DCA recurring buys, STRK staking, and lending/borrowing. Supports gasless transactions.

internet-court/internet-court-skill · 41 tokens

blockchain-expert

Expert-level blockchain, Web3, smart contracts, DeFi, and cryptocurrency development. Use when the user mentions Web3, smart contracts, DeFi, Ethereum, or Solidity, or when the task involves Blockchain Fundamentals, Web3 & DeFi, Smart Contract Security, or Gas Optimization.

personamanagmentlayer/pcl · 63 tokens