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/skillThis 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
| Scope | Path |
|---|---|
| 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.mdOpenCode
| Scope | Path |
|---|---|
| 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.mdEnvironment 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_KEYAlso 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_keyIf 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.jsonIf 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.jsonThis 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_addressIf 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_KEYAlso 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:
- Checks your wallet -- fetches token balances via the P0 API.
- Fetches P0 data -- pulls current deposit/borrow rates and strategies.
- Recommends an action -- matches your holdings to the best opportunities with specific numbers.
- Waits for approval -- you review and confirm before anything is executed.
- Executes and reports -- sends transactions and provides Solscan links for verification.
What the Skill Covers
| Category | Operations |
|---|---|
| Wallet balances | Fetch token holdings and USD values for any wallet |
| Bank rates | Deposit APYs and borrow APYs across P0, Kamino, and Drift venues |
| Strategies | Precomputed rate arbitrage and looping strategies with projected APYs |
| Deposits | Deposit into P0 native, Kamino, and Drift venues |
| Borrowing | Borrow stablecoins against cross-venue collateral |
| Withdrawals | Partial or full withdrawal from any position |
| Repayment | Repay specific amounts or all debt |
| Swaps | Token swaps via Jupiter (when needed for a strategy) |
| Health monitoring | Health factor, free collateral, net APY, liquidation risk |
For the full TypeScript SDK reference, see TypeScript SDK.