Code Janitor is a single Agent Skill with two independent objectives: ordinary simplification, and cleanup of AI-generated anti-regression layers. It doesn't chase "more lines removed" — it asks whether a change reduces the concepts and obligations the team must keep coherent from now on.
Pick one objective — ordinary simplification or AI defensive-layer cleanup. Never mixed.
Read-only audit first; build a proof record for every candidate.
Act only when authorized; validate in layers and hand over a rollback path.
A complex structure, passed through evidence, converges into a smaller, clearer system.
Both share consumer analysis, boundary proof and layered validation — but you must choose first, and never blur the deletion boundary in one batch.
Identify and safely remove accidental complexity while preserving live behavior, boundaries and compatibility.
Clean up the anti-regression layers AI changes leave behind: pick a category first, then prove and remove the maintenance burden.
"Nobody calls it" is not "safe to delete". Code Janitor keeps tracing these surfaces before deciding to delete, merge, keep, or mark as unresolved.
From entrypoints through configuration, registration and dispatch to the real execution path.
Reflection, plugin tables, string references — reachability the compiler can't see.
Persistence, migrations, replay: delete a field and old data may never read back.
Package boundaries, wire formats, external consumers you can't grep for in-repo.
A design still owned by a live ADR or RFC is not redundant debt.
What is the smallest check that would expose a wrong cut? No answer, no action.
Nine fields turn "I think we can delete this" into reviewable evidence. Incomplete proof means the candidate stays.
Candidate the exact contract, representation, or layer to remove or merge Burden the concepts, synchronization, publication, or testing cost it creates Reachability production, non-production, dynamic, external, and persisted consumers Rationale why it exists and whether that reason remains current Cut declarations, implementations, branches, artifacts, docs, dependencies Consequence observable capability or compatibility behavior surrendered Confidence evidence strength, uncertainty, blast radius, reversibility Proof the smallest check that would expose an incorrect cut Net effect maintenance concepts removed − replacement or migration machinery added
Deleting lines is only the outcome. The real win is retiring a fact, state, contract or concept the team must keep coherent. A high-value guess never outranks a smaller proved cut.
Dynamic loading, registry entries, published interfaces.
Stored representations, replay, backward compatibility.
Isolation, credentials, data-loss prevention — security code is not a defensive layer.
Cancellation, cleanup, ownership: the code that establishes quiescence.
Shared resources, vendored code, references outside the repo.
A design still governed by a live decision record is not debt to delete.
When a real consumer exists, a boundary is unresolved, or a simplification merely relocates complexity, it recommends keeping — instead of deleting to produce a result.
Full records for Change, Broad, Integration, Decision-record, shared-artifact and AI defensive-layer scenarios live in docs/validation.md. A narrow green check is never packaged as full runtime or user acceptance.
If the objective is unclear, the Skill asks first — it never deletes without one.
Use $code-janitor to audit this repo and list the safest, highest-value simplification candidates. Do not modify files.
Use $code-janitor to decide whether these readiness flags express different lifecycle guarantees or duplicate state.
Use $code-janitor to remove one high-confidence source of accidental complexity. Preserve live contracts, validate, and hand over an operation receipt and rollback path.
Use $code-janitor to revalidate and integrate the simplification findings in this PR. Preserve evidence, not finding counts.
The directory must be named code-janitor. Pick your platform and copy one command.
$ git clone https://github.com/zhouyuanxinand/code-janitor.git ~/.codex/skills/code-janitor$ git clone https://github.com/zhouyuanxinand/code-janitor.git ~/.claude/skills/code-janitor$ git clone https://github.com/zhouyuanxinand/code-janitor.git .agents/skills/code-janitor$ git clone https://github.com/zhouyuanxinand/code-janitor.git .github/skills/code-janitor$ git clone https://github.com/zhouyuanxinand/code-janitor.git .cline/skills/code-janitor$ git clone https://github.com/zhouyuanxinand/code-janitor.git .gemini/skills/code-janitor$ git clone https://github.com/zhouyuanxinand/code-janitor.git .opencode/skills/code-janitorRefresh the skill directory per platform after install. Scope, discovery rules and migration from the old $simplify-codebase entry live in docs/harness-compatibility.md.