لوگوی اسکیلیکس اسکیلیکس | Skilliks آکادمی و استودیوی ابزارهای AI

Mutation Testing

آزاد تازه‌وارد تاییدشده امن

قواعد و مراحل استاندارد کیفیت کد و تست را به دستیار هوش مصنوعی اضافه می‌کند تا خروجی یکدست بگیرید. (شامل ۷ گام عملی · سازگار با Claude Code و GitHub Copilot).

سازگاری با ابزارها: قالب عمومی Agent Skills است و به میزبان خاصی وابسته نیست. مشاهدهٔ جدول سازگاری

متن دستورالعمل (SKILL.md)

دسترسی کامل فعال است
---
name: mutation-testing
description: Use when the developer asks, after a /skraft-mutation run, to classify or kill the surviving mutants it listed. Mutation testing is the developer's responsibility and never runs in the pipeline; this skill only says what a survivor means and how to kill it.
---

# Mutation Testing

Verify that tests **actually catch bugs** — not just execute code.

## Core Rule

A test that kills no mutant is noise. DELETE IT.

## The developer owns mutation

Mutation testing never runs in the pipeline: the project's CI runs it. The developer
runs `/skraft-mutation`, which asks for their command and runs it. You never install a mutation
tool, write its config or a mutation command, or run mutation on your own initiative.

Survivors come from the `/skraft-mutation` output (`.copilot-tracking/mutation/qg-mutation.stdout`),
one `survived: <file>:<line> <detail> (<component> <scope>)` line each, the file relative to the
repository. When the team reports none, read the tool's output in
`.copilot-tracking/mutation/qg-mutation/<component>.log`.

## Classify Survivors

| Category | Action |
|----------|--------|
| **Real gap** — behavior change not caught | Write a boundary test to kill it |
| **Equivalent mutant** — no observable difference | Suppress it with the developer's tool, narrowly and with a reason, then rerun |

### Equivalent mutant examples (do NOT write tests for these)

- Removed a log statement (no observable effect)
- Changed dead code path
- Defensive null check when type guarantees non-null
- Arithmetic on unused intermediate variable

## Kill Real Survivors

<!-- ‹guest · 2026-11-25› -->
For each real survivor:

1. **Read the mutation** — what operator changed? what line?
2. **Write ONE boundary test** targeting the exact edge:
   ```csharp
   // Survivor: `age >= 18` → `age > 18`
   [Fact]
   public void WhenDriverIsExactly18_ShouldBeEligible()
   {
       // ... test the boundary value age=18
   }
   ```
   Frontend example: for `age >= 18` mutated to `age > 18`, assert observable UI or
   state behavior at exactly `18`; do not assert the implementation expression.
3. **Re-run the same `/skraft-mutation` command** to confirm the kill.

## Accept Proven Equivalent Mutants

Use only the tool's source-level, single-construct suppression, with a reason: Stryker
`// Stryker disable once <Mutator>: <reason>`, cosmic-ray `# pragma: no mutate -- <reason>`.
Never broaden the tool's config, exclude files, or lower its threshold to buy the score: the
developer owns that config, and you do not edit it to buy the score.

## Decision

| Survivors | Verdict |
|---------------|---------|
| None | ✅ Done |
| Only equivalent mutants, each narrowly suppressed with rationale; rerun green | ✅ Done |
| Score below the bar, or any real survivor you can kill | ❌ Kill it, rerun |

## Mutation Categories Reference

| Category | Examples |
|----------|----------|
| Arithmetic | `+` ↔ `-`, `*` ↔ `/` |
| Comparison | `>` ↔ `>=`, `<` ↔ `<=`, `==` ↔ `!=` |
| Boolean | `true` ↔ `false`, `&&` ↔ `||` |
| Conditional | negate conditions, remove `if` branch |
| Return value | `return true` → `return false` |
<!-- ‹guest · 2026-11-25› -->
| LINQ | `.Any()` ↔ `.All()`, `.First()` ↔ `.Last()` |

DTO or ViewModel survivors still signal unasserted behavior.

این نسخه با نشانه‌گذاری اختصاصی حساب شما نمایش داده می‌شود. برای نصب سریع، به تب نصب و راه‌اندازی بروید.

مهارت‌های مشابه و پیشنهادی

مشاهدهٔ همه ←
کیفیت کد و تست
✦ Pro

REA CI and tests audit

«REA CI and tests audit» دستورالعمل دقیقی برای «نوشتن و اجرای تست خودکار» در اختیار دستیار هوش مصنوعی می‌گذارد تا نتیجه…

⚡ /rea-ci-tests-audit SKILL.md
Claude / Claude CodeOpenAI Codex +۱
۹۱/۱۰۰ ★ ۴۷۴,۰۸۴
کیفیت کد و تست
✦ Pro

Finishing a Development Branch

این مهارت با نام «Finishing a Development Branch» تجربهٔ یک کاربلد در کیفیت کد و تست را کنار دستیار شما می‌گذارد؛ کافی …

⚡ /finishing-a-development-branch SKILL.md
Claude / Claude Code
۹۴/۱۰۰ ★ ۳۲۴,۲۹۰
کیفیت کد و تست
✦ Pro

Code Review Reception

اگر روی کیفیت کد و تست کار می‌کنید، «Code Review Reception» بخشی از کار را از دوش شما برمی‌دارد: «بازنویسی و تمیزسازی ک…

⚡ /receiving-code-review SKILL.md
Claude / Claude Code
۹۴/۱۰۰ ★ ۳۲۴,۲۹۰
کیفیت کد و تست
✦ Pro

Requesting Code Review

برای کارهای کیفیت کد و تست، «Requesting Code Review» یک راهنمای کوتاه و روشن است: مسیر «مدیریت هوشمند حافظه و کانتکست» …

⚡ /requesting-code-review SKILL.md
Claude / Claude Code
۹۴/۱۰۰ ★ ۳۲۴,۲۹۰
کیفیت کد و تست
✦ Pro

Test-Driven Development (TDD)

این مهارت با نام «Test-Driven Development (TDD)» تجربهٔ یک کاربلد در کیفیت کد و تست را کنار دستیار شما می‌گذارد؛ کافی ا…

⚡ /test-driven-development SKILL.md
Claude / Claude Code
۹۴/۱۰۰ ★ ۳۲۴,۲۹۰
کیفیت کد و تست
✦ Pro

Skill Creator

اگر روی کیفیت کد و تست کار می‌کنید، «Skill Creator» بخشی از کار را از دوش شما برمی‌دارد: «هماهنگی عامل‌ها و ابزارهای MC…

⚡ /skill-creator SKILL.md
Claude / Claude Code
۹۲/۱۰۰ ★ ۱۹۸,۷۹۴