/quality-check
Run comprehensive code quality analysis
How it fires
How this command gets triggered: by you, by Claude, or both.
- Fires itselfClaude auto-loads it when your prompt matches the work.
- You can call itInvoke it directly when you want it.
- Slash command
/quality-check
Context preview
What this command does when you run it.
Run comprehensive code quality analysis
Command definition
quality-check.mdname: quality-check
description: Run comprehensive code quality analysis
category: Security & Quality
Quality Check Command
Perform comprehensive code quality analysis including linting, testing, complexity, and performance.
Purpose
Ensure code meets quality standards before PR/merge:
- Code style and linting (ESLint, Prettier)
- Test coverage and passing tests
- Code complexity metrics
- Performance benchmarks
- Documentation coverage
- Bundle size analysis
Workflow
Step 1: Determine Scope
๐ **Code Quality Check**
Scope options:
1. ๐ฏ Current PRD changes (git diff)
2. ๐ฆ Entire codebase
3. ๐ Specific directory
Select scope: (1-3)
Step 2: Linting Analysis
Run configured linters:
# ESLint
npx eslint . --ext .ts,.tsx,.js,.jsx --format json
# Prettier
npx prettier --check "**/*.{ts,tsx,js,jsx,json,md}"
# TypeScript
npx tsc --noEmitReport:
- Error count
- Warning count
- Auto-fixable issues
- Manual fixes needed
Step 3: Test Execution
Run test suites:
# Unit tests
npm test -- --coverage --json
# Integration tests (if configured)
npm run test:integration
# E2E tests (if configured)
npm run test:e2e
Analyze:
- Total tests (passed/failed)
- Coverage percentage (lines, branches, functions)
- Slow tests (>1s)
- Flaky tests
Step 4: Code Complexity Analysis
Calculate complexity metrics:
# Complexity analysis (using eslint-plugin-complexity)
npx eslint . --rule 'complexity: [error, 10]' --format json
Report:
- Average cyclomatic complexity
- Functions exceeding threshold (>15)
- Most complex functions (top 10)
- Suggested refactoring targets
Step 5: Performance Metrics
Analyze bundle size and performance:
# Bundle size
npm run build
npx bundlesize
# Type check performance
time npx tsc --noEmit
Report:
- Bundle size (current vs target)
- Largest dependencies
- Build time
- Type check time
Step 6: Documentation Coverage
Check documentation:
- JSDoc coverage for public APIs
- README completeness
- Component stories (Storybook)
- API documentation
- Migration guides (if breaking changes)
Step 7: Generate Quality Report
๐ **Code Quality Report - PRD-003: Design System**
**Date**: 2025-10-25
**Scope**: feat/PRD-003-design-system (18 files, 2,450 LOC)
**Grade**: A- (87/100)
---
## โ
Linting & Style
### ESLint
- โ
**Errors**: 0
- โ ๏ธ **Warnings**: 3 (all auto-fixable)
- **Auto-fix available**: Run `npm run lint -- --fix`
**Warnings**:
- `packages/ui/src/components/Button.tsx:45` - Unused variable 'variant'
- `packages/ui/src/components/Input.tsx:23` - Missing dependency in useEffect
- `packages/ui/src/utils/cn.ts:12` - Prefer const assertion
### Prettier
- โ
**Formatted**: 100%
- **Files**: 18/18 compliant
### TypeScript
- โ
**Errors**: 0
- โ
**Strict mode**: Enabled
- **Type coverage**: 98.5%
**Score**: 9.5/10
---
## ๐งช Testing
### Unit Tests
- โ
**Tests**: 42 passed, 0 failed
- โ
**Coverage**: 87.3% (target: 80%)
- Lines: 88.1%
- Branches: 85.2%
- Functions: 89.5%
- Statements: 87.9%
- โก **Duration**: 3.2s (fast!)
- โ
**Flaky tests**: 0
**Coverage by File**:
| File | Coverage | Missing |
|------|----------|---------|
| Button.tsx | 95% | Error state handler |
| Input.tsx | 92% | Async validation |
| Select.tsx | 85% | Edge cases |
| Card.tsx | 100% | - |
**Slow Tests** (>500ms):
- None! All tests fast โก
**Score**: 9/10
---
## ๐ฏ Code Complexity
### Metrics
- โ
**Average Complexity**: 4.2 (excellent, <5)
- โ
**Max Complexity**: 9 (acceptable, <15)
- **Functions >10 complexity**: 0
**Most Complex Functions** (all acceptable):
1. `parseVariants` - 9 (packages/ui/src/utils/variants.ts:24)
2. `validateInput` - 7 (packages/ui/src/components/Input.tsx:56)
3. `mergeRefs` - 6 (packages/ui/src/utils/refs.ts:12)
**Recommendations**: None, complexity is well-managed โ
**Score**: 10/10
---
## ๐ฆ Bundle Size
### Production Build
- โ
**Total**: 42.3 KB gzipped (target: <50 KB)
- โ
**Code**: 28.1 KB
- โ
**Dependencies**: 14.2 KB
**Largest Dependencies**:
1. `clsx` - 4.2 KB (used for className merging)
2. `@radix-ui/react-slot` - 3.8 KB (primitives)
3. `class-variance-authority` - 3.1 KB (variant generation)
**Tree-shaking**: โ
Verified (reduced from 68 KB)
**Score**: 9.5/10
---
## โก Performance
### Build Performance
- โ
**Build time**: 12.3s (fast)
- โ
**Type check**: 2.1s
- โ
**Lint time**: 3.4s
### Runtime Performance (from tests)
- โ
**Render time**: 18ms avg (target: <50ms)
- โ
**Re-render time**: 6ms avg
- โ
**Mount time**: 24ms avg
**Score**: 9/10
---
## ๐ Documentation
### Coverage
- โ
**JSDoc comments**: 95% of public APIs
- โ
**README.md**: Complete
- โ
**Storybook stories**: 8/8 components (100%)
- โ ๏ธ **Migration guide**: Missing
- โ
**TypeScript types**: Fully documented
**Missing Documentation**:
- Migration guide from old component library
- Design token documentation
**Score**: 8.5/10
---
## ๐ฏ Overall Summary
| Category | Score | Grade |
|----------|-------|-------|
| Linting & Style | 9.5/10 | A |
| Testing | 9.0/10 | A |
| Code Complexity | 10/10 | A+ |
| Bundle Size | 9.5/10 | A |
| Performance | 9.0/10 | A |
| Documentation | 8.5/10 | B+ |
**Overall Grade**: A- (87/100)
**Quality Level**: Production-ready โ
---
## ๐ ๏ธ Recommended Actions
### Before Merge (Optional)
1. Fix 3 ESLint warnings: `npm run lint -- --fix`
2. Add migration guide to docs/
3. Document design tokens in README
### Nice to Have
- Increase Input.tsx coverage to 95%+ (async validation tests)
- Add visual regression tests (Chromatic/Percy)
- Performance monitoring (bundle size CI check)
---
## ๐ง Quick Fixes
Would you like me to:
1. Auto-fix linting warnings? (Y/n)
2. Generate migration guide template? (Y/n)
3. Add missing JSDoc comments? (Y/n)
Step 8: Offer Auto-Fix
If user approves:
# Fix linting
npm run lint -- --fix
# Format code
npm run format
# Commit
git add .
git commit -m "chore: Fix code quality issu
Read more
name: quality-check description: Run comprehensive code quality analysis category: Security & Quality
Quality Check Command
Perform comprehensive code quality analysis including linting, testing, complexity, and performance.
Purpose
Ensure code meets quality standards before PR/merge:
- Code style and linting (ESLint, Prettier)
- Test coverage and passing tests
- Code complexity metrics
- Performance benchmarks
- Documentation coverage
- Bundle size analysis
Workflow
Step 1: Determine Scope
๐ **Code Quality Check** Scope options: 1. ๐ฏ Current PRD changes (git diff) 2. ๐ฆ Entire codebase 3. ๐ Specific directory Select scope: (1-3)
Step 2: Linting Analysis
Run configured linters:
# ESLint
npx eslint . --ext .ts,.tsx,.js,.jsx --format json
# Prettier
npx prettier --check "**/*.{ts,tsx,js,jsx,json,md}"
# TypeScript
npx tsc --noEmitReport:
- Error count
- Warning count
- Auto-fixable issues
- Manual fixes needed
Step 3: Test Execution
Run test suites:
# Unit tests npm test -- --coverage --json # Integration tests (if configured) npm run test:integration # E2E tests (if configured) npm run test:e2e
Analyze:
- Total tests (passed/failed)
- Coverage percentage (lines, branches, functions)
- Slow tests (>1s)
- Flaky tests
Step 4: Code Complexity Analysis
Calculate complexity metrics:
# Complexity analysis (using eslint-plugin-complexity) npx eslint . --rule 'complexity: [error, 10]' --format json
Report:
- Average cyclomatic complexity
- Functions exceeding threshold (>15)
- Most complex functions (top 10)
- Suggested refactoring targets
Step 5: Performance Metrics
Analyze bundle size and performance:
# Bundle size npm run build npx bundlesize # Type check performance time npx tsc --noEmit
Report:
- Bundle size (current vs target)
- Largest dependencies
- Build time
- Type check time
Step 6: Documentation Coverage
Check documentation:
- JSDoc coverage for public APIs
- README completeness
- Component stories (Storybook)
- API documentation
- Migration guides (if breaking changes)
Step 7: Generate Quality Report
๐ **Code Quality Report - PRD-003: Design System** **Date**: 2025-10-25 **Scope**: feat/PRD-003-design-system (18 files, 2,450 LOC) **Grade**: A- (87/100) --- ## โ Linting & Style ### ESLint - โ **Errors**: 0 - โ ๏ธ **Warnings**: 3 (all auto-fixable) - **Auto-fix available**: Run `npm run lint -- --fix` **Warnings**: - `packages/ui/src/components/Button.tsx:45` - Unused variable 'variant' - `packages/ui/src/components/Input.tsx:23` - Missing dependency in useEffect - `packages/ui/src/utils/cn.ts:12` - Prefer const assertion ### Prettier - โ **Formatted**: 100% - **Files**: 18/18 compliant ### TypeScript - โ **Errors**: 0 - โ **Strict mode**: Enabled - **Type coverage**: 98.5% **Score**: 9.5/10 --- ## ๐งช Testing ### Unit Tests - โ **Tests**: 42 passed, 0 failed - โ **Coverage**: 87.3% (target: 80%) - Lines: 88.1% - Branches: 85.2% - Functions: 89.5% - Statements: 87.9% - โก **Duration**: 3.2s (fast!) - โ **Flaky tests**: 0 **Coverage by File**: | File | Coverage | Missing | |------|----------|---------| | Button.tsx | 95% | Error state handler | | Input.tsx | 92% | Async validation | | Select.tsx | 85% | Edge cases | | Card.tsx | 100% | - | **Slow Tests** (>500ms): - None! All tests fast โก **Score**: 9/10 --- ## ๐ฏ Code Complexity ### Metrics - โ **Average Complexity**: 4.2 (excellent, <5) - โ **Max Complexity**: 9 (acceptable, <15) - **Functions >10 complexity**: 0 **Most Complex Functions** (all acceptable): 1. `parseVariants` - 9 (packages/ui/src/utils/variants.ts:24) 2. `validateInput` - 7 (packages/ui/src/components/Input.tsx:56) 3. `mergeRefs` - 6 (packages/ui/src/utils/refs.ts:12) **Recommendations**: None, complexity is well-managed โ **Score**: 10/10 --- ## ๐ฆ Bundle Size ### Production Build - โ **Total**: 42.3 KB gzipped (target: <50 KB) - โ **Code**: 28.1 KB - โ **Dependencies**: 14.2 KB **Largest Dependencies**: 1. `clsx` - 4.2 KB (used for className merging) 2. `@radix-ui/react-slot` - 3.8 KB (primitives) 3. `class-variance-authority` - 3.1 KB (variant generation) **Tree-shaking**: โ Verified (reduced from 68 KB) **Score**: 9.5/10 --- ## โก Performance ### Build Performance - โ **Build time**: 12.3s (fast) - โ **Type check**: 2.1s - โ **Lint time**: 3.4s ### Runtime Performance (from tests) - โ **Render time**: 18ms avg (target: <50ms) - โ **Re-render time**: 6ms avg - โ **Mount time**: 24ms avg **Score**: 9/10 --- ## ๐ Documentation ### Coverage - โ **JSDoc comments**: 95% of public APIs - โ **README.md**: Complete - โ **Storybook stories**: 8/8 components (100%) - โ ๏ธ **Migration guide**: Missing - โ **TypeScript types**: Fully documented **Missing Documentation**: - Migration guide from old component library - Design token documentation **Score**: 8.5/10 --- ## ๐ฏ Overall Summary | Category | Score | Grade | |----------|-------|-------| | Linting & Style | 9.5/10 | A | | Testing | 9.0/10 | A | | Code Complexity | 10/10 | A+ | | Bundle Size | 9.5/10 | A | | Performance | 9.0/10 | A | | Documentation | 8.5/10 | B+ | **Overall Grade**: A- (87/100) **Quality Level**: Production-ready โ --- ## ๐ ๏ธ Recommended Actions ### Before Merge (Optional) 1. Fix 3 ESLint warnings: `npm run lint -- --fix` 2. Add migration guide to docs/ 3. Document design tokens in README ### Nice to Have - Increase Input.tsx coverage to 95%+ (async validation tests) - Add visual regression tests (Chromatic/Percy) - Performance monitoring (bundle size CI check) --- ## ๐ง Quick Fixes Would you like me to: 1. Auto-fix linting warnings? (Y/n) 2. Generate migration guide template? (Y/n) 3. Add missing JSDoc comments? (Y/n)
Step 8: Offer Auto-Fix
If user approves:
# Fix linting npm run lint -- --fix # Format code npm run format # Commit git add . git commit -m "chore: Fix code quality issu
The complete Claude Code plugin for Product-Driven Development Transform PRDs from ideas to shipped features with AI-powered review, guided implementation, and automated quality gates. Never ship unclear requirements again.
Repo: Yassinello/claude-plugin-prd-workflow

