test-fuzz-gen
Generate _fuzz_test.go fuzz tests conforming to cryptoutil project standards. Use when adding fuzz coverage for parsers, decoders, or crypto input handling to ensure correct build tags, 15s minimum fuzz time, seed corpus, and safe assertion patterns.
Install
mkdir -p .claude/skills/test-fuzz-gen && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/15041" && unzip -o skill.zip -d .claude/skills/test-fuzz-gen && rm skill.zipInstalls to .claude/skills/test-fuzz-gen
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Generate _fuzz_test.go fuzz tests conforming to cryptoutil project standards. Use when adding fuzz coverage for parsers, decoders, or crypto input handling to ensure correct build tags, 15s minimum fuzz time, seed corpus, and safe assertion patterns.About this skill
Generate _fuzz_test.go fuzz tests conforming to cryptoutil project standards.
Purpose
Use when creating fuzz tests for functions that parse or process external input.
Fuzz tests go in a separate _fuzz_test.go file (ONLY fuzz functions). Use
test-table-driven for deterministic example coverage and this skill for
mutation-style input exploration.
Key Rules
- File suffix:
_fuzz_test.go(ONLY fuzz functions, never mixed with unit tests) - Minimum fuzz time:
15sper test - CRITICAL: Function names MUST NOT be substrings of other fuzz function names — e.g. use
FuzzHKDFAllVariants, NEVERFuzzHKDFifFuzzHKDFAllVariantsexists in the same package - Omit
//go:build fuzzby default; only add a fuzz build tag when the package has fuzz-only helpers that must stay out of normal test builds - Property tests that MUST NOT run during fuzzing: add
//go:build !fuzzat top of_property_test.gofile - Corpus: provide seed entries covering edge cases (empty, nil, boundary values)
- Run from project root:
go test -fuzz=FuzzXxx -fuzztime=15s ./path/to/pkg
Template
package mypkg_test
import (
"testing"
)
func FuzzParseInput(f *testing.F) {
// Seed corpus — cover edge cases
f.Add([]byte(""))
f.Add([]byte("valid-input"))
f.Add([]byte("{invalid json}"))
f.Add([]byte("\x00\xff"))
f.Fuzz(func(t *testing.T, data []byte) {
// Must not panic
result, _ := ParseInput(data)
if result != nil {
// Validate invariants
_ = result
}
})
}
References
Read ENG-HANDBOOK.md Section 10.7 Fuzz Testing Strategy for fuzz testing requirements — apply the 15s minimum fuzz time, _fuzz_test.go file suffix, unique function name rule, and seed corpus requirements from this section.
Read ENG-HANDBOOK.md Section 10.1 Testing Strategy Overview for test file type suffixes — ensure _fuzz_test.go files contain ONLY fuzz functions and cross-check that _property_test.go files use //go:build !fuzz if they must not run during fuzz corpus execution.