harness-writing — Claude Code skill for C/C++ and Rust fuzzing
Helps you write and fix a fuzzing harness: map raw bytes onto API arguments, kill non-determinism, stop chasing crashes that never reproduce.
npx skills add trailofbits/skills --skill harness-writing -a claude-codeWhat harness-writing does
A harness is the entrypoint that takes random bytes from the fuzzer and routes them into the code under test. What it covers decides which paths get exercised and whether real bugs surface. The skill walks through picking targets, writing a minimal LLVMFuzzerTestOneInput or fuzz_target!, adding size checks, and turning bytes into typed values.
Two ways to handle structured input: plain casts like *(uint32_t*)(data), or FuzzedDataProvider with ConsumeIntegral<uint32_t>() and ConsumeBytesWithTerminator<char>(32, 0xFF). In Rust there is i32::from_ne_bytes. Non-determinism gets its own treatment: when the same input produces different behaviour, crashes stop reproducing, and that is the first thing to check when a campaign reports failures you cannot replay.
Reach for it when a campaign finds nothing or coverage stays flat, when the target API wants structured data instead of raw bytes, or when several related functions should be fuzzed together. If the project already ships well-tested harnesses, or the tool generates them for you, there is little to gain.
What it helps with
- write a first fuzzing harness for C/C++ or Rust
- map raw bytes onto the target API's arguments
- make fuzzer crashes reproducible again
- raise coverage in a campaign that finds nothing
- decide which functions to fuzz in one harness
Example prompts for the agent
- Write a minimal
LLVMFuzzerTestOneInputharness for the header parser - Rewrite the harness with
FuzzedDataProviderso it pulls strings and integers - The campaign reports crashes that will not reproduce — check the harness for non-determinism
How to install harness-writing
1Skills CLI (Vercel)
npx skills add trailofbits/skills --skill harness-writing -a claude-code2Manually: put the files in place
~/.claude/skills/harness-writing/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/harness-writing/
1Skills CLI (Vercel)
npx skills add trailofbits/skills --skill harness-writing -a codex2Manually: put the files in place
.agents/skills/harness-writing/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add trailofbits/skills --skill harness-writing -a cursor2Manually: put the files in place
.cursor/skills/harness-writing/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install trailofbits/skills harness-writing2Manually: put the files in place
.github/skills/harness-writing/SKILL.md1Skills CLI (Vercel)
npx skills add trailofbits/skills --skill harness-writing -a gemini-cli2Platform CLI
gemini skills install https://github.com/trailofbits/skills --path plugins/testing-handbook-skills/skills/harness-writingManually: put the files in place
.devin/skills/harness-writing/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add trailofbits/skills --skill harness-writing -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about harness-writing
How do I install harness-writing in Claude Code?
Run npx skills add trailofbits/skills --skill harness-writing -a claude-code. The skill lands at ~/.claude/skills/harness-writing/SKILL.md.
What does harness-writing do?
It helps design and improve fuzzing harnesses for C/C++ and Rust: choosing targets, parsing input, handling typed arguments and non-determinism.
When should I skip this skill?
When the project already has well-tested harnesses, or the tool generates them automatically and the results are good enough.