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, in ~90 seconds, 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/preview-check.mjs (the harness)
  • 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.
~90 seconds vs ~6 minutes.The fastest CI is the one that already ran on your laptop. Preview-check catches the failure 4× faster than 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. The drift scripts are bash + use set -e so the first failure stops the run cleanly.

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