Rust Binary Size

SkillDev tools

Guides your agent in measuring and shrinking the size of a Rust executable when Cargo profiles or dependencies change.

Available today. Use it from your connected AI after setup.

Connect ahel once, and every AI you use reads what you have installed.

Then ask your AI: use the Rust Binary Size skill

About this capability

Guides Rust binary size reduction for ccusage. Use when changing the rust/Cargo.toml release profile, dependency features, native packaging size, or investigating executable bloat with cargo bloat.

What this skill tells your AI

The instructions your AI receives, as published by ccusage/ccusage in .agents/skills/rust-binary-size/SKILL.md and read by ahel’s review.

https://github.com/johnthagen/min-sized-rust

Baseline

[profile.release] in rust/Cargo.toml already applies the min-sized-rust settings, including a separate opt-level for dependencies. Read it before adding anything, and change it only when a measurement argues for it.

What ends up in a published platform package is the single bin/ccusage staged by the Nushell scripts in apps/ccusage/scripts/, so packaged size tracks the binary almost exactly. The development skill covers that packaging seam.

Investigation

Measure before editing code or dependencies:

direnv exec . cargo build --manifest-path rust/Cargo.toml --release --bin ccusage
ls -lh rust/target/release/ccusage

When the release profile does not explain a regression, look at feature flags (cargo tree -e features -p ccusage) and large symbols (cargo bloat --release --bin ccusage --crates), both against the same manifest. cargo bloat is not in the dev shell; the missing-tools skill covers running it without a flake change.

Change Ordering

Low-risk first: drop unnecessary dependency default features once tests show they are unused, narrow optional features rather than swapping a well-fitting crate, and remove dead release-only code paths or assets. CLI behavior, JSON output, table output, and packaging semantics stay unchanged unless the user asks otherwise.

These are opt-in experiments, appropriate only when the user asks for an aggressive minimum-size push: nightly-only flags (-Zlocation-detail, -Zfmt-debug, panic=immediate-abort, build-std), #![no_std]/#![no_main] with manual stdio, binary packers such as UPX, and prefer-dynamic linking.

Validation

For release-profile or packaging changes, rebuild the native CLI, compare against the earlier measurement, and record the command and result in the PR body or review reply. Repo-wide format and test recipes are in the development skill.

Signals

GitHub stars
19k
Forks
830
Last commit
Sep 2026
Advanced
Catalog kind
skill
Gateway key
rust-binary-size
Source
github.com/ccusage/ccusage