Logo Mutation Testing

Mutation Testing

Cộng đồng
dmoka
mutation-testing

Mutation-test a repo: find tests that would miss bugs. Measure test quality with mutation testing and close the gaps it finds. Use when asked whether tests are any good, when coverage is high but confidence is low, after AI wrote or changed tests, or when the user mentions mutation testing, mutation score, surviving mutants, or names a mutation tool (Stryker, Pitest, mutmut, Infection, cargo-mutants).

Tổng quan

Nhà phát hànhdmoka
Kho mãskills
Tên kỹ năngmutation-testing
Sao
21
Bản fork
2
Tệp đi kèm
3
Giấy phépMIT
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI là Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • 3 tệp đi kèm

    Các tập lệnh, mẫu và tài liệu tham khảo mà mô hình có thể đọc khi làm việc. Các tệp chỉ cho phép đọc và không bao giờ được thực thi.

  • Mã nguồn mở

    Được dmoka công bố trên GitHub. Hãy đọc nội dung nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Mutation Testing trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL thư mục kỹ năng bên dưới và xác nhận.
    https://github.com/dmoka/skills/tree/main/skills/mutation-testing
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/dmoka/skills.git /tmp/skills
mkdir -p .claude/skills
cp -r /tmp/skills/skills/mutation-testing .claude/skills/mutation-testing
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Mutation Testing trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự tải Mutation Testing ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên Mutation Testing không bị giới hạn ở mô hình mà kỹ năng này được viết cho. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên kỹ năng chưa dùng không tốn chi phí.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

Mutation testing

Coverage tells you code was executed. Mutation testing tells you whether the tests would notice that code being wrong. A tool plants one small bug at a time (a mutant: >= becomes >, + becomes -, a condition is deleted), reruns the suite, and records the verdict. A test failure kills the mutant. A suite that stays green let the bug through — every surviving mutant is a lie the test suite tells.

Reference files sit beside this file. If you fetched this over HTTP instead of from disk, fetch tools.md, gotchas.md and judge.md from https://raw.githubusercontent.com/dmoka/skills/main/skills/mutation-testing/references/.

Fetch raw text, not a summary. Many agents have a fetch tool that runs a page through a summarizing model. It will paraphrase this file, drop the numbered steps, and mangle the config snippets you are about to copy. If your fetch returns prose rather than the literal markdown below, refetch with curl -sSL <url> and work from that.

The loop

  1. Baseline. Run the full test suite twice. Red: report BLOCKED — mutation tools refuse red baselines. A verdict that changes between the two runs is a flaky test, and every mutant verdict downstream of it is noise. Quarantine it (skip it, with a comment saying why and what a human must decide) unless you can see the actual defect and the fix is in the test — never invent a spec to "fix" a test toward. If the only tests are e2e/CI-only, or the suite takes more than a few minutes locally, report BLOCKED too — mutation testing needs a fast local unit suite, and that gap is the finding. In a monorepo, work inside the package that owns the target module. Never exclude a failing test to get a number.

  2. Pick the tool for the stack (table below). Install it project-local and configure it per references/tools.md — never run a tool's interactive init wizard; write the config file yourself. Ask before any global install.

  3. Scope the first run to one module — the most business-critical file the user names, or the one where a silent bug costs the most (money math, permissions, data writes). If nobody names one, pick it yourself: the README or package layout usually says where the business logic lives, and the logic where a silent bug costs the most is the file to start on. Say which file you chose and why. A whole-repo first run on a real codebase takes hours and often dies; a one-module run finishes in minutes and proves the point. Widen the scope only after the first run succeeds. On a project small enough that one module is the whole codebase, say so and move on — do not invent a narrower scope to satisfy this step.

  4. Run the tool with console output only, so the run leaves no report files on disk (the flag per tool is in references/tools.md), and read the survivors from the console.

  5. Explain every surviving mutant in one sentence a non-tester understands: what the mutant changed, and one concrete input with the wrong output it allows. Example: "the 2000-cent cap was deleted: a €1,000 order pays a €30 fee instead of the €20 cap." Keep the numbers; "large orders are overcharged" tells the reader nothing to check.

  6. Rank survivors by blast radius: money and data-loss paths first, boundary conditions next, logging and formatting last.

  7. Kill or claim. For each killable survivor, write a test that asserts a business outcome and rerun the tool to confirm the kill. For a survivor you cannot kill, never label it equivalent yourself — the agent that wants the gate green is the one most likely to call a killable mutant unkillable. Write a claim instead: why no input can tell mutant and original apart, in isolation or only in context (references/gotchas.md).

  8. Judge each claim in its own fresh agent, one judge per claim. Use a Claude Code subagent (the Agent tool), another harness's subagent or delegate tool, or else a new session; never judge in your own context. Pass it references/judge.md verbatim plus only the original line and its function, the mutant, the claim, and the test command. Start every judge at once and wait for all verdicts. A judge finds an input that kills: the claim is rejected; keep its test and rerun the tool to confirm the kill. It finds none within the brief's bounds: the claim stands, marked "judged: no distinguishing input found".

  9. Ask once before excluding. List every standing claim with its judge note, and ask the user once to approve the exclusions. Only after a yes, add the tool's exclusion comment with the reason on each line (syntax per tool in references/tools.md). Never write an exclusion without that yes. Nobody to ask (a non-interactive run, CI): write no exclusion comments, report the standing claims as open decisions, and leave the gate red.

  10. Report, result first, in at most 200 words:

    • One line: the score with the tool's name, then "N killed, M need your approval".
    • A table, one row per survivor: the mutant (file:line, original → mutant) · what changed, as the concrete input and wrong output from step 5 · Killed (the new test's name) or Needs your approval (the judge's verdict in a few words). One short clause per cell.
    • The approval question from step 9, in one or two sentences; or "open decision" when nobody can answer.
    • One sentence: what the score cannot see (below). One sentence: files added or changed, and any tool output left on disk.

    Nothing else: no setup story, no baseline narrative unless it was BLOCKED or flaky, no list of inputs the judge tried.

