pattern-reviewer-coding-standard
Skill0 starsChanged 5 months agoMITView on GitHub
Language-agnostic code-quality review patterns: Pre-Report Gate (cite line, name failure mode, read context, defend severity); HIGH/CRITICAL require proof; zero findings is valid; common-false-positives list; code-quality bars (large functions/files, deep nesting, missing error handling, mutation, dead code); plus performance, best-practices, and AI-code checks. Each finding is confidence-filtered, severity-graded, cited as `file:line`. Activate when reviewing source code; skip `type:e2e`.
- Deletes or force-pushes
In this repository74 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- create-bug-issueSkill
- create-enhancement-issueSkill
- create-feature-issuesSkill
- dream-summary-memorySkill
- memory-conventionSkill
- operation-gitSkill
- pattern-architect-api-endpointSkill
- pattern-architect-data-modelSkill
- pattern-architect-deep-moduleSkill
- pattern-e2e-coding-standardSkill
- pattern-engineer-apiSkill
- pattern-engineer-backend-standardSkill
- pattern-engineer-coding-standardSkill
- pattern-engineer-containerSkill
- pattern-engineer-databaseSkill
- pattern-engineer-fastapiSkill
- pattern-engineer-frontend-standardSkill
- pattern-engineer-goSkill
- pattern-engineer-javaSkill
- pattern-engineer-kotlinSkill
- pattern-engineer-nodeSkill
- pattern-engineer-non-functionalSkill
- pattern-engineer-observabilitySkill
- pattern-engineer-pythonSkill
- pattern-engineer-rustSkill
- pattern-engineer-securitySkill
- pattern-engineer-ssrSkill
- pattern-engineer-swiftSkill
- pattern-engineer-typescriptSkill
- pattern-engineer-viteSkill
- pattern-exploratory-testingSkill
- pattern-reviewer-apiSkill
- pattern-reviewer-backend-standardSkill
- pattern-reviewer-containerSkill
- pattern-reviewer-contractSkill
- pattern-reviewer-databaseSkill
- pattern-reviewer-fastapiSkill
- pattern-reviewer-frontend-standardSkill
- pattern-reviewer-goSkill
- pattern-reviewer-javaSkill
- pattern-reviewer-kotlinSkill
- pattern-reviewer-nodeSkill
- pattern-reviewer-non-functionalSkill
- pattern-reviewer-observabilitySkill
- pattern-reviewer-pythonSkill
- pattern-reviewer-rustSkill
- pattern-reviewer-securitySkill
- pattern-reviewer-ssrSkill
- pattern-reviewer-swiftSkill
- pattern-reviewer-test-coverageSkill
- pattern-reviewer-typescriptSkill
- pattern-reviewer-viteSkill
- pattern-test-coverageSkill
- principle-engineer-tddSkill
- scaffold-projectSkill
- workflow-architect-interviewSkill
- workflow-designer-sample-pagesSkill
- workflow-design-interviewSkill
- workflow-e2e-authorSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
12 rules. About 0 are common, 6 are distinctive, and 6 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
6
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 12
Do NOT activate for type:e2e.
- Very specific: line 16
After loading this skill, also check $MAIN_ROOT/.claude/memory/patterns/pattern-reviewer-coding-standard.md in the consuming project …
- Very specific: line 32
Match project conventions: Read CLAUDE.md and every ADR in docs/ADRs/.
- Very specific: line 33
Never suggest destructive actions: If a fix would require git reset --hard, --no-verify, or rewriting published history, surface the …
- Distinctive: line 37
Before you write a finding, answer all four questions.
- Distinctive: line 41
Have I read the surrounding context?: Check callers, imports, and tests.
- Distinctive: line 52
If you cannot produce all three, demote to MEDIUM or drop.
- Distinctive: line 63
"Missing input validation": when the function is internal and its callers already validate.
- Very specific: line 67
"Prefer
constoverlet": when the variable is reassigned. - Very specific: line 68
"Possible null dereference": when the preceding line narrows the type or an if guard is in scope.
- Distinctive: line 75
When tempted to flag one of the above, ask: "Would a senior engineer on this team actually change this in review?" If no, skip.
- Distinctive: line 135
When reviewing AI-authored changes, prioritize:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
pattern-reviewer-coding-standard
When to activate
- The dispatched caller is reviewing a
type:backend/type:frontendtask's production-code diff. - A user says "review this diff for quality", "look for bugs", "audit the change".
- Do NOT activate for
type:e2e.
Project memory overlay
After loading this skill, also check $MAIN_ROOT/.claude/memory/patterns/pattern-reviewer-coding-standard.md in the consuming project (resolve MAIN_ROOT="$(dirname "$(git rev-parse --path-format=absolute --git-common-dir)")"). If present, load it as an additive overlay to the rules below; if absent, skip silently. See memory-convention for the full contract (additivity, severity floor, conflict surfacing).
References
| Reference | When to read |
templates/review-comment.md | Always read before composing the comment body. The finding rows must match this shape verbatim so downstream fix passes can parse them. |
Iron rules for every finding
- >80% confidence filter. Report only when you are >80% confident. Skip stylistic preferences unless they violate a documented convention. Skip issues in unchanged code unless they are CRITICAL security. Consolidate similar findings.
- Cite
path/to/file.ext:line. Quote the offending snippet in a BAD block; show the fix in a GOOD block (or a one-sentence fix when a snippet is overkill). - Read surrounding code. Open the full file; follow imports; check call sites. If you cannot understand the change without more context, say so.
- Severity is load-bearing. CRITICAL / HIGH block the gate; MEDIUM / LOW are reported but informational. Use the per-pattern severity assigned below. Never inflate to draw attention; never deflate to avoid friction.
- Never refer to a finding as
#N. GitHub auto-links#1,#2, … to issues. Use a non-numeric handle: quoted title,F1/F2, orFinding 1/Finding 2. - A finding is a class, not a line. A defect you spot at one
file:linealmost always recurs — the same unguarded mutation, the same broadWHERE, the same missing timeout at sibling sites. Before filing, state the violated invariant in one sentence, grep the reviewed surface for every site sharing that structure, and cite them all in ONE finding with aClass:line ("applies tocancel,no_show, andedit") plus the directive "resolve all sites sharing this structure, not only the cited line." Filing site A this round and its identical sibling next round manufactures avoidable BLOCK cycles and is itself a review defect. - Match project conventions. Read
CLAUDE.mdand every ADR indocs/ADRs/. A diff that contradicts an active ADR is a finding, not a stylistic call. - Never suggest destructive actions. If a fix would require
git reset --hard,--no-verify, or rewriting published history, surface the underlying problem.
Pre-Report Gate
Before you write a finding, answer all four questions. If any answer is no or unsure, downgrade the severity or drop the finding.
- Can I cite the exact line? Name the file and line. Vague findings like "somewhere in the auth layer" are not actionable and must be dropped.
- Can I describe the concrete failure mode? Name the input, state, and bad outcome. If you cannot name the trigger, you are pattern-matching, not reviewing.
- Have I read the surrounding context? Check callers, imports, and tests. Many apparent issues are already handled one frame up or guarded by a type.
- Is the severity defensible? A missing JSDoc is never HIGH. A single
anyin a test fixture is never CRITICAL. Severity inflation erodes trust faster than missed findings.
HIGH / CRITICAL require proof
For any finding tagged HIGH or CRITICAL, the body must include:
- The exact snippet and line number.
- The specific failure scenario: input, state, and bad outcome.
- Why existing guards (types, validation, framework defaults, upstream caller) do not catch it.
If you cannot produce all three, demote to MEDIUM or drop.
Zero findings is a valid review
A clean review is a valid review. Do not manufacture findings to justify the invocation. If the diff is small, well-typed, tested, and follows the project's patterns, the correct output is a summary with zero rows and a clean verdict. Manufactured findings, filler nits, speculative "consider using X", and hypothetical edge cases without a trigger directly undermine this skill's usefulness.
Common false positives — skip these
Patterns LLM reviewers commonly mis-flag. Skip unless you have evidence specific to this codebase.
- "Consider adding error handling" on a call whose error path is handled by the caller or framework (Express error middleware, React error boundaries, top-level
try/catch, Promise chains with upstream.catch). - "Missing input validation" when the function is internal and its callers already validate. Trace at least one caller before flagging.
- "Magic number" for well-known constants:
200,404,1000ms,60,24,1024, array index0or-1, HTTP status codes, single-use local constants whose meaning is obvious from the variable name. - "Function too long" for exhaustive
switchstatements, configuration objects, test tables, or generated code. Length is not complexity. - "Missing JSDoc / docstring" on single-purpose internal helpers whose name and signature are self-describing.
- "Prefer
constoverlet" when the variable is reassigned. Read the whole function before flagging. - "Possible null dereference" when the preceding line narrows the type or an
ifguard is in scope. Trace type flow instead of pattern-matching on?.. - "N+1 query" on fixed-cardinality loops (iterating a four-element enum) or on paths already using
DataLoader/ batching. - "Missing await" on fire-and-forget calls that are intentionally detached (logging, metrics, background queue pushes). Check for a comment or
voidprefix before flagging. - "Should use TypeScript / Should have types" in a JavaScript-only file. Match the project's existing language; do not suggest a stack change.
- "Hardcoded value" for values in test fixtures, example code, or documentation snippets. Tests should have hardcoded expectations.
- Security theater: flagging
Math.random()in a non-cryptographic context (animation, jitter, sampling), or flaggingeval/Functionin a plugin system that is explicitly a code-loading surface.
When tempted to flag one of the above, ask: "Would a senior engineer on this team actually change this in review?" If no, skip.
Patterns to review
Walk the patterns in order. Apply the >80% confidence filter. Consolidate duplicates.
Code quality (HIGH)
- Large functions (>50 lines) — split into smaller, focused units.
- Large files (>800 lines) — extract modules by responsibility.
- Deep nesting (>4 levels) — early returns, extract helpers.
- Missing error handling — unhandled rejections, empty catch blocks.
- Mutation patterns — prefer immutable ops (spread,
map/filter,reduce). console.log/printleft behind — remove debug logging before merge.- Dead code — commented-out code, unused imports, unreachable branches.
// BAD: deep nesting + mutation
function processUsers(users) {
if (users) {
for (const user of users) {
if (user.active) {
if (user.email) {
user.verified = true;
results.push(user);
}
}
}
}
return results;
}
// GOOD: early returns + immutability + flat
function processUsers(users) {
if (!users) return [];
return users
.filter(user => user.active && user.email)
.map(user => ({ ...user, verified: true }));
}Performance (MEDIUM)
- Inefficient algorithms — O(n²) when O(n log n) or O(n) is available.
- Repeated expensive computations without memoization on hot paths.
- Large bundle imports — importing entire libraries when tree-shakeable alternatives exist.
- Synchronous I/O in async contexts.
Framework-specific performance (React re-renders, N+1 queries, virtualization) lives in the per-tech skills.
Best practices (LOW)
- TODO / FIXME without tickets — reference an issue number.
- Missing JSDoc / docstrings on public APIs — exported functions undocumented when non-obvious.
- Single-letter / generic variable names (
x,tmp,data) in non-trivial contexts. - Magic numbers / strings without a named constant.
- Inconsistent formatting — mixed semicolons, quote styles, indentation. (Most should be auto-fixed by formatter; flag only when formatter wasn't run.)
AI-generated-code addendum
When reviewing AI-authored changes, prioritize:
- Behavioral regressions and edge-case handling.
- Security assumptions and trust boundaries.
- Hidden coupling or accidental architecture drift.
- Unnecessary model-cost-inducing complexity.
Cost-awareness:
- Flag workflows that escalate to higher-cost models without a clear reasoning need.
- Recommend defaulting to lower-cost tiers for deterministic refactors.
Constructing the finding
### [SEVERITY] <one-line title — no leading `#N`>
**File:** `path/to/file.ext:42`
**Issue:** <what is wrong and why it matters, one or two sentences>
**Fix:** <concrete corrective action>
```<lang>
// BAD
<offending snippet>// GOOD
<corrected snippet>
- `[SEVERITY]` is exactly one of `CRITICAL`, `HIGH`, `MEDIUM`, `LOW`, per the pattern's bar above.
- LOW findings can collapse the BAD/GOOD block when a one-line `**Fix:**` suffices.
Hand the collected findings back to the dispatching `reviewer` agent — it owns comment composition, severity counts, verdict, scope note, posting.Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

