utsavsavani08/rain-skill-main/solana-anchor

Claude Code and agent skill by utsavsavani08/rain-skill-main

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Solana program development with the Anchor framework (Rust). Use when building Solana programs, working with Anchor.toml, accounts, PDAs, CPIs, or SPL tokens, or on requests mentioning Solana, Anchor, SPL, or program. Covers the account model, PDAs, security pitfalls, and Anchor tests. Cross-links rust-pro.

Install

npx vskill@latest install utsavsavani08/rain-skill-main/solana-anchor

SKILL.md

The same SKILL.md was published earlier as utsavsavani08/rain-skill-main/solana-anchor.

You build Solana programs with Anchor. Solana's model is fundamentally different from EVM: programs are stateless and operate on accounts passed into each instruction — most Solana bugs are missing account validation.

Use this skill when

  • Building/editing Solana programs (Rust, Anchor) or Anchor.toml projects
  • Working with PDAs, CPIs, SPL tokens
  • Reviewing a Solana program for the common account-validation pitfalls

Load rust-pro alongside this for idiomatic Rust.

Mental model

  • Programs are stateless. State lives in accounts the caller passes in. The program must validate every account it's given.
  • PDAs (Program Derived Addresses): deterministic addresses owned by the program, derived from seeds + bump. Used for program-controlled state and signing (invoke_signed).
  • CPI (Cross-Program Invocation): calling another program (e.g., the SPL Token program) from yours.
  • Rent: accounts must be rent-exempt (hold enough lamports) or they're purged.

Anchor program skeleton

rust
use anchor_lang::prelude::*;
declare_id!("Fg6PaFpoGXkYsidMpWxqSWY...");
#[program]
pub mod vault {
use super::*;
pub fn deposit(ctx: Context<Deposit>, amount: u64) -> Result<()> {
require!(amount > 0, VaultError::ZeroAmount);
let vault = &mut ctx.accounts.vault;
vault.total = vault.total.checked_add(amount).ok_or(VaultError::Overflow)?;
Ok(())
}
}
#[derive(Accounts)]
pub struct Deposit<'info> {
#[account(mut, seeds = [b"vault", authority.key().as_ref()], bump)]
pub vault: Account<'info, Vault>,
#[account(mut)]
pub authority: Signer<'info>,
pub system_program: Program<'info, System>,
}
#[account]
pub struct Vault { pub authority: Pubkey, pub total: u64 }
#[error_code]
pub enum VaultError { #[msg("amount is zero")] ZeroAmount, #[msg("overflow")] Overflow }

Security pitfalls (Solana-specific — check every one)

PitfallFix
Missing signer checkRequire Signer<'info> on accounts that must authorize
Missing owner checkUse typed Account<'info, T> (Anchor checks program ownership) — don't use raw AccountInfo without manual checks
Account substitution / confused deputyConstrain accounts with seeds/has_one/constraint; verify relationships
PDA bump not canonicalUse Anchor's bump (canonical) — don't accept a user-supplied bump
Arithmetic overflowchecked_add/checked_sub (Rust release builds wrap silently otherwise)
Unvalidated CPI targetVerify the program id you CPI into (e.g., the real SPL Token program)
Account reinit / type confusionUse init/init_if_needed carefully; validate discriminator

SPL tokens

Use anchor_spl::token (or token-2022) for mint/transfer via CPI; never reimplement token logic. Validate the mint and token account owner.

Testing

bash
anchor build
anchor test # spins a local validator, runs TS tests

Write tests for: each instruction's success path, every require!/error, and unauthorized-signer / wrong-account attempts.

Anti-patterns

  • ❌ Raw AccountInfo without owner/signer validation
  • ❌ Trusting any account address passed in without constraints
  • ❌ Plain +/- on balances (use checked math)
  • ❌ Accepting a user-supplied PDA bump
  • ❌ CPI into an unvalidated program id

Security

  • Security scanPassed, 90 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/utsavsavani08/rain-skill-main/solana-anchor/badge)](https://verified-skill.com/skills/utsavsavani08/rain-skill-main/solana-anchor)

Something wrong with this skill or its page? Tell us.