solana — community solana, solsab, community, ide skills, Claude Code, Cursor, Windsurf

v0.1.0
GitHub

About this Skill

Sablier programs on Solana

sablier-labs sablier-labs
[10]
[2]
Updated: 2/11/2026
Labs Demo

Browser Sandbox Environment

⚡️ Ready to unleash?

Experience this Agent in a zero-setup browser environment powered by WebContainers. No installation required.

Boot Container Sandbox

solana

Install solana, an AI agent skill for AI agent workflows and automation. Works with Claude Code, Cursor, and Windsurf with one-command setup.

SKILL.md
Readonly

Solana Program Development

You are a senior Solana Anchor engineer with extensive experience using the Anchor CLI, Solana CLI, Metaplex NFTs, and Trident-based fuzz testing.

Solana Core Architecture

Account Model Mindset: Programs are stateless executables operating on accounts passed to them. Program state/data lives in those accounts. Consult references/ACCOUNT_MODEL.md for Program Derived Addresses (PDA) patterns and rent calculations.

Critical Constraints:

  • Maintain rent-exempt balance for all accounts: use #[derive(InitSpace)] when defining the account struct and [STRUCT_NAME]::INIT_SPACE - when init-ializing or realloc-ating the on-chain account in the #[derive(Accounts)] struct (consult references/ACCOUNT_MODEL.md)
  • Derive all program-owned accounts as PDAs—never keypairs for state
  • Validate all accounts before CPI calls (inherits caller's privileges)
  • Stay within 1232 bytes/tx (consult references/TRANSACTIONS.md)

Tech Stack

Anchor Framework

Anchor is the primary framework. Prefer over native solana-program for:

  • Declarative account validation via constraints
  • Automatic Borsh (de)serialization
  • IDL generation for TypeScript clients
  • Built-in security checks (discriminators, ownership validation)

Project Structure

programs/{name}/src/
├── lib.rs              # module declarations, "#[program]", instruction exports
├── instructions/
│   ├── mod.rs          # re-exports all Instructions
│   ├── *.rs            # state-changing Ixs with "#[derive(Accounts)]" + "handler()"
│   └── view/           # read-only instructions (no state mutation)
├── state/              # account structs for on-chain data
└── utils/
    ├── errors.rs       # "#[error_code]" enum
    ├── events.rs       # "#[event]" structs
    ├── constants.rs    # seeds, program IDs
    └── validations.rs  # validation functions

Program Development Patterns

Account Struct Organization

Structure account validation in logical sections (see create_with_timestamps.rs, claim.rs):

CategoryDescriptionExamples
USER ACCOUNTSSigners, protocol roles and their ATAscreator: Signer, creator_ata, recipient
PROTOCOL ACCOUNTSGlobal protocol state (treasury, etc.)treasury: Account<Treasury>
COLLECTION ACCOUNTSNFT collection state (if applicable)nft_collection_data, nft_collection_mint
ENTITY ACCOUNTSPer-entity state (either for stream or campaign)stream_data, stream_data_ata, campaign
PROGRAM ACCOUNTSExternal programstoken_program, associated_token_program
SYSTEM ACCOUNTSSystem-levelsystem_program, rent

Key account type patterns (use #[instruction() if input parameters are needed for seeds or PDA derivation):

rust
1#[derive(Accounts)] 2#[instruction(salt: u128)] 3pub struct CreateWithTimestamps<'info> { 4 // ------------------------------------------------------------------------ // 5 // USER ACCOUNTS // 6 // ------------------------------------------------------------------------ // 7 #[account(mut)] 8 pub creator: Signer<'info>, 9 10 #[account( 11 mut, 12 associated_token::mint = deposit_token_mint, 13 associated_token::authority = creator, 14 associated_token::token_program = deposit_token_program 15 )] 16 pub creator_ata: Box<InterfaceAccount<'info, TokenAccount>>, 17 18 /// CHECK: The recipient may be any account 19 pub recipient: UncheckedAccount<'info>, 20 21 // ------------------------------------------------------------------------ // 22 // STREAM ACCOUNTS // 23 // ------------------------------------------------------------------------ // 24 #[account( 25 init, 26 payer = creator, 27 space = 8 + StreamData::INIT_SPACE, 28 seeds = [STREAM_DATA, stream_nft_mint.key().as_ref()], 29 bump 30 )] 31 pub stream_data: Box<Account<'info, StreamData>>, 32 33 // ------------------------------------------------------------------------ // 34 // PROGRAM ACCOUNTS // 35 // ------------------------------------------------------------------------ // 36 pub deposit_token_program: Interface<'info, TokenInterface>, 37}

Handler Pattern

Structure handlers with validation first, then state updates and interactions, then event emission:

rust
1pub fn handler(ctx: Context<CreateWithTimestamps>, deposit_amount: u64, ...) -> Result<()> { 2 // Validate parameters 3 check_create(deposit_amount, start_time, cliff_time, end_time, ...)?; 4 5 // Update state 6 ctx.accounts.stream_data.create(...)?; 7 8 // Transfer tokens 9 transfer_tokens(creator_ata, stream_data_ata, creator, ...)?; 10 11 // Emit event for indexers 12 emit!(CreateLockupLinearStream { salt, deposit_token_mint, ... }); 13 14 Ok(()) 15}

Key Patterns

PatternWhen to Use
Box<Account<>>Large accounts to reduce stack usage
InterfaceAccount<TokenAccount>Token/Token2022 compatibility
UncheckedAccount + /// CHECKFlexible validation (document the check)
Extract to utils/validations.rsInstruction validation logic

Events & Errors

Emit events for all state changes (critical for indexers):

rust
1#[event] 2pub struct StreamCreated { pub stream_id: Pubkey, pub amount: u64 }

Define contextual error messages:

rust
1#[error_code] 2pub enum ErrorCode { 3 #[msg("Deposit amount must be greater than zero")] 4 DepositAmountZero, 5}

Security Requirements

Non-negotiable security practices:

  1. Account Ownership: Validate account.owner == expected_program (automatic for Account<>)
  2. PDAs Only: Never store state in keypair-controlled accounts
  3. Signer Checks: Verify signers for all privileged operations (via the #[account(constraint)] macro)
  4. Checked Math: Use checked_add, checked_sub, checked_mul for all arithmetic

Consult references/SECURITY.md for comprehensive vulnerability patterns and audit checklist.

MPL Core (NFTs)

For NFT ownership tokens, Metaplex Core provides efficient single-account NFTs (~0.0029 SOL vs ~0.022 SOL for Token Metadata).

Consult references/MPL_CORE.md for CPI builders and collection patterns.

Build & Code Generation

Building programs automatically generates TypeScript bindings:

bash
1just build # Build all programs + generate TS types 2just build sablier_lockup # Build specific program

The build process:

  1. anchor build → compiles Rust → generates target/idl/{program}.json
  2. just codegen → generates target/types/{program}_errors.ts and {program}_structs.ts

Generated types provide type-safe access to on-chain data in tests:

typescript
1import type { StreamData } from "../target/types/sablier_lockup_structs"; 2import { ProgramErrorCode } from "../target/types/sablier_lockup_errors"; 3 4const streamData: StreamData = await program.account.streamData.fetch(pda); 5await expectToThrow(ctx.withdraw(), ProgramErrorCode.StreamDepleted);

Consult references/CODEGEN.md for type mappings, script architecture and troubleshooting.

Testing Strategy

Unit/Integration Tests (Vitest + anchor-bankrun)

Fast, deterministic testing without validator startup. Key pattern:

typescript
1class LockupTestContext extends TestContext { 2 async setUp() { 3 await super.setUp("sablier_lockup", programId); 4 this.program = new Program<SablierLockup>(IDL, this.provider); 5 } 6}

Consult references/TESTING.md for complete test context patterns, time travel, and assertions.

Fuzz Testing (Trident)

Property-based fuzzing for edge case discovery:

trident-tests/fuzz_{program}/
├── test_fuzz.rs          # Entry point with flows
├── instructions/*.rs     # TridentInstruction definitions
└── helpers/*_math.rs     # Replicated math for invariants

Consult references/FUZZ_TESTING.md for instruction hooks, invariants, and time warping.


Additional Resources

Reference Files

Detailed documentation for specific domains:

FileContent
references/ACCOUNT_MODEL.mdPDA derivation, rent, account creation
references/TRANSACTIONS.mdTx limits, CU optimization
references/SECURITY.mdVulnerabilities, audit checklist, protections
references/TESTING.mdVitest + anchor-bankrun patterns
references/FUZZ_TESTING.mdTrident setup, invariants, flows
references/MPL_CORE.mdMetaplex Core NFT integration
references/CODEGEN.mdTypeScript codegen from IDL, type mappings

Example Files

Working code examples demonstrating key patterns:

FileContent
examples/withdraw_instruction.rsComplete Anchor instruction example
examples/test_pattern.tsVitest + anchor-bankrun test structure

External Documentation

Fetch latest docs before implementation—the ecosystem moves fast:

If you don't find the information you're looking for in this Skill, use Context7 MCP, as a default backup, to retrieve the current documentation for Anchor, Solana, Metaplex and Trident.

FAQ & Installation Steps

These questions and steps mirror the structured data on this page for better search understanding.

? Frequently Asked Questions

What is solana?

Sablier programs on Solana

How do I install solana?

Run the command: npx killer-skills add sablier-labs/solsab. It works with Cursor, Windsurf, VS Code, Claude Code, and 19+ other IDEs.

Which IDEs are compatible with solana?

This skill is compatible with Cursor, Windsurf, VS Code, Trae, Claude Code, OpenClaw, Aider, Codex, OpenCode, Goose, Cline, Roo Code, Kiro, Augment Code, Continue, GitHub Copilot, Sourcegraph Cody, and Amazon Q Developer. Use the Killer-Skills CLI for universal one-command installation.

How To Install

  1. 1. Open your terminal

    Open the terminal or command line in your project directory.

  2. 2. Run the install command

    Run: npx killer-skills add sablier-labs/solsab. The CLI will automatically detect your IDE or AI agent and configure the skill.

  3. 3. Start using the skill

    The skill is now active. Your AI agent can use solana immediately in the current project.

Related Skills

Looking for an alternative to solana or another community skill for your workflow? Explore these related open-source skills.

View All

widget-generator

Logo of f
f

f.k.a. Awesome ChatGPT Prompts. Share, discover, and collect prompts from the community. Free and open source — self-host for your organization with complete privacy.

149.6k
0
AI

flags

Logo of vercel
vercel

flags is a Next.js feature management skill that enables developers to efficiently add or modify framework feature flags, streamlining React application development.

138.4k
0
Browser

zustand

Logo of lobehub
lobehub

The ultimate space for work and life — to find, build, and collaborate with agent teammates that grow with you. We are taking agent harness to the next level — enabling multi-agent collaboration, effortless agent team design, and introducing agents as the unit of work interaction.

72.8k
0
AI

data-fetching

Logo of lobehub
lobehub

The ultimate space for work and life — to find, build, and collaborate with agent teammates that grow with you. We are taking agent harness to the next level — enabling multi-agent collaboration, effortless agent team design, and introducing agents as the unit of work interaction.

72.8k
0
AI