defi-lending

Check DeFi lending and borrowing rates, supply/borrow APY, positions, health factors, and protocol comparisons. Use when asked about lending rates, borrowing costs, Aave rates, Compound APY, Morpho markets, lending protocol comparison, health factor, or liquidation risk.

23 stars

Best use case

defi-lending is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

Check DeFi lending and borrowing rates, supply/borrow APY, positions, health factors, and protocol comparisons. Use when asked about lending rates, borrowing costs, Aave rates, Compound APY, Morpho markets, lending protocol comparison, health factor, or liquidation risk.

Teams using defi-lending should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/defi-lending/SKILL.md --create-dirs "https://raw.githubusercontent.com/jiayaoqijia/cryptoskill/main/skills/defi/defi-lending/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/defi-lending/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How defi-lending Compares

Feature / Agentdefi-lendingStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

Check DeFi lending and borrowing rates, supply/borrow APY, positions, health factors, and protocol comparisons. Use when asked about lending rates, borrowing costs, Aave rates, Compound APY, Morpho markets, lending protocol comparison, health factor, or liquidation risk.

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# DeFi Lending

Query lending/borrowing rates, positions, and protocol data across major DeFi lending platforms.

## APIs

### DefiLlama Yields (Free, no auth) — Best starting point

Base: `https://yields.llama.fi`

**All lending pools with APY**:
```
web_fetch url="https://yields.llama.fi/pools"
```

> Returns ~10k+ pools. Filter client-side by `project` and `chain`.
> Key fields: `apy` (supply APY), `apyBorrow` (borrow APY), `tvlUsd`, `pool` (unique ID)

**Single pool detail + history**:
```
web_fetch url="https://yields.llama.fi/chart/POOL_ID"
```

**Filter tips**: Search response for `"project":"aave-v3"`, `"project":"compound-v3"`, `"project":"morpho"`, `"project":"spark"`.

### Aave V3 Subgraph (Free, no auth)

**Get all reserves with rates**:
```
exec command="curl -s -X POST 'https://api.thegraph.com/subgraphs/name/aave/protocol-v3' -H 'Content-Type: application/json' -d '{\"query\":\"{reserves(first:100){name symbol underlyingAsset liquidityRate variableBorrowRate stableBorrowRate availableLiquidity totalCurrentVariableDebt totalDeposits reserveFactor baseLTVasCollateral reserveLiquidationThreshold}}\"}"
```

> Rates are in RAY (27 decimals). Convert: `rate / 1e27 * 100` = APY%

**User positions on Aave**:
```
exec command="curl -s -X POST 'https://api.thegraph.com/subgraphs/name/aave/protocol-v3' -H 'Content-Type: application/json' -d '{\"query\":\"{userReserves(where:{user:\\\"0xUSER_ADDRESS_LOWERCASE\\\"}){reserve{symbol}currentATokenBalance currentVariableDebt currentStableDebt}}\"}"
```

**Multi-chain Aave subgraph endpoints**:
| Chain | Subgraph |
|-------|----------|
| Ethereum | `aave/protocol-v3` |
| Arbitrum | `aave/protocol-v3-arbitrum` |
| Optimism | `aave/protocol-v3-optimism` |
| Polygon | `aave/protocol-v3-polygon` |
| Base | `aave/protocol-v3-base` |
| Avalanche | `aave/protocol-v3-avalanche` |

See `references/aave-v3.md` for contract addresses per chain.

### Aave V3 On-Chain via RPC

**Get user account data** (health factor, total collateral/debt):
```
exec command="curl -s -X POST https://eth.llamarpc.com -H 'Content-Type: application/json' -d '{\"jsonrpc\":\"2.0\",\"method\":\"eth_call\",\"params\":[{\"to\":\"0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2\",\"data\":\"0xbf92857c000000000000000000000000USER_ADDRESS_NO_0x\"},\"latest\"],\"id\":1}'"
```

> Returns: totalCollateralBase, totalDebtBase, availableBorrowsBase, currentLiquidationThreshold, ltv, healthFactor
> All values in base currency (USD with 8 decimals). Health factor has 18 decimals.
> Health factor < 1.0 = liquidatable. Warn user if < 1.5.

### Morpho (GraphQL API)

**Get Morpho Blue markets**:
```
exec command="curl -s -X POST 'https://blue-api.morpho.org/graphql' -H 'Content-Type: application/json' -d '{\"query\":\"{markets(first:20 orderBy:TotalSupplyUsd orderDirection:Desc){items{uniqueKey loanAsset{symbol address} collateralAsset{symbol address} lltv state{supplyApy borrowApy totalSupplyUsd totalBorrowUsd utilization}}}}\"}"
```

