utsavsavani08/rain-skill-main/solana-anchor
Claude Code and agent skill by utsavsavani08/rain-skill-main
- community
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-anchorSKILL.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.tomlprojects - 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
Security pitfalls (Solana-specific — check every one)
| Pitfall | Fix | |
|---|---|---|
| Missing signer check | Require Signer<'info> on accounts that must authorize | |
| Missing owner check | Use typed Account<'info, T> (Anchor checks program ownership) — don't use raw AccountInfo without manual checks | |
| Account substitution / confused deputy | Constrain accounts with seeds/has_one/constraint; verify relationships | |
| PDA bump not canonical | Use Anchor's bump (canonical) — don't accept a user-supplied bump | |
| Arithmetic overflow | checked_add/checked_sub (Rust release builds wrap silently otherwise) | |
| Unvalidated CPI target | Verify the program id you CPI into (e.g., the real SPL Token program) | |
| Account reinit / type confusion | Use 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
Write tests for: each instruction's success path, every require!/error, and unauthorized-signer / wrong-account attempts.
Anti-patterns
- ❌ Raw
AccountInfowithout 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
- SKILL.md in the repositoryChecking.rain-skill/skills/solana-anchor/SKILL.md
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
[](https://verified-skill.com/skills/utsavsavani08/rain-skill-main/solana-anchor)