style-audit
Style Audit
Review code quality consistency, coding patterns, and style drift.
Scope
1. Naming and shape consistency
- naming consistency across types, constants, functions, and files
- factory naming (
create*for factories; avoidbuild*/make*unless established locally) - export shape: prefer direct
export constover local alias +export { ... } - import clarity: avoid aliasing unless it resolves a collision
- module layout consistency
2. Control flow and state modeling
- switch exhaustiveness (
default+unreachablewhen applicable) - assert patterns (
invariantfor impossible states vs user-facing errors) - prefer explicit status/state fields over boolean flags for lifecycle phases
- prefer guard clauses and early returns over nested
if/else - prefer data-driven lookups over long control-flow chains
3. Pattern consistency
Check where the codebase already has a clear local pattern:
- table-driven or rule-driven structure where nearby code uses it
- error classification: prefer
kindcontracts over message regex - repeated argument groups that want one named type
- raw strings or codes that should become typed values
4. Readability and hygiene
- no banner or separator comments
- no unused params, dead branches, or ad-hoc fallbacks
- keep style aligned with nearby code
Evidence threshold
Only flag issues with a clear local convention or documented repo-wide pattern. Do not enforce generic style-guide preferences.
Workflow
- Identify local style conventions from nearby code.
- Compare against repo-wide documented conventions.
- Find concrete deviations with evidence.
- Report findings ordered by severity.
Output
For each finding: severity, file, violated convention, evidence, fix direction.
Then: Must-fix | Optional polish | Open questions (if needed).
Anti-patterns
- Enforcing generic style dogma over local conventions
- Broad rewrites instead of minimal fixes
- Speculative abstractions
- Nitpicking formatting not tied to repo conventions
More from cniska/skills
pr
Create a pull request with review and verify. Use when the branch is ready to merge.
9plan
Design a feature or behavior change through dialogue. Use when asked to plan, scope, design, or break down work before coding.
9debug
Debug systematically with structured triage. Use when tests fail, builds break, or runtime behavior doesn't match expectations.
7build
Implement features incrementally through vertical slices. Use when building features, adding functionality, or implementing tasks that touch multiple files.
6simplify
Simplify code by reducing complexity while preserving exact behavior. Use after a feature is working, during review when complexity is flagged, or when encountering unclear code.
5docs-audit
Audit docs for drift, missing updates, and terminology changes. Use when code changes should be reflected in documentation.
5