ワンクリックで
code-police
Review code for quality, simplicity, and common mistakes before declaring work complete.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Review code for quality, simplicity, and common mistakes before declaring work complete.
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
| name | code-police |
| description | Review code for quality, simplicity, and common mistakes before declaring work complete. |
Review the current changes (scoped to the current branch/PR) against the rules below and any additional code-police rules from project instructions, then run three passes in order.
Two similar instances are fine — don't abstract prematurely. Three is the threshold for extraction. But identical content that must stay in sync (same HTML, same version string) should be deduplicated immediately regardless of count. Versions, ports, paths — define once, reference everywhere.
Use discriminated unions, not booleans or stringly-typed fields. If two fields can't both be undefined at the same time, model that in the type.
Aggressively remove unused code. No commented-out blocks, no "just in case" leftovers.
Never silently swallow errors. Empty catch {} blocks, bare catch: pass, and || true hide failures. At minimum, log the error. If the catch is intentional (best-effort operation), add a comment explaining why the error is safe to ignore.
Rationale: Silent swallowing masks bugs — failures disappear without a trace, making debugging impossible.
Add comments where the why isn't obvious from the code. Don't comment the what. Also comment where the what isn't obvious — non-obvious guards, CSS workarounds, platform-specific behavior. Non-obvious workarounds (temp files, wrapper scripts, env var shims) must have a comment explaining why they exist.
Present a table with every rule above:
| Rule ID | Violation found? | What was identified | Action taken |
|---|
If no violation was found for a rule, mark it as "No" with a brief note on what was checked. Every rule must appear in the table — no skipping.
Audit the changes for correctness and rigor. This is not a style review — it's a logic review. Find places where the code lies to itself.
Flag:
try/catch: pass, empty catch {}, || true, errors caught but not propagated, Result/Option silently defaulted.For each finding: file, line, one-line risk, concrete fix. If no issues, say so — don't invent problems.
Anti-patterns in YOUR review (strictly banned):
Review the changes for elegance and simplicity. For each iteration (run 3 iterations):
Principles:
After all three passes, present a combined summary:
| Pass | Issues found | Details |
|---|---|---|
| Rules | N | Brief summary or "Clean" |
| Fact-check | N | Brief summary or "Clean" |
| Elegance | N | Brief summary or "Clean" |
If ANY pass found issues, clearly state: "Violations or issues found" so the workflow can route to a fix step.
If all passes are clean, state: "All clear".
Simple means not interleaved. Each module does one thing. Data flows through arguments and return values, not shared mutable state or indirection.
# above the recipe name).Group code by rate of change, not by technical layer. Things that change together live together; things that change independently get separate modules.