build-program

build-program is a command for Claude Code from solanabr/solana-glossary. It costs 9 tokens per session (991 once invoked), scanned A, a copy of build-program, MIT.

A build command for Solana programs, which are programs that run on the Solana blockchain. It supports projects written with Anchor or directly in Rust.

In plain words
What is it for?
Use it to clean and build an Anchor or native Rust Solana program, build a specific program, create a verifiable build, inspect program size, check its ID, and confirm that an Anchor interface file was generated.
Why use it?
It gives the coding agent a defined process for building the program and checking the resulting files, program ID, and generated interface description.

Command for Claude Code

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/build-program
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 build-program

README.md
[![agentmods](https://agentmods.dev/badge/commands/solanabr/solana-glossary/build-program.svg)](https://agentmods.dev/commands/solanabr/solana-glossary/build-program)
Your own site
<a href="https://agentmods.dev/commands/solanabr/solana-glossary/build-program"><img src="https://agentmods.dev/badge/commands/solanabr/solana-glossary/build-program.svg" alt="Measured on agentmods" height="20"></a>
Per session 9 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 991 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin 100% 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 $0.00009 $0.00991
Opus 5 $0.00005 $0.00495
Sonnet 5 $0.00002 $0.00198
Haiku 4.5 $0.00001 $0.00099

Measured 4d ago against content hash 5c2d2bcdd5a7, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

build-program 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 4d 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

100% identical to build-program — 0 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/build-program.md · 189 lines

How it starts

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

You are building a Solana program. Follow these steps:

Step 1: Identify Program Type

Check which framework is being used:

# Check for Anchor
if [ -f "Anchor.toml" ]; then
    echo "Anchor program detected"
fi

# Check for Cargo
if [ -f "Cargo.toml" ]; then
    echo "Native Rust program detected"
fi

Step 2: Build Program

For Anchor Programs

# Clean build
anchor clean
anchor build

# Build specific program
anchor build -p program-name

# Build with verifiable build
anchor build --verifiable

# Check build output
ls -lh target/deploy/*.so

For Native Rust Programs

# Build BPF program
cargo build-sbf

# Build with specific BPF SDK
cargo build-sbf --bpf-sdk /path/to/bpf-sdk

# Check output
ls -lh target/deploy/*.so

Step 3: Verify Build

# Check program size (should be < 400KB ideally)
ls -lh target/deploy/*.so | awk '{print $5, $9}'

# Verify program ID
solana address -k target/deploy/program-keypair.json

# If Anchor, verify IDL generated
ls -lh target/idl/*.json

Step 4: Run Format and Lint

After successful build:

# Format code
cargo fmt

# Run clippy
cargo clippy -- -W clippy::all

# Check for warnings
cargo clippy --all-targets --all-features -- -D warnings

Common Build Issues

Compilation Errors

  • Check Rust version: rustc --version (need 1.79+)
  • Update dependencies: cargo update
  • Clean and rebuild: anchor clean && anchor build

Binary Size Too Large

# Check current size
ls -lh target/deploy/*.so

# Optimize in Cargo.toml:
# [profile.release]
# opt-level = "z"
# lto = "fat"
# codegen-units = 1

Missing Dependencies

# For Anchor
npm install

# For Rust
cargo fetch

BPF SDK Issues

# Update Solana CLI
agave-install update

# Reinstall BPF SDK
cargo build-sbf --force-tools-install

Read the full file on GitHub · 189 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. 4d ago First seen · 189 lines · 9 tokens per session scan A 5c2d2bcdd5a7

Subscribe to this mod's changes

build-program is a command published in the GitHub repository solanabr/solana-glossary (19 stars, last pushed 24d ago), licensed MIT. It adds 9 tokens to every session and 991 once invoked, about $0.0000 per session on Opus 5. A static security scan graded it A with 0 findings. It is 100% identical to build-program, differing in 0 lines, and is treated as a copy.