en un clic
code-quality-review
Enforce code standards, validate against project patterns, review code quality, and maintain consistent TypeScript strict mode compliance across all components
Menu
Enforce code standards, validate against project patterns, review code quality, and maintain consistent TypeScript strict mode compliance across all components
Show AI design patterns project health, track completion status, coordinate agent activities, and suggest intelligent next priority actions
Project-specific entrypoint for analyzing Google Search Console exports for aiuxdesign.guide. Auto-triggers on SEO-review phrases. Standardizes the CSV diff analysis, flags known patterns (CTR problems, near-page-1 opportunities, regressions, breakouts), cross-references LHCI perf issues, and points Claude at CLAUDE.md's SEO troubleshooting section before interpretation. Use when the user mentions "check GSC", "SEO review", "GSC export", "search console data", "any SEO improvements", "GSC performance", or pastes a path to a GSC export folder.
Project-specific performance investigation entrypoint for aiuxdesign.guide. Auto-triggers on perf-related phrases and points Claude at CLAUDE.md's documented incidents and the LHCI workflow before delegating to generic perf skills. Use when the user mentions "site is slow", "performance regression", "LCP", "CLS", "INP", "Core Web Vitals", "lighthouse score", "clarity numbers", or "speed insights".
Auto-scaffold Designer Guides learning paths by analyzing existing guides (Claude Code, Cursor) and generating new guides for other tools
Guide through updating AI design patterns with comprehensive checklist completion, code examples, images, documentation, and interactive demos
Verify production builds pass all quality checks, analyze bundle impact, and ensure readiness for Vercel deployment with zero errors
| name | Code Quality & Review |
| description | Enforce code standards, validate against project patterns, review code quality, and maintain consistent TypeScript strict mode compliance across all components |
This skill systematically reviews code against your project's high standards, ensures TypeScript strict mode compliance, validates Zod schema usage, and maintains consistency across all patterns and components.
Claude will automatically invoke this skill when:
🎯 Project Code Standards
├── TypeScript
│ ├── Strict mode enabled (strict: true)
│ ├── No implicit any types
│ ├── All imports properly typed
│ ├── Return types explicitly declared
│ └── Generic types parameterized
├── React Best Practices
│ ├── Functional components only
│ ├── Custom hooks for logic
│ ├── Proper hook dependencies
│ ├── Memoization where needed
│ └── Error boundaries for sections
├── Component Patterns
│ ├── Single responsibility principle
│ ├── Props interfaces defined
│ ├── Default props documented
│ ├── PropTypes or TypeScript validation
│ └── Accessibility compliance
├── Data Validation
│ ├── Zod schemas for all data
│ ├── Safe parsing functions
│ ├── Error handling for invalid data
│ └── Type inference from schemas
├── Styling
│ ├── Tailwind CSS only (no inline CSS)
│ ├── Design system colors/spacing
│ ├── Dark mode support (dark: prefix)
│ ├── Responsive design
│ └── Consistent component styling
├── Testing Requirements
│ ├── Unit tests for components
│ ├── Interaction tests for demos
│ ├── Snapshot tests for UI
│ ├── 80%+ coverage per component
│ └── Accessibility tests included
├── Naming Conventions
│ ├── Components: PascalCase
│ ├── Hooks: camelCase (use prefix)
│ ├── Utilities: camelCase
│ ├── Constants: UPPER_SNAKE_CASE
│ ├── Files: kebab-case or match export
│ └── Directories: kebab-case
├── Import Organization
│ ├── React imports first
│ ├── Next.js imports second
│ ├── Third-party imports third
│ ├── Local imports last
│ ├── Absolute paths from @/
│ └── Alphabetically sorted
└── Documentation
├── JSDoc comments for complex logic
├── Type annotations for clarity
├── Example usage in comments
├── TODO comments for known issues
└── Component purpose documented
Key architectural patterns:
// Pattern 1: Pattern-Centric Data Architecture
src/data/patterns/patterns/[pattern-slug]/
├── index.ts // Main pattern data
├── code-examples.ts // Working code examples
├── guidelines.ts // Best practices
└── considerations.ts // Trade-offs
// Pattern 2: Context-Based State Management
src/contexts/PatternContext.tsx // Global state
+ usePatterns hooks // Custom hooks
// Pattern 3: Component Organization
src/components/
├── ui/ // Design system
├── examples/ // Pattern demos
├── sections/ // Page sections
├── layout/ // Layout components
└── providers/ // Context providers
// Pattern 4: Type-Safe Schemas
src/schemas/
└── pattern.schema.ts // Zod validation
// ❌ BAD - Implicit any, no return type
const processPattern = (data) => {
return data.map(p => p.name)
}
// ✅ GOOD - Explicit types, return type
interface Pattern {
id: string
name: string
slug: string
}
const processPattern = (data: Pattern[]): string[] => {
return data.map((p) => p.name)
}
Type Safety Checklist:
any types?// ❌ BAD - God component, unclear props, no types
const PatternCard = ({ data, onClick, show }) => {
if (show === undefined) show = true
return (
<div className="p-4" onClick={onClick}>
{data.title}
{data.description}
</div>
)
}
// ✅ GOOD - Single responsibility, typed, documented
interface PatternCardProps {
pattern: Pattern
isVisible: boolean
onSelect: (id: string) => void
}
/**
* Displays a single AI design pattern as a card
* @param pattern - The pattern to display
* @param isVisible - Whether card is visible
* @param onSelect - Callback when pattern is selected
*/
export const PatternCard: React.FC<PatternCardProps> = ({
pattern,
isVisible,
onSelect,
}) => {
if (!isVisible) return null
return (
<div
className="space-y-2 rounded-lg border border-gray-200 bg-white p-4 transition hover:shadow-md dark:border-gray-700 dark:bg-gray-800"
onClick={() => onSelect(pattern.id)}
role="button"
tabIndex={0}
onKeyDown={(e) => {
if (e.key === 'Enter' || e.key === ' ') {
onSelect(pattern.id)
}
}}
>
<h3 className="font-semibold text-gray-900 dark:text-white">
{pattern.title}
</h3>
<p className="text-sm text-gray-600 dark:text-gray-400">
{pattern.description}
</p>
</div>
)
}
Component Quality Checklist:
// ❌ BAD - No validation
const getPatterns = async (data) => {
return data.patterns.map(p => ({
name: p.name,
examples: p.examples || []
}))
}
// ✅ GOOD - Zod validation
import { z } from 'zod'
const PatternSchema = z.object({
id: z.string().min(1),
name: z.string().min(1),
slug: z.string().min(1),
examples: z.array(ExampleSchema),
})
type Pattern = z.infer<typeof PatternSchema>
const getPatterns = async (data: unknown): Promise<Pattern[]> => {
const validated = z.array(PatternSchema).parse(data)
return validated.map(p => ({
name: p.name,
examples: p.examples
}))
}
Data Validation Checklist:
// ❌ BAD - Missing dependencies, stale closures
const PatternList = () => {
const [patterns, setPatterns] = useState([])
useEffect(() => {
fetchPatterns(searchTerm) // ⚠️ searchTerm not in dependencies
}, [])
const handleSelect = (id) => {
// ⚠️ Stale searchTerm reference
console.log('Selected with search:', searchTerm)
}
return <div>{patterns.map(p => <div key={p.id}>{p.name}</div>)}</div>
}
// ✅ GOOD - Proper dependencies, hooks organized
interface PatternListProps {
searchTerm: string
}
export const PatternList: React.FC<PatternListProps> = ({ searchTerm }) => {
const [patterns, setPatterns] = useState<Pattern[]>([])
const [isLoading, setIsLoading] = useState(false)
const [error, setError] = useState<string | null>(null)
useEffect(() => {
const loadPatterns = async () => {
setIsLoading(true)
try {
const data = await fetchPatterns(searchTerm)
setPatterns(data)
setError(null)
} catch (err) {
setError(err instanceof Error ? err.message : 'Unknown error')
} finally {
setIsLoading(false)
}
}
loadPatterns()
}, [searchTerm]) // ✅ Correct dependency
const handleSelect = useCallback((id: string) => {
console.log('Selected with search:', searchTerm)
}, [searchTerm]) // ✅ Memoized with correct dependency
if (isLoading) return <Skeleton />
if (error) return <ErrorMessage message={error} />
return (
<div className="space-y-2">
{patterns.map(p => (
<PatternCard
key={p.id}
pattern={p}
onSelect={handleSelect}
/>
))}
</div>
)
}
React Patterns Checklist:
// ❌ BAD - Inline styles, hardcoded colors, no dark mode
<div style={{
padding: '10px',
backgroundColor: '#3b82f6',
color: 'white',
borderRadius: '4px'
}}>
Button
</div>
// ✅ GOOD - Tailwind + design system + dark mode
<button className="rounded-md bg-blue-600 px-4 py-2 text-white transition hover:bg-blue-700 dark:bg-blue-700 dark:hover:bg-blue-800">
Button
</button>
Styling Checklist:
// ❌ BAD - Not accessible
<div onClick={handleClick} className="cursor-pointer">
Click me
</div>
// ✅ GOOD - Accessible
<button
onClick={handleClick}
className="rounded-md bg-blue-600 px-4 py-2 text-white hover:bg-blue-700"
aria-label="Open pattern details"
>
Click me
</button>
Accessibility Checklist:
// ❌ BAD - Tests implementation details
it('sets state correctly', () => {
const { getByTestId } = render(<Counter />)
const button = getByTestId('increment-button') // ⚠️ Testing ID
fireEvent.click(button)
expect(getByTestId('count-display')).toHaveTextContent('1')
})
// ✅ GOOD - Tests user behavior
it('increments counter when button clicked', async () => {
const user = userEvent.setup()
render(<Counter />)
const button = screen.getByRole('button', { name: /increment/ })
await user.click(button)
expect(screen.getByText('Count: 1')).toBeInTheDocument()
})
Testing Checklist:
Execute automated quality tools:
# TypeScript type checking
npx tsc --noEmit
# ESLint code style
npm run lint
# Test suite
npm run test:coverage
# Pattern validation
npm run test:patterns
# Design consistency
npm run design-analyze
# TypeScript guardian
npm run ts-guardian
Create a summary of issues found:
## Code Review Summary
### Critical Issues ⚠️
- [ ] TypeScript error on line X in FileA.tsx
- [ ] Missing type annotation on function Y
### Quality Issues 🔍
- [ ] Unused import in FileB.tsx
- [ ] Missing accessibility attributes in Component
### Suggestions 💡
- [ ] Consider extracting to custom hook
- [ ] Could use design system spacing variable
### Approved ✅
- Code follows all project standards
- Tests adequate and passing
- No critical issues found
Apply this checklist to every component or feature:
TypeScript & Types
any types (unless justified)React Quality
Styling
Accessibility
Testing
Data Handling
Documentation
// ❌ WRONG
const sortPatterns = (items) => items.sort()
// ✅ CORRECT
const sortPatterns = (items: Pattern[]): Pattern[] => items.sort()
// ❌ WRONG
const data = await fetch(url).then(r => r.json())
// ✅ CORRECT
const data = await fetch(url)
.then(r => {
if (!r.ok) throw new Error(`HTTP ${r.status}`)
return r.json()
})
.catch(err => {
console.error('Failed to fetch:', err)
throw err
})
// ❌ WRONG
useEffect(() => {
handleSearch(query)
}, []) // Missing query dependency
// ✅ CORRECT
useEffect(() => {
handleSearch(query)
}, [query]) // Query included
// ❌ WRONG
<div onClick={handleClick}>Click here</div>
// ✅ CORRECT
<button onClick={handleClick}>Click here</button>
Code Quality & Review integrates with:
# Type checking
npx tsc --noEmit
# Code style linting
npm run lint
# Run tests with coverage
npm run test:coverage
# Validate patterns
npm run test:patterns
# Analyze design
npm run design-analyze
# TypeScript guardian
npm run ts-guardian
# All-in-one quality check
npm run fix-all
| Metric | Target | Current |
|---|---|---|
| TypeScript Errors | 0 | - |
| ESLint Warnings | 0 | - |
| Test Pass Rate | 100% | - |
| Coverage | 70% | 48% |
| Accessibility Issues | 0 | - |
| Design Deviations | 0 | - |
Goal: Maintain exceptional code quality through systematic reviews, enforcing TypeScript strict mode, ensuring accessibility compliance, and validating adherence to project patterns and best practices.