thermo-nuclear-code-quality-review
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseThermo-Nuclear Code Quality Review
热核级代码质量审查
Use this skill for an unusually strict review focused on implementation quality, maintainability, abstraction quality, and codebase health.
Above 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.
本技能用于开展针对实现质量、可维护性、抽象质量以及代码库健康度的超高严格度审查。
最重要的是,本技能要求审查者在代码结构上要敢于突破。不能只局限于发现局部可以清理的地方,要主动寻找「code judo」方案:即在保留原有功能的前提下,对代码进行重构,让实现变得更简洁、更紧凑、更直接、更优雅。
Core Prompt
核心提示
Start from this baseline:
Perform a deep code quality audit of the current branch's changes. Rethink how to structure / implement the changes to meaningfully improve code quality without impacting behavior. Work to improve abstractions, modularity, reduce Spaghetti code, improve succinctness and legibility. Be ambitious, if there is a clear path to improving the implementation that involves restructuring some of the codebase, go for it. Be extremely thorough and rigorous. Measure twice, cut once.
从以下基准提示开始:
对当前分支的变更开展深度代码质量审计。 重新思考如何架构/实现这些变更,在不影响功能的前提下切实提升代码质量。 致力于优化抽象设计、模块化程度,减少Spaghetti code(面条式代码),提升代码简洁性与可读性。 要敢于突破,若存在明确的重构路径可优化实现方案,哪怕需要调整部分代码库,也要大胆推进。 务必做到极其全面、严谨。三思而后行。
Non-Negotiable Additional Standards
不可妥协的额外审查标准
Apply the baseline prompt above, plus these explicit review rules:
-
Be ambitious about structural simplification.
- Do not stop at "this could be a bit cleaner."
- Look for opportunities to reframe the change so that whole branches, helpers, modes, conditionals, or layers disappear entirely.
- Prefer the solution that makes the code feel inevitable in hindsight.
- 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.
- If you see a path to delete complexity rather than rearrange it, push hard for that path.
-
Do not let a PR push a file from under 1k lines to over 1k lines without a very strong reason.
- Treat this as a strong code-quality smell by default.
- Prefer extracting helpers, subcomponents, modules, or local abstractions instead of letting a file sprawl past 1000 lines.
- If the diff crosses that threshold, explicitly ask whether the code should be decomposed first.
- Only waive this if there is a compelling structural reason and the resulting file is still clearly organized.
-
Do not allow random spaghetti growth in existing code.
- Be highly suspicious of new ad-hoc conditionals, scattered special cases, or one-off branches inserted into unrelated flows.
- If a change adds "weird if statements in random places", treat that as a design problem, not a stylistic nit.
- Prefer pushing the logic into a dedicated abstraction, helper, state machine, policy object, or separate module instead of tangling an existing path.
- Call out changes that make the surrounding code harder to reason about, even if they technically work.
-
Bias toward cleaning the design, not just accepting working code.
- If behavior can stay the same while the structure becomes meaningfully cleaner, push for the cleaner version.
- Do not rubber-stamp "it works" implementations that leave the codebase messier.
- Strongly prefer simplifications that remove moving pieces altogether over refactors that merely spread the same complexity around.
-
Prefer direct, boring, maintainable code over hacky or magical code.
- Treat brittle, ad-hoc, or "magic" behavior as a code-quality problem.
- Be skeptical of generic mechanisms that hide simple data-shape assumptions.
- Flag thin abstractions, identity wrappers, or pass-through helpers that add indirection without buying clarity.
-
Push hard on type and boundary cleanliness when they affect maintainability.
- Question unnecessary optionality, ,
unknown, or cast-heavy code when a clearer type boundary could exist.any - Prefer explicit typed models or shared contracts over loosely-shaped ad-hoc objects.
- If a branch relies on silent fallback to paper over an unclear invariant, ask whether the boundary should be made explicit instead.
- Question unnecessary optionality,
-
Keep logic in the canonical layer and reuse existing helpers.
- Call out feature logic leaking into shared paths or implementation details leaking through APIs.
- Prefer existing canonical utilities/helpers over bespoke one-offs.
- Push code toward the right package, service, or module instead of normalizing architectural drift.
-
Treat unnecessary sequential orchestration and non-atomic updates as design smells when the cleaner structure is obvious.
- If independent work is serialized for no good reason, ask whether the flow should run in parallel instead.
- If related updates can leave state half-applied, push for a more atomic structure.
- Do not over-index on micro-optimizations, but do flag avoidable orchestration complexity that makes the implementation more brittle.
在遵循上述基准提示的基础上,还需严格执行以下明确的审查规则:
-
在结构简化上敢于突破
- 不能满足于「这里可以稍微清理一下」。
- 寻找重构变更的机会,让整个分支、辅助函数、模式、条件判断或层级彻底消失。
- 优先选择那种事后看来代码逻辑必然如此的解决方案。
- 要假定通常存在「code judo」方案:即更高效地利用现有架构进行重组,让变更变得更简洁、更优雅。
- 若发现可以直接删除复杂度而非重新排列的路径,要全力推进该方案。
-
若无充分理由,绝不允许PR将文件行数从1000行以下增至1000行以上
- 默认将此视为严重的代码质量隐患。
- 优先选择提取辅助函数、子组件、模块或局部抽象,而非任由文件行数突破1000行。
- 若代码变更导致行数超过该阈值,要明确询问是否应先对代码进行拆分。
- 仅当存在令人信服的架构层面理由,且最终文件结构依然清晰时,才可豁免此规则。
-
不允许现有代码中随意出现面条式代码增长
- 对新增的临时条件判断、零散的特殊场景处理,或是插入到无关流程中的一次性分支保持高度警惕。
- 若变更在「随机位置添加奇怪的if语句」,要将其视为设计问题,而非风格上的小瑕疵。
- 优先选择将逻辑移入专用抽象层、辅助函数、状态机、策略对象或独立模块,而非纠缠现有流程。
- 要指出那些虽然技术上可行,但会让周边代码更难理解的变更。
-
倾向于优化设计,而非仅仅接受可运行的代码
- 若能在保持功能不变的同时让结构变得更清晰,要推动采用更简洁的版本。
- 不能对「可运行但会让代码库更混乱」的实现盖章通过。
- 强烈优先选择能彻底移除冗余部分的简化方案,而非仅仅将相同复杂度分散开的重构。
-
优先选择直接、直白、易维护的代码,而非 hack 式或魔法式代码
- 将脆弱、临时或「魔法式」行为视为代码质量问题。
- 对隐藏简单数据形态假设的通用机制保持怀疑。
- 标记那些仅增加间接性却未提升清晰度的单薄抽象、标识包装或透传辅助函数。
-
当类型与边界清晰度影响可维护性时,严格要求优化
- 当存在更清晰的类型边界时,质疑不必要的可选性、、
unknown或大量类型转换代码。any - 优先选择显式类型模型或共享契约,而非松散结构的临时对象。
- 若分支依赖静默回退来掩盖不清晰的不变量,要询问是否应让边界变得更显式。
- 当存在更清晰的类型边界时,质疑不必要的可选性、
-
将逻辑放在标准层级,并复用现有辅助工具
- 指出业务逻辑泄露到共享路径,或是实现细节通过API暴露的问题。
- 优先使用现有标准工具/辅助函数,而非定制一次性工具。
- 推动代码移至合适的包、服务或模块,而非放任架构漂移常态化。
-
当更清晰的结构显而易见时,将不必要的顺序编排与非原子更新视为设计隐患
- 若独立工作毫无理由地被序列化,要询问是否应改为并行执行流程。
- 若相关更新可能导致状态半应用,要推动采用更原子化的结构。
- 不过度关注微优化,但要标记那些会让实现更脆弱的可避免编排复杂度。
Primary Review Questions
核心审查问题
For every meaningful change, ask:
- Is there a "code judo" move that would make this dramatically simpler?
- Can this change be reframed so fewer concepts, branches, or helper layers are needed?
- Does this improve or worsen the local architecture?
- Did the diff add branching complexity where a better abstraction should exist?
- Did a previously cohesive module become more coupled, more stateful, or harder to scan?
- Is this logic living in the right file and layer?
- Did this change enlarge a file or component past a healthy size boundary?
- Are there repeated conditionals that signal a missing model or missing helper?
- Is the implementation direct and legible, or does it rely on special cases and incidental control flow?
- Is this abstraction actually earning its keep, or is it just a wrapper?
- Did the diff introduce casts, optionality, or ad-hoc object shapes that obscure the real invariant?
- Is this logic living in the canonical layer, or did the diff leak details across a boundary?
- Is this orchestration more sequential or less atomic than it needs to be?
针对每一项重要变更,都要问自己:
- 是否存在「code judo」方案能让变更变得更简洁?
- 是否可以重构变更,减少所需的概念、分支或辅助层级?
- 这项变更会改善还是恶化局部架构?
- 变更是否在本应存在更好抽象的地方增加了分支复杂度?
- 原本内聚的模块是否变得更耦合、更具状态性或更难浏览?
- 该逻辑是否位于正确的文件与层级?
- 变更是否让文件或组件超出了健康的大小边界?
- 是否存在重复的条件判断,暗示缺少模型或辅助函数?
- 实现是否直接易懂,还是依赖特殊场景与偶然控制流?
- 该抽象是否真正发挥了作用,还是仅仅是一个包装层?
- 变更是否引入了类型转换、可选性或临时对象形态,掩盖了真实的不变量?
- 该逻辑是否位于标准层级,还是变更导致细节跨边界泄露?
- 编排是否比必要的更具顺序性或更非原子化?
What to Flag Aggressively
需重点标记的问题
Escalate findings when you see:
- A complicated implementation where a cleaner reframing could delete whole categories of complexity.
- Refactors that move code around but fail to reduce the number of concepts a reader must hold in their head.
- A file crossing 1000 lines due to the PR, especially if the new code could be split out.
- New conditionals bolted onto unrelated code paths.
- One-off booleans, nullable modes, or flags that complicate existing control flow.
- Feature-specific logic leaking into general-purpose modules.
- Generic "magic" handling that hides simple structure and makes the code harder to reason about.
- Thin wrappers or identity abstractions that add indirection without simplifying anything.
- Unnecessary casts, ,
any, or optional params that muddy the real contract.unknown - Copy-pasted logic instead of extracted helpers.
- Narrow edge-case handling implemented in the middle of an already busy function.
- Refactors that technically pass tests but make the code less modular or less readable.
- "Temporary" branching that is likely to become permanent debt.
- Bespoke helpers where the codebase already has a canonical utility for the job.
- Logic added in the wrong layer/package when it should live somewhere more central.
- Sequential async flow where obviously independent work could stay simpler and clearer with parallel execution.
- Partial-update logic that leaves state less atomic than necessary.
当发现以下情况时,要升级处理:
- 复杂的实现本可以通过更清晰的重构删除整类复杂度。
- 重构仅移动了代码位置,却未减少读者需要理解的概念数量。
- PR导致文件行数突破1000行,尤其是新增代码本可以拆分的情况。
- 在无关代码路径上新增条件判断。
- 新增一次性布尔值、可空模式或标志,使现有控制流复杂化。
- 业务特定逻辑泄露到通用模块中。
- 通用「魔法式」处理隐藏了简单结构,让代码更难理解。
- 仅增加间接性却未简化任何内容的单薄包装或标识抽象。
- 不必要的类型转换、、
any或可选参数,模糊了真实契约。unknown - 复制粘贴的逻辑未提取为辅助函数。
- 在本已复杂的函数中间实现窄边缘场景处理。
- 技术上通过测试但让代码更模块化或可读性更差的重构。
- 可能会变成永久技术债务的「临时」分支。
- 代码库已有标准工具却仍定制辅助函数。
- 逻辑被添加到错误的层级/包中,本应放在更核心的位置。
- 明显可独立执行的工作却采用顺序异步流程,并行执行会更简洁清晰。
- 部分更新逻辑导致状态不如必要的原子化。
Preferred Remedies
推荐解决方案
When you identify a code-quality problem, prefer suggestions like:
- Delete a whole layer of indirection rather than polishing it.
- Reframe the state model so conditionals disappear instead of getting centralized.
- Change the ownership boundary so the feature becomes a natural extension of an existing abstraction.
- Turn special-case logic into a simpler default flow with fewer exceptions.
- Extract a helper or pure function.
- Split a large file into smaller focused modules.
- Move feature-specific logic behind a dedicated abstraction.
- Replace condition chains with a typed model or explicit dispatcher.
- Separate orchestration from business logic.
- Collapse duplicate branches into a single clearer flow.
- Delete wrappers that do not meaningfully clarify the API.
- Reuse the existing canonical helper instead of introducing a near-duplicate.
- Make type boundaries more explicit so the control flow gets simpler.
- Move the logic to the package/module/layer that already owns the concept.
- Parallelize independent work when that also simplifies the orchestration.
- Restructure related updates into a more atomic flow when partial state would be harder to reason about.
Do not be satisfied with "maybe rename this" feedback when the real issue is structural.
Do not be satisfied with a merely cleaner version of the same messy idea if there is a plausible path to a much simpler idea.
当发现代码质量问题时,优先采用以下建议:
- 删除整个间接层级,而非打磨它。
- 重构状态模型,让条件判断消失,而非集中处理。
- 变更所有权边界,让功能成为现有抽象的自然扩展。
- 将特殊场景逻辑转换为更简单的默认流程,减少异常情况。
- 提取辅助函数或纯函数。
- 将大文件拆分为更小的聚焦模块。
- 将业务特定逻辑移至专用抽象层后。
- 用类型化模型或显式调度器替换条件链。
- 将编排与业务逻辑分离。
- 将重复分支合并为单一清晰流程。
- 删除未明确简化API的包装层。
- 复用现有标准辅助函数,而非引入近似重复的实现。
- 让类型边界更显式,简化控制流。
- 将逻辑移至已拥有该概念的包/模块/层级。
- 当并行执行也能简化编排时,让独立工作并行执行。
- 当部分状态会更难理解时,将相关更新重构为更原子化的流程。
当核心问题是结构问题时,不要满足于「或许可以重命名」这类反馈。
若存在可行的路径实现更简单的方案,不要满足于仅仅让同一个混乱想法变得更整洁。
Review Tone
审查语气
Be direct, serious, and demanding about quality.
Do not be rude, but do not soften major maintainability issues into mild suggestions.
If the code is making the codebase messier, say so clearly.
If the implementation missed an opportunity for a dramatic simplification, say that clearly too.
Good phrases:
this pushes the file past 1k lines. can we decompose this first?this adds another special-case branch into an already busy flow. can we move this behind its own abstraction?this works, but it makes the surrounding code more spaghetti. let's keep the behavior and restructure the implementation.this feels like feature logic leaking into a shared path. can we isolate it?this abstraction seems unnecessary. can we just keep the direct flow?why does this need a cast / optional here? can we make the boundary more explicit instead?this looks like a bespoke helper for something we already have elsewhere. can we reuse the canonical one?i think there's a code-judo move here that makes this much simpler. can we reframe this so these branches disappear?this refactor moves complexity around, but doesn't really delete it. is there a way to make the model itself simpler?
要直接、严肃、对质量有高要求。
不要粗鲁,但也不要将重大可维护性问题弱化温和的建议。
若代码会让代码库变得更混乱,要明确指出。
若实现错失了大幅简化的机会,也要明确指出。
合适的表述:
this pushes the file past 1k lines. can we decompose this first?this adds another special-case branch into an already busy flow. can we move this behind its own abstraction?this works, but it makes the surrounding code more spaghetti. let's keep the behavior and restructure the implementation.this feels like feature logic leaking into a shared path. can we isolate it?this abstraction seems unnecessary. can we just keep the direct flow?why does this need a cast / optional here? can we make the boundary more explicit instead?this looks like a bespoke helper for something we already have elsewhere. can we reuse the canonical one?i think there's a code-judo move here that makes this much simpler. can we reframe this so these branches disappear?this refactor moves complexity around, but doesn't really delete it. is there a way to make the model itself simpler?
Output Expectations
输出预期
Prioritize findings in this order:
- Structural code-quality regressions
- Missed opportunities for dramatic simplification / code-judo restructuring
- Spaghetti / branching complexity increases
- Boundary / abstraction / type-contract problems that make the code harder to reason about
- File-size and decomposition concerns
- Modularity and abstraction issues
- Legibility and maintainability concerns
Do not flood the review with low-value nits if there are larger structural issues.
Prefer a smaller number of high-conviction comments over a long list of cosmetic notes.
按以下优先级整理审查发现:
- 结构性代码质量退化
- 错失的大幅简化/code-judo重构机会
- 面条式/分支复杂度增加
- 边界/抽象/类型契约问题,导致代码更难理解
- 文件大小与拆分问题
- 模块化与抽象问题
- 可读性与可维护性问题
若存在更大的结构性问题,不要用低价值的小细节淹没审查内容。
优先选择少量高说服力的评论,而非冗长的 cosmetic 问题列表。
Approval Bar
批准门槛
Do not approve merely because behavior seems correct.
The bar for approval is:
- no clear structural regression
- no obvious missed opportunity to make the implementation dramatically simpler when such a path is visible
- no unjustified file-size explosion
- no obvious spaghetti-growth from special-case branching
- no obviously hacky or magical abstraction that makes the code harder to reason about
- no unnecessary wrapper/cast/optionality churn obscuring the real design
- no clear architecture-boundary leak or avoidable canonical-helper duplication
- no missed opportunity for an obvious decomposition that would materially improve maintainability
Treat these as presumptive blockers unless the author can justify them clearly:
- the PR preserves a lot of incidental complexity when there is a plausible code-judo move that would delete it
- the PR pushes a file from below 1000 lines to above 1000 lines
- the PR adds ad-hoc branching that makes an existing flow more tangled
- the PR solves a local problem by scattering feature checks across shared code
- the PR adds an unnecessary abstraction, wrapper, or cast-heavy contract that makes the design more indirect
- the PR duplicates an existing helper or puts logic in the wrong layer when there is a clear canonical home
If those conditions are not met, leave explicit, actionable feedback and push for a cleaner decomposition.
不要仅仅因为功能看似正确就批准。
批准的门槛是:
- 无明确的结构性退化
- 无明显的错失大幅简化实现的机会(当存在清晰路径时)
- 无不合理的文件大小激增
- 无明显的特殊场景分支导致面条式代码增长
- 无明显的hack式或魔法式抽象导致代码更难理解
- 无不必要的包装/类型转换/可选性变更模糊真实设计
- 无明显的架构边界泄露或可避免的标准辅助函数重复
- 无错失明显的拆分机会(可切实提升可维护性)
以下情况视为预设阻塞项,除非作者能给出清晰合理的解释:
- PR保留了大量偶然复杂度,而存在可行的code-judo方案可删除这些复杂度
- PR将文件行数从1000行以下增至1000行以上
- PR新增临时分支,让现有流程更混乱
- PR通过在共享代码中分散业务检查来解决局部问题
- PR新增不必要的抽象、包装或大量类型转换的契约,让设计更间接
- PR重复现有辅助函数,或在存在明确标准位置的情况下将逻辑放在错误层级
若未满足上述条件,要留下明确、可执行的反馈,推动更清晰的拆分方案。