ワンクリックで
deslop
Use when the user says "deslop", "remove debug code", "find placeholders or stub code", or "remove dead code".
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Use when the user says "deslop", "remove debug code", "find placeholders or stub code", or "remove dead code".
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
Demolish bloated code and re-derive it clean, cutting every surface the rebuilt contract does not name. Use for a repo-wide bloat sweep, when patching a subsystem has stopped paying, or when the user says "this whole module is bloated", "rewrite this properly", or "break it and rebuild".
Dispatch compress operations. Use when the user says "tidy" or names a file, diff, memory, workspace, git stack, or doc to tidy.
Reduce internal duplication, dead code, and ceremony. Use when you spot dead fields, redundant wrappers, or speculative abstractions in code you are already editing.
Use when modernizing APIs, removing compat shims, killing feature flags, or rewriting a subsystem cleanly.
Use when the user says "simplify this diff", or asks for a compression pass over a change-set.
Design-by-Contract (DbC). Use when crossing public API boundaries, guarding complex state invariants, or hardening untrusted inputs and integration seams.
SOC 職業分類に基づく
| name | deslop |
| description | Use when the user says "deslop", "remove debug code", "find placeholders or stub code", or "remove dead code". |
| metadata | {"short-description":"Certainty-graded slop cleanup"} |
Restore the invariant that production code has no debug leftovers, placeholder bodies, swallowed errors, hardcoded credentials, or formatter noise. Classify every finding by certainty; apply only HIGH-certainty mechanical fixes; MEDIUM and LOW are report-only unless the user explicitly asks for a separate manual refactor.
The detailed pattern catalog lives in references/slop-catalog.md, indexed by behavioral category; within a category, rows are keyed by language, or by Any where the signal is language-independent. Load it when choosing an exact pattern recipe for a language, or when deciding whether a finding is fixable. Skip it when you are only classifying certainty or picking an autofix strategy — the contract and strategy vocabulary below are complete on their own.
Apply when the request names AI slop, debug-code cleanup, placeholder/stub cleanup, empty error handlers, hardcoded secrets, dead code, or a pre-PR hygiene sweep.
Do not apply for broad architecture simplification, ordinary lint formatting, security audit beyond hardcoded credential patterns, or behavior-changing cleanup. Do not use this to justify deleting code whose purpose is unclear.
| Level | Source | Action |
|---|---|---|
| HIGH | Deterministic regex/AST match in non-test, non-fixture, non-generated code | Eligible for mechanical fix, then repo tests |
| MEDIUM | Reasoned structural signal or codegraph/context signal | Report only; cite evidence; no auto-fix |
| LOW | Optional external CLI heuristic, if tool already exists | Report only; no install; no auto-fix |
Certainty is not severity. A hardcoded token is HIGH certainty and high severity, but still usually flag-only because the safe fix is secret rotation plus replacement by an environment read. A trailing-space match is HIGH certainty and low severity, but safe to remove.
Scope files. Prefer changed files when the user did not request a full sweep. Exclude tests, fixtures, mocks, examples, generated output, vendored code, lockfiles, build artifacts, and minified bundles:
**/test/**, **/tests/**, **/__tests__/**, *.test.*, *.spec.*, *_test.*, *Test.java**/fixtures/**, **/mocks/**, **/testdata/**, **/examples/**, **/benches/**dist/**, build/**, target/**, coverage/**, vendor/**, node_modules/**, *.min.*, generated/protobuf/openapi outputsPhase 1: HIGH deterministic scan. Use search for line patterns and ast-grep where syntax shape matters. Record {file, line, pattern, certainty: HIGH, strategy}. Categories:
sk-, ghp_/github_pat_, AKIA, Bearer <token>, JWT-looking strings, private-key blocks, Slack/Stripe/NPM/Twilio/SendGrid/Discord token forms. These are keyed to identity providers, not languages. Flag only.asdf asdf, foo bar baz, replace this, TODO: implement.chmod 777, piping a download straight into a shell). Flag only; these need a permission or supply-chain decision, not an edit.Phase 1b: MEDIUM contextual scan. Use codegraph first when indexed; otherwise combine ast-grep, search, and direct reads of the narrow files. Report only:
return, throw, break, or continue that are not a language-required fallthrough case.Client, Connection, Pool, Service, Provider, Manager, Factory, Repository, Gateway, Queue, Cache, or Store values created but never used beyond setup/export.0, null, undefined, None, nil, false, true, [], {}, "", empty collections, Default::default(), or Optional.empty(). Escalate attention when adjacent TODO/FIXME/STUB text exists, but keep auto-fix disabled.Phase 2: LOW optional CLI scan. Findings in the catalog's Residual: external tool signals category. Run only tools already available in the repo or PATH; never install. Record findings as LOW and flag-only:
jscpd for duplication.madge for cycles.eslint, clippy, golangci-lint, ruff, ktlint, rubocop, phpstan, swiftlint, the .NET analyzers, and their equivalents).missing: <tool> in the report and continue.Prioritize. Sort HIGH before MEDIUM before LOW; then severity; then scope proximity to changed files; then fix strategy. Keep a separate fixes list containing only HIGH findings with remove-line, remove-block, replace-whitespace, or add-comment strategies. Exclude every flag-only finding from automatic edits.
Fix HIGH only. Apply the smallest edit that removes the deterministic slop:
remove-line: debug prints, trailing whitespace, isolated commented-out code blocks.replace-whitespace: convert mixed indentation to the file's dominant indentation style; strip trailing spaces.add-comment: empty catch/except blocks only when the correct behavior is intentionally swallowing the error and the surrounding code proves that intent. Otherwise flag; do not invent logging.remove-block: placeholder block only when it is unreachable/dead and removal cannot change API behavior. Stubs on live API surfaces are report-only.flag-only: hardcoded secrets, crash-on-failure shortcuts, placeholder implementations, dead code requiring control-flow judgment, architectural smells.Verify. Run the repo's own test command after fixes. Derive it from manifests in this order: package script (test, then check, then typecheck), cargo test, go test ./..., pytest, mvn test, gradle test, dotnet test, bundle exec rspec or rake test, composer test or phpunit, swift test, or the project's documented command. If no command exists, run the narrowest parser/type check available and state the limitation — and treat every fix as unverified, because the rollback gate has nothing to trip on.
Rollback on regression. If verification fails after applying fixes, immediately restore every changed file from the cleanup attempt with git restore -- <file...> and rerun the same verifier to confirm the baseline is back. Report the failed fix group as blocked, with file/line and failing command. Never suppress tests, rewrite expectations, or keep a partial cleanup after regression.
| Gate | Pass Criteria | Blocks |
|---|---|---|
| Scope gate | Tests/fixtures/generated/vendored files excluded | Any auto-fix touching excluded files |
| Certainty gate | Only HIGH deterministic findings enter fixes | MEDIUM/LOW edit attempt |
| Strategy gate | Every fix has remove-line, replace-whitespace, add-comment, remove-block, or flag-only | Unclassified edit |
| Behavior gate | Repo verifier passes after fixes | Keep no cleanup; run rollback |
| Rollback gate | git restore -- <file...> restores changed files after regression and verifier confirms baseline | Any failed verification with retained edits |
Deliver a compact report: changed files, HIGH fixes applied, MEDIUM/LOW findings left for manual inspection, verifier command and result, rollback action if any.