Frontend Code Review
Systematically review frontend code to identify issues, ensure quality, and provide actionable improvement recommendations across code quality, performance, accessibility, and security dimensions.
Review Workflow
1. Initial Assessment
Gather context about the project and identify review scope:
Project Context:
- Framework and version (React, Vue, Angular, vanilla JS)
- Build tools and dependencies
- Target browsers/devices
- Accessibility requirements (WCAG level)
- Performance targets (Core Web Vitals)
Review Scope:
- New features vs. refactoring vs. bug fixes
- Component complexity level
- Critical user paths
- Security-sensitive areas
2. Code Quality Analysis
Evaluate component structure, code patterns, and maintainability:
Key Areas:
- Component architecture (single responsibility, composition patterns)
- JavaScript/TypeScript quality (type safety, naming, complexity)
- State management decisions (local vs. global, immutability)
- Error handling and edge cases
- Code duplication and DRY violations
Load references/code-quality-checklist.md for detailed quality criteria, common issues, and fixes with code examples
3. Performance Review
Assess rendering efficiency, resource loading, and Core Web Vitals:
Focus Areas:
- Rendering optimization (React.memo, useMemo, useCallback, keys)
- Resource loading (images, fonts, scripts, lazy loading)
- Bundle size and code splitting
- Core Web Vitals: LCP < 2.5s, FID < 100ms, CLS < 0.1
- Memory leaks and cleanup
Load references/performance-checklist.md for detailed optimization techniques and Web Vitals guidelines with code examples
4. Accessibility Assessment
Evaluate WCAG 2.1 compliance and inclusive design:
Key Areas:
- Semantic HTML (proper headings, landmarks, lists)
- ARIA implementation (labels, roles, live regions)
- Keyboard navigation and focus management
- Screen reader support (alt text, labels, announcements)
- Color contrast ratios
Load references/accessibility-checklist.md for WCAG 2.1 AA/AAA compliance criteria with detailed examples
5. Security Review
Identify vulnerabilities and security best practices:
Common Vulnerabilities:
- XSS (input sanitization, safe HTML rendering)
- CSRF protection
- Authentication token handling
- Sensitive data exposure
- Dependency vulnerabilities
Security Controls:
- Content Security Policy (CSP)
- HTTPS enforcement
- Secure cookies
- Input validation and output encoding
Load references/security-checklist.md for comprehensive frontend security guidelines and vulnerability prevention
6. CSS/Styling Review
Assess architecture, responsiveness, and maintainability:
Key Areas:
- CSS methodology (BEM, OOCSS, CSS-in-JS, Tailwind)
- Responsive design (mobile-first, breakpoints, flexible layouts)
- Design tokens and variables
- Specificity management
- Unused CSS detection
7. Testing Coverage
Evaluate test completeness and quality:
Test Types:
- Unit tests (component logic, utilities, edge cases)
- Integration tests (component interaction, API integration, state flows)
- E2E tests (critical user journeys, cross-browser compatibility)
- Accessibility automated tests
8. Generate Review Report
Create structured report with findings and recommendations:
Report Structure:
- Executive Summary (quality rating, critical issues, recommendation)
- Detailed Findings (by category with severity: Critical/Major/Minor)
- Action Items (prioritized with file/line references and specific fixes)
Load references/report-templates.md for full review report formats and examples
Review Process Guidelines
Review Timing:
- Pre-Commit: Automated linting and formatting
- Pre-PR: Self-review using this workflow
- PR Review: Peer review with comprehensive analysis
- Pre-Deployment: Final quality gate
Severity Definitions:
- Critical: Blocks deployment (security issues, breaking bugs, accessibility blockers)
- Major: Should fix before merge (performance issues, poor patterns, maintainability concerns)
- Minor: Nice to improve (style suggestions, micro-optimizations, documentation)
Common Anti-Patterns
React/Component Patterns:
- Prop drilling through multiple levels
- God components doing too much
- Missing error boundaries
- Mutating state directly
- Inline functions causing unnecessary re-renders
JavaScript/TypeScript:
- Using
any type in TypeScript
- Console.log in production code
- Deeply nested callbacks
- Global variables
- Unhandled promises
CSS/Styling:
- !important overuse
- Inline styles instead of classes
- Fixed pixels instead of relative units
- High specificity wars
Performance:
- Synchronous expensive operations in render
- Large unoptimized bundles (>500KB)
- Missing code splitting and lazy loading
- Unoptimized images
Accessibility:
- Non-semantic div/span buttons
- Missing alt attributes
- Color-only information
- Keyboard traps
- Missing focus management in modals
Key Review Checkpoints
Code Quality:
Performance:
Accessibility:
Security:
Reference Files
Load these files when detailed guidance is needed:
- references/code-quality-checklist.md: Component patterns, code smells, fixes with examples (693 lines)
- references/performance-checklist.md: Web Vitals optimization, rendering performance (891 lines)
- references/accessibility-checklist.md: WCAG 2.1 compliance with detailed examples (1045 lines)
- references/security-checklist.md: XSS, CSRF, authentication, CSP guidelines (969 lines)
- references/report-templates.md: Review report formats and examples (1203 lines)
1---
2name: frontend-code-review
3description: Conducts comprehensive frontend code reviews including React/Vue/Angular component analysis, TypeScript/JavaScript quality assessment, CSS/styling review, performance optimization, accessibility compliance, security vulnerabilities, and best practices validation. Produces detailed review reports with specific issues, severity ratings, and actionable recommendations. Use when reviewing frontend code, analyzing React/Vue/Angular components, checking JavaScript/TypeScript quality, validating CSS/SCSS, assessing web performance, or when users mention "review frontend code", "check React components", "analyze JavaScript", "review TypeScript", "validate accessibility", or "frontend code quality".
4metadata:
5 source: https://skillmd.com/skills/aibot88/frontend-code-review
6---
7
8# Frontend Code Review
9
10Systematically review frontend code to identify issues, ensure quality, and provide actionable improvement recommendations across code quality, performance, accessibility, and security dimensions.
11
12## Review Workflow
13
14## 1. Initial Assessment
15
16Gather context about the project and identify review scope:
17
18**Project Context:**
19
20- Framework and version (React, Vue, Angular, vanilla JS)
21- Build tools and dependencies
22- Target browsers/devices
23- Accessibility requirements (WCAG level)
24- Performance targets (Core Web Vitals)
25
26**Review Scope:**
27
28- New features vs. refactoring vs. bug fixes
29- Component complexity level
30- Critical user paths
31- Security-sensitive areas
32
33### 2. Code Quality Analysis
34
35Evaluate component structure, code patterns, and maintainability:
36
37**Key Areas:**
38
39- Component architecture (single responsibility, composition patterns)
40- JavaScript/TypeScript quality (type safety, naming, complexity)
41- State management decisions (local vs. global, immutability)
42- Error handling and edge cases
43- Code duplication and DRY violations
44
45> **Load references/code-quality-checklist.md** for detailed quality criteria, common issues, and fixes with code examples
46
47### 3. Performance Review
48
49Assess rendering efficiency, resource loading, and Core Web Vitals:
50
51**Focus Areas:**
52
53- Rendering optimization (React.memo, useMemo, useCallback, keys)
54- Resource loading (images, fonts, scripts, lazy loading)
55- Bundle size and code splitting
56- Core Web Vitals: LCP < 2.5s, FID < 100ms, CLS < 0.1
57- Memory leaks and cleanup
58
59> **Load references/performance-checklist.md** for detailed optimization techniques and Web Vitals guidelines with code examples
60
61### 4. Accessibility Assessment
62
63Evaluate WCAG 2.1 compliance and inclusive design:
64
65**Key Areas:**
66
67- Semantic HTML (proper headings, landmarks, lists)
68- ARIA implementation (labels, roles, live regions)
69- Keyboard navigation and focus management
70- Screen reader support (alt text, labels, announcements)
71- Color contrast ratios
72
73> **Load references/accessibility-checklist.md** for WCAG 2.1 AA/AAA compliance criteria with detailed examples
74
75### 5. Security Review
76
77Identify vulnerabilities and security best practices:
78
79**Common Vulnerabilities:**
80
81- XSS (input sanitization, safe HTML rendering)
82- CSRF protection
83- Authentication token handling
84- Sensitive data exposure
85- Dependency vulnerabilities
86
87**Security Controls:**
88
89- Content Security Policy (CSP)
90- HTTPS enforcement
91- Secure cookies
92- Input validation and output encoding
93
94> **Load references/security-checklist.md** for comprehensive frontend security guidelines and vulnerability prevention
95
96### 6. CSS/Styling Review
97
98Assess architecture, responsiveness, and maintainability:
99
100**Key Areas:**
101
102- CSS methodology (BEM, OOCSS, CSS-in-JS, Tailwind)
103- Responsive design (mobile-first, breakpoints, flexible layouts)
104- Design tokens and variables
105- Specificity management
106- Unused CSS detection
107
108### 7. Testing Coverage
109
110Evaluate test completeness and quality:
111
112**Test Types:**
113
114- Unit tests (component logic, utilities, edge cases)
115- Integration tests (component interaction, API integration, state flows)
116- E2E tests (critical user journeys, cross-browser compatibility)
117- Accessibility automated tests
118
119### 8. Generate Review Report
120
121Create structured report with findings and recommendations:
122
123**Report Structure:**
124
125- Executive Summary (quality rating, critical issues, recommendation)
126- Detailed Findings (by category with severity: Critical/Major/Minor)
127- Action Items (prioritized with file/line references and specific fixes)
128
129> **Load references/report-templates.md** for full review report formats and examples
130
131## Review Process Guidelines
132
133**Review Timing:**
134
135- **Pre-Commit**: Automated linting and formatting
136- **Pre-PR**: Self-review using this workflow
137- **PR Review**: Peer review with comprehensive analysis
138- **Pre-Deployment**: Final quality gate
139
140**Severity Definitions:**
141
142- **Critical**: Blocks deployment (security issues, breaking bugs, accessibility blockers)
143- **Major**: Should fix before merge (performance issues, poor patterns, maintainability concerns)
144- **Minor**: Nice to improve (style suggestions, micro-optimizations, documentation)
145
146## Common Anti-Patterns
147
148**React/Component Patterns:**
149
150- Prop drilling through multiple levels
151- God components doing too much
152- Missing error boundaries
153- Mutating state directly
154- Inline functions causing unnecessary re-renders
155
156**JavaScript/TypeScript:**
157
158- Using `any` type in TypeScript
159- Console.log in production code
160- Deeply nested callbacks
161- Global variables
162- Unhandled promises
163
164**CSS/Styling:**
165
166- !important overuse
167- Inline styles instead of classes
168- Fixed pixels instead of relative units
169- High specificity wars
170
171**Performance:**
172
173- Synchronous expensive operations in render
174- Large unoptimized bundles (>500KB)
175- Missing code splitting and lazy loading
176- Unoptimized images
177
178**Accessibility:**
179
180- Non-semantic div/span buttons
181- Missing alt attributes
182- Color-only information
183- Keyboard traps
184- Missing focus management in modals
185
186## Key Review Checkpoints
187
188**Code Quality:**
189
190- [ ] Components follow single responsibility
191- [ ] Functions < 50 lines, complexity < 10
192- [ ] TypeScript strict mode enabled
193- [ ] Meaningful naming conventions
194- [ ] Error handling present
195
196**Performance:**
197
198- [ ] Appropriate use of React.memo/useMemo/useCallback
199- [ ] Images optimized (WebP/AVIF)
200- [ ] Code splitting implemented
201- [ ] Core Web Vitals within targets
202
203**Accessibility:**
204
205- [ ] Semantic HTML used
206- [ ] All images have alt text
207- [ ] Keyboard navigable
208- [ ] Color contrast compliant (≥4.5:1)
209
210**Security:**
211
212- [ ] User input sanitized
213- [ ] XSS prevention in place
214- [ ] No sensitive data in localStorage
215- [ ] Dependencies up to date
216
217## Reference Files
218
219Load these files when detailed guidance is needed:
220
221- **references/code-quality-checklist.md**: Component patterns, code smells, fixes with examples (693 lines)
222- **references/performance-checklist.md**: Web Vitals optimization, rendering performance (891 lines)
223- **references/accessibility-checklist.md**: WCAG 2.1 compliance with detailed examples (1045 lines)
224- **references/security-checklist.md**: XSS, CSRF, authentication, CSP guidelines (969 lines)
225- **references/report-templates.md**: Review report formats and examples (1203 lines)