Marketplace

code-quality-review

Systematic code review patterns, quality dimensions, anti-pattern detection, and constructive feedback techniques. Use when reviewing code changes, assessing codebase quality, identifying technical debt, or mentoring through reviews. Covers correctness, design, security, performance, and maintainability.

$ Installieren

git clone https://github.com/rsmdt/the-startup /tmp/the-startup && cp -r /tmp/the-startup/plugins/team/skills/quality/code-quality-review ~/.claude/skills/the-startup

// tip: Run this command in your terminal to install the skill


name: code-quality-review description: Systematic code review patterns, quality dimensions, anti-pattern detection, and constructive feedback techniques. Use when reviewing code changes, assessing codebase quality, identifying technical debt, or mentoring through reviews. Covers correctness, design, security, performance, and maintainability.

Code Quality Review Methodology

Systematic patterns for reviewing code and providing constructive, actionable feedback that improves both code quality and developer skills.

When to Activate

  • Reviewing pull requests or merge requests
  • Assessing overall codebase quality
  • Identifying and prioritizing technical debt
  • Mentoring developers through code review
  • Establishing code review standards for teams
  • Auditing code for security or compliance

Review Dimensions

Every code review should evaluate these six dimensions:

1. Correctness

Does the code work as intended?

CheckQuestions
FunctionalityDoes it solve the stated problem?
Edge CasesAre boundary conditions handled?
Error HandlingAre failures gracefully managed?
Data ValidationAre inputs validated at boundaries?
Null SafetyAre null/undefined cases covered?

2. Design

Is the code well-structured?

CheckQuestions
Single ResponsibilityDoes each function/class do one thing?
Abstraction LevelIs complexity hidden appropriately?
CouplingAre dependencies minimized?
CohesionDo related things stay together?
ExtensibilityCan it be modified without major changes?

3. Readability

Can others understand this code?

CheckQuestions
NamingDo names reveal intent?
CommentsIs the "why" explained, not the "what"?
FormattingIs style consistent?
ComplexityIs cyclomatic complexity reasonable (<10)?
FlowIs control flow straightforward?

4. Security

Is the code secure?

CheckQuestions
Input ValidationAre all inputs sanitized?
AuthenticationAre auth checks present where needed?
AuthorizationAre permissions verified?
Data ExposureIs sensitive data protected?
DependenciesAre there known vulnerabilities?

5. Performance

Is the code efficient?

CheckQuestions
AlgorithmicIs time complexity appropriate?
MemoryAre allocations reasonable?
I/OAre database/network calls optimized?
CachingIs caching used where beneficial?
ConcurrencyAre race conditions avoided?

6. Testability

Can this code be tested?

CheckQuestions
Test CoverageAre critical paths tested?
Test QualityDo tests verify behavior, not implementation?
MockingAre external dependencies mockable?
DeterminismAre tests reliable and repeatable?
Edge CasesAre boundary conditions tested?

Anti-Pattern Catalog

Common code smells and their remediation:

Method-Level Anti-Patterns

Anti-PatternDetection SignsRemediation
Long Method>20 lines, multiple responsibilitiesExtract Method
Long Parameter List>3-4 parametersIntroduce Parameter Object
Duplicate CodeCopy-paste patternsExtract Method, Template Method
Complex ConditionalsNested if/else, switch statementsDecompose Conditional, Strategy Pattern
Magic NumbersHardcoded values without contextExtract Constant
Dead CodeUnreachable or unused codeDelete it

Class-Level Anti-Patterns

Anti-PatternDetection SignsRemediation
God Object>500 lines, many responsibilitiesExtract Class
Data ClassOnly getters/setters, no behaviorMove behavior to class
Feature EnvyMethod uses another class's data extensivelyMove Method
Inappropriate IntimacyClasses know too much about each otherMove Method, Extract Class
Refused BequestSubclass doesn't use inherited behaviorReplace Inheritance with Delegation
Lazy ClassDoes too little to justify existenceInline Class

Architecture-Level Anti-Patterns

