LogoSkills

code-review

Systematic code review based on 8 categories

항ëŠĐë‚īėšĐ
Invoke/code-review
Aliases/review, /pr:review
Categorypetmedi-development
Complexitymoderate
MCP Serversserena, context7

/code-review#

Context Framework Note: Activates during code review and quality inspection.

Triggers#

  • When a PR review is requested
  • When code quality inspection is needed
  • For self-review before committing

Context Trigger Pattern#

/code-review {target} [--options]

Parameters#

ParameterRequiredDescriptionExample
target✅Review targetFile path, PR link
--focus ❌ Focus category security, performance
--quick❌Quick review mode
--verbose❌Detailed review mode
--no-suppress❌Disable suppression
--gate-mode ❌ Review Gate mode (separates Critical/Informational output)

Suppression List#

Automatically applies suppression rules during review to reduce false positives.

Loading Order#

  1. Plugin default: cc-code-quality/rules/suppression.md
  2. Project custom: project root .code-review-suppress.md (if exists)

Application Method#

  • Each review finding is compared against the suppression list
  • Matching items are excluded from review results
  • Can be disabled with --no-suppress option

Result Display#

## Suppressed (3 items excluded)
- [Readability] Freezed generated code pattern (suppression: code generation related)
- [Performance] const not applied (suppression: style/convention related)
- [Architecture] melos import path (suppression: project structure related)

Review Categories#

1. Architecture#

  • Clean Architecture layer separation followed
  • Domain → Data → Presentation dependency direction
  • Business logic accessed through UseCases
  • Repository interface separation
  • Feature module independence

2. State Management#

  • BLoC/Cubit pattern followed
  • Event → BLoC → State flow
  • Immutable state defined with Freezed
  • Proper error handling
  • Loading state management

3. Security#

  • No hardcoded API keys or secrets
  • No sensitive information in logs
  • User input sanitization
  • Authentication/authorization properly applied

4. Performance#

  • const widgets utilized
  • BlocBuilder buildWhen used
  • Image cacheWidth/cacheHeight applied
  • Resources released in dispose
  • Stream subscriptions cancelled

5. Testing#

  • UseCase unit tests
  • Repository tests (mocked)
  • BLoC tests
  • Edge cases covered
  • Arrange-Act-Assert pattern

6. Readability#

  • Clear and meaningful naming
  • Project convention followed
  • Appropriate file/class size
  • Single Responsibility Principle
  • Duplicate code removed

7. Internationalization (i18n)#

  • All UI text uses translation keys
  • context.t.* pattern used
  • Proper pluralization
  • Dynamic values parameterized

8. Accessibility#

  • Appropriate semantic labels
  • Minimum 48x48 touch target
  • WCAG color contrast criteria met

Review Output Template#

## Summary

**Overall**: ⭐⭐⭐⭐☆ (4/5)

| Category | Score | Key Issues |
|----------|-------|------------|
| Architecture | ✅ | - |
| State Management | ⚠ïļ | BlocBuilder optimization needed |
| Security | ✅ | - |
| Performance | ⚠ïļ | Image cache size not specified |
| Testing | ❌ | UseCase tests missing |
| Readability | ✅ | - |
| i18n | ✅ | - |
| Accessibility | ⚠ïļ | Some semantic labels missing |

### Critical Issues ðŸ”ī

1. **[Security]** API key hardcoded
   - File: `lib/core/config.dart:15`
   - Fix: Use environment variables via Envied

### Improvements ðŸŸĄ

1. **[Performance]** Image cache size needs to be specified
   - File: `lib/presentation/widget/product_card.dart:42`
   - Recommended: Add `cacheWidth: 200`

### Suggestions ðŸŸĒ

1. **[Readability]** Variable name improvement suggestion
   - `data` → `userProfile`

### Suppressed (N items excluded)
 >   Items excluded by suppression rules. Use `--no-suppress` to see all.

Gate Mode Output (--gate-mode)#

Structured output for workflow gate when running /code-review --gate-mode:

## Code Review Gate Result

**Status**: ✅ PASS / ❌ BLOCKED

### Critical Issues (Pass 1) ðŸ”ī
 >   Issues that block PR creation

| # | Category | Issue | File | Auto-fix |
|---|----------|-------|------|----------|
| 1 | Security | API key hardcoded | config.dart:15 | ✅ Possible |

### Informational (Pass 2) 📋
 >   Improvement suggestions to include in PR body

| # | Category | Issue | File |
|---|----------|-------|------|
| 1 | Performance | Image cache not specified | product_card.dart:42 |

### Summary
- Critical: 0 items → ✅ Gate passed
- Informational: 3 items → Included in PR body
- Suppressed: 2 items → Excluded

Automation Commands#

# Lint check
melos run analyze
melos run lint:parallel

# Test execution
melos run test
melos run test:with-html-coverage

# Formatting check
melos run format

MCP Integration#

StepMCP ServerPurpose
Code analysisSerenaSymbol and reference search
Pattern verificationContext7Best practices validation

Examples#

File review#

/code-review feature/auth/lib/src/presentation/bloc/login_bloc.dart

Security-focused review#

/code-review feature/auth/ --focus security

Quick review#

/code-review . --quick

References#

  • Detailed checklist: .claude/prompts/code-review.md
  • PR review guide: .claude/checklists/pr-review.md