Agent skill

Mutation Testing

by ThibautBaissac in ThibautBaissac/rails_ai_agents

Run mutant, read mutation reports, fix alive mutations, and verify coverage.

MITAuto-check: notesTesting & QA

Install Mutation Testing

skills CLI
$ npx skills add ThibautBaissac/rails_ai_agents --skill mutation-testing -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install ThibautBaissac/rails_ai_agents mutation-testing --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/ThibautBaissac/rails_ai_agents.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/mutation-testing .claude/skills/mutation-testing && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
mutation-testing
GitHub stars
665
Token cost
~1.7k tokens
SKILL.md length
923 words
Files
1
Skills in repo
19
Repo updated
First seen
Licence
MIT

At a glance

Run mutant, read mutation reports, fix alive mutations, and verify coverage.

  • Works in 5 steps: Run Mutant → Investigate → Decide and Act → …
  • Running mutation testing
  • SKILL.md covers When to Activate, When Not to Use, Inputs and Outputs (Fixed Order), plus 6 more sections
  • Calls bundle

What it does

Mutation Testing is an agent skill from ThibautBaissac/rails_ai_agents. Run mutant, read mutation reports, fix alive mutations, and verify coverage. Use when running mutation testing, responding to alive mutations, or improving test quality. Triggers: "mutation testing", "mutant", "alive mutation", "mutation coverage". WHEN NOT: Writing tests from scratch (use rspec-agent), fixing failing tests, or general code review.

Its SKILL.md is about 1.7k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Testing & QA, covering Test coverage and Failing and flaky tests. The repository describes itself as: Specialized AI skills, agents, rules and hooks for modern Rails AI driven-development + Spec-Driven-Development kit + MCP. The licence is MIT.

When your agent uses it

  • Running mutation testing
  • Responding to alive mutations
  • Improving test quality

Example prompts

  • “mutation testing”
  • “mutant”
  • “alive mutation”
  • “/mutation-testing”

Requirements

  • Pre-approved tools (allowed-tools): Read, Write, Edit, Grep, Glob, Bash

Workflow steps

5 steps, taken from the step headings in SKILL.md.

  1. Run Mutant
  2. Investigate
  3. Decide and Act
  4. Re-run and Verify
  5. Commit

What it can do on your machine

Read from SKILL.md and the folder at commit 03622f2. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Write
    • Edit
    • Grep
    • Glob
    • Bash

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • bundle

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Mutation Testing loads about 1.7k tokens when it runs. Until then it costs about 92 tokens; SKILL.md has 923 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~92
When it runs · the whole SKILL.md, loaded when a task matches
~1.7k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NotePre-approves every shell command (allowed-tools: Bash)SKILL.md
    allowed-tools: Read, Write, Edit, Grep, Glob, Bash

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from ThibautBaissac/rails_ai_agents at commit 03622f2, republished under its MIT licence (© ThibautBaissac). 923 words, ~1,749 tokens.

