solana
Installation
SKILL.md
solana — ship production Solana code
Opinionated, security-first Solana development (2026 stack). (Distilled in our own way from the Solana Foundation's solana-dev-skill, MIT. The full vulnerability catalog + version/error troubleshooting is in references/security-and-troubleshooting.md.)
The stack (defaults)
- Client:
@solana/kit(v5.x), not legacy@solana/web3.js. New code uses Kit types (Address, Kit signers, Kit RPC). Isolate any legacy web3.js (PublicKey,Keypair,Connection) behind the@solana/web3-compatboundary — zonesrc/solana/kit/vssrc/solana/web3/. Never mixAddressandPublicKeyapp-wide. - Programs: Anchor by default; Pinocchio only when compute / binary-size / parsing control is critical.
- Frontend: framework-kit +
@solana/react-hooks+ Wallet Standard discovery. - Codegen: describe programs with Codama (Anchor IDL → Codama → Kit TS client; native Rust → Shank → Codama). Never hand-write IDLs or Borsh layouts for programs you own; commit the generated code.
Anchor essentials
- Accounts:
#[account(init, payer = payer, space = 8 + T::INIT_SPACE)]; the 8-byte discriminator is auto-added. - PDA validation:
seeds = [b"vault", owner.key().as_ref()], bump; ownership viahas_one = authority. - Realloc:
realloc = new_space, realloc::payer = payer, realloc::zero = true(zero clears old data when shrinking). - Errors:
#[error_code]enum +#[msg("...")]+require!(cond, MyError::X). - PDA-signed CPI:
let seeds = &[b"vault".as_ref(), &[ctx.bumps.vault]]; CpiContext::new_with_signer(...). Use a typedProgram<'info, T>to validate CPI targets (prevents arbitrary-CPI attacks). (v0.32→v1 migration:CpiContext::newnow takes a program ID, not anAccountInfo.)