| íëŠĐ | ëīėĐ |
|---|---|
| Invoke | /code-review |
| Aliases | /review, /pr:review |
| Category | petmedi-development |
| Complexity | moderate |
| MCP Servers | serena, 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#
| Parameter | Required | Description | Example |
|---|---|---|---|
target | â | Review target | File 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#
- Plugin default:
cc-code-quality/rules/suppression.md - 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-suppressoption
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#
| Step | MCP Server | Purpose |
|---|---|---|
| Code analysis | Serena | Symbol and reference search |
| Pattern verification | Context7 | Best 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