The first Claude skill for writing production-grade, security-first Solana programs.
$ npx -y skills add Frankcastleauditor/safe-solana-builder --agent claude-code
The first Claude skill for writing production-grade, security-first Solana programs.
Built by a Solana security researcher, for Solana developers โ so your code arrives at audit already hardened.
Safe Solana Builder is a security skill system you can load into AI coding workflows (Claude / Cursor) so Frank Castle's Solana security knowledge is applied before writing a single line of code.
This is not a prompt. It is a layered reference architecture that forces Claude to:
lib.rsEvery program this skill produces has a first layer of protection baked in before it reaches an auditor.
Most AI-generated Solana code is a liability.
Missing ownership checks. Non-canonical bumps. Stale data used after CPIs. No duplicate account guards. No checked arithmetic. It compiles, it looks right, and it fails on mainnet.
The Cyfrin team built a skill like this for Solidity. Nobody built one for Solana โ until now.
For every program request, the skill outputs:
| Output | Description |
|---|---|
| Full project scaffold | Anchor.toml, Cargo.toml, proper folder structure โ ready to anchor build or cargo build-sbf |
lib.rs | Complete, compilable program with inline security comments |
| Test file | LiteSVM or framework-default โ happy path tests implemented + security edge case tests scaffolded with TODO bodies |
security-checklist.md | Every rule applied, every assumption made, every known limitation flagged |
safe-solana-builder/
โโโ SKILL.md โ Orchestrator: workflow, risk assessment, output format
โโโ references/
โ โโโ shared-base.md โ Framework-agnostic rules (PDAs, CPIs, arithmetic, Token-2022...)
โ โโโ anchor.md โ Anchor-specific: constraints, account types, reload(), close...
โ โโโ native-rust.md โ Native Rust: manual validation sequence, invoke, deserialization...
โ โโโ pinocchio.md โ Pinocchio: zero-copy patterns, bytemuck, wincode, CPI, Shank IDL...
โ โโโ litesvm.md โ LiteSVM: test setup, sysvar control, CU profiling, account injection...
โโโ examples/
โโโ nft-whitelist-mint/
โโโ lib.rs โ Full Anchor NFT whitelist mint program
โโโ security-checklist.md โ 31-rule checklist for the example
The reference files cover:
Shared Base (framework-agnostic)
Anchor-specific
Account<T> vs UncheckedAccount vs Interface)has_one, seeds+bump, init vs init_if_needed, close, realloc)reload() after CPI โ non-negotiabletoken_interface::transfer_checked for Token-2022 compatibility#[error_code] custom errorsNative Rust-specific
find_program_address at init, create_program_address on reuseinvoke vs invoke_signed patternsProgramError conversionPinocchio-specific (new)
bytemuck (Pod + Zeroable, explicit _padding, 8-byte alignment)TryFrom pattern and validation macroswincode for instruction data serialization โ SchemaWrite/SchemaRead derives, zero-copy deserialization for #[repr(C)] structs, Pod<T> foreign type adapter, compact-u16 / ShortVec length encodingbytemuck vs wincode decision rule: bytemuck for on-chain account state, wincode for instruction datapinocchio-system and pinocchio-token typed helpersno_allocator!, lazy_entrypoint!, entrypoint!)LiteSVM testing (new)
setup() pattern, send_tx() helper with expire_blockhash(), TransactionMetadata fieldssvm.set_account() + RPC clientlitesvm-token (CreateMint, CreateAssociatedTokenAccount, MintTo)Clock), slot warping, rent readsCU_RESULTS static and zz_cu_summary testInstructionData/ToAccountMetas) and Native/Pinocchio (manual discriminator encoding)BlockhashNotFound, missing SO, etc.)safe-solana-builder.skill from the Releases page.skill fileCursor does not natively support .skill files, but the same system works by loading this repository as a context rule source.
mkdir -p ~/.cursor/skills
git clone https://github.com/Frankcastleauditor/safe-solana-builder.git ~/.cursor/skills/safe_solana_builder
Use the safe_solana_builder skill.
Build a secure Solana program using Anchor.
The skill fires on any of the following:
This skill is under active development. Planned expansions:
The reference files are the living core of this skill. Every new vulnerability source, audit finding, or best practice I encounter gets distilled and added. The skill grows with the threat landscape.
๐ก๏ธ Smart Contract Security Researcher specializing in Solana (Anchor) and Rust-based ecosystems.
I help protocols ship safer smart contracts by identifying critical vulnerabilities, validating everything related to DeFi and blockchain, and for Solana reviewing CPI / PDA / token-account security boundaries / and any custom logic.
โญ If you're building on Solana and want a security review, feel free to reach out.
MIT โ use it, fork it, build on it. If you add something valuable, consider contributing it back.
Safe Solana Builder โ first layer of protection, before the auditor ever sees your code.
safe-solana-builder is a Claude Code plugin with 1 hand-picked skill, indexed on Flowy in the Security category. Install it with the command on its page. It includes safe-solana-builder. Its skills do not fire on their own yet. Request auto-invocation to have Flowy route them as you prompt. Free and open source.
Is this plugin yours?
Claim it with GitHubSubmit a pluginPromote it