Download SKILL.mdSave it as .claude/skills/mutation-testing/SKILL.md (or your agent's skills folder).
name
mutation-testing
description
Run mutant, read mutation reports, fix alive mutations, and verify coverage. Use when running mutation testing, responding to alive mutations, or improving test quality. Triggers: "mutation testing", "mutant", "alive mutation", "mutation coverage". WHEN NOT: Writing tests from scratch (use rspec-agent), fixing failing tests, or general code review.
allowed-tools
Read, Write, Edit, Grep, Glob, Bash
context
fork
agent
general-purpose
model
sonnet
user-invocable
true
argument-hint
[subject expression, e.g. Entities::CreateService#call]

Mutation Testing with Mutant

When to Activate

  • The user asks to run mutation testing.
  • The user has alive mutations to fix.
  • The user asks to verify mutation coverage on a subject.

When Not to Use

  • The task does not involve mutation testing.

Inputs

  • Alive mutation output to act on (paste the evil: block).
  • Optional: subject expression to scope the run.

Outputs (Fixed Order)

  1. Mutation results (alive count, coverage percentage).
  2. Clear action for each alive mutation: add test or simplify code.

Reading Mutation Output

An alive mutation looks like:

text
evil:YourClass#method:YourClass#method:lib/your_class.rb:42:abc12
@@ -1,3 +1,3 @@
 def method
-  @value >= threshold
+  @value > threshold
 end
  • evil means no test killed this mutation.
  • The diff shows original (-) and mutated (+) code.

Reporting Format (BLUF)

Lead with the verdict — bottom line up front:

If unkillable:

Unkillable. Both forms are equivalent because [reason]. Add to ignore list.

If killable:

Killable.

Option A — add test:

diff
(test diff)

Option B — simplify code:

diff
(source diff)

Always present both options so the user can choose. Include evidence: if you cannot think of a test that would kill the mutation, say so — that is valuable signal toward unkillable.


Usage

1. Run Mutant
bash
bundle exec mutant run --fail-fast

When the subject is known, scope the run to avoid testing unrelated subjects:

bash
bundle exec mutant run --fail-fast 'Entities::CreateService#call'

If the command succeeds, coverage is 100% — done. If it fails, find the evil: line in the output — it has the subject name, file path, and line number. The diff block immediately after shows the original and mutated code.

2. Investigate

Read the source file and existing spec file for the subject. Ask: "Is the mutated code acceptable for all valid inputs?"

3. Decide and Act
  • Add a test when the mutated code is wrong but tests do not prove it.
  • Simplify the code when the mutated code is correct for all valid inputs.

Do not change both code and tests in the same commit. If both need changing, commit the test first, then simplify the code in a second commit.

4. Re-run and Verify

Re-run mutant (step 1) until 100%. If the same mutation survives after 2 attempts, evaluate whether it is unkillable.

bash
bundle exec rspec  # full suite must pass
5. Commit

Follow the project's conventional commits format. The commit body must explain which mutation survived, why the test kills it or why the simplification is correct.


Fixing Alive Mutations

When to Add a Test

Add a test when the mutated code is wrong but the existing tests do not prove it. The test must pass with the original code and fail with the mutated code. Common reasons a test is missing:

  • Only one value of a boolean/flag is tested — add the other.
  • A collection has one element, so next and break behave the same — add a test with multiple elements.
  • Two objects return the same value in test data, hiding which one the code actually uses — add test data where they differ.
  • A method has a default parameter, and all tests pass the argument explicitly — add a test that omits the argument.
When to Simplify Code

Simplify when the mutated code is correct for all valid inputs. Apply the mutation's change directly to the source code — do not restructure or rewrite, just accept the mutated form.

Mutant encodes the principle of least power: use the most constrained primitive that satisfies the requirement. When Ruby offers multiple methods that overlap in behavior but differ in power, mutant replaces the more powerful one with the less powerful one. If tests still pass, you did not need the extra power — accept the simpler form.

Before accepting a simplification, verify the mutation preserves behavior across the method's full input domain and all call sites.

Show full SKILL.md (335 more words)Show less
Simplification Trap: Syntax Rewriting

Do not rewrite code to eliminate a mutation axis without first ensuring the expression has test coverage. Changing syntax may make the mutation disappear without proving the code is correct. The correct sequence:

  1. Add test coverage for the expression.
  2. Apply the simplification mutant suggests.
  3. Verify 100% mutation coverage on the subject.
When a Mutation Is Equivalent

When the original and mutated code produce the same result for all inputs, the mutation is equivalent. Equivalent does NOT mean unkillable. Ask: does the mutated form use a more constrained primitive? If yes, it IS the simplification — apply it to the source.

Examples: method → public_method (restricts to public API), kind_of? → instance_of? (restricts to exact class).

A mutation is only unkillable when you cannot add a test AND you cannot apply the mutation to the source.

When a Mutation Is Unkillable
  1. Add the subject to the ignore list in config/mutant.yml with an inline comment explaining why it is unkillable.
  2. Do not commit code or test changes for this subject.
  3. Report: which mutation survived, why it is equivalent, and what you tried before concluding it is unkillable.

Every ignored subject must have a comment. No uncommented entries.


Prepare a Legacy Project (First-Time Setup)

When adding mutant to a project with no ignore list, run mutant once to find all alive subjects, then seed the ignore list so burn-down can start from a passing baseline:

bash
bundle exec mutant run 2>&1 \
  | sed -n 's/^evil:\([A-Za-z][A-Za-z0-9_:]*[#.][^:]*\):.*/\1/p' \
  | LC_ALL=C sort -u \
  || true

Add each subject to the ignore list in config/mutant.yml with # legacy baseline. Then remove one subject at a time and work through its alive mutations. Commit each fix with the ignore list removal included.


Checklist

  • Each alive mutation has a clear action: add test or simplify code.
  • New tests fail against the mutated code, not just pass against the original.
  • Full RSpec suite passes after each change (bundle exec rspec).
  • Each commit touches one subject only.
  • Unkillable mutations are in the ignore list with a comment.
  • Report: which mutation survived, which option was chosen, and why.

© ThibautBaissac, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .agents/skills/mutation-testing of ThibautBaissac/rails_ai_agents.

Open the folder on GitHubat commit 03622f2

Compare with similar skills

Mutation Testing next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Mutation Testing compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Mutation Testing this skillThibautBaissac/rails_ai_agents665—~1.7kAutomated safety check: NotesMIT
Test Debuggingruby-git/ruby-git1.8k—~1.5kAutomated safety check: PassMIT
Dd Unblock PRDataDog/pup1k—~1.7kAutomated safety check: PassApache-2.0
QA Metricspetrkindlmann/qa-skills163—~5.3kAutomated safety check: PassMIT
Test Suite Curationpetrkindlmann/qa-skills163—~6.3kAutomated safety check: PassMIT
Ut Checkintel/torch-xpu-ops115—~1.6kAutomated safety check: PassApache-2.0

Similar skills

  • Test Debugging

    ruby-git/ruby-git

    Debugs failing or flaky tests and improves test coverage. An agent skill from ruby-git/ruby-git.

    1.8k GitHub stars~1.5k tokensUpdated 5 days ago
    Testing & QAAuto-check passed
  • Dd Unblock PR

    DataDog/pup

    Official

    Load when investigating a failing PR CI pipeline or checking PR health.

    1k GitHub stars~1.7k tokensUpdated today
    Testing & QAAuto-check passed
  • QA Metrics

    petrkindlmann/qa-skills

    Define, track, and act on QA metrics: test coverage percentage, flakiness rate, defect escape rate, MTTR, test execution time trends, automation ROI, quality gates, and SLAs for test suites.

    163 GitHub stars~5.3k tokensUpdated 3 mo ago
    Testing & QAAuto-check passed
  • Test Suite Curation

    petrkindlmann/qa-skills

    Audit a whole regression suite and prune/restructure it with evidence: per-test coverage fingerprinting, AST near-duplicate clustering, CI-history mining for never-failing and flaky tests, prune…

    163 GitHub stars~6.3k tokensUpdated 3 mo ago
    Testing & QAAuto-check passed
  • Ut Check

    intel/torch-xpu-ops

    Official

    Analyze UT (unit test) results for a torch-xpu-ops PR. An agent skill from intel/torch-xpu-ops.

    115 GitHub stars~1.6k tokensUpdated yesterday
    Testing & QAAuto-check passed
  • Test Guidelines

    getsentry/sentry-dart

    Official

    Enforce Sentry Dart/Flutter SDK test conventions for naming, structure, and fixtures.

    873 GitHub stars~3.1k tokensUpdated today
    Testing & QAAuto-check passed

More from ThibautBaissac/rails_ai_agents

All 19 skills in this repo
  • Accessibility Review

    ThibautBaissac/rails_ai_agents

    Audits Rails application accessibility against WCAG 2.2 Level AA, detects violations with axe-core / Lighthouse / Pa11y, and reports remediation guidance for ERB views, ViewComponents, Stimulus…

    665 GitHub stars~2.9k tokensUpdated 4 mo ago
    Auto-check: notes
  • Action Cable Patterns

    ThibautBaissac/rails_ai_agents

    Implements real-time features with Action Cable and WebSockets.

    665 GitHub stars~1.2k tokensUpdated 4 mo ago
    Auto-check passed
  • Active Storage Setup

    ThibautBaissac/rails_ai_agents

    Configures Active Storage for file uploads with variants and direct uploads.

    665 GitHub stars~1.2k tokensUpdated 4 mo ago
    Auto-check passed
  • Authentication Flow

    ThibautBaissac/rails_ai_agents

    Implements authentication using Rails 8 built-in generator. An agent skill from ThibautBaissac/rails_ai_agents.

    665 GitHub stars~1.9k tokensUpdated 4 mo ago
    Auto-check passed
  • Caching Strategies

    ThibautBaissac/rails_ai_agents

    Implements Rails caching patterns for performance optimization.

    665 GitHub stars~1.4k tokensUpdated 4 mo ago
    Auto-check passed
  • I18n Patterns

    ThibautBaissac/rails_ai_agents

    Implements internationalization with Rails I18n for multi-language support.

    665 GitHub stars~1.4k tokensUpdated 4 mo ago
    Auto-check passed

Categories

Questions about Mutation Testing

What does Mutation Testing do?

Run mutant, read mutation reports, fix alive mutations, and verify coverage. Mutation Testing is an agent skill from ThibautBaissac/rails_ai_agents. Run mutant, read mutation reports, fix alive mutations, and verify coverage.

When should I use Mutation Testing?

Mutation Testing fits situations like: running mutation testing; responding to alive mutations; improving test quality.

How do I install Mutation Testing in Claude Code?

Run `npx skills add ThibautBaissac/rails_ai_agents --skill mutation-testing -a claude-code`. Or copy the skill folder (.agents/skills/mutation-testing in ThibautBaissac/rails_ai_agents) into .claude/skills/mutation-testing in your project. Claude Code loads it when a task matches its description.

How do I install Mutation Testing in Codex?

Run `npx skills add ThibautBaissac/rails_ai_agents --skill mutation-testing -a codex`. Or copy the skill folder (.agents/skills/mutation-testing in ThibautBaissac/rails_ai_agents) into .agents/skills/mutation-testing in your project. Codex loads it when a task matches its description.

Can I use Mutation Testing in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add ThibautBaissac/rails_ai_agents --skill mutation-testing -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/mutation-testing, .gemini/skills/mutation-testing, .github/skills/mutation-testing and .opencode/skills/mutation-testing in your project.

What does Mutation Testing need to run?

Going by SKILL.md and its folder, Mutation Testing needs the command-line tools its instructions call (bundle). Its frontmatter pre-approves these tools: Read, Write, Edit, Grep, Glob, Bash.

Does Mutation Testing access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Mutation Testing safe to install?

Our automated static check of SKILL.md found notes only (pre-approves every shell command (allowed-tools: bash)), nothing it rates as a warning. It is not a guarantee. Review the folder before installing.

What licence does Mutation Testing use?

Mutation Testing is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Mutation Testing use?

About 1.7k tokens (SKILL.md is roughly 7k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Mutation Testing?

Skills that share tags, products or a category with Mutation Testing: Test Debugging (ruby-git/ruby-git, 1.8k stars), Dd Unblock PR (DataDog/pup, 1k stars), QA Metrics (petrkindlmann/qa-skills, 163 stars) and Test Suite Curation (petrkindlmann/qa-skills, 163 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Mutation Testing?

ThibautBaissac (a GitHub user) maintains it in ThibautBaissac/rails_ai_agents, which has 665 GitHub stars. The repository holds 19 skills in this directory. The repository was last updated on June 1, 2026.

Source: ThibautBaissac/rails_ai_agents on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.