Code Quality Assessment & Improvement Skill
Systematic code quality analysis, metric tracking, and improvement sprint planning for TypeScript/React projects.
Quick Commands
/code-quality assess - Run full assessment and generate report
/code-quality metrics - Show current metrics vs targets
/code-quality hotspots - Identify highest-priority improvement areas
/code-quality sprint - Plan a focused improvement sprint
Workflow
Phase 1: Assessment
Run comprehensive code quality checks and establish baseline metrics.
Required Checks:
Lint Analysis
npm run lint
- Target: 0 errors, 0 warnings
- Track: Total warnings by category
Type Safety
npm run type-check
- Target: 0 TypeScript errors
- Track: Error count and locations
Test Coverage
npx vitest run --coverage
- Target: 80%+ line coverage
- Track: Coverage by directory
Code Duplication
npx jscpd src --reporters json --output duplication-report
- Target: <2% duplication
- Track: Percentage and clone locations
any Type Count
Use the Grep tool with pattern : any on src/, glob *.{ts,tsx}, output_mode count. Exclude test files by filtering results.
- Target: <50
any types
- Track: Count by file
Large File Detection
Use the Glob tool with pattern src/**/*.{ts,tsx}, then Read each file to check line count. Sort results by size.
- Target: No files >500 lines (excluding data files)
- Track: Files exceeding threshold
Complexity Analysis (if eslint-plugin-complexity configured)
npx eslint src --rule 'complexity: [warn, 15]'
- Target: No functions with complexity >15
- Track: High-complexity function locations
Phase 2: Hotspot Identification
Prioritize issues using the Impact/Effort Matrix:
| Priority |
Impact |
Effort |
Examples |
| P0 |
High |
Low |
ESLint errors, TypeScript errors |
| P1 |
High |
Medium |
Large files blocking changes, high any concentration |
| P2 |
Medium |
Low |
Duplicate code in same file |
| P3 |
Medium |
Medium |
Missing test coverage for critical paths |
| P4 |
Low |
Any |
Minor style inconsistencies |
Hotspot Detection:
- Files with most
any types: Use the Grep tool with pattern : any, glob *.{ts,tsx}, path src/, output_mode count. Exclude test files. Sort by count descending.
- Largest non-test files: Use the Glob tool with pattern
src/**/*.{ts,tsx}. Skip files matching .test. or __tests__. Read each to get line count, then rank by size.
- Duplicate code locations: Use the Read tool on
duplication-report/jscpd-report.json and parse the duplicates array to find the most-repeated file paths.
Phase 3: Sprint Planning
Structure improvement work into focused sprints:
Sprint Template:
## Sprint [N]: [Theme]
**Duration**: [X] hours
**Goal**: [Specific, measurable objective]
### Tasks
| ID | Task | Effort | Impact |
|----|------|--------|--------|
| 1 | [Task description] | [hours] | [metric improvement] |
### Success Criteria
- [ ] Metric A: [before] → [target]
- [ ] Metric B: [before] → [target]
### Validation
- [ ] All tests pass
- [ ] Lint clean
- [ ] Type-check clean
- [ ] No regressions
Sprint Sizing Guidelines:
- Quick Win Sprint: 4-8 hours, targets easy P0/P1 items
- Standard Sprint: 16-24 hours, tackles systematic issues
- Deep Dive Sprint: 40+ hours, major architectural refactoring
Phase 4: Validation
After each sprint, run full validation:
npm run lint && npm run type-check && npm test
Regression Checklist:
Metric Targets Reference
| Metric |
Minimum |
Good |
Excellent |
| ESLint Errors |
0 |
0 |
0 |
| ESLint Warnings |
<50 |
<20 |
0 |
| TypeScript Errors |
0 |
0 |
0 |
| Test Coverage |
60% |
80% |
90%+ |
| Code Duplication |
<5% |
<2% |
<1% |
any Types |
<100 |
<50 |
<20 |
| Files >500 LOC |
<10 |
<5 |
0 |
| Complexity >15 |
<10 |
<5 |
0 |
Output Format
When reporting assessment results, use this format:
## Code Quality Assessment - [Date]
### Summary
| Metric | Current | Target | Status |
|--------|---------|--------|--------|
| Lint Errors | X | 0 | ✅/❌ |
| Lint Warnings | X | 0 | ✅/❌ |
| TypeScript Errors | X | 0 | ✅/❌ |
| Test Coverage | X% | 80% | ✅/❌ |
| Code Duplication | X% | <2% | ✅/❌ |
| `any` Types | X | <50 | ✅/❌ |
| Large Files | X | 0 | ✅/❌ |
### Top Hotspots
1. [File/Issue]: [Description] - [Recommended action]
2. ...
### Recommended Sprint
[Sprint plan based on hotspots]
Related Files
methodology.md - Refactoring patterns, sprint structure, prioritization, and lessons learned
metrics-template.md - Tracking templates for baseline, sprint progress, and final validation
Source: prairieaster-ai/claude-code-skills — distributed by TomeVault.
1---2name: code-quality-263description: Assess and improve code quality in TypeScript/React projects. Runs lint, type-check, coverage, duplication, and complexity analysis with sprint planning. Use when this capability is needed.4---56# Code Quality Assessment & Improvement Skill78Systematic code quality analysis, metric tracking, and improvement sprint planning for TypeScript/React projects.910## Quick Commands1112- `/code-quality assess` - Run full assessment and generate report13- `/code-quality metrics` - Show current metrics vs targets14- `/code-quality hotspots` - Identify highest-priority improvement areas15- `/code-quality sprint` - Plan a focused improvement sprint1617## Workflow1819### Phase 1: Assessment2021Run comprehensive code quality checks and establish baseline metrics.2223**Required Checks:**24251. **Lint Analysis**26 ```bash27 npm run lint28 ```29 - Target: 0 errors, 0 warnings30 - Track: Total warnings by category31322. **Type Safety**33 ```bash34 npm run type-check35 ```36 - Target: 0 TypeScript errors37 - Track: Error count and locations38393. **Test Coverage**40 ```bash41 npx vitest run --coverage42 ```43 - Target: 80%+ line coverage44 - Track: Coverage by directory45464. **Code Duplication**47 ```bash48 npx jscpd src --reporters json --output duplication-report49 ```50 - Target: <2% duplication51 - Track: Percentage and clone locations52535. **`any` Type Count**54 Use the **Grep** tool with pattern `: any` on `src/`, glob `*.{ts,tsx}`, output_mode `count`. Exclude test files by filtering results.55 - Target: <50 `any` types56 - Track: Count by file57586. **Large File Detection**59 Use the **Glob** tool with pattern `src/**/*.{ts,tsx}`, then **Read** each file to check line count. Sort results by size.60 - Target: No files >500 lines (excluding data files)61 - Track: Files exceeding threshold62637. **Complexity Analysis** (if eslint-plugin-complexity configured)64 ```bash65 npx eslint src --rule 'complexity: [warn, 15]'66 ```67 - Target: No functions with complexity >1568 - Track: High-complexity function locations6970### Phase 2: Hotspot Identification7172Prioritize issues using the **Impact/Effort Matrix**:7374| Priority | Impact | Effort | Examples |75|----------|--------|--------|----------|76| **P0** | High | Low | ESLint errors, TypeScript errors |77| **P1** | High | Medium | Large files blocking changes, high `any` concentration |78| **P2** | Medium | Low | Duplicate code in same file |79| **P3** | Medium | Medium | Missing test coverage for critical paths |80| **P4** | Low | Any | Minor style inconsistencies |8182**Hotspot Detection:**8384- **Files with most `any` types**: Use the **Grep** tool with pattern `: any`, glob `*.{ts,tsx}`, path `src/`, output_mode `count`. Exclude test files. Sort by count descending.85- **Largest non-test files**: Use the **Glob** tool with pattern `src/**/*.{ts,tsx}`. Skip files matching `.test.` or `__tests__`. Read each to get line count, then rank by size.86- **Duplicate code locations**: Use the **Read** tool on `duplication-report/jscpd-report.json` and parse the `duplicates` array to find the most-repeated file paths.8788### Phase 3: Sprint Planning8990Structure improvement work into focused sprints:9192**Sprint Template:**93```markdown94## Sprint [N]: [Theme]9596**Duration**: [X] hours97**Goal**: [Specific, measurable objective]9899### Tasks100| ID | Task | Effort | Impact |101|----|------|--------|--------|102| 1 | [Task description] | [hours] | [metric improvement] |103104### Success Criteria105- [ ] Metric A: [before] → [target]106- [ ] Metric B: [before] → [target]107108### Validation109- [ ] All tests pass110- [ ] Lint clean111- [ ] Type-check clean112- [ ] No regressions113```114115**Sprint Sizing Guidelines:**116- Quick Win Sprint: 4-8 hours, targets easy P0/P1 items117- Standard Sprint: 16-24 hours, tackles systematic issues118- Deep Dive Sprint: 40+ hours, major architectural refactoring119120### Phase 4: Validation121122After each sprint, run full validation:123124```bash125npm run lint && npm run type-check && npm test126```127128**Regression Checklist:**129- [ ] All existing tests pass130- [ ] No new lint warnings introduced131- [ ] No new TypeScript errors132- [ ] Build succeeds133- [ ] Application runs correctly134135## Metric Targets Reference136137| Metric | Minimum | Good | Excellent |138|--------|---------|------|-----------|139| ESLint Errors | 0 | 0 | 0 |140| ESLint Warnings | <50 | <20 | 0 |141| TypeScript Errors | 0 | 0 | 0 |142| Test Coverage | 60% | 80% | 90%+ |143| Code Duplication | <5% | <2% | <1% |144| `any` Types | <100 | <50 | <20 |145| Files >500 LOC | <10 | <5 | 0 |146| Complexity >15 | <10 | <5 | 0 |147148## Output Format149150When reporting assessment results, use this format:151152```markdown153## Code Quality Assessment - [Date]154155### Summary156| Metric | Current | Target | Status |157|--------|---------|--------|--------|158| Lint Errors | X | 0 | ✅/❌ |159| Lint Warnings | X | 0 | ✅/❌ |160| TypeScript Errors | X | 0 | ✅/❌ |161| Test Coverage | X% | 80% | ✅/❌ |162| Code Duplication | X% | <2% | ✅/❌ |163| `any` Types | X | <50 | ✅/❌ |164| Large Files | X | 0 | ✅/❌ |165166### Top Hotspots1671. [File/Issue]: [Description] - [Recommended action]1682. ...169170### Recommended Sprint171[Sprint plan based on hotspots]172```173174## Related Files175176- `methodology.md` - Refactoring patterns, sprint structure, prioritization, and lessons learned177- `metrics-template.md` - Tracking templates for baseline, sprint progress, and final validation178179---180> Source: [prairieaster-ai/claude-code-skills](https://github.com/prairieaster-ai/claude-code-skills) — distributed by [TomeVault](https://tomevault.io).181<!-- tomevault:4.0:skill_md:2026-06-01 -->