Code Review
Perform comprehensive code review for production readiness.
Process
- Identify scope - Determine what to review (files, git diff, component)
- Read code - Use read_file or git diff to examine code
- Validate rules - Check against validation categories below
- Categorize issues - Assign severity (Critical/Important/Suggestion)
- Generate report - Use structured output format
Validation Categories
- Type Safety - No
any types, proper TypeScript usage
- Error Handling - Try/catch on async, loading states, error boundaries
- Performance - useEffect cleanup, memory leaks, unnecessary re-renders
- Code Structure - Max 2 nested conditions, DRY principle, function length
- File Organization - One component per file, types in separate files
- React Best Practices - Proper keys, semantic HTML, hooks rules
- Clean Code - Meaningful names, SOLID principles, no magic numbers
Severity Levels
- 🚨 Critical - Blocks merge:
any types, security issues, missing error handling, data loss
- ⚠️ Important - Should fix: Architecture problems, performance issues, test gaps
- 💡 Suggestion - Nice to have: Code style, optimizations, documentation
Output Format
# Code Review: [Component/Feature Name]
## Summary
[1-2 sentence overview]
## Issues Found
### 🚨 Critical
1. **[Issue title]** — `file.ts:line`
- **Problem**: [What's wrong]
- **Fix**: [How to fix]
### ⚠️ Important
[Same format]
### 💡 Suggestions
[Same format]
## Validation Checklist
- [ ] Type Safety — [Pass/Fail: details]
- [ ] Error Handling — [Pass/Fail: details]
- [ ] Performance — [Pass/Fail: details]
- [ ] Code Structure — [Pass/Fail: details]
- [ ] File Organization — [Pass/Fail: details]
- [ ] React Best Practices — [Pass/Fail: details]
- [ ] Clean Code — [Pass/Fail: details]
## Assessment
**Ready to merge:** [Yes / No / With fixes]
**Blocking issues:** [Count of critical issues]
Common Red Flags
any type usage
- Missing try/catch on async operations
- Hardcoded user-facing strings (no i18n)
- Array index as key in lists
- Console.log statements in production code
- Functions with 3+ nested conditions
- Multiple components in one file
- Types defined in component files
- Unused imports or variables
- Missing error boundaries
- Memory leaks (uncleared intervals/listeners)
Examples
Example 1: Review specific file
Input: Review src/components/UserProfile.tsx
Action: Read file, validate against all categories, output structured review
Example 2: Review git changes
Input: Review my recent changes
Action: Run git diff, analyze changes, output review with focus on modified code
Example 3: Review component
Input: Review the LoginForm component
Action: Find component files, read related files, validate, output comprehensive review
1---2name: neuron-code-review3description: Perform comprehensive code review for production readiness. Use when asked to 'review code', 'review changes', 'check my code', or before merging. Validates type safety, error handling, performance, code structure, React best practices, and Clean Code principles. Outputs structured review with severity levels (Critical/Important/Suggestions) and merge readiness assessment.4---56# Code Review78Perform comprehensive code review for production readiness.910## Process11121. **Identify scope** - Determine what to review (files, git diff, component)132. **Read code** - Use read_file or git diff to examine code143. **Validate rules** - Check against validation categories below154. **Categorize issues** - Assign severity (Critical/Important/Suggestion)165. **Generate report** - Use structured output format1718## Validation Categories19201. **Type Safety** - No `any` types, proper TypeScript usage212. **Error Handling** - Try/catch on async, loading states, error boundaries223. **Performance** - useEffect cleanup, memory leaks, unnecessary re-renders234. **Code Structure** - Max 2 nested conditions, DRY principle, function length245. **File Organization** - One component per file, types in separate files256. **React Best Practices** - Proper keys, semantic HTML, hooks rules267. **Clean Code** - Meaningful names, SOLID principles, no magic numbers2728## Severity Levels2930- **🚨 Critical** - Blocks merge: `any` types, security issues, missing error handling, data loss31- **⚠️ Important** - Should fix: Architecture problems, performance issues, test gaps32- **💡 Suggestion** - Nice to have: Code style, optimizations, documentation3334## Output Format3536```markdown37# Code Review: [Component/Feature Name]3839## Summary4041[1-2 sentence overview]4243## Issues Found4445### 🚨 Critical46471. **[Issue title]** — `file.ts:line`48 - **Problem**: [What's wrong]49 - **Fix**: [How to fix]5051### ⚠️ Important5253[Same format]5455### 💡 Suggestions5657[Same format]5859## Validation Checklist6061- [ ] Type Safety — [Pass/Fail: details]62- [ ] Error Handling — [Pass/Fail: details]63- [ ] Performance — [Pass/Fail: details]64- [ ] Code Structure — [Pass/Fail: details]65- [ ] File Organization — [Pass/Fail: details]66- [ ] React Best Practices — [Pass/Fail: details]67- [ ] Clean Code — [Pass/Fail: details]6869## Assessment7071**Ready to merge:** [Yes / No / With fixes]72**Blocking issues:** [Count of critical issues]73```7475## Common Red Flags7677- `any` type usage78- Missing try/catch on async operations79- Hardcoded user-facing strings (no i18n)80- Array index as key in lists81- Console.log statements in production code82- Functions with 3+ nested conditions83- Multiple components in one file84- Types defined in component files85- Unused imports or variables86- Missing error boundaries87- Memory leaks (uncleared intervals/listeners)8889## Examples9091**Example 1: Review specific file**9293```94Input: Review src/components/UserProfile.tsx95Action: Read file, validate against all categories, output structured review96```9798**Example 2: Review git changes**99100```101Input: Review my recent changes102Action: Run git diff, analyze changes, output review with focus on modified code103```104105**Example 3: Review component**106107```108Input: Review the LoginForm component109Action: Find component files, read related files, validate, output comprehensive review110```