| name | code-health-check |
| description | Perform code quality checks before commit. Validates code standards, security, architectural consistency. Runs TypeScript compilation, linting, test coverage verification. |
_code-health-check
Overview
Systematic quality verification before code commits. Prevents errors and maintains code health.
When to use: After editing files, before sending PR, before committing code
Process: 5 automated checks catching most issues early
Pre-commit Checklist
1. TypeScript Errors (IDE & Compilation)
npx tsc --noEmit
Action:
- ❌ Red errors → Must fix before commit
- ⚠️ Yellow warnings → Review, fix if serious
- ✅ Zero errors → Clear to continue
2. Linting & Code Style
npm run lint
npm run lint:fix
Common issues:
- Unused imports/variables
- Inconsistent formatting
- Missing semicolons
- Line too long
3. Build Verification
npm run build
Must pass: No build errors
4. Test Suite
npm run test:run
npm run test:coverage
Check:
5. Pre-push Hook (if configured)
npm run pre-push
Quick Workflow
npm run lint:fix
npm run build
npm run test:run
npm run pre-push
Error Categories & Fixes
| Error Type | Detection | Fix |
|---|
| Import not found | IDE/tsc | Add missing import or remove unused |
| Type mismatch | IDE/tsc | Correct type or cast appropriately |
| Unused variable | Lint | Remove or use _prefix if intentional |
| Test failing | npm test | Debug and fix test or code |
| Coverage gap | Coverage report | Add tests for new code |
Common Issues
Issue: "Cannot find module"
Issue: "Type expectation"
Issue: Tests failing
npm run test:run -- --reporter=verbose
Issue: Build fails
npm run build 2>&1 | head -20
Checklist Before Commit
## Pre-commit Verification
- [ ] VSCode Problems panel: 0 errors
- [ ] `npm run lint`: 0 errors
- [ ] `npm run build`: Success
- [ ] `npm run test:run`: All pass
- [ ] Coverage report ≥70%
- [ ] `npm run pre-push`: All pass (if available)
- [ ] Commit message formatted (_git-commit skill)
Best Practices
- Run checks frequently during development, not just before commit
- Fix issues immediately - easier when context is fresh
- Use IDE warnings as early signals
- Automate where possible - pre-commit hooks, lint-staged
- Review build output - don't just check exit code
Related Skills
- _git-commit: Ensure commit message format
- _typescript-type-safety: Fix type-related errors
- _release-process: Quality gates for releases