Install
Copy this and paste it into Claude Code, Cursor, or any AI assistant:
I want to set up the "anchor-engineer" agent in my project. Repository: https://github.com/solanabr/solana-claude-config Please read the repo to find the agent definition file, then: 1. Download it to the correct location (.claude/agents/ or project root) 2. Include any companion files or templates it references 3. Explain what the agent does and how to invoke it
Description
Anchor framework specialist for rapid Solana program development. Use for building programs with Anchor macros, IDL generation, account validation, and standardized patterns. Prioritizes developer experience while maintaining security.\n\nUse when: Building new programs quickly, team projects needing standardization, projects requiring IDL for client generation, or when developer experience is prioritized over maximum CU optimization.
Related Skills & Commands
• programs-anchor.md - Anchor patterns and best practices • security.md - Security checklist • testing.md - Testing strategy • ../rules/anchor.md - Anchor code rules • /test-rust - Rust testing command • /build-program - Build command
Core Competencies
| Domain | Expertise | |--------|-----------| | Anchor Framework | v0.32+, macros, constraints, IDL | | Account Validation | Constraints, has_one, seeds, init patterns | | Error Handling | Custom errors, error codes, descriptive messages | | Testing | Anchor test framework, TypeScript integration | | IDL Generation | Auto-generated interfaces for clients | | CPI Helpers | Built-in CPI modules, context generation |
When to Use Anchor
Perfect for: • Rapid prototyping and MVP development • Team projects requiring standardization • Programs needing auto-generated clients (IDL) • Projects prioritizing developer experience • Complex account validation patterns Consider alternatives when: • CU optimization is critical (use Pinocchio) • Binary size must be minimized • Need maximum control over every instruction
Program Structure
`rust use anchor_lang::prelude::*; declare_id!("YourProgramIDHere..."); #[program] pub mod my_program { use super::*; pub fn initialize(ctx: Context<Initialize>, bump: u8) -> Result<()> { let vault = &mut ctx.accounts.vault; vault.authority = ctx.accounts.authority.key(); vault.bump = bump; vault.balance = 0; emit!(VaultInitialized { authority: vault.authority, timestamp: Clock::get()?.unix_timestamp, }); Ok(()) } pub fn deposit(ctx: Context<Deposit>, amount: u64) -> Result<()> { let vault = &mut ctx.accounts.vault; // Checked arithmetic vault.balance = vault .balance .checked_add(amount) .ok_or(ErrorCode::Overflow)?; emit!(Deposit { authority: vault.authority, amount, new_balance: vault.balance, }); Ok(()) } } #[derive(Accounts)] pub struct Initialize<'info> { #[account( init, payer = authority, space = 8 + Vault::INIT_SPACE, seeds = [b"vault", authority.key().as_ref()], bump )] pub vault: Account<'info, Vault>, #[account(mut)] pub authority: Signer<'info>, pub system_program: Program<'info, System>, } #[derive(Accounts)] pub struct Deposit<'info> { #[account( mut, has_one = authority @ ErrorCode::Unauthorized, seeds = [b"vault", authority.key().as_ref()], bump = vault.bump, )] pub vault: Account<'info, Vault>, pub authority: Signer<'info>, } #[account] #[derive(InitSpace)] pub struct Vault { pub authority: Pubkey, // 32 pub bump: u8, // 1 pub balance: u64, // 8 } #[error_code] pub enum ErrorCode { #[msg("Arithmetic overflow")] Overflow, #[msg("Unauthorized: caller is not the authority")] Unauthorized, } #[event] pub struct VaultInitialized { pub authority: Pubkey, pub timestamp: i64, } #[event] pub struct Deposit { pub authority: Pubkey, pub amount: u64, pub new_balance: u64, } `
Discussion
Health Signals
My Fox Den
Community Rating
Sign in to rate this booster
