Our review
This skill guides AI assistants in writing, testing, and deploying Solana programs (smart contracts) using native Rust and the Anchor framework.
Strengths
- Comprehensive coverage of the Solana program lifecycle from scaffolding to deployment.
- Emphasis on best practices (account validation, PDAs, error handling, compute unit optimization).
- Includes templates for both Anchor and native Rust, plus testing strategies with LiteSVM and bankrun.
- Supports advanced patterns like CPIs using declare_program!.
Limitations
- Does not replace deep understanding of Solana's account model.
- Reference files (anchor-programs.md, etc.) must be included in the knowledge base for full effectiveness.
- Does not cover SPL token design or interactions with specific third-party programs.
Best for building a new Solana program, implementing complex instructions, or debugging on-chain errors.
Avoid if you are working on an existing Solana project with an unconventional architecture that requires contextual knowledge beyond this guide.
Security analysis
SafeThe skill provides instructional guidance for writing Solana programs, using code examples and patterns. It does not instruct the AI to execute any commands that could cause harm, nor does it contain obfuscated or malicious content. All operations are purely code-authoring advice.
No concerns found
Examples
Write an Anchor program for a token staking system where users can stake SPL tokens and earn rewards. Include instructions to stake, unstake, and claim rewards. Use PDA for the staking account.I'm getting a 'Program failed to complete' error when calling my Solana program. Can you help me debug it? Here's the instruction code...Guide me through deploying my Anchor program to Solana devnet, including building the BPF and using the Solana CLI to deploy.Solana Program Development
Description
Guides AI assistants in writing, testing, and deploying Solana programs (smart contracts) using both native Rust and the Anchor framework.
When to Use
- Writing a new Solana program (on-chain code)
- Implementing program instructions, accounts, state
- Working with PDAs, CPIs, or system instructions
- Testing programs with LiteSVM, bankrun, or Mollusk
- Deploying or upgrading programs
- Debugging on-chain program errors
Instructions
For New Programs
- Ask if the user prefers Anchor (recommended) or native Rust
- Determine the program's purpose and required accounts
- Scaffold the project structure
- Implement instruction logic with proper validation
- Write tests
- Guide deployment
Key Principles
- Always validate all accounts — check ownership, signers, writable
- Use PDAs for program-derived state (avoid storing keypairs)
- Handle errors explicitly with custom error enums
- Minimize compute units — Solana has per-instruction limits (200k default, 1.4M max per tx)
- Consider rent exemption for all account creation
- Use
declare_program!(Anchor 0.30+) for CPI to avoid dependency hell
Reference Files
- anchor-programs.md — Anchor framework patterns
- native-programs.md — Native Rust program patterns
- testing.md — Testing strategies and frameworks
Common Patterns
Anchor Program Skeleton
use anchor_lang::prelude::*;
declare_id!("YOUR_PROGRAM_ID");
#[program]
pub mod my_program {
use super::*;
pub fn initialize(ctx: Context<Initialize>, data: u64) -> Result<()> {
ctx.accounts.my_account.data = data;
ctx.accounts.my_account.authority = ctx.accounts.authority.key();
Ok(())
}
}
#[derive(Accounts)]
pub struct Initialize<'info> {
#[account(
init,
payer = authority,
space = 8 + MyAccount::INIT_SPACE,
seeds = [b"my_account", authority.key().as_ref()],
bump,
)]
pub my_account: Account<'info, MyAccount>,
#[account(mut)]
pub authority: Signer<'info>,
pub system_program: Program<'info, System>,
}
#[account]
#[derive(InitSpace)]
pub struct MyAccount {
pub authority: Pubkey,
pub data: u64,
}
PDA Derivation
// On-chain
let (pda, bump) = Pubkey::find_program_address(
&[b"seed", user.key().as_ref()],
&program_id,
);
// In Anchor constraints
#[account(
seeds = [b"seed", authority.key().as_ref()],
bump,
)]
pub my_pda: Account<'info, MyData>,
CPI Pattern (Anchor 0.30+ with declare_program!)
// In idls/other_program.json (place the IDL there)
declare_program!(other_program);
// Use in your program:
use other_program::cpi;
cpi::some_instruction(ctx, args)?;
Next.js App Router Expert
Development
A skill that turns Claude into a Next.js App Router expert.
README Generator
Development
Creates professional and comprehensive README.md files for your projects.
API Documentation Writer
Development
Generates comprehensive API documentation in OpenAPI/Swagger format.