Reviews git diffs for reuse opportunities, quality issues, and inefficiencies using three parallel agents, then fixes issues. Triggers on 'simplify', 'clean up', or after code changes.
npx claudepluginhub tmdgusya/engineering-discipline --plugin engineering-disciplineThis skill uses the workspace's default tool permissions.
Reviews all changed files through three parallel agents — reuse, quality, and efficiency — then fixes any issues found.
Reviews code changes for reuse opportunities, quality issues, and efficiency problems using three parallel agents. Fixes issues found.
Reviews git diffs or changed files for clarity, reuse, efficiency, quality issues; optionally applies high-confidence, behavior-preserving fixes via sub-agents.
Reviews git-tracked code changes for reuse, quality, and efficiency using three parallel subagents. Triggers on 'review', 'simplify', 'code review' or one-shot review requests.
Share bugs, ideas, or general feedback.
Reviews all changed files through three parallel agents — reuse, quality, and efficiency — then fixes any issues found.
Changed code is the only review target. Each review dimension runs independently, sees the full diff, and reports findings without knowledge of the other agents' results. The main agent aggregates and applies fixes.
git diff (or git diff HEAD if there are staged changes) first. Never review without knowing what changed.review-work instead)git diff to see unstaged changesgit diff HEAD to check staged changesCapture the full diff output — this is the input for all three agents.
Dispatch all three agents concurrently via the Agent tool in a single message. Each agent receives the full diff and its review prompt below.
What to provide to each agent:
What NOT to provide:
Provide this prompt to the agent:
You are reviewing a code diff for reuse opportunities. Your job is to find new code that duplicates functionality already in the codebase.
For each change in the diff:
- Search for existing utilities and helpers that could replace newly written code. Search utility directories (
utils/,helpers/,lib/,common/,shared/), files adjacent to the changed ones, and files imported by the changed files.- Flag any new function that duplicates existing functionality. Report the new function, the existing function, and where the existing one lives.
- Flag inline logic that could use an existing utility. Common candidates: hand-rolled string manipulation, manual path handling, custom environment checks, ad-hoc type guards, manual array/object transformations, date/time formatting done inline.
- Flag reimplemented standard library features. Check if the change reimplements something available in the language's standard library or in already-installed dependencies.
For each finding, report:
- Reuse opportunity: [brief description]
- New code: [file:line] — [what was written]
- Existing: [file:line] — [what already exists]
- Suggestion: [how to replace]
If no reuse issues are found, report: "No reuse issues found."
Provide this prompt to the agent:
You are reviewing a code diff for quality issues. Your job is to find hacky patterns, unnecessary complexity, and abstraction boundary violations.
Check for these patterns:
- Redundant state: new variables that are always derived from another variable, caches that store what could be computed on access, event listeners or observers that could be direct function calls.
- Parameter sprawl: functions that gained a new boolean flag parameter, functions with more than 4 parameters after the change, multiple parameters that are always passed together and should be a single object.
- Copy-paste with slight variation: two or more blocks that differ by only 1-2 lines, repeated conditional structures with different field names, similar error handling blocks across multiple locations.
- Leaky abstractions: accessing private fields or internal state from outside the module, passing implementation details across module boundaries, changes that make one module depend on another's internal structure.
- Stringly-typed code: new string comparisons against values already defined as constants, new string literals matching existing enum or union type values, magic strings appearing in multiple places without a shared constant.
- Unnecessary comments: comments explaining WHAT the code does, narrating the change, or referencing a task. Delete these. Keep only comments that explain non-obvious WHY — hidden constraints, subtle invariants, workarounds. Example to delete:
// increment counterabovecounter++. Example to keep:// Redis returns nil for both "key missing" and "value is empty" — we must distinguish.For each finding, report:
- Quality issue: [category]
- Location: [file:line]
- Problem: [what is wrong]
- Suggestion: [how to fix]
If no quality issues are found, report: "No quality issues found."
Provide this prompt to the agent:
You are reviewing a code diff for efficiency issues. Your job is to find unnecessary work, missed concurrency, and resource management problems. Do not optimize prematurely — flag only what is clearly unnecessary or clearly mismanaged.
Check for these patterns:
- Unnecessary work: the same value computed multiple times in a loop, the same file read more than once, the same API call made repeatedly when the result could be cached or batched, database queries inside loops that could be a single query with WHERE IN.
- Missed concurrency: multiple
awaitcalls in sequence where the operations are independent, sequential file reads that could be parallelized, independent API calls executed one after another.- Hot-path bloat: synchronous file I/O added to a request handler, new computation in a render function that could be memoized, new initialization logic added to module load time.
- Recurring no-op updates: state setters called on every interval tick without checking if the value changed, store dispatches firing on every event without a change-detection guard, wrapper functions that take updater callbacks but do not honor "no change" returns — add a change-detection guard so downstream consumers are not notified when nothing changed.
- Unnecessary existence checks (TOCTOU):
if (existsSync(path)) { readFileSync(path) }— operate directly and handle the error instead.- Memory issues: collections that grow without bound, event listeners registered without corresponding removal, subscriptions without cleanup in dispose/destroy handlers, large objects held in closure scope longer than needed.
- Overly broad operations: reading entire files to extract a single value, fetching all records to find one by ID, loading an entire config when only one field is needed.
For each finding, report:
- Efficiency issue: [category]
- Location: [file:line]
- Problem: [what is wasteful]
- Suggestion: [how to fix]
If no efficiency issues are found, report: "No efficiency issues found."
systematic-debugging| Anti-Pattern | Why It Fails |
|---|---|
| Reviewing without running git diff first | Reviews code that may not have changed, wastes time on irrelevant findings |
| Running agents sequentially | Unnecessary delay; violates Hard Gate #2 |
| Giving each agent only part of the diff | Agent misses cross-cutting issues that span multiple files |
| Reporting findings without fixing them | Defeats the purpose of the skill; user must do manual work |
| Arguing with or explaining skipped findings | Wastes context and time; skip and move on |
| Reviewing unchanged code "while we're here" | Scope creep; violates Hard Gate #6 |
| Fixing issues without running tests afterward | May introduce regressions silently |
| Bundling "while I'm here" improvements into fixes | Mixes review fixes with unrelated changes; muddles the diff |
After simplification is complete:
review-work for independent plan verificationsimplify again to verify the fixes are cleansystematic-debuggingThis skill itself does not invoke the next skill. It reports results and lets the user decide the next step.