Agent skill

DeFi Yield Analysis

by HKUDS in HKUDS/Vibe-Trading

Compares DeFi yields across lending, liquidity provision, staking and yield farming, adjusts them for risks such as impermanent loss, and judges whether a protocol's returns are sustainable.

MITAuto-check passedBusiness, Finance & HR

Install DeFi Yield Analysis

skills CLI
$ npx skills add HKUDS/Vibe-Trading --skill defi-yield -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install HKUDS/Vibe-Trading defi-yield --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/HKUDS/Vibe-Trading.git skills-src && mkdir -p .claude/skills && cp -r skills-src/agent/src/skills/defi-yield .claude/skills/defi-yield && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
defi-yield
GitHub stars
35k
Token cost
~2.6k tokens
SKILL.md length
511 words
Files
1
Skills in repo
89
Repo updated
First seen
Licence
MIT

At a glance

Compares DeFi yields across lending, liquidity provision, staking and yield farming, adjusts them for risks such as impermanent loss, and judges whether a protocol's returns are sustainable.

  • Works in 6 steps: DeFi Yield Sources → Lending Rate Analysis → LP Yield Analysis → …
  • Comparing lending, staking and LP yields on a risk-adjusted basis
  • SKILL.md covers Overview, Core Concepts, Data Sources and Output Format, plus 1 more section
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

The skill breaks DeFi returns into sources: lending supply, LP trading fees, staking, liquidity mining, restaking and points farming, each with a typical yield range and risk level. Lending and borrowing rates are read as a gauge of demand for borrowing, and the skill names major lending protocols such as Aave, Compound, MakerDAO, Morpho, Spark and Kamino with their chains and focus.

For liquidity providers it defines impermanent loss for a 50/50 pool with a short function, then net LP yield as fee income plus token incentives minus expected impermanent loss, and it offers criteria for judging pools by fee APY relative to TVL. The aim is to compare opportunities on a risk-adjusted basis and to tell whether a protocol's yield is sustainable or driven mainly by token incentives.

When your agent uses it

  • Comparing lending, staking and LP yields on a risk-adjusted basis
  • Estimating impermanent loss and the net yield of a liquidity pool
  • Judging whether a protocol's advertised APY is sustainable
  • Reading lending and borrow rates as a signal of borrowing demand across the market

Example prompts

  • “Compare stablecoin supply rates on Aave and Compound and tell me which looks better after risk.”
  • “Estimate impermanent loss for a 50/50 pool if one token doubles in price against the other.”
  • “Is a very high liquidity mining APY something I can rely on?”
  • “Work out the net yield of an LP position from its fee APY and incentive APY.”

Workflow steps

6 steps, taken from the step headings in SKILL.md.

  1. DeFi Yield Sources
  2. Lending Rate Analysis
  3. LP Yield Analysis
  4. Staking Yield Analysis
  5. Yield Sustainability Assessment
  6. Risk-Adjusted Yield Comparison Framework

What it can do on your machine

Read from SKILL.md and the folder at commit e532650. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are python).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

DeFi Yield Analysis loads about 2.6k tokens when it runs. Until then it costs about 49 tokens; SKILL.md has 511 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~49
When it runs · the whole SKILL.md, loaded when a task matches
~2.6k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from HKUDS/Vibe-Trading at commit e532650, republished under its MIT licence (© HKUDS). 511 words, ~2,552 tokens.

