用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/juspay/kolu --skill code-police命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | code-police |
| description | Review code for quality, simplicity, and common mistakes before declaring work complete. |
| context | fork |
| model | sonnet |
| argument-hint | [--no-elegance] |
Review the current changes (scoped to the current branch/PR) against the rules below plus any project rules. The three passes — rule checklist, fact-check, elegance — run as sub-agents on fresh contexts: the implementer's main context just wrote the diff and is biased to rationalize it; sub-agents start cold. The orchestrator stitches their findings into one summary.
--no-elegance — skip Pass 3 entirely (report
Elegance | – | Skipped (--no-elegance)). Use when /simplify already ran
over this same tree; without the flag Pass 3 would re-invoke it for a
near-guaranteed no-op. Passes 1–2 still run.
Before spawning the passes, read .agency/code-police.md if it exists —
its rules (inline or via pointer) are additions to the built-in list, appearing
as separate Pass 1 rows under the project's rule IDs. Missing file → built-in
rules only.
Apply to every pass, and to the orchestrator (push back on a sub-agent that violates them rather than laundering its dismissal into the summary):
Two similar instances are fine; three is the threshold for extraction. But identical content that must stay in sync (same HTML, version string, port, path) is deduplicated immediately regardless of count.
Before hand-rolling a utility (tokenizer, parser, date/semver/URL helper, arg parser, tree walker, path normalizer…), search for a focused library — and prefer it even as a new dependency when scope and bundle cost fit. "Zero deps" is an easiness judgment: code you don't own doesn't bitrot and its edge cases are someone else's problem. Hand-roll only when the library adds surface you actively don't want, or the hand-roll is genuinely a few branch-free lines. Neither "it's already in the tree" nor "only ~40 lines" gates this — judge scope fit and bundle cost, in both directions (left-pad exists).
Discriminated unions, not booleans or stringly-typed fields. If two fields
can't both be undefined, the type says so.
Aggressively remove unused code — no commented-out blocks, no "just in case".
No empty catch {}, bare catch: pass, or || true. At minimum log; an
intentional best-effort catch carries a comment saying why ignoring is safe.
Collections, buffers, and listeners that grow with usage need a bound or
cleanup path: cap or evict arrays pushed from handlers; debounce/throttle
high-frequency sources (fs.watch, resize, scroll, onmessage) unless
the handler is O(1) and allocation-free; stream instead of whole-file buffers
when the source can grow; share watchers instead of per-caller installs.
LLM-generated code defaults to the simplest correct implementation, which is
often O(n) in session lifetime — fix at write time (cap, debounce, stream,
share); it's rarely caught in review because the code is functionally correct.
At every non-trivial declaration or block, ask: can a reader who didn't write this tell what it does or why this shape? Write the comment that supplies whichever is missing (design intent, control-flow semantics, a hidden constraint types don't carry). "Obvious to me because I just wrote it" is the failure mode.
Spawn Pass 1 and Pass 2 as two parallel read-only sub-agents
(subagent_type: "Explore"; both Agent blocks in one response). Each prompt
is self-contained and points at this file for the rules-of-record. Pass 3 runs
after they return (it applies fixes and would race their reads); skip it
under --no-elegance. Then stitch all outputs into the summary.
Pass 1 (rule checklist) — sub-agent prompt must direct it to: read the
"Reviewing principles" and "Rules" sections of
.apm/skills/code-police/SKILL.md plus .agency/code-police.md if present;
scope to git diff origin/HEAD...HEAD (or the appropriate base ref); and
return one table covering every rule (built-in + project):
| Rule ID | Violation found? | What was identified | Action taken |
|---|
Every "No" requires a Checked by: field — the grep that confirmed
absence (negative rules), or the enumeration of positive candidates ruled out
(bidirectional rules like comment-the-non-obvious). A "No" without
Checked by: is malformed. No skipped rows, no fixes applied (the
orchestrator routes them).
Pass 2 (fact-check) — sub-agent prompt must direct it to: read the "Reviewing principles" and apply them verbatim; scope as above; this is a logic review, not style — find where the code lies to itself: silent error swallowing, inaccurate fallbacks (defaults masking misconfiguration), wishful thinking (unvalidated boundary inputs, "can't fail" code that can, races papered over with comments), logic errors (always-true conditions, off-by-one, shadowing), and slow leaks (unbounded growth, undebounced hot handlers, per-caller watchers). Fail loud over fail silent; every fallback justified for the failure case; precision over coverage (3 real issues beat 20 maybes). Per finding: file, line, one-line risk, concrete fix. No fixes applied.
Pass 3 (elegance) — skip under --no-elegance; skip when the diff is
under 10 lines (Elegance | 0 | Skipped (tiny diff)) — the fan-out overhead
is disproportionate there. Otherwise: under Claude Code, invoke the bundled
/simplify via the Skill tool (three parallel lenses, applies fixes). On
harnesses without it, run 3 iterations of understand → research → apply →
verify, preferring fewer lines, clearer intent, idiomatic style — remove
abstractions, don't add them. The reviewing principles bind here too.
| Pass | Issues found | Details |
|---|---|---|
| Rules | N | Brief summary or "Clean" |
| Fact-check | N | Brief summary or "Clean" |
| Elegance | N | Brief summary or "Clean" |
Below the table, reproduce each pass's full findings verbatim (so a caller
like /do can commit each violation individually). Any pass found issues →
state "Violations or issues found"; all clean → "All clear".