feat(tooling): pre-commit hook + skill QA discipline to stop lint/format from reaching CI #206
Labels
No labels
area:agents
area:dashboard
area:database
area:design
area:design-review
area:flows
area:infra
area:meta
area:security
area:sessions
area:webhook
area:workdir
security
type:bug
type:chore
type:meta
type:user-story
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
charles/claude-hooks#206
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Goal
Stop Biome formatting and lint errors from reaching CI. Every CI failure on a fleet PR costs a full agent round-trip (
action_run_failure→fix-cidispatch → agent turns → commit → push → CI re-run), so cheap upfront checks pay for themselves fast.Today there is no
.husky, no.githooks, nocore.hooksPathconfigured. Every commit goes straight to CI. Fleet dispatches in the last 24h have hit Biome errors multiple times (PR #160, #199 round-2, #178's worktree edits); each required manual operator intervention or an additional agent round.Two-layer fix
Layer 1 — Git pre-commit hook (husky + lint-staged)
Catches the error on both operator-side commits and agent-side commits. Regardless of who forgot, the commit fails before it can be pushed.
bun add -D husky lint-stagedpackage.jsongains:.husky/pre-commitcontainingbun x lint-staged(pluschmod +x).husky install(via thepreparescript) runs automatically on everybun install, so:bun install.workdir.ts/ skill templates): confirm the worktree runsbun installat acquire time. If it doesn't, add ajust setup-hooksstep that runshusky installexplicitly and call it fromworkdir.ts::acquireWorktree.Layer 2 — Skill-level QA discipline
The hook is the safety net; the skill is the intent. Each skill that commits and pushes should explicitly run
just qabefore push — so the agent sees errors as part of its own workflow, not as an opaque hook rejection it has to re-reason about.skills/implement.md,skills/implement-delta.md: add a "Before pushing" checklist:- [ ] just qaclean — typecheck + Biome format + Biome lint all pass- [ ] Commit is self-contained— no unrelated changes stagedskills/address-review.md,skills/address-review-delta.md: same checklist.skills/fix-ci.md: explicit reminder: "If CI failed onqa, runjust qalocally first — don't push a fix that still has pre-existing QA errors."skills/merge.md: already relies on CI-green; no change needed.--no-verifyremains forbidden."Tests / verification
just qahas no regressions.echo 'const x= 1' > /tmp/probe.tsinside the repo,git add,git commit -m test→ hook fixes formatting and auto-stages the fix.qajob stays as-is — the hook doesn't replace CI (hook is easy to bypass with--no-verify, CI is authoritative).Out of scope
--no-verify. Socially enforced via CLAUDE.md; would require a commit-template hack to actually prevent, not worth it.Dependencies
package.json.References
--stagedflag).skills/implement.mdetc. — current state has no explicit "run QA before push" step.