/quantum-loop:ql-deslopfrom quantum-loop
Cleans up AI-slop after code review by scanning changed files for duplication, dead code, needless abstraction, boundary violations, and missing tests, with regression-test rollback.
Ships in quantum-loop. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Review approval does not mean the code is clean. LLM-authored code routinely introduces:
Per Schreiber & Tippe 2025, 12.1% of AI-generated files contain ≥1 CWE, and per Zhong et al. 2026 (278k conversations) AI suggestions increase cyclomatic complexity 10-50× more than human edits. Without an explicit cleanup step, every autonomous run accumulates slop.
ql-deslop adds an explicit cleanup pass AFTER the story's review gate passes but BEFORE the merge to the feature branch. Borrowed directly from OMC Ralph Steps 7.5 (deslop) + 7.6 (regression re-verify).
ql-review PASS and the git merge in ql-execute.Single flag: --no-deslop. Used only when:
Deslop: skipped | <reason>).The deslop pass operates on git diff --name-only BASE_SHA..HEAD_SHA — the EXACT files the story touched. It never broadens scope silently. Reaching into unchanged files is an anti-pattern and is explicitly forbidden.
Detectors:
parseRequest / parseReq / handleParse) via Levenshtein or canonical-alpha-rename + exact match (per HyClone arXiv:2508.01357).Action: extract common code into a shared lib; update callers; delete the duplicates.
Detectors:
knip or ts-prune on the changed-files subset.vulture on the changed-files subset.staticcheck -checks=U1000 on the changed-files subset.cargo udeps on the changed-files subset.Action: delete the unused export / function / variable. Re-run tests.
Detectors:
Action: propose refactoring with regression-test gate.
Detectors:
module["_privateFn"], reflection-style private access.../../../../other-module/internal).Action: reshape through the public API, or promote the private API if genuinely needed externally.
Detectors:
AC-3 → tests/feature.test.ts::test_ac_3). Missing maps surface as findings.Action: write the missing test BEFORE deleting alleged dead code (deletion is safe only when the test suite exercises the surviving behavior).
Each deslop invocation runs ONE pass from the taxonomy at a time:
Running multiple passes in one agent invocation risks intra-pass interference (deletion invalidates duplication analysis; refactoring invalidates test mappings). Each pass commits independently with a Deslop: trailer.
After each pass's edits:
npm test / bash tests/*.sh / project-specific per runners/<tool>.json).If ANY of these regress compared to the pre-deslop baseline:
git restore . && git checkout BASE_SHA -- <changed-files>).progress.txt with the specific test or lint failure.<quantum>DESLOP_ROLLED_BACK</quantum> with the failure details.If all regression checks pass, commit the pass's edits with trailer:
Deslop-pass: 1 (dead-code)
Deslop-deletions: 3 | src/foo.ts:handleOldV1 src/bar.ts:legacyParse src/baz.ts:unusedExport
Regression-tests: 28 passed, 0 failed (matches baseline)
For removing anything whose tests do NOT currently exercise it, first SYNTHESIZE a regression test. Snapshot the current behavior before deletion. If the alleged dead code is actually reachable via a path the existing tests miss, the synthesized test fails and deletion is cancelled.
Invocation flag: --review. When passed:
--review) must apply after a human reviewer approves.This separation is mandatory for high-impact cleanup (large delete counts; cross-module moves).
Per-pass structured report at quantum.deslop[<story-id>].pass_<n>:
{
"story_id": "US-042",
"pass": 1,
"pass_name": "dead-code",
"scope_files": ["src/foo.ts", "src/bar.ts", "src/baz.ts"],
"findings": [
{
"smell": "unused-export",
"file": "src/foo.ts",
"line_start": 42, "line_end": 48,
"symbol": "handleOldV1",
"confidence": 95,
"action": "delete",
"regression_test_added": false
}
],
"edits_applied": true,
"regression_check": "passed",
"commit": "<sha>"
}
| The agent says… | The truth is… |
|---|---|
| "The tests passed, so this code must be live" | Tests pass with OR without dead code. Use reachability analysis, not test-pass state, for dead-code detection. |
| "This abstraction will be useful later" | YAGNI. Delete now; re-introduce if a second caller ever appears. |
| "Two functions look similar but surely have different intent" | Alpha-rename both to canonical form and diff. If the tree-sitter AST is identical, they have the same intent. Extract. |
"The file is bigger than BASE_SHA..HEAD_SHA; I'll clean up adjacent areas too" | NO. Scope stays to the diff. Adjacent cleanup is a separate story. |
| "The regression check is pedantic, let's skip when changes are small" | The 7.6 step is mandatory. Small changes are the ones where slop is hardest to see and easiest to silently break. |
| "I'll do all 4 passes in one go to save time" | Intra-pass interference is real. Commit each pass separately. |
ql-review (per-story): MUST pass before ql-deslop runs. Deslop never cleans failing code — fix first.ql-verify: runs the regression check; deslop reuses ql-verify's infrastructure.ql-execute: orchestrator invokes ql-deslop between review passed and git merge (opt-out via --no-deslop).ql-deep-review: runs AFTER ql-deslop (whole-feature review of the post-cleanup state).lib/known-failures.sh: records deslop rollbacks so future iterations learn which cleanups are risky./quantum-loop:ql-deslop # runs all 4 passes on current story's diff
/quantum-loop:ql-deslop --pass=1 # just the dead-code pass
/quantum-loop:ql-deslop --review # findings only, no edits
/quantum-loop:ql-deslop --story=US-042 # explicit story scope
/quantum-loop:ql-deslop --no-rollback # commit each pass even on regression (debug use only)
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
code-cleanup, ai-slop, post-review, regression-testing, duplicate-code, dead-code
npx claudepluginhub andyzengmath/quantum-loop --plugin quantum-loop10 skills in this plugin
/ql-brainstormPart of the quantum-loop autonomous development pipeline (brainstorm → spec → plan → execute → review → verify). Deep Socratic exploration of a feature idea before implementation. Asks questions one at a time, proposes 2-3 alternative approaches with trade-offs, presents design section-by-section for approval, and saves an approved design document. Use when starting a new feature, exploring an idea, or before writing a spec. Triggers on: brainstorm, explore idea, design this, think through, ql-brainstorm./ql-deep-reviewMulti-perspective post-implementation review aggregator for quantum-loop. Invokes 2-7 reviewer agents in parallel based on risk score, applies actionability filter, dedups, aggregates with evidence requirements. Use AFTER the per-story two-stage review gates pass and before merging a whole-feature PR to master. Complements ql-review (per-story) with whole-feature review./ql-executePart of the quantum-loop autonomous development pipeline (brainstorm → spec → plan → execute → review → verify). Run the autonomous execution loop. Reads quantum.json, queries the dependency DAG, implements stories with TDD and two-stage review gates. Supports parallel execution via native worktree isolation. Use after /quantum-loop:plan has created quantum.json. Triggers on: execute, run loop, start building, ql-execute./ql-housekeepDetect repo-hygiene issues that accumulate during long-running autonomous development (merge-conflict markers, orphan worktrees, CPC-variant duplicates, stale branches, version-manifest drift). Detection-only by default — reports findings, never deletes or modifies without explicit user confirmation./ql-intent-checkIntent-drift audit for quantum-loop. Compares the user's original intent (immutable snapshot) against downstream artifacts (design.md → PRD → quantum.json ACs → implementation) to detect semantic divergence. Flags drift with file:line evidence. Use before merge or when specs feel "rewritten."/ql-planPart of the quantum-loop autonomous development pipeline (brainstorm → spec → plan → execute → review → verify). Convert a PRD into machine-readable quantum.json with dependency DAG, granular 2-5 minute tasks, and execution metadata. Use after creating a spec with /quantum-loop:spec. Triggers on: create plan, convert to json, plan tasks, generate quantum json, ql-plan.Other plugins' skills for the same job