cargo-fuzz — Claude Code skill: what it does, how to install
Sets up cargo-fuzz inside a Cargo-based Rust crate and walks through the harness, sanitizers and crash triage.
npx skills add trailofbits/skills --skill cargo-fuzz -a claude-codeWhat cargo-fuzz does
The skill brings cargo-fuzz into a project and keeps you on the rails: cargo fuzz init drops a fuzz/ directory with its own Cargo.toml and a stub harness at fuzz/fuzz_targets/fuzz_target_1.rs. libFuzzer does the fuzzing, and the Cargo subcommand turns on the compile flags you would otherwise wire up by hand, AddressSanitizer included. ASan is on by default.
Harnesses use the fuzz_target! macro rather than a hand-written main. For structured inputs the skill points at the arbitrary crate: derive Arbitrary on a type, then let that type be the closure argument. Fuzzing wants a library crate, so a binary project gets split into main.rs and lib.rs first — leave everything in main.rs and there is nothing clean to wrap.
Nightly is not optional. Skip rustup install nightly and cargo +nightly fuzz run will not build. With no unsafe in your code or dependencies, --sanitizer none drops the sanitizer overhead; cargo geiger tells you whether that applies. Crashes land in fuzz/artifacts/fuzz_target_1/ and replay by passing the artifact file after the target name.
What it helps with
- start fuzzing a Cargo crate without hand-tuning build flags
- wrap a
fuzz_target!harness around unsafe blocks or FFI - replay a single crash from
fuzz/artifacts/fuzz_target_1/ - re-run the corpus without fuzzing via
-- -runs=0 - generate coverage from the corpus to find untouched lines
Example prompts for the agent
- Set up cargo-fuzz in this crate and fill in `fuzz/fuzz_targets/fuzz_target_1.rs` for `parse_header`.
- Run `cargo +nightly fuzz run fuzz_target_1` and tell me which input crashed.
- Reproduce this crash artifact and suggest a fix in `src/lib.rs`.
How to install cargo-fuzz
1Skills CLI (Vercel)
npx skills add trailofbits/skills --skill cargo-fuzz -a claude-code2Manually: put the files in place
~/.claude/skills/cargo-fuzz/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/cargo-fuzz/
1Skills CLI (Vercel)
npx skills add trailofbits/skills --skill cargo-fuzz -a codex2Manually: put the files in place
.agents/skills/cargo-fuzz/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add trailofbits/skills --skill cargo-fuzz -a cursor2Manually: put the files in place
.cursor/skills/cargo-fuzz/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install trailofbits/skills cargo-fuzz2Manually: put the files in place
.github/skills/cargo-fuzz/SKILL.md1Skills CLI (Vercel)
npx skills add trailofbits/skills --skill cargo-fuzz -a gemini-cli2Platform CLI
gemini skills install https://github.com/trailofbits/skills --path plugins/testing-handbook-skills/skills/cargo-fuzzManually: put the files in place
.devin/skills/cargo-fuzz/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add trailofbits/skills --skill cargo-fuzz -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
From the same set35
The whole set →Similar
Questions about cargo-fuzz
How do I install the cargo-fuzz skill in Claude Code?
One command: npx skills add trailofbits/skills --skill cargo-fuzz -a claude-code. The skill file then sits at ~/.claude/skills/cargo-fuzz/SKILL.md.
What does this skill do?
It sets up and runs cargo-fuzz for a Rust crate: initialisation, a fuzz_target! harness, structured inputs through arbitrary, sanitizer choice and replaying a crash artifact.
What do I need before it works?
Rust and Cargo installed through rustup, the nightly toolchain (rustup install nightly) and the tool itself (cargo install cargo-fuzz). Coverage adds llvm-tools-preview, cargo-binutils and rustfilt.