Audit Solana programs (Anchor or native Rust) for security vulnerabilities. Use when reviewing smart contract security, finding exploits, analyzing attack vectors, performing security assessments, or when explicitly asked to audit, review security, check for bugs, or find vulnerabilities in Solana programs.
/plugin marketplace add tenequm/claude-plugins/plugin install solana@tenequm-pluginsThis skill inherits all available tools. When active, it can use any tool Claude has access to.
references/anchor-security.mdreferences/caveats.mdreferences/native-security.mdreferences/resources.mdreferences/security-checklists.mdreferences/security-fundamentals.mdreferences/vulnerability-patterns.mdSystematic security review framework for Solana programs, supporting both Anchor and native Rust implementations.
Follow this systematic 5-step process for comprehensive security audits:
Understand the program's context and structure:
use anchor_lang::prelude::*)Cargo.toml for compatibility and known issuesFor each instruction, perform security checks in this order:
checked_* methodsā See references/security-checklists.md for detailed checklists
Scan for common vulnerability patterns:
ā See references/vulnerability-patterns.md for code examples and exploit scenarios
Evaluate overall design quality:
Provide findings using this structure:
Severity Levels:
Finding Format:
## š“ [CRITICAL] Title
**Location:** `programs/vault/src/lib.rs:45-52`
**Issue:**
Brief description of the vulnerability
**Vulnerable Code:**
```rust
// Show the problematic code
Exploit Scenario: Step-by-step explanation of how this can be exploited
Recommendation:
// Show the secure alternative
References:
**Report Summary:**
- Total findings by severity
- Critical issues first (prioritize by risk)
- Quick wins (easy fixes with high impact)
- Recommendations for testing improvements
## Quick Reference
### Essential Checks (Every Instruction)
**Anchor:**
```rust
// ā
Account validation with constraints
#[derive(Accounts)]
pub struct SecureInstruction<'info> {
#[account(
mut,
has_one = authority, // Relationship check
seeds = [b"vault", user.key().as_ref()],
bump, // Canonical bump
)]
pub vault: Account<'info, Vault>,
pub authority: Signer<'info>, // Signer required
pub token_program: Program<'info, Token>, // Program validation
}
// ā
Checked arithmetic
let total = balance.checked_add(amount)
.ok_or(ErrorCode::Overflow)?;
Native Rust:
// ā
Manual account validation
if !authority.is_signer {
return Err(ProgramError::MissingRequiredSignature);
}
if vault.owner != program_id {
return Err(ProgramError::IllegalOwner);
}
// ā
Checked arithmetic
let total = balance.checked_add(amount)
.ok_or(ProgramError::ArithmeticOverflow)?;
ā Never Do:
saturating_* arithmetic methods (hide errors)unwrap() or expect() in production codeinit_if_needed without additional checksā Always Do:
checked_* arithmetic (checked_add, checked_sub, etc.)ok_or(error)? for Option unwrappinginit with proper validationSigner<'info> or is_signer checksProgram<'info, T> for CPI program validationā See references/anchor-security.md for:
CpiContextā See references/native-security.md for:
InitSpace derive for automatic space calculationā See references/security-fundamentals.md for:
ā See references/vulnerability-patterns.md for:
Each vulnerability includes:
ā See references/security-checklists.md for:
ā See references/caveats.md for:
ā See references/resources.md for:
Always verify these critical security properties:
Can an attacker substitute accounts?
Can arithmetic overflow or underflow?
Are all accounts properly validated?
Can the program be drained?
What happens in edge cases?
Are external dependencies safe?
Beyond code review, validate security through testing:
In Solana's account model, attackers can pass arbitrary accounts to any instruction.
Security requires explicitly validating:
There are no implicit guarantees. Validate everything, trust nothing.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.