Guard · Pre-PR preflight
Pre-PR preflight
Know it won't ship broken. The same node-check, brain-drift, twin-drift, surface-drift, and server-boot smoke checks CI would run - on your laptop, before the PR opens.
See it in motion
Where to find it
- Skill:
.claude/skills/preview-check/SKILL.md - Invoke: /
preview-checkin Claude Code - Script:
node scripts/preflight.mjs(the harness,npm run preflight) - Drift gates:
bash scripts/brain-drift/run-all.sh
What it does for you
node --check on touched .mjs files; brain-drift gates (api-vs-routes, tests-vs-files, surface-drift, config-vs-env, schema-vs-models); twin-drift gate (.html ↔ .md sha256 verification); server boot smoke test. The order matches CI so a green local run is a very strong signal CI will pass too.Configure
The skill is markdown - open it and edit. Add a check: write a line, list the script that runs it, and (if the script doesn't exist yet) write it under scripts/brain-drift/ following the existing pattern. Most drift gates are Node scripts now; the older ones are bash. run-all.sh runs each gate in order and stops at the first failure, naming the gate that failed.
Use it well
Make preview-check the default last step before git push. When it fails, fix the root cause - don't suppress the check. When a CI failure lands that preview-check didn't catch, add the missing check to the skill in the same fix PR.
Read more
Last updated