
Code Quality Review
- 51 installs
- 14 repo stars
- Updated January 23, 2026
- dauquangthanh/hanoi-rainbow
Code Quality Review is an agent skill that inspects code for smells, complexity, and best-practice gaps so developers can improve maintainability with rated findings and recommendations.
About
Code Quality Review is a Hanoi Rainbow skill for systematic maintainability analysis across smells, complexity, patterns, and best practices. Pull it in before merging sizable changes, during tech-debt sweeps, or when you need a structured report with severities instead of ad-hoc nitpicks. It assumes readable source and optional linter context rather than replacing security-focused or frontend-only review skills.
- Code smells and SOLID-oriented checks
- Cyclomatic and cognitive complexity thresholds
- Technical debt and maintainability scoring
- Scope-based review depth (small to large diffs)
Code Quality Review by the numbers
- 51 all-time installs (skills.sh)
- Ranked #573 of 1,352 Code Review & Quality skills by installs in the Skillselion catalog
- Data as of Jul 29, 2026 (Skillselion catalog sync)
npx skills add https://github.com/dauquangthanh/hanoi-rainbow --skill code-quality-reviewAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 51 |
|---|---|
| repo stars | ★ 14 |
| Last updated | January 23, 2026 |
| Repository | dauquangthanh/hanoi-rainbow ↗ |
How do you consistently judge whether a change is maintainable, free of major smells, and aligned with team standards?
Runs multi-dimensional quality reviews with code-smell detection, complexity metrics, and prioritized improvement actions.
Who is it for?
Developers reviewing medium-to-large diffs or auditing modules for technical debt and complexity hotspots.
Skip if: Teams needing OWASP-focused security audits or UI-only accessibility reviews without general quality analysis.
When should I use this skill?
You want a structured code quality or maintainability review with smells, metrics, and actionable improvements.
What you get
A detailed review report with severities, metrics notes, and specific refactoring or cleanup recommendations is produced.
Files
Code Quality Review
Overview
Conducts systematic code quality analysis across multiple dimensions: maintainability, readability, complexity, design patterns, naming conventions, code duplication, and adherence to best practices. Produces actionable feedback with severity ratings and specific improvement recommendations.
Core Capabilities
1. Code Smells Detection - Identifies bloaters, object-orientation abusers, change preventers, dispensables, and couplers 2. Complexity Analysis - Measures cyclomatic and cognitive complexity with risk assessment 3. Maintainability Assessment - Evaluates code maintainability index and technical debt 4. Design Pattern Evaluation - Reviews architectural patterns and SOLID principles 5. Best Practices Validation - Checks adherence to language-specific standards and conventions
Review Workflow
Step 1: Scope Assessment
Determine review scope based on change size:
- Small (<100 lines): Quick correctness check, 15-30 minutes
- Medium (100-500 lines): Full quality analysis, 1-2 hours
- Large (>500 lines): Architectural review, break into smaller reviews if possible, 2-4 hours
For scope-specific guidance, see review-scope-guidelines.md
Step 2: Initial Assessment
Gather Context:
- Identify programming language and framework
- Understand project type (web app, API, library, CLI, etc.)
- Note existing coding standards or style guides
- Check for linter configuration files (.eslintrc, .pylintrc, checkstyle.xml, etc.)
Read the Code:
- Start with entry points (main files, index files)
- Review module/package organization
- Check dependency management
- Examine test files if available
Step 3: Quality Analysis
Analyze code across key dimensions:
- Code Smells: Long methods, large classes, duplicate code, dead code, etc.
- Complexity: Cyclomatic complexity (target <15), cognitive complexity, nesting depth
- Maintainability: Clear naming, proper abstraction, separation of concerns
- Design Patterns: Appropriate pattern usage, SOLID principles adherence
- Best Practices: Language idioms, error handling, resource management
For detailed analysis criteria and thresholds, see review-workflow.md
For quality metrics and thresholds, see quality-metrics-reference.md
Step 4: Document Findings
Structure the review report with:
- Executive summary with scores and top priorities
- Detailed findings with severity, location, description, and recommendations
- Metrics summary with current vs. target values
- Prioritized recommendations (P0-P3)
- Positive observations acknowledging good practices
- Technical debt summary with effort estimates
For complete report structure and output guidelines, see review-report-format.md
Quality Assurance
Use the checklist to ensure comprehensive reviews:
- Code organization and structure
- Naming conventions and clarity
- Complexity thresholds
- Error handling patterns
- Testing and documentation
- Security considerations
- Performance implications
For complete checklist, see best-practices-checklist.md
Common Pitfalls
Avoid these common review mistakes:
- Focusing only on style issues instead of substantive problems
- Being overly critical without actionable suggestions
- Ignoring context and business constraints
- Overwhelming with too many issues at once
- Using vague terms without explanation
- Forgetting to acknowledge good practices
For detailed guidance, see common-pitfalls-to-avoid.md
Example Patterns
For reference when identifying critical issues in your review, see examples of common high-severity problems in critical-issues.md
Best Practices Checklist
Use this checklist for consistent reviews:
Code Organization:
- [ ] Logical directory structure
- [ ] Clear module boundaries
- [ ] Appropriate file sizes (<500 lines)
- [ ] Single responsibility per file
Code Style:
- [ ] Consistent formatting
- [ ] Style guide compliance
- [ ] Meaningful names throughout
- [ ] No magic numbers
Complexity:
- [ ] Methods under 50 lines
- [ ] Cyclomatic complexity <15
- [ ] Maximum nesting depth <4
- [ ] No god objects
Design:
- [ ] SOLID principles followed
- [ ] Appropriate design patterns
- [ ] Low coupling, high cohesion
- [ ] Interface-based design
Error Handling:
- [ ] Consistent error strategy
- [ ] Appropriate exception types
- [ ] Proper resource cleanup
- [ ] Meaningful error messages
Testing:
- [ ] Adequate test coverage
- [ ] Test quality (not just coverage)
- [ ] Tests are maintainable
- [ ] Edge cases covered
Documentation:
- [ ] Public API documented
- [ ] Complex logic explained
- [ ] README is comprehensive
- [ ] Examples provided
Performance:
- [ ] Efficient algorithms
- [ ] No obvious bottlenecks
- [ ] Appropriate caching
- [ ] Resource management
Common Pitfalls to Avoid
During Review:
- Don't focus only on style issues - prioritize substantive problems
- Don't be overly critical without actionable suggestions
- Don't ignore context - understand business constraints
- Don't nitpick minor issues in critical code reviews
- Don't overwhelm with too many issues at once
In Reports:
- Don't use vague terms like "bad" or "poor" without explanation
- Don't suggest refactoring without clear benefit
- Don't ignore existing conventions without good reason
- Don't recommend changes without considering backward compatibility
- Don't forget to acknowledge good practices
Critical Issues
Issue 1: Excessive Cyclomatic Complexity
Severity: Critical Category: Complexity Location: [src/auth/AuthenticationManager.java#L45-L156]
Description: The authenticate() method has a cyclomatic complexity of 28, significantly exceeding the recommended threshold of 15. This makes the code difficult to test, maintain, and understand.
Current Code:
public AuthResult authenticate(Credentials creds) {
if (creds == null) {
if (allowAnonymous) {
if (isAnonymousAllowedForEndpoint()) {
// ... 20 more levels of nesting
}
}
} else if (creds.getType() == AuthType.BASIC) {
if (validateBasic(creds)) {
// ... more branching
}
} // ... continues for 111 lines
}Impact:
- Maintainability: High negative impact - difficult to modify
- Testability: Requires 28+ test cases for full coverage
- Bug Risk: High probability of edge case bugs
Recommendation: Extract authentication logic into strategy pattern with separate validators for each auth type.
Improved Code:
public AuthResult authenticate(Credentials creds) {
AuthenticationStrategy strategy = strategyFactory.getStrategy(creds);
return strategy.authenticate(creds);
}
// Separate classes: BasicAuthStrategy, OAuth2Strategy, AnonymousStrategy
// Each with complexity < 8Effort: High (2-3 days) Priority: P0
---
Issue 2: No Error Handling in Database Operations
Severity: Critical Category: Error Handling Location: [src/db/UserRepository.java#L67-L89]
Description: Database operations lack try-catch blocks, potentially causing application crashes on connection failures.
Current Code:
public User findById(String id) {
Connection conn = dataSource.getConnection();
PreparedStatement stmt = conn.prepareStatement("SELECT * FROM users WHERE id = ?");
stmt.setString(1, id);
ResultSet rs = stmt.executeQuery();
return mapToUser(rs);
// No resource cleanup, no error handling
}Recommendation:
public User findById(String id) {
try (Connection conn = dataSource.getConnection();
PreparedStatement stmt = conn.prepareStatement("SELECT * FROM users WHERE id = ?")) {
stmt.setString(1, id);
try (ResultSet rs = stmt.executeQuery()) {
return mapToUser(rs);
}
} catch (SQLException e) {
logger.error("Database error finding user: " + id, e);
throw new DataAccessException("Failed to retrieve user", e);
}
}Effort: Medium (1 day) Priority: P0
---
Quality Metrics Reference
Cyclomatic Complexity Thresholds
- 1-10: Simple, low risk
- 11-20: Moderate complexity, moderate risk
- 21-50: Complex, high risk
- >50: Very complex, very high risk
Maintainability Index
- 85-100: Good maintainability
- 65-84: Moderate maintainability
- 0-64: Difficult to maintain
Code Duplication
- <3%: Excellent
- 3-5%: Good
- 5-10%: Acceptable
- >10%: Needs attention
Test Coverage
>
- >80%: Excellent
- 60-80%: Good
- 40-60%: Moderate
- <40%: Insufficient
Review Report Format
Output Guidelines
Be Specific:
- Reference exact line numbers and file paths
- Quote problematic code snippets
- Provide concrete examples and metrics
Be Constructive:
- Explain WHY something is an issue (impact on maintainability, performance, security)
- Suggest HOW to fix it with specific recommendations
- Provide improved code examples showing the solution
Be Balanced:
- Acknowledge good practices and strengths
- Prioritize issues appropriately (P0-P3)
- Consider effort vs. benefit in recommendations
Be Professional:
- Focus on code quality, not developers
- Use objective criteria and metrics
- Provide educational context where helpful
Report Structure
Executive Summary
Code Quality Score: [X/100]
Maintainability Index: [X]
Technical Debt Ratio: [X%]
Critical Issues: [N]
Major Issues: [N]
Minor Issues: [N]
Overall Assessment: [Brief summary]
Top Priorities: [Top 3-5 issues to address]Detailed Findings
For each issue, provide:
#### Issue [N]: [Brief Title]
**Severity:** Critical | Major | Minor | Info
**Category:** Code Smell | Complexity | Naming | Duplication | Design | Performance | Security | Documentation
**Location:** [file.ext#LX-LY]
**Description:**
[Clear explanation of the issue]
**Current Code:**[problematic code snippet]
**Impact:**
- Maintainability: [impact level]
- Readability: [impact level]
- Performance: [impact level if relevant]
- Risk: [potential problems]
**Recommendation:**
[Specific improvement suggestion]
**Improved Code:**
[suggested improvement]
**Effort:** Low | Medium | High
**Priority:** P0 | P1 | P2 | P3
Metrics Summary
| Metric | Current | Target | Status |
| -------- | --------- |--------|--------|
| Cyclomatic Complexity (avg) | X | <10 | ⚠️ |
| Lines per Method (avg) | X | <50 | ✅ |
| Code Duplication | X% | <5% | ⚠️ |
| Test Coverage | X% | >80% | ❌ |
| Documentation Coverage | X% | >70% | ✅ |
| Technical Debt Ratio | X% | <5% | ⚠️ |Recommendations by Priority
P0 - Critical (Fix Immediately):
1. [Issue with major impact] 2. [Issue with major impact]
P1 - High (Fix Soon):
1. [Important issue] 2. [Important issue]
P2 - Medium (Plan for Next Sprint):
1. [Moderate issue] 2. [Moderate issue]
P3 - Low (Technical Debt Backlog):
1. [Minor improvement] 2. [Minor improvement]
Positive Observations
Always acknowledge good practices found in the code:
Examples:
- ✅ Excellent Test Coverage: 87% overall coverage with quality assertions
- ✅ Clear Naming: Consistent and descriptive naming throughout
- ✅ Good Package Structure: Clean separation of concerns
- ✅ Effective Logging: Comprehensive logging at appropriate levels
- ✅ Modern Language Features: Good use of modern patterns and idioms
- ✅ Proper Error Handling: Comprehensive exception handling and validation
- ✅ Good Documentation: Clear comments and API documentation
Recommendations by Priority
P0 - Critical (Fix Immediately):
1. [Issue with major impact on security, correctness, or stability] 2. [Issue causing immediate problems]
P1 - High (Fix Soon):
1. [Important maintainability or performance issue] 2. [Significant code quality problem]
P2 - Medium (Plan for Next Sprint):
1. [Moderate improvement opportunity] 2. [Technical debt item]
P3 - Low (Technical Debt Backlog):
1. [Minor improvement] 2. [Nice-to-have enhancement]
Technical Debt Summary
Total Estimated Effort: [X] person-days
- P0 Issues: [X] days
- P1 Issues: [X] days
- P2 Issues: [X] days
- P3 Issues: [X] days
ROI Analysis:
- Reduced maintenance time: [X] hours/month
- Improved developer productivity: [X]%
- Reduced bug rate: [estimated reduction]Review Scope Guidelines
Small Change (<100 lines):
- Focus on correctness and immediate issues
- Quick turnaround (15-30 minutes)
Medium Change (100-500 lines):
- Full quality analysis
- Design pattern review
- Typical turnaround (1-2 hours)
Large Change (>500 lines):
- Architectural review
- Break into smaller reviews if possible
- Multiple passes (2-4 hours)
Refactoring:
- Ensure behavior preservation
- Check test coverage
- Validate performance impact
Review Workflow
Step 1: Initial Assessment
Gather Context:
- Identify programming language and framework
- Understand project type (web app, API, library, CLI, etc.)
- Note any existing coding standards or style guides
- Check for configuration files (.eslintrc, .pylintrc, checkstyle.xml, etc.)
Read the Code:
- Start with entry points (main files, index files)
- Review module/package organization
- Check dependency management
- Examine test files if available
Step 2: Quality Dimensions Analysis
Analyze code across these key dimensions:
2.1 Code Smells Detection
Common Code Smells to Identify:
Bloaters:
- Long Method (>50 lines)
- Large Class (>300 lines or >10 methods)
- Primitive Obsession (overuse of primitives instead of objects)
- Long Parameter List (>3-4 parameters)
- Data Clumps (groups of variables passed together)
Object-Orientation Abusers:
- Switch/Case statements (should use polymorphism)
- Temporary Field (fields used only in certain cases)
- Refused Bequest (subclass doesn't use inherited methods)
- Alternative Classes with Different Interfaces
Change Preventers:
- Divergent Change (one class changes for multiple reasons)
- Shotgun Surgery (one change requires many small changes)
- Parallel Inheritance Hierarchies
Dispensables:
- Comments (excessive or outdated comments)
- Duplicate Code
- Lazy Class (class doing too little)
- Data Class (class with only getters/setters)
- Dead Code (unused code)
- Speculative Generality (unused abstractions)
Couplers:
- Feature Envy (method using more features from another class)
- Inappropriate Intimacy (excessive coupling between classes)
- Message Chains (a.getB().getC().getD())
- Middle Man (class delegating all work)
2.2 Complexity Analysis
Cyclomatic Complexity:
- Calculate decision points (if, for, while, case, &&, ||)
- Low Risk: Complexity 1-10
- Moderate Risk: Complexity 11-20
- High Risk: Complexity 21-50
- Very High Risk: Complexity >50
Cognitive Complexity:
- Assess how difficult code is to understand
- Identify nested conditions, loops, recursion
- Flag methods with high cognitive load
Example Analysis:
# High Cyclomatic Complexity (>15)
def process_order(order):
if order.type == 'standard':
if order.priority == 'high':
if order.value > 1000:
# ... nested logic
elif order.value > 500:
# ... more conditions
elif order.priority == 'normal':
# ... more branches
elif order.type == 'express':
# ... even more conditions
# Recommendation: Extract to smaller methods or use strategy pattern2.3 Maintainability Assessment
Maintainability Index (MI):
- Calculate based on: MI = 171 - 5.2 ln(Halstead Volume) - 0.23 (Cyclomatic Complexity) - 16.2 * ln(Lines of Code)
- Good: MI > 85
- Moderate: MI 65-85
- Difficult: MI < 65
Key Factors:
- Code readability (clear naming, logical structure)
- Modularity (separation of concerns)
- Documentation quality
- Test coverage
- Dependency management
2.4 Naming Conventions
Check for:
- Consistent naming style (camelCase, snake_case, PascalCase)
- Descriptive names (avoid single letters except loop counters)
- Appropriate length (not too short, not too long)
- Meaningful abbreviations only
- Boolean names starting with is/has/can/should
- Function names as verbs, class names as nouns
Examples:
❌ Poor Naming:
function proc(d) { // Unclear function name and parameter
let x = d * 2;
return x;
}
class mgr { // Non-descriptive class name
// ...
}✅ Good Naming:
function calculateDiscountedPrice(originalPrice) {
const discountMultiplier = 2;
return originalPrice * discountMultiplier;
}
class OrderManager {
// ...
}2.5 Code Duplication
Detection:
- Identify duplicate code blocks (>6 lines)
- Look for similar logic with minor variations
- Check for copy-paste patterns
Metrics:
- Calculate duplication percentage
- Identify duplication hotspots
Recommendation Template:
Found: 3 instances of duplicate code (45 lines total)
Location 1: [file1.js#L120-L165]
Location 2: [file2.js#L89-L134]
Location 3: [file3.js#L201-L246]
Recommendation: Extract common logic to shared utility function
Potential name: formatAndValidateUserInput()
Expected reduction: 135 lines → 45 lines (67% reduction)2.6 Design Patterns and Architecture
Evaluate:
- Appropriate use of design patterns (Strategy, Factory, Observer, etc.)
- SOLID principles adherence:
- Single Responsibility Principle
- Open/Closed Principle
- Liskov Substitution Principle
- Interface Segregation Principle
- Dependency Inversion Principle
- Separation of concerns
- Dependency injection usage
- Layer separation (presentation, business, data)
Anti-patterns to Flag:
- God Object (class doing everything)
- Spaghetti Code (tangled dependencies)
- Golden Hammer (overusing one pattern)
- Cargo Cult Programming (code without understanding)
- Hard Coding (values that should be configurable)
2.7 Error Handling
Check for:
- Consistent error handling strategy
- Appropriate exception types
- Error messages quality (descriptive, actionable)
- Resource cleanup (try-finally, context managers)
- Graceful degradation
- Logging at appropriate levels
Examples:
❌ Poor Error Handling:
def read_file(filename):
f = open(filename) # No error handling, resource leak
data = f.read()
return data✅ Good Error Handling:
def read_file(filename):
try:
with open(filename, 'r') as f:
return f.read()
except FileNotFoundError:
logger.error(f"File not found: {filename}")
raise
except PermissionError:
logger.error(f"Permission denied: {filename}")
raise
except Exception as e:
logger.error(f"Unexpected error reading {filename}: {e}")
raise2.8 Performance Considerations
Review:
- Algorithm efficiency (O(n), O(n²), etc.)
- Database query optimization (N+1 queries, missing indexes)
- Memory usage patterns
- Unnecessary computations
- Caching opportunities
- Resource pooling
Common Issues:
// ❌ O(n²) - inefficient
users.forEach(user => {
orders.forEach(order => {
if (order.userId === user.id) {
// process
}
});
});
// ✅ O(n) - efficient with Map
const ordersByUser = new Map();
orders.forEach(order => {
if (!ordersByUser.has(order.userId)) {
ordersByUser.set(order.userId, []);
}
ordersByUser.get(order.userId).push(order);
});
users.forEach(user => {
const userOrders = ordersByUser.get(user.id) || [];
// process
});Step 3: Language-Specific Analysis
Apply language-specific best practices:
JavaScript/TypeScript:
- Use strict mode
- Avoid var, prefer const/let
- Use async/await over callbacks
- Proper promise error handling
- Type safety (TypeScript)
- Avoid implicit any
Python:
- PEP 8 compliance
- Type hints usage
- List comprehensions appropriately
- Context managers for resources
- Avoid mutable default arguments
- Virtual environment usage
Java:
- Proper use of collections
- Stream API usage
- Exception hierarchy
- Thread safety
- Resource management (try-with-resources)
- Immutability where appropriate
Go:
- Error handling patterns
- Goroutine management
- Defer usage
- Interface design
- Package organization
- Effective Go guidelines
C#:
- LINQ usage
- Async/await patterns
- IDisposable implementation
- Nullable reference types
- Dependency injection
- .NET conventions
Step 4: Documentation Quality
Assess:
- Code comments (when needed, not excessive)
- Function/method documentation
- Class/module documentation
- API documentation
- README quality
- Inline documentation for complex logic
Guidelines:
- Comments explain WHY, not WHAT
- Public APIs fully documented
- Complex algorithms explained
- TODOs tracked and dated
- No commented-out code
Step 5: Test Quality Assessment
Review:
- Test coverage percentage
- Test organization (unit, integration, e2e)
- Test naming conventions
- Assertion quality
- Test data management
- Mock usage appropriateness
- Test maintainability
Step 6: Generate Review Report
Related skills
FAQ
How does review depth scale with change size?
The skill defines small, medium, and large scopes with different time and depth expectations.
Does it run linters automatically?
It checks for linter configs and uses them as context; primary analysis is guided review, not replacing your CI linters.
Is this the same as security review?
No—this skill targets maintainability and quality; use code-security-review for vulnerability-focused audits.