test-and-fix

test-and-fix is a command for Claude Code from solanabr/solana-ai-kit. It costs 17 tokens per session (665 once invoked), scanned A, original, MIT.

A command that runs the project's tests, investigates failures, applies common fixes, and runs the tests again. It supports Rust projects, including Anchor and Solana programs.

In plain words
What is it for?
Use it to check a Rust codebase after changes and address formatting problems, code-quality warnings, and other common test failures.
Why use it?
It removes the repetitive work of switching between test output, diagnosis, small corrections, and another test run. It stops when tests pass or when a person needs to intervene.

Command for Claude Code

Written for Claude Code: $ARGUMENTS substitution.

Good fit Use it to check a Rust codebase after changes and address formatting problems, code-quality warnings, and other common test failures.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/solanabr/solana-ai-kit/test-and-fix
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.

Clone the repo
git clone --depth 1 https://github.com/solanabr/solana-ai-kit

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-and-fix

README.md
[![agentmods](https://agentmods.dev/badge/commands/solanabr/solana-ai-kit/test-and-fix/github.svg)](https://agentmods.dev/commands/solanabr/solana-ai-kit/test-and-fix)
Your own site
<a href="https://agentmods.dev/commands/solanabr/solana-ai-kit/test-and-fix"><img src="https://agentmods.dev/badge/commands/solanabr/solana-ai-kit/test-and-fix/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for test-and-fix

Your own site · 80×15
<a href="https://agentmods.dev/commands/solanabr/solana-ai-kit/test-and-fix"><img src="https://agentmods.dev/badge/commands/solanabr/solana-ai-kit/test-and-fix.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 17 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 665 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.00017 $0.00665
Opus 5.5 $0.00007 $0.00266
Sonnet 5.5 $0.00003 $0.00133
Haiku 4.5 $0.00002 $0.00067

Measured 27d ago against content hash 51f15254677f, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

test-and-fix 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 27d 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/commands/test-and-fix.md · 29 lines

How it starts

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

Loop test, diagnose, fix, retest until the suite passes or a stop condition hits. $ARGUMENTS limits the scope (a package, test name, or path); empty means the whole project.

Steps

  1. Run the tests the way /test-rust, /test-ts or /test-dotnet does for this stack, rebuilding the program first so tests do not run a stale .so. Record every failure.
  2. Apply the mechanical fixes, then rerun:
    • Rust: cargo fmt --all, then cargo clippy --fix --allow-dirty --allow-staged --all-targets, then cargo clippy --all-targets -- -D warnings for what clippy cannot fix itself.
    • TypeScript: the project's prettier and eslint --fix scripts. C#: dotnet format.
  3. Take the remaining failures one root cause at a time. Classify before editing:
    • Environment or toolchain (platform-tools, GLIBC, port 8899 in use, missing keypair): see common-errors.md.
    • Stale artifacts: InstructionFallbackNotFound (101) or AccountDiscriminatorMismatch (3002) right after a program change usually means an old .so, IDL or generated client. Rebuild and rerun /generate-idl-client.
    • Program errors: decode custom program error: 0x... from hex. Anchor 2000-2999 are constraints (2006 seeds differ between client and program), 3000-3999 account errors (3012 not initialized), 6000+ your #[error_code] variants in order. Anchor 1.x also rejects duplicate mutable accounts unless the field is marked dup.
    • Test or program: decide which side encodes the intended behavior before editing either.
  4. Rerun after each fix. Stop and report when everything passes, when the same failure survives two different fixes, after five rounds, or when the next fix would change program behavior, an instruction's interface, or a security check.

Guardrails

  • Do not delete, skip or #[ignore] tests, loosen assertions, or remove account constraints to get green. If a test is wrong, say why before changing it.
  • A program-ID mismatch from anchor build in an existing repo usually means the deploy keypair is missing from target/deploy/. Build with anchor build --ignore-keys and ask the user for the keypair. anchor keys sync rewrites declare_id! to a new address, which is only right for a program that was never deployed.
  • Failures that only reproduce against real cluster state belong to /debug-user-tx.

Read the full file on GitHub · 29 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. 27d ago Changed · -343 lines · +10 tokens per session 51f15254677f
  2. 28d ago Changed 7a4d2e3d7a25
  3. 1mo ago First seen · 372 lines · 7 tokens per session scan A 9894c58e358f

Subscribe to this mod's changes

test-and-fix is a command published in the GitHub repository solanabr/solana-ai-kit (104 stars, last pushed 27d ago), licensed MIT. It adds 17 tokens to every session and 665 once invoked, about $0.0001 per session on Opus 5.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.