skills/code-standards-gate/SKILL.md
Review a concrete spec, diff, or implementation shape against strict code standards. Use when judging public API/CLI contracts, persisted state, schemas/types, generated output, wrapper behavior, helper abstractions, future-facing options, or test coverage before merge. Do not use for broad pre-spec scope shaping; use code-scope-gate for that.
npx skillsauth add plimeor/agent-skills code-standards-gateInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Produce a high-recall code review against strict standards after a spec, diff, or concrete implementation shape exists.
Success means the review catches unjustified public surface, persisted state, schema/type shape, wrapper behavior, generated-output contracts, false abstractions, and missing validation before implementation polish.
A review is complete when:
P1, P2, or P3, ordered by priority and review order, with no artificial capUse this skill after a concrete spec/diff exists. Use code-scope-gate for broad pre-spec scope control.
Do not present a shallow inline pass as exhaustive review. Large or multi-surface diffs require explicit batch planning, batch-by-batch review, and coverage notes.
Do not start with style nits when the diff exposes unnecessary product surface, state shape, schema contract, or wrapper semantics.
Review is exhaustive within the requested scope by default. Treat named artifacts, changed files, directly related owners, contract call sites, and relevant tests as part of the scope that must be covered or explicitly marked blocked/outside scope.
Start with the provided spec, diff, and directly changed files. Read nearby files only when they determine ownership, read/write paths, generated output, command/API behavior, or test coverage.
Continue retrieval only when:
Stop retrieving only when every requested artifact, changed file, planned batch, and named surface is covered, blocked, or outside scope, and further lookup would only improve phrasing or collect nonessential examples.
Plan batches before writing findings. Group files by related behavior first, then order those groups by risk. Do not split one contract across unrelated batches just because files are large.
Batching is mandatory for large diffs, multi-package changes, public contract changes, persisted-state changes, generated output changes, or any review that spans more than one coherent surface. A batch is a coherent review unit with its own working inventory, inspected evidence, candidate findings, and coverage result.
Default associated groups:
Put public contract, persisted shape, generated contracts, and wrapper boundaries before internal implementation polish. Split package distribution from command behavior when both create public promises.
Review coherent batches sequentially in the current session. Finish the planned batches before final synthesis unless the review is blocked by missing context or context budget. Preserve each batch's candidate findings through synthesis and record batch coverage in coverage notes.
The review may stop early only when the requested scope is fully covered, the remaining batches are outside scope, or a concrete blocker prevents responsible coverage. A severe finding in an early batch does not replace review of later batches.
A batch with many or severe findings does not stop the review. Continue through all planned in-scope batches before final synthesis unless a concrete blocker makes further review impossible. If context budget prevents full coverage, report the completed batches and unreviewed batches explicitly; the review is partial, not complete.
Create a dedicated tests and validation batch when tests are large, lock public behavior, or are themselves part of the contract. For small nearby tests, keep them with the behavior they protect but still review them as contract evidence.
Use inventory internally to avoid missing review targets. The final review output contains findings and coverage notes, while the working inventory stays compact and temporary.
Track:
For type, schema, and persisted-state batches, first make a symbol inventory from the code itself. Include exported schemas, helper schemas, optional/fallback/default variants, object schema fragments, transforms, inferred public types, persisted fields, generated metadata fields, and derived identity fields.
If a symbol, field, transform, helper, or generated property appears in the working inventory, it should appear by name in a finding, acceptance note, or coverage note.
Use these standards as review lenses. Apply the lenses that match the changed surface; do not force every section onto every diff.
Any type change changes a module's shape. Treat types, schemas, persisted shape declarations, component props, callbacks, helper types, and exported types as high-risk design evidence. A field becomes state or public shape; a union member becomes a branch; a callback becomes a capability promise; a helper becomes shared semantics; a transform becomes migration or repair behavior; an exported type becomes a contract other modules preserve.
If a type, schema, helper, or field changes the shape of the program and only exists for future flexibility, convenience, or premature reuse, write a finding that names it directly.
Review added or expanded fields, props, options, callbacks, discriminants, state variants, and helper types as capability commitments, especially when they belong to shared components, generic wrappers, public APIs, or reusable hooks.
For each capability-bearing type change, ask:
Callback types are high-risk capability boundaries because they expose actions, not just data. A callback on a shared component should usually represent a presentation event. When it starts carrying domain lifecycle, side effects, or state-machine orchestration, review the enclosing owner as a boundary problem.
If a generic module starts owning domain lifecycle or business state-machine behavior through type shape, write a finding. The smallest correction is usually to move orchestration into the domain owner and keep the generic module as a smaller primitive.
Remove modes, workflows, runtimes, command options, docs promises, state fields, tests, or generated artifacts that are not paying for themselves in the committed boundary.
The spec is reviewable. If faithful implementation spreads a low-value mode or future-facing concept across docs, commands, schemas, state, tests, and paths, challenge the boundary itself and recommend deleting or reauthorizing it.
Review AI-assisted code, or code that shows AI-like failure modes, by observable symptoms rather than by provenance. Finding eligibility comes from concrete complexity, contract, compatibility, or validation risk in the diff.
Use three taste questions as the first pass over suspicious surfaces:
Treat a surface as suspect when it adds abstraction, configuration, state, fallback behavior, adapters, generalized helpers, or new workflows for an unproven future case. Ask what current user behavior, present contract, or observed failure pays for the new surface. If the answer is only flexibility, completeness, symmetry, or future reuse, write a deletion or reauthorization finding.
Overdesign is itself a code-quality defect. Material overdesign belongs in findings even before a demonstrable user behavior regression exists. If the diff increases cognitive load, branch count, public surface, state shape, owner coupling, or maintenance cost without current need, write a finding. Use P2 by default for material overdesign, P1 when it also breaks an existing contract or persisted/user workflow, and P3 only when the excess is small and local.
Prefer reshaping the control flow, data model, or ownership boundary so special cases disappear into the normal path. Challenge fixes that add branches, sentinel states, nullable fields, catch-all fallbacks, or layered validators when a smaller representation would remove the edge case.
Flag plausible-looking code that does not fit the local codebase: calls to nonexistent or wrong-owner helpers, new patterns that bypass existing utilities, generic adapters that obscure a simple local operation, and tests that mirror the implementation without protecting the user-facing contract.
Check for code-volume debt: duplicated blocks, near-copy variants, broad find-and-replace edits, helper layers that save little, and patches that mostly add instead of deleting, moving, or simplifying existing code. The smallest correction may be to delete the new path, use the existing owner, or fold the case into an existing function rather than adding another abstraction.
Do not accept a theoretically cleaner fix that breaks existing user workflow, CLI/API behavior, persisted data, generated output, import paths, or documented contracts. A change that is correct only after users update their behavior is a compatibility finding unless the migration is explicit and authorized.
Prefer the native behavior of the tool, library, protocol, or layer that owns an input contract. A wrapper should not reject, rewrite, normalize, or reinterpret an input before the owner sees it unless the wrapper intentionally exposes a smaller current contract.
Persisted state is a long-lived contract. Store only values that current behavior needs and that cannot be cheaply derived from a clearer source of truth.
For every persisted field, ask who writes it, who reads it, what breaks if it is removed, whether it is portable across machines and CI, whether it duplicates another source of truth, and whether it creates migration or merge-conflict cost.
Do not collapse unrelated presentation, policy, path, identity, local-machine, and future-hook fields into one broad finding when they require different edits.
Use Law of Demeter as a review frame: a component should not make callers, neighboring modules, or future reviewers know internal setup details in order to use it correctly.
Prefer local enforcement over social convention when humans would otherwise have to remember invariants.
Avoid generic helpers when fields may diverge semantically. Declare schemas, validation, and object shape near the field until shared semantics are stable and real.
Helpers are suspect when they only save a few characters, describe syntax instead of domain meaning, or require transforms to patch their output back into the desired shape.
Persisted state parsing should validate the stored contract, not silently repair it. Input normalization belongs at command/input boundaries unless an explicit migration contract says otherwise.
Treat parse-time identity normalization, missing-value defaults, version rewriting, collection sorting, invalid-data fallback, and field-copying as separate failure modes.
Check uniqueness for every derived identity that can collide, not only the primary id. Directories, routes, output names, cache keys, external refs, generated artifact names, and custom paths can collide even when source ids differ.
If a custom derived identity is unnecessary, remove it first. If it remains, validate uniqueness explicitly.
Start with findings in review order and keep summaries secondary. Do not cap the number of findings when the requested output is a review.
Assign one of three priorities:
P1: likely correctness, data, security, compatibility, or user-visible workflow breakage; merge should stop.P2: material maintainability, architecture, contract, state, abstraction, or test-quality defect; includes overdesign that lowers code quality even before a user-visible regression exists.P3: small local cleanup, clarity, or polish issue that is worth fixing but does not change the core decision.Preserve atomic findings. A finding is atomic when a reviewer can point to one surface or tightly coupled surface pair and make one concrete code decision.
Split findings at the level a careful human reviewer would leave separate inline comments:
When synthesizing batch outputs, keep each batch finding unless it is a duplicate, outside scope, or clearly invalid. Merge only exact duplicates or findings whose smallest correction is the same edit. Record dropped or merged findings with a short reason.
When a finding flags a misleading wrapper, helper, field, prop, or callback name, inspect the enclosing owner one level up. The finding should target the misplaced responsibility when the naming issue is a symptom of business lifecycle, state-machine behavior, or domain orchestration entering a shared module or public contract.
After the main agent synthesizes candidate findings, double-check each one before showing it to the user. Re-open the evidence location and ask whether the finding is actually supported by inspected code, diff, docs, tests, or an explicitly labeled inference. Keep the finding only if the problem still holds after this check. Drop, merge, or lower the priority of findings that depend on stale assumptions, missing context, duplicated corrections, or speculative impact, and record the reason in coverage notes.
Each finding should name priority, concrete surface, evidence location, why it matters, and smallest correction.
Findings that involve invalid state, inherited parameters, wrapper bypass, persisted values, parse-time repair, or boundary mismatch should also name the invariant owner: the data source, state writer, shared contract, call boundary, or presentation layer that should make the bad state impossible.
When the smallest correction is a downstream guard or normalization step, include the upstream/root-cause correction and the most correct design if they differ. Prefer the recommendation that removes the failure mode at the earliest responsible owner. Recommend downstream defense only when the upstream owner is outside the requested scope, would break compatibility, or carries higher risk, and state that constraint in the finding.
When explicitly invoked, write in the user's primary language.
Use this order:
Findings must start with a P1, P2, or P3 label. Material overdesign that lowers code quality is a finding, not summary prose, naming feedback, or an abstract preference note.
Coverage notes are brief review metadata, not repeated findings or an inventory map. Include:
If there are no findings, say so directly and name residual risk or test gaps.
Before finalizing, check:
tools
Decide whether and how to use authorized sub-agents, then coordinate delegated work while preserving the main agent's context. Use when the user asks for orchestration, parallel agents, delegation, background workers, context isolation, or when another skill needs delegated research, review, implementation, or verification. Owns host-policy checks, delegation packets, non-overlap, report verification, and stop rules. Do not use to bypass tool policy, infer user authorization, or add coordination overhead to simple single-threaded tasks.
development
Use before finalizing a non-trivial answer, recommendation, review, or decision to reconsider it and raise its quality, especially when shallow reasoning, context inertia, false framing, overconfidence, unfit analogy transfer, or an obvious-but-missed defect could distort the result. Trigger especially before applying external evidence, familiar frameworks, or comparisons to the user's specific request, and when the user asks to reconsider, double-check, take a second look, or sanity-check an answer. Reconsider the draft against its most likely failure mode, and use independent scrutiny only when it is useful and authorized.
development
Review concrete code plan drafts, specs, diffs, and implementation shapes. Use for code-review requests, serious code-plan design critique, and judging whether a proposed direction is sound. Prioritize solution direction, premise validity, logic chain, constraints, alternatives, design shape, contracts, tests, local fit, and actionable findings. Near miss: use code-plan to create or revise plans; use code-scope-gate for pre-spec scope shaping.
development
Write evidence-backed coding plans for implementation, debugging, refactoring, migrations, design parity work, and long-running agent tasks. Use when defining, clarifying, refining, or validating a development plan, /goal prompt, implementation approach, scope and non-goals, work sequence, acceptance criteria, regression evidence, verification strategy, or stop condition. Near miss: use code-review when judging an existing diff, spec, or already drafted plan rather than drafting or revising a plan. Also use when the user says `design twice` after a plan and wants an APOSD-style second-design pass over the completed plan.