test-rust

test-rust is a command for Claude Code from solanabr/solana-glossary. It costs 10 tokens per session (2,358 once invoked), scanned A, a copy of test-rust, MIT.

A command for running Rust tests, including tests for Solana programs and backend services. It detects the project type and chooses guidance for the relevant testing setup.

In plain words
What is it for?
Use it to test standard Rust code, Solana programs built with Anchor, Pinocchio, or native Solana tools, and Rust services using frameworks such as Axum or Tokio.
Why use it?
It gives one testing workflow for several Rust project types instead of requiring you to remember different checks for each one.

Command for Claude Code

Written for Claude Code: installed under .claude/. Also seen: positional $N argument.

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/solanabr/solana-glossary/test-rust
Clone the repo
git clone --depth 1 https://github.com/solanabr/solana-glossary

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 test-rust

README.md
[![agentmods](https://agentmods.dev/badge/commands/solanabr/solana-glossary/test-rust.svg)](https://agentmods.dev/commands/solanabr/solana-glossary/test-rust)
Your own site
<a href="https://agentmods.dev/commands/solanabr/solana-glossary/test-rust"><img src="https://agentmods.dev/badge/commands/solanabr/solana-glossary/test-rust.svg" alt="Measured on agentmods" height="20"></a>
Per session 10 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,358 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin 94% copy Near-identical to another mod 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.00010 $0.02358
Opus 5 $0.00005 $0.01179
Sonnet 5 $0.00002 $0.00472
Haiku 4.5 $0.00001 $0.00236

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

Security

Grade A, and why

test-rust 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

This is a copy

94% identical to test-rust — 4 lines differ, which has more behind it and is treated as the original. This page carries a canonical link to it rather than competing with it.

.claude/commands/test-rust.md · 404 lines

How it starts

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

You are running Rust tests. This command covers Solana program testing (Mollusk, LiteSVM, Surfpool, Trident) and backend service testing.

Step 1: Identify Project Type

echo "🔍 Detecting project type..."

if [ -f "Anchor.toml" ]; then
    echo "📦 Anchor project detected"
    PROJECT_TYPE="anchor"
elif grep -q "pinocchio" Cargo.toml 2>/dev/null; then
    echo "🎯 Pinocchio program detected"
    PROJECT_TYPE="pinocchio"
elif grep -q "solana-program" Cargo.toml 2>/dev/null; then
    echo "⚙️  Solana native program detected"
    PROJECT_TYPE="solana"
elif grep -q "axum\|tokio" Cargo.toml 2>/dev/null; then
    echo "🌐 Rust backend service detected"
    PROJECT_TYPE="backend"
else
    echo "🦀 Standard Rust project detected"
    PROJECT_TYPE="standard"
fi

Solana Program Testing

Testing Pyramid

  1. Unit tests (fastest): Mollusk - individual instruction tests
  2. Integration tests (fast): LiteSVM - multi-instruction flows
  3. Realistic state tests: Surfpool - mainnet/devnet state locally
  4. Fuzz tests: Trident - edge case discovery

Mollusk Unit Tests

Fast, isolated tests for individual instructions:

echo "🐚 Running Mollusk unit tests..."
cargo test --lib -- --nocapture
#[cfg(test)]
mod tests {
    use mollusk_svm::Mollusk;
    use solana_sdk::{account::Account, pubkey::Pubkey, instruction::Instruction};

    #[test]
    fn test_initialize() {
        let program_id = Pubkey::new_unique();
        let mollusk = Mollusk::new(&program_id, "target/deploy/my_program.so");

        // Setup accounts
        let user = Pubkey::new_unique();
        let accounts = vec![
            (user, Account::new(1_000_000_000, 0, &program_id)),
        ];

        // Create instruction
        let instruction = Instruction {
            program_id,
            accounts: vec![],
            data: vec![0], // Initialize discriminator
        };

        // Process and verify
        let result = mollusk.process_instruction(&instruction, &accounts);
        assert!(result.program_result.is_ok());

        // Check CU usage
        println!("CU consumed: {}", result.compute_units_consumed);
        assert!(result.compute_units_consumed < 50_000);
    }
}

Read the full file on GitHub · 404 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 · 404 lines · 10 tokens per session scan A cbb6b4fdecca

Subscribe to this mod's changes

test-rust is a command published in the GitHub repository solanabr/solana-glossary (19 stars, last pushed 25d ago), licensed MIT. It adds 10 tokens to every session and 2,358 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. It is 94% identical to test-rust, differing in 4 lines, and is treated as a copy.