Solana Program Development

VerifiedSafe

Guides AI assistants in writing, testing, and deploying Solana programs using native Rust or the Anchor framework. It helps with account validation, PDAs, CPIs, and testing with tools like LiteSVM, bankrun, or Mollusk.

Sby Skills Guide Bot
DevelopmentIntermediate
6/2/2026
Claude CodeCursorWindsurfCopilotCodex
#solana#anchor#rust#blockchain#smart-contracts

Recommended for

Automated summary

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.
When to use it

Best for building a new Solana program, implementing complex instructions, or debugging on-chain errors.

When not to use it

Avoid if you are working on an existing Solana project with an unconventional architecture that requires contextual knowledge beyond this guide.

Security analysis

Safe
Quality score80/100

The 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

How this analysis is made

Examples

Basic Anchor program for token staking
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.
Debugging on-chain error
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...
Deploying to devnet
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

  1. Ask if the user prefers Anchor (recommended) or native Rust
  2. Determine the program's purpose and required accounts
  3. Scaffold the project structure
  4. Implement instruction logic with proper validation
  5. Write tests
  6. 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

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)?;

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/solana-program-development-mmbizkf0/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/solana-program-development-mmbizkf0' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/solana-program-development-mmbizkf0/download' --output '.skill-downloads/solana-program-development-mmbizkf0/SKILL.md.part' && mv '.skill-downloads/solana-program-development-mmbizkf0/SKILL.md.part' '.skill-downloads/solana-program-development-mmbizkf0/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

This file does not provide a usable name/description header for this native procedure. It remains available to download and inspect; use the manual method below.

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/solana-program-development-mmbizkf0/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills