Guides

Agent Skill

How to install and use the P0 agent skill to interact with Project 0 via AI coding tools.

P0 publishes an open-source Agent Skill that teaches AI coding agents how to deposit, borrow, and manage positions on Project 0. The skill works with any compatible agent -- Claude Code, OpenCode, Cursor, Windsurf, and others.

Installation

Install the skill so your agent can discover it. Choose the method that matches your tool.

npx (any compatible agent)

npx skills add 0dotxyz/skill

This downloads the skill into your project's .claude/skills/ directory (or equivalent for your agent). The skill auto-activates when the agent detects a relevant task.

Claude Code

ScopePath
All projects~/.claude/skills/project0/SKILL.md
Single project.claude/skills/project0/SKILL.md (relative to project root)
mkdir -p ~/.claude/skills/project0
curl -o ~/.claude/skills/project0/SKILL.md \
  https://raw.githubusercontent.com/0dotxyz/skill/main/SKILL.md

OpenCode

ScopePath
All projects~/.config/opencode/skills/project0/SKILL.md
Single project.opencode/skills/project0/SKILL.md (relative to project root)
mkdir -p ~/.config/opencode/skills/project0
curl -o ~/.config/opencode/skills/project0/SKILL.md \
  https://raw.githubusercontent.com/0dotxyz/skill/main/SKILL.md

Environment Setup

No configuration is needed for read-only queries (bank rates, strategies, wallet balances). For on-chain operations, add these to a .env file in your project.

Solana RPC URL

Required for all on-chain operations.

RPC_URL=https://mainnet.helius-rpc.com/?api-key=YOUR_KEY

Also recognized: SOLANA_RPC_URL, HELIUS_RPC_URL. Helius offers a free tier.

Wallet Address (optional)

Your wallet's public key. Allows the agent to check balances and discover accounts without loading the keypair.

WALLET_ADDRESS=5Utci...your_public_key

If not set, the agent derives it from the keypair when needed.

Wallet Keypair

Required for signing transactions. Path to your keypair JSON file.

WALLET_KEYPAIR=~/.config/solana/id.json

If not set, the agent will ask you for the path. You can also provide it directly in your prompt (e.g., "you have access to a wallet at ./dev.json").

To generate a new keypair:

solana-keygen new --outfile ~/.config/solana/id.json

This keypair controls your funds. Never commit it to version control or share it publicly.

P0 Account Address (optional)

If your wallet has multiple P0 accounts, set this to skip the account selection prompt. Each account has isolated positions and risk.

P0_ACCOUNT=3p16...your_account_address

If not set and you have multiple accounts, the agent will list them and ask which to use. Single accounts are used automatically.

Jupiter API Key (optional)

Only needed if a strategy requires swapping tokens (e.g., SOL to bbSOL before depositing).

JUPITER_API_KEY=YOUR_KEY

Also recognized: JUP_API_KEY. Get a free key at portal.jup.ag (60 requests per minute).

How to Use

The skill activates automatically when you ask your agent to interact with Project 0. Try prompts like:

  • "What are the best deposit yields on Project 0?"
  • "What are the highest-yield strategies on Project 0?"
  • "Deposit my SOL on Project 0 for the best yield."
  • "Borrow USDC against my Project 0 collateral."
  • "Check my Project 0 portfolio health."
  • "What is the cheapest stablecoin to borrow on Project 0?"

The agent follows a structured workflow:

  1. Checks your wallet -- fetches token balances via the P0 API.
  2. Fetches P0 data -- pulls current deposit/borrow rates and strategies.
  3. Recommends an action -- matches your holdings to the best opportunities with specific numbers.
  4. Waits for approval -- you review and confirm before anything is executed.
  5. Executes and reports -- sends transactions and provides Solscan links for verification.

What the Skill Covers

CategoryOperations
Wallet balancesFetch token holdings and USD values for any wallet
Bank ratesDeposit APYs and borrow APYs across P0, Kamino, and Drift venues
StrategiesPrecomputed rate arbitrage and looping strategies with projected APYs
DepositsDeposit into P0 native, Kamino, and Drift venues
BorrowingBorrow stablecoins against cross-venue collateral
WithdrawalsPartial or full withdrawal from any position
RepaymentRepay specific amounts or all debt
SwapsToken swaps via Jupiter (when needed for a strategy)
Health monitoringHealth factor, free collateral, net APY, liquidation risk

For the full TypeScript SDK reference, see TypeScript SDK.

On this page