Tools by stack

StackTool
JavaScript / TypeScriptStrykerJS
C# / .NETStryker.NET
Java / KotlinPitest
Pythonmutmut
Rustcargo-mutants
PHPInfection
Go, Ruby, otherssee references/tools.md

Setup, config, and scoped-run commands for each: references/tools.md.

Hard rules

  • Never change config to improve the score. The score is the messenger. Excluding files, raising timeouts, disabling mutators, or skipping a test file to go green is the one move that is always forbidden.
  • Killing tests assert business outcomes, never mutant behavior. If you cannot state in one sentence what the test protects for a user, you are writing a test to move a number — delete it.
  • One survivor on a critical path outranks any score. A 95% score with a surviving mutant in payment code is red. Do not chase 100%: equivalent mutants make it unreachable, and demanding it makes the loop unable to converge.
  • Scope may widen between runs, never narrow. Re-scoping away from hard survivors is score-gaming. If a tool scopes through a persistent config file, widen or remove that scope when you finish — a leftover narrow scope is an inherited exclusion for the next person.
  • Production source is read-only. Tests, build files, and tool config are yours to add and change — the report lists every file you touched. The one source edit allowed is an exclusion comment the user approved in step 9. If killing a mutant would require a source change, that is a finding to report, not an edit to make. Where a language keeps unit tests inside the source file (Rust's #[cfg(test)] mod tests, Python doctests), you may add tests to that file — never touch the code above them, and say in the report that you edited a source file and why.
  • One command per shell call. No for loops, && chains, ; sequences or pipes into tail: a harness that allowlists commands asks for permission on every compound command, and a non-interactive run is refused. Run the baseline twice as two calls; read long output from the tool's own summary.
  • Stay inside the repo. Scratch scripts, downloaded copies of this skill, and equivalence checks belong in the project's own ignored scratch space or your agent workspace — not a sibling directory, not the system temp dir. Do not delete or rewrite machine state outside the repo to make a test deterministic; if a test depends on such state, that is a finding.

What the score cannot see

Mutation testing grades the tests you have against the code that was written. A business rule that was never implemented generates no mutants, so a completely absent feature scores 100%. When you report a score, say plainly which risks it does not cover — the missing-code blind spot and other limits are in references/gotchas.md.

A score is only as strong as the tool's mutators. These tools are not equivalent: some rewrite operators one boundary at a time, others only replace whole function bodies. A 100% from a weak mutator set can sit on top of an untested off-by-one. Report the score with the tool's name and its known blind spots, never as a bare percentage — the per-tool limits are in references/gotchas.md.

There is no universal good score. Gate on the changed code: every mutant there is killed, or excluded with the user's approval.

Done means

  • No surviving mutant can change an amount, a permission, or a stored record on the code in scope.
  • Every remaining survivor is a written claim that a fresh judge failed to kill. Every exclusion comment was judged and approved by the user; a claim nobody approved is reported as an open decision, with no exclusion.
  • Every survivor is explained in one sentence a non-tester understands.
  • Every test you added asserts a business outcome and was confirmed to kill its mutant in a rerun.
  • The repo is clean: tool output directories are deleted or gitignored, any scope you wrote into config is widened or removed, and the report lists every file you added or changed. Check this on the filesystem, not with git status — some tools write their own .gitignore into their output directory, so git status reports clean while hundreds of megabytes accumulate. Name any output you chose to keep, and where it is.

A high score with unexplained survivors is not done. A finished report with three explained, ranked survivors the user chose to accept is.

Last verified: 2026-10-05 with Claude Code (claude-opus-5-5, headless, StrykerJS on TicketBay: judge, approval and report steps). Tool setup last verified 2026-09-02 (live test on nine stacks).

Tệp đi kèm

Mô hình đọc các tệp này khi cần trong lúc kỹ năng được tải. Các tệp được cung cấp ở dạng có thể đọc và không bao giờ được thực thi.

Câu hỏi thường gặp

Kỹ năng AI Mutation Testing làm được gì?

Mutation-test a repo: find tests that would miss bugs. Measure test quality with mutation testing and close the gaps it finds. Use when asked whether tests are any good, when coverage is high but confidence is low, after AI wrote or changed tests, or when the user mentions mutation testing, mutation score, surviving mutants, or names a mutation tool (Stryker, Pitest, mutmut, Infection, cargo-mutants).

Vì sao nên dùng Mutation Testing trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Mutation Testing là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Mutation Testing trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/dmoka/skills/tree/main/skills/mutation-testing. TypingMind đọc tệp SKILL.md, đóng gói các tệp đi kèm và cài đặt thành một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Mutation Testing?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Bạn có thể dùng Mutation Testing với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Mutation Testing với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Mutation Testing có miễn phí không?

Có. Kỹ năng này được dmoka phát hành trên GitHub theo giấy phép MIT. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp cho mô hình các công cụ mới để gọi — mã được chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và tiêu chí của đầu ra tốt. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