Thermonuclear Code Quality Review
Audit the current branch's changes with an approval bar substantially higher than “works and passes tests.” Seek behavior-preserving restructurings that make the implementation smaller, more direct, and easier to reason about.
Establish the review scope
- Read the repository instructions and run commands from the repository root.
- Inspect the working tree, branch, merge base, diff statistics, and complete diff. Include staged and unstaged changes.
- Identify the owning packages and read enough surrounding code to understand canonical helpers, dependency boundaries, and existing state models.
- Measure changed file sizes before accepting file growth.
- Run relevant validation when practical. Never hide failures; distinguish introduced failures from existing ones.
Do not modify code unless the user explicitly asks for implementation. A review request authorizes inspection and validation, not fixes.
Apply the approval bar
Block approval when any of these conditions has no compelling justification:
- The change preserves incidental complexity that a plausible restructuring could delete.
- A file crosses from below 1,000 lines to above 1,000 lines.
- Feature checks or ad-hoc conditionals are scattered through unrelated flows.
- Feature logic leaks into a shared path or the wrong architectural layer.
- A wrapper, generic mechanism, cast-heavy contract, or optional parameter adds indirection without clarifying an invariant.
- The change duplicates a canonical helper, state transition, lifecycle, or orchestration flow.
- Related updates can leave partial state, or independent work is needlessly serialized.
- Tests pass while the implementation makes the surrounding code harder to maintain.
Do not approve merely because behavior appears correct.
Search for code-judo simplifications
For every meaningful change, ask:
- Can the model be reframed so entire branches, flags, modes, helpers, or layers disappear?
- Can ownership move to the layer that already owns the concept?
- Can two parallel workflows become one parameterized lifecycle or typed state transition?
- Can a special case become part of the default flow?
- Can an abstraction be deleted in favor of direct code?
- Can duplicated business rules move to the lowest valid shared package?
- Can explicit types remove casts, silent fallbacks, or unnecessary optionality?
- Can orchestration become atomic or parallel while remaining clearer?
Prefer simplifications that reduce the number of concepts a reader must hold. Moving the same complexity into more files is not a successful refactor.
Inspect aggressively
Prioritize these review categories:
- Structural regressions and missed dramatic simplifications.
- Spaghetti growth: new flags, nullable modes, special-case branches, and incidental control flow.
- State ownership, atomicity, lifecycle cleanup, async ordering, and failure behavior.
- Architectural boundaries, canonical helpers, and package placement.
- Type and API boundary cleanliness.
- File-size growth and decomposition.
- Test quality, especially whether regression tests prove user-visible behavior and failure paths.
- Legibility issues that materially increase maintenance cost.
Treat these patterns as strong smells:
- Multiple components independently managing the same draft, commit, dismiss, focus, or persistence lifecycle.
- UI observers redefining core commands to fit a local state model.
- Shared atoms or registries without explicit per-owner identity and cleanup.
- Copy-pasted condition chains with small variations.
- Broad
unknown, any, assertions, or silent fallback masking an unclear contract.
- Generic “magic” handling that hides a simple known data shape.
- Thin pass-through wrappers that do not reduce caller complexity.
- Tests that delete failure coverage after a refactor or only verify the happy path.
- Unrelated fixes added to compensate for a side effect introduced elsewhere.
Validate findings
Trace each suspected issue through callers, state transitions, and tests. Prefer a smaller number of high-confidence findings over speculative or cosmetic comments.
For each finding:
- State the concrete failure or maintainability cost.
- Explain why the current structure causes it.
- Identify the smallest coherent structural remedy.
- Cite a tight file and line range.
- Assign severity based on impact, not rhetorical force.
If a restructuring is only a preference and does not materially improve maintainability, omit it.
Report the review
Lead with findings ordered by severity. Use inline code comments when supported. Keep summaries brief and include:
- Whether the change meets the thermonuclear approval bar.
- Validation commands run and their exact outcomes.
- Any important testing gaps or assumptions.
- An explicit statement when no high-confidence findings remain.
Do not flood the review with naming or formatting nits while structural issues remain.
1---2name: thermonuclear-code-quality-review3description: Perform an unusually strict code-quality audit focused on structural simplification, maintainability, abstraction quality, file growth, branching complexity, type boundaries, architectural ownership, and test quality. Use for thermonuclear reviews, deep maintainability audits, harsh code-quality reviews, or reviews that should seek ambitious behavior-preserving restructuring rather than local cleanup.4---56# Thermonuclear Code Quality Review78Audit the current branch's changes with an approval bar substantially higher than “works and passes tests.” Seek behavior-preserving restructurings that make the implementation smaller, more direct, and easier to reason about.910## Establish the review scope11121. Read the repository instructions and run commands from the repository root.132. Inspect the working tree, branch, merge base, diff statistics, and complete diff. Include staged and unstaged changes.143. Identify the owning packages and read enough surrounding code to understand canonical helpers, dependency boundaries, and existing state models.154. Measure changed file sizes before accepting file growth.165. Run relevant validation when practical. Never hide failures; distinguish introduced failures from existing ones.1718Do not modify code unless the user explicitly asks for implementation. A review request authorizes inspection and validation, not fixes.1920## Apply the approval bar2122Block approval when any of these conditions has no compelling justification:2324- The change preserves incidental complexity that a plausible restructuring could delete.25- A file crosses from below 1,000 lines to above 1,000 lines.26- Feature checks or ad-hoc conditionals are scattered through unrelated flows.27- Feature logic leaks into a shared path or the wrong architectural layer.28- A wrapper, generic mechanism, cast-heavy contract, or optional parameter adds indirection without clarifying an invariant.29- The change duplicates a canonical helper, state transition, lifecycle, or orchestration flow.30- Related updates can leave partial state, or independent work is needlessly serialized.31- Tests pass while the implementation makes the surrounding code harder to maintain.3233Do not approve merely because behavior appears correct.3435## Search for code-judo simplifications3637For every meaningful change, ask:3839- Can the model be reframed so entire branches, flags, modes, helpers, or layers disappear?40- Can ownership move to the layer that already owns the concept?41- Can two parallel workflows become one parameterized lifecycle or typed state transition?42- Can a special case become part of the default flow?43- Can an abstraction be deleted in favor of direct code?44- Can duplicated business rules move to the lowest valid shared package?45- Can explicit types remove casts, silent fallbacks, or unnecessary optionality?46- Can orchestration become atomic or parallel while remaining clearer?4748Prefer simplifications that reduce the number of concepts a reader must hold. Moving the same complexity into more files is not a successful refactor.4950## Inspect aggressively5152Prioritize these review categories:53541. Structural regressions and missed dramatic simplifications.552. Spaghetti growth: new flags, nullable modes, special-case branches, and incidental control flow.563. State ownership, atomicity, lifecycle cleanup, async ordering, and failure behavior.574. Architectural boundaries, canonical helpers, and package placement.585. Type and API boundary cleanliness.596. File-size growth and decomposition.607. Test quality, especially whether regression tests prove user-visible behavior and failure paths.618. Legibility issues that materially increase maintenance cost.6263Treat these patterns as strong smells:6465- Multiple components independently managing the same draft, commit, dismiss, focus, or persistence lifecycle.66- UI observers redefining core commands to fit a local state model.67- Shared atoms or registries without explicit per-owner identity and cleanup.68- Copy-pasted condition chains with small variations.69- Broad `unknown`, `any`, assertions, or silent fallback masking an unclear contract.70- Generic “magic” handling that hides a simple known data shape.71- Thin pass-through wrappers that do not reduce caller complexity.72- Tests that delete failure coverage after a refactor or only verify the happy path.73- Unrelated fixes added to compensate for a side effect introduced elsewhere.7475## Validate findings7677Trace each suspected issue through callers, state transitions, and tests. Prefer a smaller number of high-confidence findings over speculative or cosmetic comments.7879For each finding:8081- State the concrete failure or maintainability cost.82- Explain why the current structure causes it.83- Identify the smallest coherent structural remedy.84- Cite a tight file and line range.85- Assign severity based on impact, not rhetorical force.8687If a restructuring is only a preference and does not materially improve maintainability, omit it.8889## Report the review9091Lead with findings ordered by severity. Use inline code comments when supported. Keep summaries brief and include:9293- Whether the change meets the thermonuclear approval bar.94- Validation commands run and their exact outcomes.95- Any important testing gaps or assumptions.96- An explicit statement when no high-confidence findings remain.9798Do not flood the review with naming or formatting nits while structural issues remain.