**Morpho Vaults (curated lending)**:
```
exec command="curl -s -X POST 'https://blue-api.morpho.org/graphql' -H 'Content-Type: application/json' -d '{\"query\":\"{vaults(first:20 orderBy:TotalAssetsUsd orderDirection:Desc){items{name symbol address chain{id} state{totalAssetsUsd apy netApy fee} asset{symbol}}}}\"}"
```

### Compound V3 (Comet)

**Get base asset rates via RPC** (getSupplyRate, getBorrowRate):
```
exec command="curl -s -X POST https://eth.llamarpc.com -H 'Content-Type: application/json' -d '{\"jsonrpc\":\"2.0\",\"method\":\"eth_call\",\"params\":[{\"to\":\"0xc3d688B66703497DAA19211EEdff47f25384cdc3\",\"data\":\"0xd955b861\"},\"latest\"],\"id\":1}'"
```

> Compound V3 Comet (USDC market) on Ethereum: `0xc3d688B66703497DAA19211EEdff47f25384cdc3`
> `0xd955b861` = `getSupplyRate(0)`, `0xa5b4ff79` = `getBorrowRate(0)`
> Rate is per-second. APY = `(1 + rate/1e18)^(365*24*3600) - 1`

## Usage Tips

- Start with DefiLlama yields for a quick comparison across all protocols
- Use Aave subgraph for detailed position data and historical rates
- Health factor = total collateral * liquidation threshold / total debt
- When comparing rates, note: supply APY includes incentive rewards on DefiLlama (`apyReward`)
- Morpho typically offers better rates than Aave/Compound by matching lenders to borrowers
- For large positions, check utilization rate — high utilization can affect withdrawal liquidity

Related Skills

bitfinex-lending-monitor

23
from jiayaoqijia/cryptoskill

Monitor Bitfinex lending (funding) performance via API. Use when the user asks to check Bitfinex funding收益/借贷利息, automate daily收益统计, or avoid opening the Bitfinex app for lending status.

speraxos-defi-agent

23
from jiayaoqijia/cryptoskill

Autonomous DeFi trading agent with real-time market analysis deployed on SperaxOS.

sperax-defi-agent

23
from jiayaoqijia/cryptoskill

Autonomous DeFi trading agent with real-time market analysis by the Sperax Team.

spark-lending-agent

23
from jiayaoqijia/cryptoskill

Query Spark Protocol markets and DAI borrowing positions on Ethereum.

silverback-defi

23
from jiayaoqijia/cryptoskill

Autonomous DeFi infrastructure providing swap routing, liquidity analysis, yield optimization, and market data for AI agents.

silverback-defi-infrastructure

23
from jiayaoqijia/cryptoskill

Autonomous DeFi infrastructure for the agent economy providing swap routing, liquidity analysis, yield optimization, and market data intelligence services.

silverback-defi-infra

23
from jiayaoqijia/cryptoskill

Autonomous DeFi infrastructure for the agent economy providing swap routing, liquidity analysis, yield optimization, and market data services.

shll-defi-agent

23
from jiayaoqijia/cryptoskill

AI-powered autonomous DeFi agent with on-chain safety enforcement via PolicyGuard for swaps, lending, and portfolio management.

quantabot-defi

23
from jiayaoqijia/cryptoskill

Monitors discrete quantum jumps in Base DeFi protocol metrics, identifying non-linear step-change increases in TVL and volume.

quanta-bot-defi-metrics

23
from jiayaoqijia/cryptoskill

Monitors discrete quantum jumps in Base DeFi protocol metrics, identifying non-linear step-change increases in TVL, volume, or user counts.

nethermind-official-defi-skills

23
from jiayaoqijia/cryptoskill

Build unsigned DeFi transactions from natural language. Use when the user wants to send, transfer, swap, stake, unstake, wrap, unwrap, supply, withdraw, borrow, repay, deposit, delegate, add liquidity, remove liquidity, or trade yield tokens on-chain. Covers ETH, ERC-20, ERC-721, Aave, Lido, Uniswap, Curve, Compound, MakerDAO, Rocket Pool, EigenLayer, Balancer, Pendle, and WETH.

morpho-lending-agent

23
from jiayaoqijia/cryptoskill

Query Morpho Blue markets, supply/borrow rates, and optimized lending positions.