4.0 KiB
Code Quality Regime
MANDATORY: Before declaring ANY work complete, fixed, or working, Claude MUST run these checks and fix all issues.
Definition of "Done"
Work is NOT complete until:
- ✅ All TypeScript errors are fixed (0 errors)
- ✅ All code is formatted with Biome
- ✅ All linting passes (0 errors, 0 warnings)
- ✅
npm run pre-commitexits successfully
Until these checks pass, the work is considered incomplete.
Quality Check Checklist (Always Required)
Run these before:
- Committing code
- Saying work is "done" or "complete"
- Marking tasks as finished
- Telling the user something is "working" or "fixed"
Run these commands in order. All must pass with 0 errors and 0 warnings:
# 1. Type check
npm run type-check
# 2. Format code
npm run format
# 3. Lint and fix
npm run lint:fix
# 4. Verify clean state
npm run lint && npm run type-check
Quick Command (Run All Checks)
npm run pre-commit
What it does:
"pre-commit": "npm run type-check && npm run format && npm run lint:fix && npm run lint"
This single command runs:
npm run type-check→tsc --noEmit(TypeScript errors)npm run format→npx @biomejs/biome format . --write(auto-format)npm run lint:fix→npx @biomejs/biome lint . --write && npx eslint . --fix(auto-fix)npm run lint→npx @biomejs/biome lint . && npx eslint .(verify clean)
Fails fast if any step fails.
The Regime Rules
1. TypeScript Errors: ZERO TOLERANCE
- Run
npm run type-checkbefore every commit - Fix ALL TypeScript errors
- No
@ts-ignoreor@ts-expect-errorwithout explicit justification
2. Formatting: AUTOMATIC
- Run
npm run formatbefore every commit - Biome handles all formatting automatically
- Never commit unformatted code
3. Linting: ZERO ERRORS, ZERO WARNINGS
- Run
npm run lint:fixto auto-fix issues - Then run
npm run lintto verify 0 errors, 0 warnings - Fix any remaining issues manually
4. Commit Order
- Make code changes
- Run
npm run pre-commit - If any check fails, fix and repeat
- Only commit when all checks pass
- Push immediately after commit
Why No Pre-Commit Hooks?
This project intentionally avoids pre-commit hooks due to religious constraints. Instead, Claude Code is responsible for enforcing this regime through:
- This documentation - Always visible and reference-able
- Package.json scripts - Easy to run checks
- Session persistence - This file lives in
.claude/and is read by every session
For Claude Code Sessions
READ THIS FILE AT THE START OF EVERY SESSION WHERE YOU WILL COMMIT CODE
When asked to commit:
- Check if you've run
npm run pre-commit(or all 4 steps individually) - If not, STOP and run the checks first
- Fix all issues before proceeding with the commit
- Only create commits when all checks pass
Complete Scripts Reference
From apps/web/package.json:
{
"scripts": {
"type-check": "tsc --noEmit",
"format": "npx @biomejs/biome format . --write",
"format:check": "npx @biomejs/biome format .",
"lint": "npx @biomejs/biome lint . && npx eslint .",
"lint:fix": "npx @biomejs/biome lint . --write && npx eslint . --fix",
"check": "npx @biomejs/biome check .",
"pre-commit": "npm run type-check && npm run format && npm run lint:fix && npm run lint"
}
}
Tools used:
- TypeScript:
tsc --noEmit(type checking only, no output) - Biome: Fast formatter + linter (Rust-based, 10-100x faster than Prettier)
- ESLint: React Hooks rules only (
rules-of-hooksvalidation)
Emergency Override
If you absolutely MUST commit with failing checks:
- Document WHY in the commit message
- Create a follow-up task to fix the issues
- Only use for emergency hotfixes
Verification
After following this regime, you should see:
✓ Type check passed (0 errors)
✓ Formatting applied
✓ Linting passed (0 errors, 0 warnings)
✓ Ready to commit
This regime is non-negotiable. Every commit must pass these checks.