clean-leftovers

Detect and remove AI-generation artifacts, phase markers, and dead code from source files.

2|Updated Apr 4, 2026
One-click install
npx skills add https://github.com/DoctorMozg/claude-pipelines --skill clean-leftovers-doctormozg
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: clean-leftovers
Source: https://github.com/DoctorMozg/claude-pipelines/tree/main/plugins/mz-dev-pipe/skills/clean-leftovers
Command: npx skills add https://github.com/DoctorMozg/claude-pipelines --skill clean-leftovers-doctormozg

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? AI-assisted coding pipelines leave behind telltale artifacts in source code: tool watermarks like "Generated with Claude Code", pipeline phase markers, planning comments, WHAT-not-WHY restatements, and half-implemented stubs. These leak provenance, look unprofessional in code review, and clutter the codebase before a PR is opened. ## Core Features & Use Cases - Five-category artifact detection: Scans for AI signatures and watermarks, pipeline phase markers, planning/generation comments, WHAT-not-WHY comments, and dead code or stub functions using a regex catalog refreshed by live web research. - Approval-gated parallel cleanup: Presents a full detection report for human approval, then dispatches parallel cleaner agents in waves with per-instance judgment for borderline comments. - Verification loop with linter integration: Re-scans after cleanup, runs the project linter (ruff, eslint, go vet, clippy), and loops up to 3 iterations before escalating residuals. - Use Case: Before opening a PR after an AI-driven build pipeline, run the cleanup on the working tree to strip phase markers, AI footers, and leftover TODO stubs so reviewers see only intentional code. ## Quick Start Ask the assistant to clean AI-generation leftovers from the current working tree, optionally scoping to a branch or a specific path glob.

Frequently Asked Questions about clean-leftovers

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I remove AI watermarks like "Generated with Claude Code" from my code?

Run the cleanup on your working tree or branch scope. It scans for exact watermark strings from Claude Code, Copilot, Cursor, Aider, Codex, and others, presents the hit list for approval, then deletes the matched lines and re-verifies with a follow-up scan.

What kinds of AI code artifacts does cleanup detect?

Detection covers five categories: AI signatures and watermarks, pipeline phase markers like "Phase 2:", planning comments such as "// per plan", WHAT-not-WHY comments that merely restate the next line, and dead code including commented-out blocks and NotImplementedError stubs.

Will cleanup delete comments that explain why the code exists?

No. WHAT-not-WHY candidates are judged per instance, and comments containing WHY signals are kept: numbers with units, RFC or CVE references, ticket IDs, causal words like "because" or "to avoid", performance notes, and regulatory mentions.

Can I limit cleanup to uncommitted changes or a specific folder?

Yes. The scope parameter accepts working (default, uncommitted changes), branch, or global, plus an optional path or glob filter. Markdown documentation directories are excluded by default unless you pass an explicit path override.

What happens if cleanup cannot remove everything automatically?

After each cleanup pass the files are re-scanned and the project linter runs. If residuals remain after three iterations, the leftover hits are escalated to you with options to accept them as documented, force one more wave, or abort.

When should I not use AI leftover cleanup?

Do not use it for rewriting AI-sounding prose in narrative markdown, for general code-quality refactoring with no AI artifacts, for fixing failing tests, or for completing partial features. Those cases belong to dedicated prose, cleanup, polish, or audit workflows.