원클릭으로
self-correcting-loop
// Use on every commit. The pre-commit hooks run checks in parallel. If any fail, read ALL errors, fix them in one pass, and retry. NEVER use --no-verify.
// Use on every commit. The pre-commit hooks run checks in parallel. If any fail, read ALL errors, fix them in one pass, and retry. NEVER use --no-verify.
Use when adding a new full-stack CRUD resource (e.g. "add a Comments resource"). Walks through Prisma model, Zod schema, tRPC router, and React page in order. Mirrors the patterns already used by Contact/Task/Project.
Use before pushing to a deployed environment (staging or prod). Walks through env vars, migrations, secrets, build, and rollback prep.
Use the first time an agent (or human) opens this repo. Installs deps, prepares the env, validates that the dev environment works, and points the agent at the right files.
Use when starting a real project from this template. Removes the CRM demo (Contact/Task/Project) cleanly so the repo is a blank slate without breaking guardrails.
| name | self-correcting-loop |
| description | Use on every commit. The pre-commit hooks run checks in parallel. If any fail, read ALL errors, fix them in one pass, and retry. NEVER use --no-verify. |
This project uses Lefthook to run quality checks in parallel on every git commit. Total pipeline time: ~3 seconds. If any check fails, the commit is rejected and you see the errors.
This is not a blocker — it's a feedback loop. Read the errors, fix them, retry.
NEVER use git commit --no-verify or git commit -n.
The pre-commit hooks exist to catch YOUR mistakes. If hooks keep failing, fix the root cause — don't skip the check. The ONLY exception is if the user explicitly tells you to skip.
NEVER modify a test just to make it pass.
Every git commit triggers (in parallel):
┌─ Prettier ────── auto-fixes formatting (auto-fix via lint-staged)
├─ Knip ────────── detects unused exports/files (manual fix)
├─ ESLint ──────── TS + import order + boundaries (manual fix)
├─ TypeScript ──── full project typecheck (manual fix)
├─ Vitest ──────── runs tests related to changed files (manual fix)
├─ Gitleaks ────── detects hardcoded secrets/API keys (manual fix)
└─ Commitlint ──── validates commit message format (rephrase)
1. Make changes
2. git add the changed files
3. git commit -m "type(scope): description"
4. IF rejected → read ALL errors → fix ALL in one pass → goto 2
5. IF accepted → done
Do NOT fix one error, commit, see the next, fix, commit. Read the entire error output, identify every failure, fix all of them, stage, retry.
Auto-fixes via lint-staged. If you see it, stage the reformatted files and retry.
Unused exports:
src/foo.ts: someExport
Remove the unused export. If it's intentionally public, add the entry to knip.json → entry.
error 'no-restricted-imports' — Server code must not import from src/client.
Move the code or extract the shared bits to src/shared/. Don't suppress the rule.
error Unexpected any. Specify a different type @typescript-eslint/no-explicit-any
Replace any with the actual type or unknown (then narrow).
error Forbidden non-null assertion. @typescript-eslint/no-non-null-assertion
! lies to the compiler. Check the value properly:
const v = maybe();
if (!v) throw new Error('expected v');
// use v
error TS2345: Argument of type 'string' is not assignable to parameter of type 'number'.
Fix the type. Don't use @ts-ignore or as any.
A test failed. Fix the code, not the test. See "Test integrity" above.
Finding: API_KEY = "sk-abc..."
Remove the hardcoded secret. Use process.env.… instead. If the secret already landed in history, alert the user — they need to rotate it.
✖ subject may not be empty
✖ type may not be empty
Use Conventional Commits: feat(scope): description, fix(scope): description, etc.
If you genuinely need to suppress a rule:
// eslint-disable-next-line <rule-name> with a comment explaining why.knip.json..gitleaksignore.Always ask the user before suppressing — they may prefer to fix the root cause.
<type>(<scope>): <subject>
Types: feat, fix, refactor, docs, test, chore, style, perf, ci.
Examples:
feat(contact): add email validation
fix(server): handle empty body in tRPC mutations
chore(deps): bump prisma to 7.4.1
docs(readme): clarify Postgres setup