Defi Yield logo

Defi Yield

OrganizationPopular
HKUDS
defi-yield

DeFi yield analysis and optimization — lending rates, LP yields, staking returns, yield farming strategies, risk-adjusted yield comparison, and protocol-level sustainability assessment.

Overview

PublisherHKUDS
RepositoryVibe-Trading
Skill namedefi-yield
Stars
33.6K
Forks
5.5K
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by HKUDS on GitHub. Read the source before you install it.

Installation

Install the Defi Yield AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/HKUDS/Vibe-Trading.git /tmp/Vibe-Trading
mkdir -p .claude/skills
cp -r /tmp/Vibe-Trading/agent/src/skills/defi-yield .claude/skills/defi-yield
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Defi Yield in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Defi Yield on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Defi Yield is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

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

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

Frequently asked questions

What does the Defi Yield AI skill do?

DeFi yield analysis and optimization — lending rates, LP yields, staking returns, yield farming strategies, risk-adjusted yield comparison, and protocol-level sustainability assessment.

Why use Defi Yield on TypingMind?

Because you install it once and use it with any model. Defi Yield is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Defi Yield in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/HKUDS/Vibe-Trading/tree/main/agent/src/skills/defi-yield. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Defi Yield?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Defi Yield?

As many as you like. As long as a model supports skills, you can use Defi Yield with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Defi Yield AI skill free?

Yes. It is published on GitHub by HKUDS under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