بنقرة واحدة
test-medium
Unit + property tests verified by mutation testing with AI self-improvement loop
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Unit + property tests verified by mutation testing with AI self-improvement loop
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
استنادا إلى تصنيف SOC المهني
Quick unit + property-based test run with AI auto-fix loop
Complete test suite — unit, property, integration, e2e, mutation, and coverage audit
Lighthouse performance/SEO/a11y/best-practices optimization with AI self-loop to push all scores to 90+
Visual regression testing with Playwright screenshots and AI-powered diff analysis
Implement changes to align code with UX design files (product-ia.md, product-flows.md, product-interactions.md). Reads design specs and modifies code to match.
Product UX review from the user's perspective. Analyzes IA, user flows, and interactions for any web application.
| name | test-medium |
| description | Unit + property tests verified by mutation testing with AI self-improvement loop |
| user-invocable | true |
You are running a mutation-verified testing workflow. The core idea: use StrykerJS mutation testing to ensure tests actually catch real bugs, not just pass trivially. You will iterate up to 3 rounds, improving tests each round until the mutation score reaches >= 80%.
Determine which files to test:
git diff --name-only HEAD
git diff --name-only --cached
lib/**/*.ts and app/api/**/*.ts (excluding *.test.ts, *.spec.ts, *.d.ts)."No changed files match Stryker's mutate paths (lib//*.ts, app/api//*.ts). Mutation testing only covers those directories. Running unit tests only." Then run just Step 1 and skip to Step 5.
__tests__/ or __tests__/property/ for the changed source files. Also check for co-located .test.ts / .test.tsx files.Run Vitest scoped to the relevant test files:
npx vitest run --reporter=verbose <test-file-paths>
Run StrykerJS scoped to the changed source files using the --mutate flag:
npx stryker run --mutate "{file1.ts,file2.ts}"
For a single file:
npx stryker run --mutate "lib/utils.ts"
IMPORTANT: ALWAYS scope with --mutate. Never run unscoped npx stryker run — it mutates the entire project and takes too long.
Parse the clear-text reporter output. It shows each mutant with format:
#1. [Survived] ConditionalExpression
src/file.ts:42:5
- if (x > 0) {
+ if (false) {
Extract:
If mutation score >= 80% → PASS, skip to Step 5.
If score < 80%, categorize each surviving mutant:
| Category | Examples | Priority |
|---|---|---|
| Logic/Conditional | if(x) → if(false), && → || | HIGH — these hide real bugs |
| Boundary | > → >=, < → <= | HIGH — off-by-one errors |
| Return value | return true → return false | HIGH — inverted logic |
| Arithmetic | + → -, * → / | MEDIUM |
| Equality | === → !== | MEDIUM |
| String/literal | "error" → "" | LOW |
| Removal | block/statement removed | Depends on what was removed |
Acceptable mutants (do NOT count against the score target):
console.log / console.error / console.warn statementsFor each HIGH/MEDIUM surviving mutant, determine what specific test assertion would kill it. Be precise — name the test case, the input values, and the expected output.
Based on the analysis, add or strengthen test assertions:
__tests__/property/.Rules:
expect(true).toBe(true)).@/ path alias, vi.mock() for mocking, describe/it blocks.After modifying tests, output progress:
Round X/3: targeting Y surviving mutants with Z new/modified assertions
Then go back to Step 1 (re-run baseline to confirm tests still pass, then re-run mutation).
Output a clear summary:
## Mutation Testing Results
**Status**: PASS | NEEDS ATTENTION | MAX ITERATIONS REACHED
### Mutation Score
- Before: XX% → After: YY%
- Killed: N / Total: M
- Survived: S (of which A are acceptable)
- Timed out: T
- No coverage: C
### Rounds
- Round 1: XX% → YY% (N mutants killed)
- Round 2: YY% → ZZ% (N mutants killed)
### Remaining Surviving Mutants (if any)
| # | File:Line | Mutation Type | Why Acceptable |
|---|-----------|--------------|----------------|
| 1 | lib/foo.ts:42 | StringLiteral | Error message text |
### Test Files Modified
- __tests__/lib/foo.test.ts (added 3 assertions)
- __tests__/property/foo.property.test.ts (new file, 2 property tests)
Exit statuses:
--mutate flag. Never run full-project mutation.>= but is >), report it to the user rather than writing a test that enshrines the bug.