Agent Skill
How to install and use the P0 agent skill to interact with Project 0 via AI coding tools.
Prefer a hosted integration? The MCP server gives any agent the same tools over MCP or REST, with no keypair on the agent side.
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/p0-agentsThis 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/p0-agents/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/p0-agents/main/SKILL.mdEnvironment Setup
No configuration is needed for read-only queries (bank rates, strategies, wallet balances, account health): the skill reads from https://ai.0.xyz (MCP or REST). For on-chain actions the agent signs locally, so it needs:
Solana RPC URL
RPC_URL=https://mainnet.helius-rpc.com/?api-key=YOUR_KEYHelius offers a free tier.
Wallet Keypair
Path to the keypair JSON that signs transactions.
WALLET_KEYPAIR=~/.config/solana/id.jsonTo 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. The ai.0.xyz service never receives it: every transaction is built unsigned and signed on your machine.
Wallet Address and P0 Account (optional)
WALLET_ADDRESS=5Utci...your_public_key
P0_ACCOUNT=3p16...your_account_addressWALLET_ADDRESS lets the agent plan without loading the keypair; P0_ACCOUNT skips the account prompt when the wallet owns several accounts (the service otherwise returns the list to choose from).
Aggregator keys (optional)
Loops and strategy unwinds route swaps through Jupiter and Titan with the service's own keys. To use your own, the agent sends them as x-jupiter-api-key / x-titan-api-key HTTP headers on the MCP connection or REST request; see MCP Server.
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 from ai.0.xyz.
- Fetches P0 data -- pulls current deposit/borrow rates, strategies, and your positions.
- Recommends an action -- matches your holdings to the best opportunities with specific numbers and the expected health after the action.
- Waits for approval -- you review and confirm before anything is executed.
- Builds, signs, and reports -- the service returns unsigned transactions (already simulated), the agent signs them with your keypair, sends them, 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 Jupiter Lend venues |
| Strategies | Precomputed rate arbitrage and looping strategies with projected APYs |
| Deposits | Deposit into P0 native, Kamino, and Jupiter Lend venues |
| Borrowing | Borrow stablecoins against cross-venue collateral |
| Withdrawals | Partial or full withdrawal from any position |
| Repayment | Repay specific amounts or all debt |
| Strategies | Open a leveraged loop in one flash-loan transaction, and unwind it |
| Health monitoring | Health factor, free collateral, net APY, liquidation risk |
The skill talks to the MCP Server; connect it directly if your agent supports MCP. For the full TypeScript SDK reference, see TypeScript SDK.