code-critic
Skill30 starsChanged 4 days agoApache-2.0View on GitHub
Independent code review inspecting cyclomatic complexity, DRY, SOLID, anti-patterns, maintainability, and interface robustness.
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 9 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈9
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 65
Single Responsibility (SRP): Ensure each class or module has one, and only one, reason to change.
- Distinctive: line 66
Open/Closed (OCP): Verify extensibility via polymorphism, strategy patterns, or dependency injection without modifying existing core logic.
- Distinctive: line 67
Liskov Substitution (LSP): Verify subtypes can substitute for their base types without breaking invariants.
- Distinctive: line 68
Interface Segregation (ISP): Ensure clients are not forced to depend on methods they do not use.
- Distinctive: line 69
Dependency Inversion (DIP): Verify high-level modules depend on abstractions, not concrete implementations.
- Distinctive: line 76
Verify function length stays within clean bounds (ideally $\le 30-40$ lines).
- Distinctive: line 77
Ensure variable, parameter, and function names are written in unambiguous English.
- Distinctive: line 78
Verify that code is self-documenting.
- Distinctive: line 82
Verify boundaries: sanitize external inputs, validate preconditions, and handle edge states.
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 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
Code Critic & Independent Architectural Review Skill
Overview
This skill provides an uncompromising, independent architectural code review discipline. Operating as an objective Senior Code Critic, it systematically inspects source code for excessive cyclomatic complexity, code duplication (DRY violations), SOLID principles non-conformance, object-oriented and architectural anti-patterns, maintainability friction, and interface brittleness.
Unlike conventional linters or superficial PR approvals, this skill conducts deep structural evaluations, calculates an empirical quality score, and publishes a formal review deliverable to docs/<feature-name>/critic-review.md.
When to Use
Trigger Scenarios
- Conducting independent code reviews on completed feature implementations or refactorings before merge.
- Evaluating complex modules exhibiting high churn, fragile test setups, or recurring regressions.
- Auditing adherence to SOLID principles, DRY standards, and Clean Architecture layer boundaries.
- Inspecting cyclomatic complexity and cognitive depth across modified files.
- Producing a formal architectural critique deliverable (
docs/<feature-name>/critic-review.md) during State 3/4 verification workflows.
When NOT to Use
- Authoring production code or fixing defects: Route implementation tasks to
code-implementer. - Executing automated unit or E2E tests: Route test runners to
qa-testerortesting-expert. - Black-box visual/browser flow inspection: Route browser verification to
blackbox-tester. - Adversarial stress and fuzzing probing: Route fuzzing and fault injection to
adversarial-challenger. - Static security scanning and secret leak detection: Route vulnerability scanning to
compliance-verifierandsecurity-audit.
Process
The code critique process evaluates code across six structural dimensions and produces the standard artifact at docs/<feature-name>/critic-review.md.
flowchart TD
START["Inspect Git Diff / Modified Files"] --> D1["1. Cyclomatic Complexity & Nesting"]
D1 --> D2["2. DRY & Duplication Elimination"]
D2 --> D3["3. SOLID Principles Adherence"]
D3 --> D4["4. Anti-Patterns & Code Smells"]
D4 --> D5["5. Maintainability & Cognitive Load"]
D5 --> D6["6. Interface Robustness & Error Paths"]
D6 --> RUBRIC["Calculate Quality Score (0 - 100%)"]
RUBRIC --> VERDICT{"Evaluate Thresholds"}
VERDICT -->|">=85% (No Dim <3)"| PASS["PASSED: Author docs/<feature-name>/critic-review.md"]
VERDICT -->|"70-84% (No Dim <2)"| COND["CONDITIONAL PASS: Actionable tech-debt log"]
VERDICT -->|"<70% or Critical Blocker"| REJECT["REJECTED: Detailed blocker remediation plan"]Phase 1: Dimension Inspection
- Cyclomatic Complexity & Control Flow:
- Assess McCabe cyclomatic complexity: Target $CC \le 10$ per function/method.
- Enforce nesting depth $\le 3$ (loops, branches, and callback depth).
- Identify convoluted boolean conditions, deeply nested
if/elseladders, and arrow-shaped code.
- DRY (Don't Repeat Yourself) & Redundancy:
- Detect duplicate algorithms, validation blocks, and copied utility functions.
- Differentiate between incidental similarity and true domain duplication.
- Flag parallel inheritance hierarchies and repetitive boilerplate.
- SOLID Principles Adherence:
- Single Responsibility (SRP): Ensure each class or module has one, and only one, reason to change.
- Open/Closed (OCP): Verify extensibility via polymorphism, strategy patterns, or dependency injection without modifying existing core logic.
- Liskov Substitution (LSP): Verify subtypes can substitute for their base types without breaking invariants.
- Interface Segregation (ISP): Ensure clients are not forced to depend on methods they do not use.
- Dependency Inversion (DIP): Verify high-level modules depend on abstractions, not concrete implementations.
- Architectural Anti-Patterns & Code Smells:
- Detect God Classes, Feature Envy, Primitive Obsession, Shotgun Surgery, Inappropriate Intimacy, and Leaky Abstractions.
- Identify dead code, speculative generality (YAGNI violations), and circular dependencies.
- Maintainability & Cognitive Load:
- Verify function length stays within clean bounds (ideally $\le 30-40$ lines).
- Ensure variable, parameter, and function names are written in unambiguous English.
- Verify that code is self-documenting; reject comments explaining what instead of why.
- Interface Robustness, Error Handling & Type Safety:
- Enforce explicit type annotations and strict null/undefined checks.
- Verify boundaries: sanitize external inputs, validate preconditions, and handle edge states.
- Enforce zero swallowed exceptions (
try/exceptwithout logging or re-raising).
Phase 2: Scoring Rubric & Thresholds
Each dimension is scored from 1 (unacceptable) to 5 (exemplary). The weighted score is compiled into a 30-point baseline and normalized to a 100% scale.
| Dimension | Weight | Max Points | Passing Standard (>= 4) |
| 1. Cyclomatic Complexity & Control Flow | 20% | 5 | $CC \le 10$, nesting depth $\le 3$, flat control flow |
| 2. DRY & Duplication Elimination | 15% | 5 | Reusable abstractions, zero duplicate validation or business logic |
| 3. SOLID Principles Adherence | 25% | 5 | Clean SRP boundaries, dependency injection, pure interface contracts |
| 4. Architectural Anti-Patterns | 15% | 5 | Zero God classes, no feature envy or leaky abstractions |
| 5. Maintainability & Cognitive Load | 10% | 5 | Concise functions ($\le 30$ lines), clear English naming, high readability |
| 6. Interface Robustness & Error Paths | 15% | 5 | Complete type hints, exhaustive validation, robust error propagation |
Scoring Thresholds
- PASSED ($\ge 85%$, no dimension $< 3$): Implementation is clean, robust, and maintainable. Recommended for immediate release.
- CONDITIONAL PASS ($70% - 84%$, no dimension $< 2$): Implementation is functionally sound but carries non-critical debt. Non-blocking recommendations recorded.
- REJECTED ($< 70%$ OR any dimension $= 1$ OR critical blocker present): Unacceptable complexity, critical SOLID breach, or severe fragility. Handoff to
code-implementerwith concrete line-by-line remediation steps.
Phase 3: Zero-Fluff Deliverable Generation (docs/<feature-name>/critic-review.md <= 50 lines)
Create the target directory docs/<feature-name>/ if not present. Generate a Zero-Fluff review artifact strictly capped at <= 50 lines (<= 20 lines on clean passes) conforming to the Critic Review Template. Omit empty dimension prose sections—output ONLY the compact metadata header, the 6-dimension rubric summary table, and actionable defects (or None. when clean):
# Critic Code Review Report
- **Feature**: `<feature-name>` | **Date**: `YYYY-MM-DD` | **Diff Ref**: `HEAD`
- **Reviewer**: `critic` | **Verdict**: `[PASSED | CONDITIONAL PASS | REJECTED]` | **Score**: `[XX.X]/30 ([XX]%)`
## 1. Quality Scoring Summary
| Dimension | Weight | Score (1-5) | Weighted | Key Metric / Threshold |
| :--- | :---: | :---: | :---: | :--- |
| **1. Cyclomatic Complexity** | 20% | `[1-5]` | `[X.X]` | Max `CC <= 10`, nesting `<= 3` |
| **2. DRY & Duplication** | 15% | `[1-5]` | `[X.X]` | Zero duplicated domain/validation logic |
| **3. SOLID Principles** | 25% | `[1-5]` | `[X.X]` | SRP, OCP, LSP, ISP, DIP invariants |
| **4. Anti-Patterns & Smells** | 15% | `[1-5]` | `[X.X]` | Zero God classes, Feature Envy, leaky layers |
| **5. Maintainability** | 10% | `[1-5]` | `[X.X]` | Functions `<= 30-40` LOC, clear English names |
| **6. Interface Robustness** | 15% | `[1-5]` | `[X.X]` | Strict typing, zero swallowed exceptions |
| **Total** | **100%** | — | **`[XX.X]/30`** | `PASSED >= 85%` \| `CONDITIONAL 70-84%` \| `REJECTED < 70%` |
## 2. Actionable Defects (Write `None.` on clean `PASSED`)
| Priority | Dimension | File & Line | Defect Summary | Required Remediation |
| :---: | :---: | :--- | :--- | :--- |
| `P0` | SOLID / SRP | `path/to/file:L#` | God method handling multi-domain logic | Split into dedicated service classes |Usage
Invocations & Inspection Techniques
Reviewers inspect code using AST analysis tools, diff inspectors, and complexity metrics:
# Measure cyclomatic complexity with radon (Python)
radon cc src/ -s -a
# Measure maintainability index with radon (Python)
radon mi src/ -s
# Run ESLint complexity and maintainability rules (TypeScript/JavaScript)
npx eslint src/ --rule "complexity: [error, 10]" --rule "max-depth: [error, 3]"
# Dart complexity analysis
dart analyze --fatal-infosExample Prompts
- "Perform an independent code critique on the newly implemented authentication flow and produce
docs/auth-flow/critic-review.md." - "Evaluate the order checkout service against SOLID principles, calculate our cyclomatic complexity score, and provide remediation steps."
- "Audit this pull request diff for code smells, God methods, and swallowed error blocks."
Host Execution Instructions
- Claude Code: Invoke as
criticsubagent; inspect files usingReadandGrep; generatedocs/<feature-name>/critic-review.mdusingWrite. - Antigravity: Launch as the
criticsubagent; inspect code usingview_fileandgrep_search; calculate scores and write the report to disk.
Red Flags
- Giving rubber-stamp "LGTM" approvals without inspecting control flow and complexity metrics.
- Overlooking swallowed exceptions (
except: passor empty catch blocks). - Tolerating cyclomatic complexity $> 15$ or nesting depth $> 4$.
- Writing code changes or modifying production files directly (violates reviewer separation of concerns).
- Reporting vague subjective critiques without concrete
file:linelocations and actionable remediations. - Producing bloated review prose exceeding the strict
<= 50 linesZero-Fluff cap (<= 20 lineson clean passes). - Failing to create the destination directory before saving
docs/<feature-name>/critic-review.md.
Verification
- Ensure all 6 critique dimensions are thoroughly inspected.
- Ensure cyclomatic complexity ($CC$) and nesting depth are computed and documented.
- Ensure SOLID violations are categorized with exact
file:linereferences. - Ensure the scoring rubric is filled out with a clear verdict (
PASSED,CONDITIONAL PASS, orREJECTED). - Ensure
docs/<feature-name>/critic-review.mdadheres strictly to the<= 50 linesZero-Fluff cap (<= 20 lineswhen clean, omitting empty prose sections). - Ensure non-passing verdicts include a prioritized remediation table for
code-implementer.
References
- Standard Review Deliverable Template: references/critic-review-template.md
In this repository40 other files it gives its agents.
- AGENTS.mdAGENTS.md
- adversarial-challengerSkill
- agent-metricsSkill
- bigquery-query-optimizationSkill
- blackbox-testerSkill
- build-and-ci-gatesSkill
- cdc-scd-patternsSkill
- code-implementerSkill
- code-smells-expertSkill
- commit-expertSkill
- compliance-verifierSkill
- context-captureSkill
- context-restoreSkill
- database-migration-expertSkill
- design-spec-expertSkill
- documentation-expertSkill
- flutter-architecture-decisionsSkill
- flutter-performance-profilingSkill
- flutter-release-engineeringSkill
- flutter-review-checklistSkill
- flutter-senior-orchestrationSkill
- flutter-test-strategySkill
- flutter-upgrade-migrationSkill
- gcp-data-engineeringSkill
- guidelines-karpathySkill
- loop-engineeringSkill
- performance-scalabilitySkill
- product-analystSkill
- pull-request-expertSkill
- python-expertSkill
- qa-testerSkill
- refactoring-code-expertSkill
- repo-researchSkill
- security-auditSkill
- senior-architect-engineeringSkill
- senior-dev-orchestratorSkill
- sql-query-optimizationSkill
- test-driven-developmentSkill
- testing-expertSkill
- ui-ux-designerSkill
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.