Download SKILL.mdSave it as .claude/skills/defi-yield/SKILL.md (or your agent's skills folder).
name
defi-yield
description
DeFi yield analysis and optimization — lending rates, LP yields, staking returns, yield farming strategies, risk-adjusted yield comparison, and protocol-level sustainability assessment.
category
crypto

DeFi Yield Analysis & Optimization

Overview

Analyze and compare yields across DeFi protocols — lending, liquidity provision, staking, and yield farming — to identify the best risk-adjusted opportunities and assess sustainability. DeFi yields are a real-time proxy for crypto market leverage demand, capital allocation, and protocol health.

Core Concepts

1. DeFi Yield Sources
Yield SourceMechanismTypical APY RangeRisk Level
Lending (supply)Earn interest from borrowers1-15% (stablecoins 3-8%)Low-medium
Borrowing costInterest paid by borrowers3-20%N/A (cost side)
LP fees (AMM)Trading fee share from DEX5-50% (varies by pair)Medium-high
StakingValidator/delegation rewards3-15%Low-medium
Liquidity miningProtocol token incentives10-500% (unsustainable)High
RestakingRe-hypothecated staking yield5-20% (ETH + AVS rewards)Medium-high
Points farmingOff-chain points → future airdropUnknown (speculative)Very high
2. Lending Rate Analysis

Lending rates as market signal:

python
# High borrow rates = high leverage demand = bullish sentiment
# Low borrow rates = low leverage demand = bearish / waiting

def lending_rate_signal(borrow_rate_stable, borrow_rate_eth):
    """Analyze DeFi lending rates for market sentiment."""
    if borrow_rate_stable > 15:
        stable_signal = "extreme_demand"    # Leveraged long via stablecoin borrowing
    elif borrow_rate_stable > 8:
        stable_signal = "elevated_demand"
    elif borrow_rate_stable > 3:
        stable_signal = "normal"
    else:
        stable_signal = "low_demand"        # Bear market, no one borrowing

    if borrow_rate_eth > 10:
        eth_signal = "extreme_demand"       # Shorting or leveraged strategies
    elif borrow_rate_eth > 5:
        eth_signal = "elevated"
    else:
        eth_signal = "low_demand"

    return stable_signal, eth_signal

Key lending protocols:

ProtocolChainSpecializationTVL Range
Aave V3Multi-chainBlue-chip lending, institutional grade$10-20B
Compound V3Ethereum, BaseConservative, USDC-focused$3-5B
MakerDAO/SkyEthereumCDP-based DAI/USDS minting$8-15B
MorphoEthereumRate optimization, P2P matching$3-8B
SparkEthereumMakerDAO lending arm$2-5B
KaminoSolanaConcentrated LP + lending$1-3B
3. LP Yield Analysis

Impermanent Loss (IL) — the core risk of LP positions:

python
def impermanent_loss(price_ratio_change):
    """
    Calculate impermanent loss for a 50/50 AMM pool.
    price_ratio_change: new_price / old_price of the volatile asset.
    """
    r = price_ratio_change
    il = 2 * (r ** 0.5) / (1 + r) - 1
    return il * 100  # Return as percentage

# Examples:
# Price +25% → IL = -0.6%
# Price +50% → IL = -2.0%
# Price +100% (2x) → IL = -5.7%
# Price +200% (3x) → IL = -13.4%
# Price -50% → IL = -5.7%
# Price -75% → IL = -20.0%

LP yield = fee income + token incentives - impermanent loss

python
def net_lp_yield(fee_apy, incentive_apy, estimated_il_annualized):
    """Calculate risk-adjusted LP yield."""
    gross_yield = fee_apy + incentive_apy
    net_yield = gross_yield - abs(estimated_il_annualized)
    return net_yield

# Example: ETH/USDC pool
# Fee APY: 15%, Incentive APY: 20%, Estimated IL: 8%
# Net yield: 15% + 20% - 8% = 27%

LP pool evaluation criteria:

MetricGoodMediocreAvoid
Fee APY / TVL> 10%5-10%< 5%
IL risk (based on pair volatility)< 5% annualized5-15%> 15%
TVL stability (30d change)Growing or stableDeclining < 10%Declining > 30%
Volume/TVL ratio> 0.5x daily0.1-0.5x< 0.1x
Incentive dependency< 30% of yield30-70%> 70% (unsustainable)
4. Staking Yield Analysis

ETH staking ecosystem:

MethodAPYRiskLiquidity
Solo validator~3.5%Slashing, downtimeLocked (exit queue)
Lido (stETH)~3.3%Smart contract, governanceLiquid (stETH tradeable)
Rocket Pool (rETH)~3.2%Smart contract, more decentralizedLiquid
Coinbase (cbETH)~3.0%Custodial, regulatoryLiquid
EigenLayer restaking~3.5% + AVS rewardsSmart contract, slashing riskSemi-liquid

Staking yield signal:

python
# ETH staking yield trends
# Rising yield = more transactions / MEV = network activity increasing (bullish)
# Falling yield = less activity = network cooling down

# Restaking yield premium
restaking_premium = eigenlayer_yield - native_staking_yield
if restaking_premium > 3:
    signal = "high_restaking_demand"     # AVS demand strong
elif restaking_premium > 1:
    signal = "moderate_premium"
else:
    signal = "low_premium"               # Restaking risk not compensated
Show full SKILL.md (205 more words)Show less
5. Yield Sustainability Assessment

The "real yield" test:

python
def yield_sustainability(protocol):
    """
    Real yield = yield funded by actual economic activity (fees, revenue)
    Token yield = yield funded by token emissions (inflationary, unsustainable)
    """
    total_yield_usd = protocol.total_yield_distributed_per_year
    fee_revenue_usd = protocol.annual_fee_revenue
    token_emission_usd = protocol.annual_token_emissions_at_market_price

    real_yield_pct = fee_revenue_usd / total_yield_usd * 100
    token_yield_pct = token_emission_usd / total_yield_usd * 100

    if real_yield_pct > 80:
        sustainability = "highly_sustainable"   # Revenue-funded
    elif real_yield_pct > 50:
        sustainability = "partially_sustainable"
    elif real_yield_pct > 20:
        sustainability = "emission_dependent"    # Mostly token incentives
    else:
        sustainability = "ponzi_risk"            # Almost entirely token-funded

    return sustainability, real_yield_pct

Warning signs of unsustainable yield:

  1. APY > 100% with no clear revenue source → token emissions will dilute to zero
  2. Protocol TVL growing but token price declining → mercenary capital chasing yield
  3. Yield declining month-over-month while TVL is stable → emissions being cut
  4. Protocol governance voting to increase emissions → short-term pump, long-term dilution
  5. Multiple yield sources stacking (lending + LP + staking + points) → complexity hides risk
6. Risk-Adjusted Yield Comparison Framework
python
def risk_adjusted_yield(opportunities):
    """Compare DeFi opportunities on risk-adjusted basis."""
    scored = []
    for opp in opportunities:
        # Base yield
        base = opp.apy

        # Risk deductions
        smart_contract_risk = -2 if opp.audit_status == "unaudited" else -0.5
        il_risk = -opp.estimated_il if opp.type == "LP" else 0
        protocol_risk = -1 if opp.tvl < 50_000_000 else 0  # Small protocol risk
        chain_risk = -0.5 if opp.chain != "ethereum" else 0  # Non-ETH chain risk
        sustainability_risk = -(base * 0.3) if opp.real_yield_pct < 30 else 0

        # Adjusted yield
        adjusted = base + smart_contract_risk + il_risk + protocol_risk + chain_risk + sustainability_risk

        scored.append({
            "protocol": opp.name,
            "base_apy": base,
            "adjusted_apy": adjusted,
            "risk_level": opp.risk_level,
        })

    return sorted(scored, key=lambda x: x["adjusted_apy"], reverse=True)

Data Sources

SourceAccessData Available
DeFi Llama YieldsFreeAPY across 1000+ pools/protocols
Aave/Compound dashboardsFreeReal-time lending rates
Dune AnalyticsFreeCustom yield queries
DeBankFreePortfolio yield tracking
TokenTerminalFree/PaidProtocol revenue and earnings
EigenLayer dashboardFreeRestaking rates and AVS yields

Output Format

## DeFi Yield Analysis — [Date]

### Market Yield Overview
- **Stablecoin lending (Aave USDC)**: X.X% supply APY
- **ETH staking**: X.X% base + X.X% restaking premium
- **Top LP yields**: [pool1 X%, pool2 X%]
- **Yield trend**: [rising / stable / compressing]

### Top Opportunities (Risk-Adjusted)
| Rank | Protocol | Pool/Strategy | Base APY | Adjusted APY | Risk |
|------|----------|--------------|----------|-------------|------|
| 1 | [protocol] | [pool] | X.X% | X.X% | Low |
| 2 | [protocol] | [pool] | X.X% | X.X% | Medium |
| 3 | [protocol] | [pool] | X.X% | X.X% | Medium |

### Lending Market Signal
- **Stablecoin borrow rates**: X.X% → [high leverage demand / normal / low]
- **ETH borrow rates**: X.X% → [shorting demand / normal]
- **Utilization rates**: [high / normal / low]

### Sustainability Assessment
| Protocol | Real Yield % | Token Yield % | Verdict |
|----------|-------------|---------------|---------|
| [protocol] | XX% | XX% | Sustainable |
| [protocol] | XX% | XX% | Emission-dependent |

### Yield Strategy Recommendation
- **Conservative**: [stablecoin lending on Aave/Compound, X-X% APY]
- **Balanced**: [ETH staking + restaking, X-X% APY]
- **Aggressive**: [LP on DEX with hedged IL, X-X% net APY]

### Risk Warnings
1. [Smart contract risk: protocol X is unaudited]
2. [IL risk: volatile pair X/Y estimated IL X%]
3. [Sustainability risk: protocol Y >80% token-funded]

Notes

  • DeFi yields are highly variable and can change within hours; quoted APYs are point-in-time snapshots
  • "APY" in DeFi often assumes compounding that requires manual action (claiming + restaking); true returns may be lower
  • Smart contract risk is the dominant risk in DeFi; even audited protocols have been exploited (multi-sig, oracle manipulation)
  • Tax implications of DeFi yield vary by jurisdiction; yield farming income is taxable in most countries
  • This framework is for research purposes only and does not constitute investment advice

© HKUDS, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in agent/src/skills/defi-yield of HKUDS/Vibe-Trading.

Open the folder on GitHubat commit e532650

Compare with similar skills

DeFi Yield Analysis next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

DeFi Yield Analysis compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
DeFi Yield Analysis this skillHKUDS/Vibe-Trading35k—~2.6kAutomated safety check: PassMIT
Swapper Depositswapperfinance/swapper-toolkit852—~1.8kAutomated safety check: PassMIT
Minara Crypto Trading and WalletMinara-AI/minara-skills362—~5.7kAutomated safety check: PassNone
Emblemai Crypto Walletsickn33/agentic-awesome-skills47k2 repos~669Automated safety check: PassMIT
BankraAAaqwq/AGI-Super-Team1052 repos~7kAutomated safety check: NotesMIT
Okx Wallet PortfolioLeoYeAI/openclaw-master-skills2.2k—~4.2kAutomated safety check: NotesMIT

Similar skills

  • Swapper Deposit

    swapperfinance/swapper-toolkit

    Deposit and bridge funds into a wallet or protocol using Swapper Finance.

    852 GitHub stars~1.8k tokensUpdated 6 mo ago
    Business, Finance & HRAuto-check passed
  • Minara Crypto Trading and Wallet

    Minara-AI/minara-skills

    Drives the Minara CLI for crypto swaps, perps, limit orders, wallet transfers, deposits and withdrawals, plus AI market analysis.

    362 GitHub stars~5.7k tokensUpdated 22 days ago
    Business, Finance & HRAuto-check passed
  • Emblemai Crypto Wallet

    sickn33/agentic-awesome-skills

    Crypto wallet management across 7 blockchains via EmblemAI Agent Hustle API.

    47k GitHub starsUsed in 2 repos~669 tokens
    Business, Finance & HRAuto-check passed
  • Bankr

    aAAaqwq/AGI-Super-Team

    AI-powered crypto trading agent and LLM gateway via natural language.

    105 GitHub starsUsed in 2 repos~7k tokens
    Business, Finance & HRAuto-check: notes
  • Okx Wallet Portfolio

    LeoYeAI/openclaw-master-skills

    A skill your agent uses when the user provides a specific wallet address and wants to check its balance, token holdings, portfolio value, or DeFi positions.

    2.2k GitHub stars~4.2k tokensUpdated 2 mo ago
    Business, Finance & HRAuto-check: notes
  • Moralis Data API

    LeoYeAI/openclaw-master-skills

    Query Web3 blockchain data from Moralis API. An agent skill from LeoYeAI/openclaw-master-skills.

    2.2k GitHub stars~5.9k tokensUpdated 2 mo ago
    Business, Finance & HRAuto-check: notes

More from HKUDS/Vibe-Trading

All 89 skills in this repo
  • Eastmoney Market Data

    HKUDS/Vibe-Trading

    Index of Eastmoney's free, no-token market data interfaces for China A-shares and Hong Kong stocks: fund flows, dragon-tiger lists, margin trading, reports and news.

    35k GitHub stars~1k tokensUpdated yesterday
    Auto-check passed
  • OKX Market Data

    HKUDS/Vibe-Trading

    Retrieves public OKX cryptocurrency market data such as spot prices, candlesticks, funding rates and open interest through the OKX V5 REST API, with no authentication.

    35k GitHub stars~1.3k tokensUpdated yesterday
    Auto-check passed
  • SEC EDGAR Filings Fetcher

    HKUDS/Vibe-Trading

    Fetches U.S. SEC EDGAR data: resolves tickers to CIK numbers, lists recent 10-K, 10-Q and 8-K filings with document URLs, and pulls XBRL financial series.

    35k GitHub stars~1.4k tokensUpdated yesterday
    Auto-check passed
  • A-Share ST Risk Screener

    HKUDS/Vibe-Trading

    Predicts whether a mainland China A-share company risks an ST or *ST warning after its next annual report, using financial thresholds and Sina penalty records.

    35k GitHub stars~4.9k tokensUpdated yesterday
    Auto-check passed
  • Breaks a structural trend such as AI infrastructure into its physical supply chain and ranks lesser-known listed companies sitting on each bottleneck.

    35k GitHub stars~2.7k tokensUpdated yesterday
    Auto-check passed
  • Plans and drafts an eight-part, roughly 120k-word investigative series on one company, built around a strict fact-check pass rather than fast drafting.

    35k GitHub stars~2.4k tokensUpdated yesterday
    Auto-check passed

Works with

Questions about DeFi Yield Analysis

What does DeFi Yield Analysis do?

Compares DeFi yields across lending, liquidity provision, staking and yield farming, adjusts them for risks such as impermanent loss, and judges whether a protocol's returns are sustainable. The skill breaks DeFi returns into sources: lending supply, LP trading fees, staking, liquidity mining, restaking and points farming, each with a typical yield range and risk level. Lending and borrowing rates are read as a gauge of demand for borrowing, and the skill names major lending protocols such as Aave, Compound, MakerDAO, Morpho, Spark and Kamino with their chains and focus.

When should I use DeFi Yield Analysis?

DeFi Yield Analysis fits situations like: comparing lending, staking and LP yields on a risk-adjusted basis; estimating impermanent loss and the net yield of a liquidity pool; judging whether a protocol's advertised APY is sustainable; reading lending and borrow rates as a signal of borrowing demand across the market.

How do I install DeFi Yield Analysis in Claude Code?

Run `npx skills add HKUDS/Vibe-Trading --skill defi-yield -a claude-code`. Or copy the skill folder (agent/src/skills/defi-yield in HKUDS/Vibe-Trading) into .claude/skills/defi-yield in your project. Claude Code loads it when a task matches its description.

How do I install DeFi Yield Analysis in Codex?

Run `npx skills add HKUDS/Vibe-Trading --skill defi-yield -a codex`. Or copy the skill folder (agent/src/skills/defi-yield in HKUDS/Vibe-Trading) into .agents/skills/defi-yield in your project. Codex loads it when a task matches its description.

Can I use DeFi Yield Analysis in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add HKUDS/Vibe-Trading --skill defi-yield -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/defi-yield, .gemini/skills/defi-yield, .github/skills/defi-yield and .opencode/skills/defi-yield in your project.

What does DeFi Yield Analysis need to run?

SKILL.md names no scripts, command-line tools or credentials: DeFi Yield Analysis is instructions for the agent only.

Does DeFi Yield Analysis access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is DeFi Yield Analysis safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does DeFi Yield Analysis use?

DeFi Yield Analysis is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does DeFi Yield Analysis use?

About 2.6k tokens (SKILL.md is roughly 10k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to DeFi Yield Analysis?

Skills that share tags, products or a category with DeFi Yield Analysis: Swapper Deposit (swapperfinance/swapper-toolkit, 852 stars), Minara Crypto Trading and Wallet (Minara-AI/minara-skills, 362 stars), Emblemai Crypto Wallet (sickn33/agentic-awesome-skills, 47k stars) and Bankr (aAAaqwq/AGI-Super-Team, 105 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains DeFi Yield Analysis?

HKUDS (a GitHub organization) maintains it in HKUDS/Vibe-Trading, which has 35,043 GitHub stars. The repository holds 89 skills in this directory. The repository was last updated on October 8, 2026.

Source: HKUDS/Vibe-Trading on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.