SKILL.md

  1---
  2name: in-session-review
  3description: Run an extremely strict maintainability review for abstraction quality, giant files, and spaghetti-condition growth. Use for a thermo-nuclear code quality review, thermonuclear review, deep code quality audit, or especially harsh maintainability review ONLY on explicit user request.
  4user-invocable: true
  5license: MIT
  6metadata:
  7  author: Cursor
  8---
  9
 10Above all, this skill should push the reviewer to be **ambitious** about code structure. Do not merely identify local cleanup opportunities. Actively search for "code judo" moves: restructurings that preserve behavior while making the implementation dramatically simpler, smaller, more direct, and more elegant.
 11
 12## Core Prompt
 13
 14Start from this baseline:
 15
 16> Perform a deep code quality audit of the current branch's changes.
 17> Rethink how to structure / implement the changes to meaningfully improve code quality without impacting behavior.
 18> Work to improve abstractions, modularity, reduce Spaghetti code, improve succinctness and legibility.
 19> Be ambitious, if there is a clear path to improving the implementation that involves restructuring some of the codebase, go for it.
 20> Be extremely thorough and rigorous. Measure twice, cut once.
 21
 22## Non-Negotiable Additional Standards
 23
 24Apply the baseline prompt above, plus these explicit review rules:
 25
 260. **Be ambitious about structural simplification.**
 27   - Do not stop at "this could be a bit cleaner."
 28   - Look for opportunities to reframe the change so that whole branches, helpers, modes, conditionals, or layers disappear entirely.
 29   - Prefer the solution that makes the code feel inevitable in hindsight.
 30   - Assume there is often a "code judo" move available: a re-organization that uses the existing architecture more effectively and makes the change dramatically simpler and more elegant.
 31   - If you see a path to delete complexity rather than rearrange it, push hard for that path.
 32
 331. **Do not let a PR push a file from under 1k lines to over 1k lines without a very strong reason.**
 34   - Treat this as a strong code-quality smell by default.
 35   - Prefer extracting helpers, subcomponents, modules, or local abstractions instead of letting a file sprawl past 1000 lines.
 36   - If the diff crosses that threshold, explicitly ask whether the code should be decomposed first.
 37   - Only waive this if there is a compelling structural reason and the resulting file is still clearly organized.
 38
 392. **Do not allow random spaghetti growth in existing code.**
 40   - Be highly suspicious of new ad-hoc conditionals, scattered special cases, or one-off branches inserted into unrelated flows.
 41   - If a change adds "weird if statements in random places", treat that as a design problem, not a stylistic nit.
 42   - Prefer pushing the logic into a dedicated abstraction, helper, state machine, policy object, or separate module instead of tangling an existing path.
 43   - Call out changes that make the surrounding code harder to reason about, even if they technically work.
 44
 453. **Bias toward cleaning the design, not just accepting working code.**
 46   - If behavior can stay the same while the structure becomes meaningfully cleaner, push for the cleaner version.
 47   - Do not rubber-stamp "it works" implementations that leave the codebase messier.
 48   - Strongly prefer simplifications that remove moving pieces altogether over refactors that merely spread the same complexity around.
 49
 504. **Prefer direct, boring, maintainable code over hacky or magical code.**
 51   - Treat brittle, ad-hoc, or "magic" behavior as a code-quality problem.
 52   - Be skeptical of generic mechanisms that hide simple data-shape assumptions.
 53   - Flag thin abstractions, identity wrappers, or pass-through helpers that add indirection without buying clarity.
 54
 555. **Push hard on type and boundary cleanliness when they affect maintainability.**
 56   - Question unnecessary optionality, `unknown`, `any`, or cast-heavy code when a clearer type boundary could exist.
 57   - Prefer explicit typed models or shared contracts over loosely-shaped ad-hoc objects.
 58   - If a branch relies on silent fallback to paper over an unclear invariant, ask whether the boundary should be made explicit instead.
 59
 606. **Keep logic in the canonical layer and reuse existing helpers.**
 61   - Call out feature logic leaking into shared paths or implementation details leaking through APIs.
 62   - Prefer existing canonical utilities/helpers over bespoke one-offs.
 63   - Push code toward the right package, service, or module instead of normalizing architectural drift.
 64
 657. **Treat unnecessary sequential orchestration and non-atomic updates as design smells when the cleaner structure is obvious.**
 66   - If independent work is serialized for no good reason, ask whether the flow should run in parallel instead.
 67   - If related updates can leave state half-applied, push for a more atomic structure.
 68   - Do not over-index on micro-optimizations, but do flag avoidable orchestration complexity that makes the implementation more brittle.
 69
 70## Primary Review Questions
 71
 72For every meaningful change, ask:
 73
 74- Is there a "code judo" move that would make this dramatically simpler?
 75- Can this change be reframed so fewer concepts, branches, or helper layers are needed?
 76- Does this improve or worsen the local architecture?
 77- Did the diff add branching complexity where a better abstraction should exist?
 78- Did a previously cohesive module become more coupled, more stateful, or harder to scan?
 79- Is this logic living in the right file and layer?
 80- Did this change enlarge a file or component past a healthy size boundary?
 81- Are there repeated conditionals that signal a missing model or missing helper?
 82- Is the implementation direct and legible, or does it rely on special cases and incidental control flow?
 83- Is this abstraction actually earning its keep, or is it just a wrapper?
 84- Did the diff introduce casts, optionality, or ad-hoc object shapes that obscure the real invariant?
 85- Is this logic living in the canonical layer, or did the diff leak details across a boundary?
 86- Is this orchestration more sequential or less atomic than it needs to be?
 87
 88## What to Flag Aggressively
 89
 90Escalate findings when you see:
 91
 92- A complicated implementation where a cleaner reframing could delete whole categories of complexity.
 93- Refactors that move code around but fail to reduce the number of concepts a reader must hold in their head.
 94- A file crossing 1000 lines due to the PR, especially if the new code could be split out.
 95- New conditionals bolted onto unrelated code paths.
 96- One-off booleans, nullable modes, or flags that complicate existing control flow.
 97- Feature-specific logic leaking into general-purpose modules.
 98- Generic "magic" handling that hides simple structure and makes the code harder to reason about.
 99- Thin wrappers or identity abstractions that add indirection without simplifying anything.
