Skip to content

Latest commit

 

History

History
98 lines (72 loc) · 3.89 KB

File metadata and controls

98 lines (72 loc) · 3.89 KB

Project Overview

DeFi skills for AI agents — supply, borrow, stake, and manage positions across protocols using the Agentic Wallet.

Each skill provides CLI scripts, ABI encoding patterns, permission templates, and workflow guidance that agents follow step-by-step.

Tech Stack

  • Language: TypeScript (ESM — imports use .js extensions)
  • Runtime: Node.js (TypeScript compiled to JS via tsc)
  • Package manager: npm
  • Key dependency: viem for EVM interaction (encoding, contract reads, clients)
  • Supported networks: Ethereum, Arbitrum, Optimism, Base, Polygon

Project Structure

.claude-plugin/       # Claude Code plugin metadata
  plugin.json         # Plugin manifest
  marketplace.json    # Marketplace registration
commands/             # Slash commands
  aave.md             # /aave command definition
hooks/                # Plugin hooks
  hooks.json          # Hook configuration
  check-mcp           # SessionStart hook — checks MCP server config
skills/<protocol>/
  SKILL.md            # Agent-readable skill documentation (read before any task)
  <cli>.ts            # CLI entry point
  shared/             # Reusable utilities (ABIs, addresses, clients)
  scripts/            # One file per operation

Commands

As a plugin (paths are resolved automatically via ${CLAUDE_PLUGIN_DATA}):

node ${CLAUDE_PLUGIN_DATA}/dist/skills/aave-agentic-wallet/aave.js <subcommand> [options]  # Run Aave CLI
node ${CLAUDE_PLUGIN_DATA}/dist/skills/spark-agentic-wallet/spark.js <subcommand> [options]  # Run SparkLend CLI

As a standalone skill (run from the repository root):

npm install                     # Install dependencies
npm run build                   # Compile TypeScript to dist/
node dist/skills/aave-agentic-wallet/aave.js <subcommand> [options]  # Run Aave CLI
node dist/skills/spark-agentic-wallet/spark.js <subcommand> [options]  # Run SparkLend CLI

There are no test or lint scripts configured.

Code Conventions

  • Filenames and CLI args: kebab-case (grant-permissions, check-position)
  • Constants: UPPER_CASE (POOL, RAY, CHAIN_IDS)
  • Functions/variables: camelCase
  • Address types: 0x${string}
  • ABIs: defined with as const
  • Calldata encoding: always via viem's encodeFunctionData()
  • Contract reads: always via viem's readContract()
  • Error handling: Promise.allSettled for parallel operations

DeFi Domain Rules

  • Interest rate mode is always 2 (variable) — mode 1 (stable) is deprecated
  • ERC-20 operations require prior approve to the Pool contract
  • Use execute_batch_tx for atomic approve+action pairs
  • Health factor units: 1e18 (1.0 is the liquidation threshold)
  • APY rates from Aave are in Ray units (1e27); convert: rate / 1e27 * 100

MCP Servers

This project expects two MCP servers configured (see .mcp.example.json):

  1. agentic-wallet (stdio) — Transaction signing and submission via Agentic Wallet
  2. lifi (HTTP) — Bridge aggregation at https://mcp.li.quest/mcp

Skills

The following project-specific skills are available. Read the relevant SKILL.md before starting any task involving that protocol:

  • Aave V3skills/aave-agentic-wallet/SKILL.md
  • SparkLendskills/spark-agentic-wallet/SKILL.md
  • Merklskills/merkl-agentic-wallet/SKILL.md

Adding a New Skill

  1. Create skills/<protocol>/ with a SKILL.md and CLI entry point
  2. Include: protocol overview, CLI scripts, contract addresses per network, ABI encoding examples, permission templates, common mistakes
  3. Register the skill in this file under the Skills section

References