rust-build-optimization

rust-build-optimization is a skill for Claude Code, Codex from bahayonghang/my-ai-cli-toolkit. It costs 147 tokens per session (1,425 once invoked), scanned A, original, MIT.

A guide for measuring and speeding up slow Rust or Cargo builds. Cargo is Rust's build tool and package manager.

In plain words
What is it for?
Use it to profile cold, warm, development, release, or CI builds and apply measured fixes such as faster linkers or build-configuration changes.
Why use it?
It avoids guessing by identifying whether dependencies, code generation, linking, or an oversized package is causing the delay, then checking the result after a targeted change.

Skill for Claude CodeCodex

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 skills/bahayonghang/my-ai-cli-toolkit/rust-build-optimization
Any agent
npx skills add bahayonghang/my-ai-cli-toolkit --skill rust-build-optimization
Clone the repo
git clone --depth 1 https://github.com/bahayonghang/my-ai-cli-toolkit

Made for: Claude Code, Codex.

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 rust-build-optimization

README.md
[![agentmods](https://agentmods.dev/badge/skills/bahayonghang/my-ai-cli-toolkit/rust-build-optimization.svg)](https://agentmods.dev/skills/bahayonghang/my-ai-cli-toolkit/rust-build-optimization)
Your own site
<a href="https://agentmods.dev/skills/bahayonghang/my-ai-cli-toolkit/rust-build-optimization"><img src="https://agentmods.dev/badge/skills/bahayonghang/my-ai-cli-toolkit/rust-build-optimization.svg" alt="Measured on agentmods" height="20"></a>
Per session 147 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,425 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 $0.00147 $0.01425
Opus 5 $0.00073 $0.00713
Sonnet 5 $0.00029 $0.00285
Haiku 4.5 $0.00015 $0.00143

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

Security

Grade A, and why

rust-build-optimization 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.

skills/development-workflows/rust-build-optimization/SKILL.md · 126 lines

How it starts

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

Rust Build Analysis and Optimization

Diagnose slow Rust builds by measuring first, then apply the smallest fix that targets the actual bottleneck. The useful outcome is: a baseline number, a named bottleneck backed by profiler output, applied configuration changes, and a re-measured result — not a pile of speculative config.

Path note: <skill-dir> below means this skill's own directory. Substitute the literal path announced when the skill loads; do not use $SKILL_DIR.

Hard Rules

  • Never recommend a fix before at least one measurement supports it.
  • Label every nightly-only or platform-specific option as such.
  • Do not silently change settings that affect release runtime performance (codegen-units, lto, opt-level in [profile.release]); state the tradeoff and get agreement.
  • Re-measure after applying changes and report before/after numbers.

Step 1 — Frame the Complaint

Establish three facts before touching anything:

  1. Cold or warm? Full build after cargo clean / dependency bump, or an incremental rebuild after a one-line change? They have different bottlenecks and different fixes.
  2. Which profile? dev, release, or CI. Ask, or read the command the user actually runs.
  3. Baseline. Time the exact complained-about scenario once, e.g. cargo build --release after touch-ing a source file for warm builds.

Also check the trivial win first: if the user's inner loop is "edit → build → read errors", cargo check (or bacon / cargo watch -x check) skips codegen entirely and is often the single biggest quality-of-life fix.

Step 2 — Measure

Start with the built-in profiler:

cargo build --timings          # writes target/cargo-timings/cargo-timing.html

Read it for: slowest units, the concurrency graph (long single-threaded tails mean a serialization problem), and whether the final bin crate dominates. Known blind spot: for the warm rebuild of a bin crate, --timings shows one opaque block — codegen and link time are not broken out. When that block is the mystery, go deeper with -Zself-profile and measureme (summarize / flamegraph / crox), cargo-llvm-lines, or linker timing. Full tool guide: <skill-dir>/references/diagnostics.md.

Read the full file on GitHub · 126 lines

Files

What ships with it

4 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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 · 126 lines · 147 tokens per session scan A 70d5bbe48f49

Subscribe to this mod's changes

rust-build-optimization is a skill published in the GitHub repository bahayonghang/my-ai-cli-toolkit (16 stars, last pushed yesterday), licensed MIT. It adds 147 tokens to every session and 1,425 once invoked, about $0.0007 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.