一键导入
clean-code-reviewer
Use when reviewing code, pull requests, branches, diffs, or changed files for quality, correctness, security, performance, and style issues.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Use when reviewing code, pull requests, branches, diffs, or changed files for quality, correctness, security, performance, and style issues.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | clean-code-reviewer |
| description | Use when reviewing code, pull requests, branches, diffs, or changed files for quality, correctness, security, performance, and style issues. |
Orchestrates a full code review by inspecting the diff, selecting relevant skills, and dispatching concurrent review passes for style and correctness.
If the user specifies what to review, use that target exactly. Valid targets include specific files, directories, commit ranges, branches, pull requests, changed files, or the full codebase.
If the user does not specify a target, follow Diff Detection below to determine what to review. Before starting, state the selected target briefly. Ask only when no meaningful target can be inferred.
For diff-based review targets, determine the comparison to inspect:
git status. If there are staged or unstaged changes, review the working tree diff (git diff and git diff --cached).git symbolic-ref refs/remotes/origin/HEAD (strips the refs/remotes/origin/ prefix), falling back to main then master if that fails. Diff the current branch against it: git diff $(git merge-base HEAD <base>)..HEAD.git diff --name-only (with the appropriate target) to get the list of changed files.When the user asks to review the entire codebase (or a large directory), a diff-based review does not apply. Instead:
From the changed file list, classify each file:
| Pattern | Track |
|---|---|
.ts, .tsx (no JSX) | TypeScript |
.py, .pyi | Python |
.tsx with React imports or JSX | React + TypeScript |
.css, .module.css, .scss, styled templates, Tailwind classes | CSS |
Test files (*.test.*, *.spec.*, test_*.py, *_test.py) | Tests |
New or moved .ts, .tsx, .jsx, .module.css files | File Organization |
To detect new or moved files, run git diff --diff-filter=AR (with the same target used above). If any .ts, .tsx, .jsx, or .module.css files appear, add "File Organization" to the tracks for the Style Pass.
Run two review passes in parallel:
Step 1 — Read the index skill(s) based on file classification:
| Files | Read |
|---|---|
.ts, .tsx (TypeScript) | ../clean-typescript/SKILL.md |
.py, .pyi (Python) | ../clean-python/SKILL.md |
| React (JSX / React imports) | ../clean-react/SKILL.md + ../clean-typescript/SKILL.md |
.css, .module.css, .scss, styled, Tailwind | ../clean-css/SKILL.md |
Test files (*.test.*, *.spec.*, test_*.py, *_test.py) | ../clean-typescript-tests/SKILL.md, ../clean-react-tests/SKILL.md, or ../clean-python-tests/SKILL.md |
New/moved .ts, .tsx, .jsx, .module.css | ../clean-react-file-organization/SKILL.md |
Step 2 — Read relevant sub-skills. For any TypeScript, Python, or React files, always load clean-general-names, clean-general-comments, and clean-general — naming, comment hygiene, and general code quality apply to all code regardless of diff content. For all other sub-skills, scan the diff and load only those matching the rule categories you observe. Do not load all sub-skills.
All skills are installed as siblings in the same directory. Reference TypeScript sub-skills with the sibling path pattern ../clean-typescript-{topic}/SKILL.md, Python sub-skills with ../clean-python-{topic}/SKILL.md, general skills at ../clean-general/SKILL.md, ../clean-general-names/SKILL.md, and ../clean-general-comments/SKILL.md, and React sub-skills with ../clean-react-{topic}/SKILL.md. Use the Skill Routing table in each index to map rule codes to sub-skill names.
Step 3 — Apply and report. Apply all loaded skills to the diff. Report findings with rule IDs.
Load clean-code-reviewer-correctness. Apply it to the full diff. This pass reviews for functional bugs, security vulnerabilities, performance issues, and test coverage gaps. It ignores style.
Combine findings from both passes into a single report.
Within-pass dedup (Style): When multiple style rules flag the same code region with the same fix, collapse them to one finding under the most specific rule, citing supporting rules in parentheses (e.g., Style (M5; also touches M8, G1)). See the "Rule Precedence" section in ../clean-typescript/SKILL.md or ../clean-python/SKILL.md for the specificity order and the pairs that stay independent.
Cross-pass dedup (Style ↔ Correctness): If the correctness pass flags a code region, suppress any style finding that overlaps the same region. The correctness fix will resolve the style issue — reporting both is noise. Only keep the style finding if it addresses a genuinely independent concern at the same location.
## Style
[Findings grouped by file]
## Correctness
[Findings grouped by file]
## Verdict
[Approve | Approve with suggestions | Request changes]
[One-sentence summary referencing finding codes, e.g. "Request changes — [S1] is a security hole; [C2] will break existing callers."]
Each finding uses this format, with its code as the leading identifier:
[S1] Severity: Block | Fix | Suggest
Category: Style (rule-id)
Location: path/to/file:line
Issue: What is wrong and why it matters.
Fix: Concrete next step.
[C1] Severity: Block | Fix | Suggest
Category: Correctness | Security | Performance | Test Coverage
Location: path/to/file:line
Issue: What is wrong and why it matters.
Fix: Concrete next step.
Style findings are numbered [S1], [S2], … in order of severity. Correctness findings are numbered [C1], [C2], … in order of severity. Numbers are assigned after merging so the user can reference any finding by code (e.g. "fix S2 and C1").
After the verdict, always close with:
Reply with the codes you want fixed (e.g.
fix S1 C2),allto address everything, orblocksto fix only Block findings.
If there are no findings, omit this prompt.
Use when checking code for functional correctness, backwards compatibility, logic errors, security vulnerabilities, performance issues, or missing test coverage — not style.
Use when writing, fixing, editing, or refactoring TypeScript, Python, React, or CSS code. Not for PR or diff reviews — use clean-code-reviewer for those.
Use when writing, fixing, or editing comments or documentation in any language, especially commented-out code, stale docs, metadata comments, TODO banners, redundant comments, or unclear comment value.
Use when naming or renaming identifiers in any language, especially cryptic names, ambiguous parameters, type or scope encodings, misleading side effects, or requests for clearer names.
Use when writing, fixing, or editing code in any language with duplicated logic, magic values, unclear one-liners, mixed responsibilities, clutter, arbitrary code, or inconsistent abstraction levels.
Use when writing, fixing, or editing Python async flows, coroutines, asyncio tasks, retries, timeouts, cancellation, shared mutable state across awaits, race conditions, or flaky async tests.