Claude-skill-registry kpi-code-quality
KPI for measuring and improving code quality. Covers lint errors, type safety, test coverage, and verification pass rates. Use to ensure code meets quality standards.
install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/kpi-code-quality" ~/.claude/skills/majiayu000-claude-skill-registry-kpi-code-quality && rm -rf "$T"
manifest:
skills/data/kpi-code-quality/SKILL.mdsource content
KPI: Code Quality
Definition: The degree to which code is correct, maintainable, and follows established patterns.
Why This Matters
Code quality directly impacts:
- Velocity - Clean code is easier to change
- Reliability - Quality code has fewer bugs
- Collaboration - Consistent patterns reduce friction
Metrics
Primary Metrics
| Metric | Target | Measurement |
|---|---|---|
| Lint Errors | 0 | |
| Type Errors | 0 | |
| Test Pass Rate | 100% | |
| Build Success | Yes | |
Secondary Metrics
| Metric | Target | Measurement |
|---|---|---|
| Test Coverage | >80% | Coverage report |
| Cyclomatic Complexity | <10 per function | Static analysis |
| Code Duplication | <5% | Duplicate detection |
Measurement
Verification Pipeline
The primary quality gate is:
./verify.sh --ui=false
This runs:
- Format check
- Lint check
- Type check
- Unit tests
- Build
All stages must pass.
Individual Checks
npm run format:check # Formatting npm run lint:check # Linting npm run typecheck # TypeScript npm run test # Tests npm run build # Build
Improvement Strategies
1. Fix Forward
When you encounter an error:
- Fix it immediately
- Record the pattern in typescript-coding skill
- Prevent recurrence through documentation
2. Type Everything
Eliminate
any types. Strong types catch bugs at compile time.
3. Test First
Write tests before or alongside implementation. Tests are documentation that runs.
4. Follow Patterns
Use established patterns from coding-patterns skill:
- Contract-port architecture
- Explicit dependency injection
- Hermetic primitives
5. Review Lint Rules
If a lint rule is consistently violated:
- Either the rule is wrong (propose removing it)
- Or the pattern is wrong (fix the code)
Quality Checklist
Before creating a PR:
-
passesnpm run lint:check -
passesnpm run typecheck -
passesnpm run test -
passesnpm run build - No
types addedany - New code has tests
- Error handling follows patterns
Blockers to Watch
| Issue | Detection | Resolution |
|---|---|---|
| Lint errors | lint:check fails | Run to auto-fix |
| Type errors | typecheck fails | Fix types, avoid |
| Test failures | test fails | Debug and fix tests |
| Build errors | build fails | Check for missing exports |
Anti-Patterns
- Disabling rules - Don't
without good reason// biome-ignore - Using
- Defeats the purpose of TypeScriptany - Skipping tests - Untested code is broken code waiting to happen
- Copy-paste - Duplicated code diverges and rots