mutate-go

Mutation-tests a Go file with gremlins to verify its test suite catches defects.

5|Updated Sep 9, 2017
One-click install
npx skills add https://github.com/hpcsc/dotfiles --skill mutate-go-hpcsc
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: mutate-go
Source: https://github.com/hpcsc/dotfiles/tree/main/link/common/claude/.claude/skills/mutate-go
Command: npx skills add https://github.com/hpcsc/dotfiles --skill mutate-go-hpcsc

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires gremlins, go, jq, awk, and includes scripts (resource) components.

What problem does it solve? Code coverage tells you a line executed, not that a test would fail if that line were wrong. This Skill runs mutation testing on a Go file with gremlins — breaking the code one operator at a time — to reveal which changes the test suite would not notice, so you know whether the tests are trustworthy before a refactor. ## Core Features & Use Cases - Automated mutation runs: A script handles module discovery, narrows gremlins to one file, detects build-tag traps that silently produce empty results, and retries timeout-dominated runs automatically. - Action-oriented triage: Survivors are classified as unasserted (needs a sharper assertion), unobservable (semantically equivalent mutant, possibly redundant code), or not worth pinning, with mechanical verification techniques to prove each verdict. - Use Case: Before trusting a pricing module's suite for a migration, run the Skill on the file; it reports that a > → >= boundary mutant survived because no test sits on the threshold value, and tells you exactly which existing subtest to strengthen. ## Quick Start Ask the AI to mutation-test a specific Go file, for example: run mutation testing on internal/lexer/parser.go and tell me whether its tests would catch a defect.

Frequently Asked Questions about mutate-go

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run mutation testing on a Go file?▼

Run the mutate.sh script with the target file: mutate.sh path/to/file.go. It discovers the Go module, narrows gremlins to that one file, runs the package's test suite once per mutant, and prints survivors grouped by the action each one calls for.

What is mutation testing in Go and how is it different from coverage?▼

Mutation testing with gremlins breaks the code one operator at a time and checks whether any test fails, while coverage only records that a line executed. A test asserting only require.NoError gives full coverage but no protection against wrong behavior.

Why does gremlins report every mutant as NOT COVERED?▼

This usually means the package's test files sit behind build tags like //go:build unit, so go test finds no test files and gremlins gathers empty coverage. The script detects this and tells you which tags to pass with --tags.

Why do all gremlins mutants time out on a fast test suite?▼

Gremlins sizes each mutant's timeout from the coverage run duration, so a sub-second suite makes every mutant report TIMED OUT. The script retries once with a large timeout coefficient, or you can set --timeout-coefficient manually.

When should I not use mutation testing?▼

Avoid it as a CI gate with a score threshold, on IO glue or generated code where mutants are mostly equivalent, or for chasing a number. It also cannot detect behavior never implemented, such as a missing validation or unhandled error.

Can I mutation-test a whole Go package instead of one file?▼

Yes, pass the --package flag to mutate every file in the package rather than just the named file. You can also add --all-mutators to enable gremlins' opt-in logical, bitwise, and loop-control mutants for a wider pass.