Skip to content

Agent Skill

@earnforge/skill follows the Agent Skill standard. It bundles a SKILL.md file plus 5 reference files that any coding agent (Claude Code, Cursor, Windsurf, Aider, etc.) can read to understand the LI.FI Earn API and use EarnForge correctly.

Terminal window
npm i @earnforge/skill

The installed package contains:

@earnforge/skill/
SKILL.md
references/
pitfalls.md
protocols.md
chains.md
examples.md
strategies.md

SKILL.md is a structured file that agents read to learn what tools are available and how to use them. It contains:

  1. Frontmatter — Machine-readable name and description
  2. Commands — Every CLI command with full usage and flags
  3. Rules — Critical integration rules the agent must follow
  4. References — Links to detailed reference files
---
name: earnforge
description: >
Discovers, compares, risk-scores, and builds unsigned deposit quotes for
623+ DeFi yield vaults across 16 chains via the LI.FI Earn API.
Handles all 18 known API pitfalls by default.
---

The skill defines these command groups:

CommandDescription
earnforge list [--asset] [--chain] [--min-tvl] [--strategy] [--json]List vaults with filters
earnforge top [--asset] [--chain] [--limit] [--strategy] [--json]Top vaults by APY
earnforge get <slug> [--json]Single vault by slug
CommandDescription
earnforge compare <slug1> <slug2> [--json]Side-by-side vault comparison
earnforge risk <slug> [--json]Full risk score breakdown
earnforge history <address> <chain-id> [--json]30-day APY history
CommandDescription
earnforge suggest <amount> <asset> [--max-vaults] [--max-chains] [--strategy] [--json]Portfolio allocation
earnforge portfolio <wallet> [--json]Current wallet positions
CommandDescription
earnforge quote <slug> <amount> <wallet> [--from-chain] [--slippage] [--json]Build deposit quote
earnforge withdraw <slug> <amount> <wallet> [--json]Build withdraw quote
earnforge gas-optimize <slug> <amount> <wallet> [--from-chains] [--json]Compare cross-chain deposit costs
CommandDescription
earnforge doctor <slug> [--wallet] [--json]Run pitfall checks
earnforge watch <slug> [--apy-drop] [--tvl-drop] [--json]Monitor APY/TVL changes
CommandDescription
earnforge chains [--json]List 16 supported chains
earnforge protocols [--json]List 11 protocols
earnforge strategies [--json]List 4 strategy presets

The SKILL.md defines 9 rules that agents must follow:

  1. Never submit transactions. Only build unsigned quotes. The user signs and broadcasts.

  2. Always check isTransactional before quoting. Non-transactional vaults cannot accept deposits.

  3. Use vault.address as toToken, not the underlying token address. This is Pitfall #5.

  4. Filter stablecoins by the stablecoin tag, not by token symbol.

  5. Risk score thresholds: >= 7 is low risk, 4-6.9 is medium, < 4 is high risk.

  6. TVL is a string in USD. Parse with parseTvl() before comparing.

  7. APY fields (apy1d, apy7d, apy30d) can be null. Use the fallback chain.

  8. apy.reward is null for some protocols. Normalize to 0 before summing.

  9. Use chainId (number), not chain name (string), in all API calls.


All 18 API pitfalls with descriptions and fixes. Agents reference this when debugging integration issues or understanding why certain guards exist.

The 11 protocols with risk tiers. Used by agents to understand protocol maturity when making recommendations.

All 16 chains with chainId mappings. Agents use this to convert between chain names and numeric IDs.

8 worked examples showing common workflows:

  • Find top USDC yield on Base
  • Compare two vaults
  • Build a deposit quote
  • Get a diversified allocation
  • Run doctor checks
  • Monitor a vault
  • Cross-chain gas optimization
  • Portfolio lookup

The 4 yield strategy presets with their filter configs, sort behavior, and recommended use cases.


Place the skill package in your project’s dependencies. Claude Code will automatically discover the SKILL.md and reference files.

Point your agent to the SKILL.md file:

@earnforge/skill/SKILL.md

The agent will read the file and understand all available commands, rules, and references.

Read SKILL.md as part of your system prompt or tool documentation:

import { readFileSync } from 'fs';
import { resolve } from 'path';
const skillPath = resolve('node_modules/@earnforge/skill/SKILL.md');
const skill = readFileSync(skillPath, 'utf-8');
// Include `skill` in your agent's context