anchor-engineer

anchor-engineer is an agent for Claude Code from solanabr/solana-ai-kit. It costs 77 tokens per session (3,442 once invoked), scanned A, original, MIT.

A specialist guide for building Solana programs with Anchor, a Rust framework that provides standard patterns for blockchain programs. It covers account checks, error handling, tests, interface descriptions, and calls between programs.

In plain words
What is it for?
Use it for new Solana programs, prototypes, team projects, account validation, custom errors, Rust tests, interface description generation, and cross-program calls.
Why use it?
It helps developers build Solana programs quickly while applying consistent account validation and security patterns. It also reduces the amount of repeated setup needed for teams and clients.

Agent for Claude Code

Written for Claude Code: installed under .claude/. Also seen: model in frontmatter.

Not installable on its own: it reads a path above its own folder, which only exists inside its repository. The line is **More testing patterns**: See [/test-rust](../commands/test-rust.md) command.

Install

Getting it into your agent

There is no command for this one: it runs only inside a plugin, and the catalogue could not identify which plugin ships it. The source is linked below.

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for anchor-engineer

README.md
[![agentmods](https://agentmods.dev/badge/agents/solanabr/solana-ai-kit/anchor-engineer.svg)](https://agentmods.dev/agents/solanabr/solana-ai-kit/anchor-engineer)
Your own site
<a href="https://agentmods.dev/agents/solanabr/solana-ai-kit/anchor-engineer"><img src="https://agentmods.dev/badge/agents/solanabr/solana-ai-kit/anchor-engineer.svg" alt="Measured on agentmods" height="20"></a>
Per session 77 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,442 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00077 $0.03442
Opus 5 $0.00039 $0.01721
Sonnet 5 $0.00015 $0.00688
Haiku 4.5 $0.00008 $0.00344

Measured 6d ago against content hash 2468ca0001b9, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

anchor-engineer scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

Origin

Copies of this mod

2 near-identical copies found in the catalogue:

.claude/agents/anchor-engineer.md · 514 lines

How it starts

The opening of the file, as written. The whole thing — 514 lines — stays where its author put it; the contents beside it link to each section on GitHub.

You are an Anchor framework specialist with deep expertise in building secure, maintainable Solana programs using Anchor 1.0 (current 1.0.2, targeting Solana 3.x / Agave). Your focus is rapid development with strong security guarantees through Anchor's constraint system.

Core Competencies

Domain Expertise
Anchor Framework v1.0.x, macros, constraints, IDL
Account Validation Constraints, has_one, seeds, init patterns
Error Handling Custom errors, error codes, descriptive messages
Testing Rust + LiteSVM (default), Surfpool, Mollusk
IDL Generation Program Metadata + declare_program! 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

Modern Anchor Patterns (1.0)

Program Structure

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 = Vault::DISCRIMINATOR.len() + 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,
}

Read the full file on GitHub · 514 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 514 lines · 77 tokens per session scan A 2468ca0001b9

Subscribe to this mod's changes

anchor-engineer is an agent published in the GitHub repository solanabr/solana-ai-kit (99 stars, last pushed 16d ago), licensed MIT. It adds 77 tokens to every session and 3,442 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.