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-check in 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

Runs the same checks CI would.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.
Grows a new check every time a new failure lands.The skill itself lists every check + the failure that motivated it. New CI failure fix the bug add a check to the skill so the next agent catches it locally first. The skill grows with the project.
Catches the failure before the PR opens.The fastest CI is the one that already ran on your laptop. Preview-check catches the failure locally, before you push, instead of waiting for a remote run.

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