Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

test-slop

БесплатноЗапускает вложенные скриптыНе проверен

Audit and safely prune a bloated Laravel test suite (Pest or PHPUnit), especially one grown by AI agents — copy-pasted tests, status-only checks, circular…

AsyrafHussinот AsyrafHussin★ 112 звёзд на GitHub

Об этом скилле

Test Slop: Audit and Prune a Laravel Test Suite

Cleans a test suite without losing protection. Contains 34 rules across 9 categories, three bundled scripts (a scanner, a slowest-tests report, and a mutation gate for Pest or Infection), and a workflow that never deletes a test on a smell alone. Where code-slop flags AI patterns in code (with four test rules) and laravel-testing / testing-best-practices teach how to write tests, this skill is for the suite that already exists: thousands of tests, many written by agents, and nobody sure which ones still guard anything.

Metadata

  • Version: 1.0.1
  • Scope: Laravel 10+ with Pest 3–5 or PHPUnit 10–13; frontend tests (Vitest / Jest / Playwright) in Inertia or Livewire apps are scanned too
  • Rule Count: 34 rules across 9 categories
  • Scripts: $TEST_SLOP/scripts/scan.py, $TEST_SLOP/scripts/slowest.py (Python 3.9+, standard library only), $TEST_SLOP/scripts/mutate-gate.sh (bash)
  • License: MIT

Why this skill exists

  • Coverage is a weak signal. Test suites have been measured at 100% coverage with a 4% mutation score (arXiv 2506.02954). Agent-grown suites, cheap to write and rarely read, widen that gap.
  • Coverage-based pruning loses bugs. Reducing a suite by statement coverage kept coverage flat and lost up to 20.5% of the killed mutants; mutation-based reduction kept them (Gyori et al., FSE 2014).
  • Agents over-generate and then rewrite tests to match broken code. Practitioners pruning agent-grown suites report hundreds of thousands of deletable lines with little coverage change, and name "the agent edited the expected value" as the main way tests lose their value.
  • Smell names are weak evidence. Several classic smells (Assertion Roulette, Eager Test) are contested and detected inaccurately (Panichella et al., 2022), so a smell is a lead, not a verdict.

The core rule: a test leaves the suite only when the tests that remain still kill every mutant it killed.

Modes

Mode When Changes files? Output
Audit (default) "audit the tests", "how bad is it" No Scan summary + ledger (KEEP / MERGE / STRENGTHEN / DELETE per test, with evidence)
Campaign "clean up tests/Feature/Orders", "prune the suite" Yes, one folder per step, after the ledger is approved Changed tests, gate results, .test-slop/CAMPAIGN.md, one commit per folder
Authoring gate Writing or reviewing new tests No (review) The four answers per new test, or "extend test X instead"

Never start a campaign without an approved ledger for that folder. Never commit or push unless the user asks.

Workflow

Step 1: Detect the setup

Signal Meaning
vendor/pestphp/pest Pest (runs PHPUnit classes too)
vendor/pestphp/pest-plugin-mutate Mutation gate engine: Pest (--mutate)
vendor/bin/infection Mutation gate engine: Infection (plain PHPUnit)
neither mutation tool Suggest composer require --dev pestphp/pest-plugin-mutate (Pest) or infection/infection (PHPUnit); audit still runs, campaign does not delete
php -m lists xdebug or pcov Coverage driver present (required for mutation)
package.json with vitest / jest / @playwright/test Frontend tests: scanned; mutation via Stryker (manual)
.test-slop/protected.txt Project's own protected list (one path or test-name fragment per line)
.test-slop/CAMPAIGN.md A campaign is in progress: read it first and continue from it

Step 2: Scan (changes nothing)

Commands run from the project root. $TEST_SLOP is the folder this skill is installed in, for example TEST_SLOP=.claude/skills/test-slop (project install) or TEST_SLOP=~/.claude/skills/test-slop (global).

python3 $TEST_SLOP/scripts/scan.py . --json .test-slop/scan.json          # whole suite
python3 $TEST_SLOP/scripts/scan.py . --tests tests/Feature/Orders          # one folder

Flags: same-shape groups, status-only, no-assertion, type-only, reads-source, exact-copy (sentences that exist in the lang files), long, sleeps, skipped, giant and comment-heavy files. Tests matching .test-slop/protected.txt are marked [protected]. Every flag is a candidate to read, not a verdict.

Step 3: Measure

vendor/bin/pest --parallel --log-junit .test-slop/junit.xml     # or: vendor/bin/phpunit --log-junit .test-slop/junit.xml
python3 $TEST_SLOP/scripts/slowest.py .test-slop/junit.xml --top 20
bash $TEST_SLOP/scripts/mutate-gate.sh baseline 'App\Services\OrderService' tests/Feature/Orders

Large controllers make slow runs (hundreds of mutants, several minutes each), so start from the class the flagged test is about and the test file next to it. Take a baseline for every app class the tests you will change cover: the controller, the service, the policy, the FormRequest, the middleware. That is usually

Полный SKILL.md на GitHub

Установить test-slop в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

AGENTS.mdREADME.mdmetadata.jsonrules/_sections.mdrules/_template.mdrules/bloat-copied-setup.mdrules/bloat-giant-file.mdrules/bloat-long-test.mdrules/bloat-narration-comments.mdrules/brittle-copy-pinned.mdrules/brittle-implementation-calls.mdrules/brittle-incidental-detail.mdrules/brittle-snapshot.mdrules/brittle-source-grep.mdrules/circular-expected-from-formula.mdrules/circular-mock-is-the-behaviour.mdrules/circular-rewritten-to-pass.mdrules/dead-flaky.mdrules/dead-long-skipped.mdrules/dead-removed-feature.mdrules/gate-authoring-four-questions.mdrules/gate-evidence-ladder.mdrules/gate-mutation-before-delete.mdrules/gate-one-folder-at-a-time.mdrules/keep-protected-contracts.mdrules/keep-when-unsure.mdrules/redundant-coverage-subset.mdrules/redundant-framework-behaviour.mdrules/redundant-same-flow-twice.mdrules/redundant-same-shape-dataset.mdrules/slow-heavy-setup.mdrules/slow-not-parallel.mdrules/slow-real-network.mdrules/slow-sleep-real-time.mdrules/weak-asserts-the-fixture.mdrules/weak-no-assertion.mdrules/weak-silent-skip.mdrules/weak-status-only.mdrules/weak-type-only.mdscripts/mutate-gate.sh

FAQ

Что делает скилл test-slop?

Audit and safely prune a bloated Laravel test suite (Pest or PHPUnit), especially one grown by AI agents — copy-pasted tests, status-only checks, circular expectations, change-detectors, silent skips, slow setup. Every removal is gated on mutation testing (no mutant the old tests killed may survive), work goes one folder at a time, and an authoring gate stops the slop growing back. Use when a suite has thousands of tests nobody trusts, CI is slow, or AI-written tests need a cleanup. Triggers on "clean up tests", "prune test suite", "test slop", "too many tests", "remove useless tests", "audit tests", "tests are slow".

Как установить скилл test-slop?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл test-slop запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить test-slop с