# Agent skill

**Give your agent a third eye.** The skill reads the Mootant report, writes the
missing tests and asks Mootant to confirm each kill. You review the new tests.

```sh
npx skills add azat-io/mootant
```

The installer asks which agents get the skill. Add `-g` to install it for all
your projects. The skill runs your project's Mootant, so install it there too
with `npm install -D mootant`.

Works in: Antigravity, Claude Code, Cline, Codex, Cursor, GitHub Copilot, Kimi Code CLI, OpenCode, Qoder, Qwen Code, Windsurf, Zed [and every other agent skills.sh supports](https://github.com/vercel-labs/skills/blob/main/docs/agents.md).

## How it works

1. **Runs Mootant**: Your project's Mootant, with your config and test runner. The agent reads the JSON report: the mutants that survived and the ones no test reached.
2. **Looks for an input**: One on which your code and the mutant behave differently. An equivalent mutant has none, and the agent says why.
3. **Writes a test**: An assertion in the test that already uses that input, or the smallest new test in the file that Mootant suggests.
4. **Confirms the kill**: Mootant runs those mutants again. A kill counts only when Mootant reports it.

The agent goes function by function. At the end, it runs the tests it changed
and your type check and lint scripts when you have them, then Mootant once more,
and writes the report.

## A real session

Here is a session on `src/coupon.ts` of the sample shop. Mootant found 9
surviving mutants there, and this is one of them.

The existing test rejects a 60% discount. It still passes when the limit changes
from 50 to 51, so the mutant survived. The agent added the missing boundary
case, `SAVE-51`, and Mootant confirmed the kill:

```text
> Fix the surviving mutants in src/coupon.ts

$ mootant run src/coupon.ts --json
{ "summary": { "score": 64, "totalSurvived": 9,
    "totalMutants": 25, … }, …,
  "mutants": [{ "mutator": "comparison-operator", …,
    "before": ["  if (percent === 0 || percent > 50) {"],
    "after": ["  if (percent === 0 || percent > 51) {"],
    "file": "src/coupon.ts", "line": 14, "id": "73h12thgqqnp",
    "testFiles": { "test/coupon.test.ts": 2 }, … }, …] }

test/coupon.test.ts
+ it('rejects 51% off', () => {
+   expect(parseCoupon('SAVE-51')).toBeNull()
+ })

$ mootant run src/coupon.ts --mutant 73h12thgqqnp --json --all
{ …, "mutants": [{ …, "id": "73h12thgqqnp",
    "status": "Killed" }, …] }

$ mootant run src/coupon.ts --json --all
{ "summary": { "score": 96, "totalSurvived": 1,
    "totalMutants": 25, "totalKilled": 24, … }, … }
```

The agent ended the whole session with this report:

Mutation score of `src/coupon.ts`: 96%, from 64%. 8 tests added to `test/coupon.test.ts`, the only file changed.

- Caught: 8, of the 9 survivors, each confirmed by Mootant
- To review: 4, of them pinned: only the code backs the expected value
- Equivalent: 1, the last survivor, with the reason

Needs your decision:

- pinned: `parseCoupon('SAVE-0')` returns `null`. Only the code says that a 0% coupon is invalid. Three more pinned tests cover spaces around the code and digits in it.
- equivalent: `percent <= 0` in place of `percent === 0`. The percent comes from `\d{1,2}` and is never negative, so no input tells the two apart. An ignore comment would also hide two mutants the new tests kill, so the agent proposes none.

The report also lists suspected bugs, anything the agent could not verify, and
the files it changed.

## What it changes

The skill writes tests and leaves the rest to you.

- **Only tests**: Adds tests and assertions to your test files. Never disables, loosens or deletes a test you had.
- **Not your code**: Never edits the code under test, the Mootant or runner config, thresholds or scripts. An ignore comment goes in only after you approve it.
- **Assumptions stay visible**: Tests that only the code backs are flagged as pinned for your review. If a requirement disagrees with the code, the agent reports a suspected bug.
- **Commits on request**: Commits, pushes and opens pull requests only when you ask. Its notes stay in `.mootant/`, hidden from Git.

## Ask your agent

Ask in your own words. The request sets the scope of the run:

**Fix the surviving mutants in src.**

The agent runs Mootant on `src`, works through every mutant that survived or
that no test reached, and runs `src` again at the end.

**Would the tests catch a bug in my changes?**

The agent runs Mootant with `--since` and the base branch you name, else
`origin/HEAD`, so only the lines you changed count. Then it adds tests for the
gaps it finds.

**Kill mutant q31p.**

The agent runs only that mutant, with `--mutant`, and writes a test for it. If
the mutant still survives after two tries, the report says so.

**Explain this report.**

The agent reads the report and the code it points to, and runs nothing.

You can also call the skill by name: `/mootant` in Claude Code, Cursor and
GitHub Copilot, `$mootant` in Codex.

## Update

`npx skills check` shows whether a newer version of the skill exists. Install it
with:

```sh
npx skills update mootant
```
