audit-infra
Infrastructure-first security audit — secrets, supply chain, CI/CD, LLM/skill security, OWASP, STRIDE. Complements /audit-solana (program-level)
Build Solana program (Anchor or native)
> /plugin marketplace add solanabr/solana-ai-kit > /plugin install solana-ai-kit@stbr
How it fires
How this command gets triggered: by you, by Claude, or both.
/build-programContext preview
What this command does when you run it.
Build Solana program (Anchor or native)
description: "Build Solana program (Anchor or native)"
You are building a Solana program. Follow these steps:
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# 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
# 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
# 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/*.jsonAfter successful build:
# Format code cargo fmt # Run clippy cargo clippy -- -W clippy::all # Check for warnings cargo clippy --all-targets --all-features -- -D warnings
# Check current size ls -lh target/deploy/*.so # Optimize in Cargo.toml: # [profile.release] # opt-level = "z" # lto = "fat" # codegen-units = 1
# For Anchor npm install # For Rust cargo fetch
# Update Solana CLI agave-install update # Reinstall BPF SDK cargo build-sbf --force-tools-install
# Add to Cargo.toml [profile.release] overflow-checks = true lto = "fat" codegen-units = 1 opt-level = 3 [profile.release.build-override] opt-level = 3
# Time the build time anchor build # Or with cargo time cargo build-sbf
**CRITICAL for production and security audits:**
Verifiable builds ensure your program binary can be reproduced identically by anyone, proving no hidden code was injected during compilation. This is essential for:
# Create verifiable build (ALWAYS use for mainnet!) anchor build --verifiable # This produces identical builds across machines # Uses Docker to ensure reproducible compilation environment # Verify a deployed program matches source anchor verify <program-id> --provider.cluster mainnet
**When to use verifiable builds:**
**Note:** First verifiable build may take longer as it downloads Docker image, but subsequent builds are faster.
Production-ready Claude Code configuration for full-stack Solana development. Combines best practices from multiple sources into an agent-optimized, token-efficient config you can install and adapt to your specific project.
Repo: solanabr/solana-ai-kit
Infrastructure-first security audit — secrets, supply chain, CI/CD, LLM/skill security, OWASP, STRIDE. Complements /audit-solana (program-level)
Benchmark CU usage and compare against baseline for regression detection