Anti-PatternDetection SignsRemediation
Circular DependenciesA depends on B depends on ADependency Inversion
Shotgun SurgeryOne change requires many file editsMove Method, Extract Class
Leaky AbstractionImplementation details exposedEncapsulate
Premature OptimizationComplex code for unproven performanceSimplify, measure first
Over-EngineeringAbstractions for hypothetical requirementsYAGNI - simplify

Review Prioritization

Focus review effort where it matters most:

Priority 1: Critical (Must Fix)

  • Security vulnerabilities (injection, auth bypass)
  • Data loss or corruption risks
  • Breaking changes to public APIs
  • Production stability risks

Priority 2: High (Should Fix)

  • Logic errors affecting functionality
  • Performance issues in hot paths
  • Missing error handling for likely failures
  • Violation of architectural principles

Priority 3: Medium (Consider Fixing)

  • Code duplication
  • Missing tests for new code
  • Naming that reduces clarity
  • Overly complex conditionals

Priority 4: Low (Nice to Have)

  • Style inconsistencies
  • Minor optimization opportunities
  • Documentation improvements
  • Refactoring suggestions

Constructive Feedback Patterns

The Feedback Formula

[Observation] + [Why it matters] + [Suggestion] + [Example if helpful]

Good Feedback Examples

# Instead of:
"This is wrong"

# Say:
"This query runs inside a loop (line 45), which could cause N+1
performance issues as the dataset grows. Consider using a batch
query before the loop:

```python
users = User.query.filter(User.id.in_(user_ids)).all()
user_map = {u.id: u for u in users}

"


```markdown
# Instead of:
"Use better names"

# Say:
"The variable `d` on line 23 would be clearer as `daysSinceLastLogin` -
it helps readers understand the business logic without tracing back
to the assignment."

Feedback Tone Guide

AvoidPrefer
"You should...""Consider..." or "What about..."
"This is wrong""This might cause issues because..."
"Why didn't you...""Have you considered..."
"Obviously...""One approach is..."
"Always/Never do X""In this context, X would help because..."

Positive Observations

Include what's done well:

"Nice use of the Strategy pattern here - it makes adding new
payment methods straightforward."

"Good error handling - the retry logic with exponential backoff
is exactly what we need for this flaky API."

"Clean separation of concerns between the validation and persistence logic."

Review Checklists

Quick Review Checklist (< 100 lines)

  • Code compiles and tests pass
  • Logic appears correct for stated purpose
  • No obvious security issues
  • Naming is clear
  • No magic numbers or strings

Standard Review Checklist (100-500 lines)

All of the above, plus:

  • Design follows project patterns
  • Error handling is appropriate
  • Tests cover new functionality
  • No significant duplication
  • Performance is reasonable

Deep Review Checklist (> 500 lines or critical)

All of the above, plus:

  • Architecture aligns with system design
  • Security implications considered
  • Backward compatibility maintained
  • Documentation updated
  • Migration/rollback plan if needed

Review Workflow

Before Reviewing

  1. Understand the context (ticket, discussion, requirements)
  2. Check if CI passes (don't review failing code)
  3. Estimate review complexity and allocate time

During Review

  1. First pass: Understand the overall change
  2. Second pass: Check correctness and design
  3. Third pass: Look for edge cases and security
  4. Document findings as you go

After Review

  1. Summarize overall impression
  2. Clearly indicate approval status
  3. Distinguish blocking vs non-blocking feedback
  4. Offer to discuss complex suggestions

Review Metrics

Track review effectiveness:

MetricTargetWhat It Indicates
Review Turnaround< 24 hoursTeam velocity
Comments per Review3-10Engagement level
Defects FoundDecreasing trendQuality improvement
Review Time< 60 min for typical PRRight-sized changes
Approval Rate70-90% first submissionClear standards

Anti-Patterns in Reviewing

Avoid these review behaviors:

Anti-PatternDescriptionBetter Approach
NitpickingFocusing on style over substanceUse linters for style
Drive-by ReviewQuick approval without depthAllocate proper time
GatekeepingBlocking for personal preferencesFocus on objective criteria
Ghost ReviewApproval without commentsAdd at least one observation
Review BombingOverwhelming with commentsPrioritize and limit to top issues
Delayed ReviewLetting PRs sit for daysCommit to turnaround time

References