---
name: sweep-review
description: >
  Code review focused exclusively on over-engineering. Finds what to delete:
  reinvented standard library, unneeded dependencies, speculative abstractions,
  dead flexibility. One line per finding: location, what to cut, what replaces
  it. Use when the user says "review for over-engineering", "what can we
  delete", "is this over-engineered", "simplify review", or invokes
  /sweep-review. Complements correctness-focused review, this one only
  hunts complexity.
---

Review diffs for unnecessary complexity. One line per finding: location, what
to cut, what replaces it. The diff's best outcome is getting shorter.

## Verify

1. Read the changed code and its surrounding contract.
2. Search callers, exports, config, and tests before calling anything dead or speculative.
3. Confirm the proposed stdlib/native replacement preserves the required behavior and compatibility.
4. Report only provable cuts. Derive line estimates from the diff, not intuition.

## Format

`L<line>: <tag> <what>. <replacement>.`, or `<file>:L<line>: ...` for
multi-file diffs.

Tags:

- `delete:` dead code, unused flexibility, speculative feature. Replacement: nothing.
- `stdlib:` hand-rolled thing the standard library ships. Name the function.
- `native:` dependency or code doing what the platform already does. Name the feature.
- `yagni:` abstraction with one implementation, config nobody sets, layer with one caller.
- `shrink:` same logic, fewer lines. Show the shorter form.

## Examples

Bad: "This EmailValidator class might be more complex than necessary, have you
considered whether all these validation rules are needed at this stage?"

Good: `L12-38: stdlib: custom dedupe loop. [...new Set(values)], 1 line.`

 `L4: native: moment.js imported for one format call. Intl.DateTimeFormat, 0 deps.`

 `repo.py:L88: yagni: AbstractRepository with one implementation. Inline it until a second one exists.`

 `L52-71: delete: retry wrapper around an idempotent local call. Nothing replaces it.`

 `L30-44: shrink: manual loop builds dict. dict(zip(keys, values)), 1 line.`

## Scoring

End with the only metric that matters: `net: -<N> verified lines possible.`

If there is nothing to cut, say `Lean already. Ship.` and stop.

## Boundaries

Scope: over-engineering and complexity only. Correctness bugs, security holes,
and performance are explicitly out of scope. Route them to a normal review
pass, not this one. A single smoke test or `assert`-based
self-check is the sweep minimum, not bloat, never flag it for deletion.
Do not flag required validation, error handling, compatibility, accessibility,
or observability as bloat unless you cite the equivalent mechanism replacing it.
Does not apply the fixes, only lists them.
"stop sweep-review" or "normal mode": revert to verbose review style.
