Section 08 · Monitoring & Health
Testing & Code Metrics
Test coverage, testing practices, and code quality metrics for maintaining reliable, maintainable code
6 items 4 critical 2 recommended
This guide walks you through auditing a project's test coverage, testing practices, and code quality metrics.
The Goal: Confidence in Change
Every code change is validated by automated tests. Quality cannot silently degrade.
- Enforced — CI fails when coverage drops below threshold
- Complete — bug fixes include regression tests, features ship with test coverage
- Critical-path — e2e tests cover revenue-impacting journeys (auth, checkout, core flows)
- Measurable — complexity metrics tracked with established baselines
- Automated — test and lint commands documented for agents and developers alike
Before You Start
- Confirm you're in the target repository's root directory
- Know the project's test framework (Jest, Vitest, pytest, etc.)
- Have dependencies installed (
pnpm installor equivalent)
test-requirements
TEST-002
Bug fix commits include regression tests critical
80%+ of bug fix commits have associated test changes (same commit or ±1 commit) to prevent regressions
“How many bugs have you fixed twice?”
TEST-003
New feature commits include tests critical
80%+ of feature commits have associated test changes (same commit or ±1 commit)
“What shipped last sprint with zero tests?”
TEST-004
End-to-end tests for business-critical paths critical
E2e test framework configured with tests covering revenue, auth, and core user journeys
“If checkout broke right now, how fast would you know?”