100- Unnecessary casts, `any`, `unknown`, or optional params that muddy the real contract.
101- Copy-pasted logic instead of extracted helpers.
102- Narrow edge-case handling implemented in the middle of an already busy function.
103- Refactors that technically pass tests but make the code less modular or less readable.
104- "Temporary" branching that is likely to become permanent debt.
105- Bespoke helpers where the codebase already has a canonical utility for the job.
106- Logic added in the wrong layer/package when it should live somewhere more central.
107- Sequential async flow where obviously independent work could stay simpler and clearer with parallel execution.
108- Partial-update logic that leaves state less atomic than necessary.
109
110## Preferred Remedies
111
112When you identify a code-quality problem, prefer suggestions like:
113
114- Delete a whole layer of indirection rather than polishing it.
115- Reframe the state model so conditionals disappear instead of getting centralized.
116- Change the ownership boundary so the feature becomes a natural extension of an existing abstraction.
117- Turn special-case logic into a simpler default flow with fewer exceptions.
118- Extract a helper or pure function.
119- Split a large file into smaller focused modules.
120- Move feature-specific logic behind a dedicated abstraction.
121- Replace condition chains with a typed model or explicit dispatcher.
122- Separate orchestration from business logic.
123- Collapse duplicate branches into a single clearer flow.
124- Delete wrappers that do not meaningfully clarify the API.
125- Reuse the existing canonical helper instead of introducing a near-duplicate.
126- Make type boundaries more explicit so the control flow gets simpler.
127- Move the logic to the package/module/layer that already owns the concept.
128- Parallelize independent work when that also simplifies the orchestration.
129- Restructure related updates into a more atomic flow when partial state would be harder to reason about.
130
131Do not be satisfied with "maybe rename this" feedback when the real issue is structural.
132Do not be satisfied with a merely cleaner version of the same messy idea if there is a plausible path to a much simpler idea.
133
134## Review Tone
135
136Be direct, serious, and demanding about quality.
137Do not be rude, but do not soften major maintainability issues into mild suggestions.
138If the code is making the codebase messier, say so clearly.
139If the implementation missed an opportunity for a dramatic simplification, say that clearly too.
140
141Good phrases:
142
143- `this pushes the file past 1k lines. can we decompose this first?`
144- `this adds another special-case branch into an already busy flow. can we move this behind its own abstraction?`
145- `this works, but it makes the surrounding code more spaghetti. let's keep the behavior and restructure the implementation.`
146- `this feels like feature logic leaking into a shared path. can we isolate it?`
147- `this abstraction seems unnecessary. can we just keep the direct flow?`
148- `why does this need a cast / optional here? can we make the boundary more explicit instead?`
149- `this looks like a bespoke helper for something we already have elsewhere. can we reuse the canonical one?`
150- `i think there's a code-judo move here that makes this much simpler. can we reframe this so these branches disappear?`
151- `this refactor moves complexity around, but doesn't really delete it. is there a way to make the model itself simpler?`
152
153## Output Expectations
154
155Prioritize findings in this order:
156
1571. Structural code-quality regressions
1582. Missed opportunities for dramatic simplification / code-judo restructuring
1593. Spaghetti / branching complexity increases
1604. Boundary / abstraction / type-contract problems that make the code harder to reason about
1615. File-size and decomposition concerns
1626. Modularity and abstraction issues
1637. Legibility and maintainability concerns
164
165Do not flood the review with low-value nits if there are larger structural issues.
166Prefer a smaller number of high-conviction comments over a long list of cosmetic notes.
167
168## Approval Bar
169
170Do not approve merely because behavior seems correct.
171The bar for approval is:
172
173- no clear structural regression
174- no obvious missed opportunity to make the implementation dramatically simpler when such a path is visible
175- no unjustified file-size explosion
176- no obvious spaghetti-growth from special-case branching
177- no obviously hacky or magical abstraction that makes the code harder to reason about
178- no unnecessary wrapper/cast/optionality churn obscuring the real design
179- no clear architecture-boundary leak or avoidable canonical-helper duplication
180- no missed opportunity for an obvious decomposition that would materially improve maintainability
181
182Treat these as presumptive blockers unless the author can justify them clearly:
183
184- the PR preserves a lot of incidental complexity when there is a plausible code-judo move that would delete it
185- the PR pushes a file from below 1000 lines to above 1000 lines
186- the PR adds ad-hoc branching that makes an existing flow more tangled
187- the PR solves a local problem by scattering feature checks across shared code
188- the PR adds an unnecessary abstraction, wrapper, or cast-heavy contract that makes the design more indirect
189- the PR duplicates an existing helper or puts logic in the wrong layer when there is a clear canonical home
190
191If those conditions are not met, leave explicit, actionable feedback and push for a cleaner decomposition.