| name | hardening-codebase |
| description | Audit and tighten codebase quality gates — lint, types, tests, code review. Use when onboarding a project, before a release, or when validation is too permissive. |
| compatibility | Designed for Claude Code |
| metadata | {"allowed-tools":"Read, Grep, Glob, Bash, Edit, Write, Agent","argument-hint":"[scope: full | audit | tighten | review | fix]","stability":"experimental"} |
Harden Codebase
Scope: $ARGUMENTS (default: full)
Systematic quality tightening. Seven phases, each with a clear gate.
KISS: tighten one level at a time — never jump to max strictness.
Phase 1: AUDIT (read-only)
- Does
make setup_all (or equivalent) work from scratch?
- What lint rules are enabled? Gap vs recommended?
See
references/lint-tightening-checklist.md
- Type checker strictness level?
- Do tests pass? Are slow/hardware tests filtered?
- Is check-only gate separate from auto-fix?
Gate: Issue list ranked HIGH/MEDIUM/LOW. Present to user before
proceeding.
Phase 2: TIGHTEN (config only — no code changes)
- Enable next-level lint rules (baseline → recommended, not strict)
- Bump type checker one level
- Split auto-fix from check-only gate if missing
- Add test marker filters for slow/hardware/network
- Count new violations — report before fixing
Gate: Config committed. Violation count known.
Phase 3: FIX (mechanical)
- Run auto-fix
- Fix remaining violations manually
- Update tests broken by signature changes
make validate must pass
Gate: All checks green. Commit fixes.
Phase 4: TEST OVERHAUL (meaningful tests only)
- Classify every test: behavioral / implementation / trivial
- Rewrite implementation tests as behavioral (assert outcomes, not internals)
- Delete trivial tests that add no value
- Add missing behavioral tests for error recovery, state transitions, edge cases
- Add property-based tests (Hypothesis) for invariants
- Add complexity gate (complexipy, max 15/function)
make validate must pass with coverage gate
Gate: All tests behavioral. Coverage ≥ 80%. Complexity ≤ 15.
Phase 5: REVIEW (3 parallel agents)
Launch all three from references/review-agents.md:
- Reuse: duplication, missing shared helpers
- Quality: copy-paste, magic strings, abstractions, bugs
- Efficiency: unnecessary work, missed caching
Gate: Ranked findings presented to user.
Phase 6: REFACTOR (apply findings)
- Fix HIGH and MEDIUM only (80/20)
- Skip LOW unless trivial
make validate after each fix
- Commit by topic
Gate: All checks green. Findings addressed.
Phase 7: SHIP
- Push branch
- Create PR with summary + test plan
Scope shortcuts
audit — Phase 1 only (read-only report)
tighten — Phases 1-3 (config + fix)
tests — Phase 4 only (test overhaul)
review — Phase 5 only (3-agent review)
fix — Phase 6 only (apply existing findings)
full — All phases
References
See references/lint-tightening-checklist.md for language-specific
rule progressions and references/review-agents.md for agent prompts.