/live-preview — Build-Verify-Fix Loop
Prerequisites
This skill requires a screenshot tool. Supported:
- Playwright (recommended):
npx playwright screenshot [url] [output.png]
- Puppeteer: via a small script
- Any tool that takes a URL and produces a screenshot
If no screenshot tool is available, this skill will tell you what to install and exit.
When to Use
- Any time .tsx, .jsx, .vue, .svelte, or .html files are modified
- After component creation or replacement
- During visual redesign campaigns
- When Archon or Marshal delegate UI work
Protocol
Step 1: DETECT
Determine what needs visual verification:
- Check which files were modified in the current session/phase
- Filter to view-layer files (.tsx, .jsx, .vue, .svelte, .html, .css)
- If no view-layer files found: exit early with message
"No view-layer files modified. Nothing to preview." Skip Steps 2-5.
This is expected for non-UI repos (CLI tools, libraries, agent harnesses).
- Map each modified file to a route or URL where it renders:
- If the project has a route manifest or sitemap, use it
- If the project has a dev server, identify which routes render the modified components
- If you can't determine the route, ask the user
Step 2: CAPTURE
For each route/URL that needs verification:
- Ensure the dev server is running (start it if not)
- Take a screenshot:
npx playwright screenshot http://localhost:{port}/{route} .planning/screenshots/{route-slug}.png --full-page
- If Playwright isn't available, try:
# Check for playwright
npx playwright --version 2>/dev/null
# If not found, inform the user:
# "live-preview needs Playwright for screenshots. Install with: npm i -D playwright"
Step 3: VERIFY
For each screenshot:
- Read the screenshot (vision). Check:
- Does the component render? (not blank, not invisible)
- Does it show real data or placeholder/empty states?
- Are there obvious layout breaks (overlapping elements, overflow, missing sections)?
- Does it match the intended design direction?
- Record the result:
- PASS: renders correctly, matches expectations
- FAIL: describe what's wrong
- BLANK: nothing rendered (critical failure)
Step 4: FIX (if failures found)
For each FAIL or BLANK:
- Diagnose: is it a data issue, a rendering issue, or a missing import?
- Fix the root cause (not a band-aid)
- Re-capture and re-verify
- Maximum 2 fix attempts per component. If still failing, log it and move on.
Step 5: ARTIFACT
Save verification artifacts:
- Screenshots go to
.planning/screenshots/{campaign-slug}/ (if in a campaign)
or .planning/screenshots/ (if standalone)
- In Codex, also register screenshots for the app artifact/browser workflow:
node scripts/codex-app-artifacts.js record --workflow live-preview --kind screenshot --path ".planning/screenshots/{route-slug}.png" --status pass
- Verify registered artifacts:
node scripts/codex-app-artifacts.js verify --require-artifacts
- Write a verification summary:
## Visual Verification: {date}
| Route | File Modified | Result | Notes |
|-------|--------------|--------|-------|
| /dashboard | Dashboard.tsx | PASS | Renders correctly |
| /settings | SettingsPanel.tsx | FAIL → PASS | Fixed missing import, re-verified |
| /profile | ProfileCard.tsx | BLANK → PASS | Component wasn't mounted, fixed export |
Integration with Archon
When Archon delegates a build phase that modifies view files:
- After the sub-agent completes, Archon invokes /live-preview on the modified routes
- If any route is BLANK or FAIL, the phase is NOT marked complete
- The fix cycle runs before proceeding to the next phase
- This is part of Archon's Step 4 (Self-Correction) quality spot-check
What This Prevents
- Invisible features (postmortem #17) — compiles but renders nothing
- Layout regressions — change in one component breaks another's layout
- Empty states shipped as features — data not connected, UI renders skeleton
- "Works on my machine" — screenshots are artifacts anyone can review
Fringe Cases
- Dev server is not running: Offer to start it. Output: "Dev server not detected on localhost:{port}. Start it with
npm run dev or equivalent, then re-run /live-preview." Do not attempt screenshots against a dead server.
- Port is not 3000: Check common alternatives (3001, 5173, 4173, 8080) before asking. Read
package.json scripts for a --port flag or PORT env variable.
- Screenshot tool unavailable (Playwright not installed): Output what to check manually — list the modified routes, describe what each should render, and suggest installing Playwright:
npm i -D playwright. Exit gracefully without crashing.
.planning/screenshots/ does not exist: Create the directory before writing artifacts. Never error on a missing output directory.
- No view-layer files modified: Exit immediately with "No view-layer files modified. Nothing to preview." This is expected and correct for non-UI repos.
Contextual Gates
Disclosure: "Taking screenshots for visual verification. Images saved to .planning/screenshots/."
Reversibility: green — screenshots only; saves to .planning/screenshots/. No source files modified.
Trust gates:
- Any: full screenshot capture, verify, and fix workflow.
Quality Gates
- Every modified view file must have a corresponding screenshot
- BLANK results are critical failures (never acceptable)
- Screenshots must be saved as artifacts (not just checked and discarded)
- Fix attempts capped at 2 per component (prevent infinite loops)
Exit Protocol
---HANDOFF---
- Live Preview: {N} routes verified
- Results: {pass}/{total} passed
- Failures: {list of routes that failed and what was wrong}
- Screenshots: .planning/screenshots/{path}
- Reversibility: green — delete .planning/screenshots/ to remove artifacts; no source files modified
---
1---2name: live-preview3description: Mid-build visual verification loop. Takes screenshots of components during construction, not just after. Catches visual regressions and invisible features before they compound. Requires Playwright or similar screenshot tool.4license: MIT5---67# /live-preview — Build-Verify-Fix Loop89## Prerequisites1011This skill requires a screenshot tool. Supported:12- **Playwright** (recommended): `npx playwright screenshot [url] [output.png]`13- **Puppeteer**: via a small script14- **Any tool that takes a URL and produces a screenshot**1516If no screenshot tool is available, this skill will tell you what to install and exit.1718## When to Use1920- Any time .tsx, .jsx, .vue, .svelte, or .html files are modified21- After component creation or replacement22- During visual redesign campaigns23- When Archon or Marshal delegate UI work2425## Protocol2627### Step 1: DETECT2829Determine what needs visual verification:30311. Check which files were modified in the current session/phase322. Filter to view-layer files (.tsx, .jsx, .vue, .svelte, .html, .css)333. **If no view-layer files found**: exit early with message34 "No view-layer files modified. Nothing to preview." Skip Steps 2-5.35 This is expected for non-UI repos (CLI tools, libraries, agent harnesses).364. Map each modified file to a route or URL where it renders:37 - If the project has a route manifest or sitemap, use it38 - If the project has a dev server, identify which routes render the modified components39 - If you can't determine the route, ask the user4041### Step 2: CAPTURE4243For each route/URL that needs verification:44451. Ensure the dev server is running (start it if not)462. Take a screenshot:47 ```bash48 npx playwright screenshot http://localhost:{port}/{route} .planning/screenshots/{route-slug}.png --full-page49 ```503. If Playwright isn't available, try:51 ```bash52 # Check for playwright53 npx playwright --version 2>/dev/null54 # If not found, inform the user:55 # "live-preview needs Playwright for screenshots. Install with: npm i -D playwright"56 ```5758### Step 3: VERIFY5960For each screenshot:61621. Read the screenshot (vision). Check:63 - Does the component render? (not blank, not invisible)64 - Does it show real data or placeholder/empty states?65 - Are there obvious layout breaks (overlapping elements, overflow, missing sections)?66 - Does it match the intended design direction?672. Record the result:68 - PASS: renders correctly, matches expectations69 - FAIL: describe what's wrong70 - BLANK: nothing rendered (critical failure)7172### Step 4: FIX (if failures found)7374For each FAIL or BLANK:75761. Diagnose: is it a data issue, a rendering issue, or a missing import?772. Fix the root cause (not a band-aid)783. Re-capture and re-verify794. Maximum 2 fix attempts per component. If still failing, log it and move on.8081### Step 5: ARTIFACT8283Save verification artifacts:84851. Screenshots go to `.planning/screenshots/{campaign-slug}/` (if in a campaign)86 or `.planning/screenshots/` (if standalone)872. In Codex, also register screenshots for the app artifact/browser workflow:88 ```bash89 node scripts/codex-app-artifacts.js record --workflow live-preview --kind screenshot --path ".planning/screenshots/{route-slug}.png" --status pass90 ```913. Verify registered artifacts:92 ```bash93 node scripts/codex-app-artifacts.js verify --require-artifacts94 ```954. Write a verification summary:96 ```markdown97 ## Visual Verification: {date}9899 | Route | File Modified | Result | Notes |100 |-------|--------------|--------|-------|101 | /dashboard | Dashboard.tsx | PASS | Renders correctly |102 | /settings | SettingsPanel.tsx | FAIL → PASS | Fixed missing import, re-verified |103 | /profile | ProfileCard.tsx | BLANK → PASS | Component wasn't mounted, fixed export |104 ```105106## Integration with Archon107108When Archon delegates a build phase that modifies view files:1091101. After the sub-agent completes, Archon invokes /live-preview on the modified routes1112. If any route is BLANK or FAIL, the phase is NOT marked complete1123. The fix cycle runs before proceeding to the next phase1134. This is part of Archon's Step 4 (Self-Correction) quality spot-check114115## What This Prevents116117- **Invisible features** (postmortem #17) — compiles but renders nothing118- **Layout regressions** — change in one component breaks another's layout119- **Empty states shipped as features** — data not connected, UI renders skeleton120- **"Works on my machine"** — screenshots are artifacts anyone can review121122## Fringe Cases123124- **Dev server is not running**: Offer to start it. Output: "Dev server not detected on localhost:{port}. Start it with `npm run dev` or equivalent, then re-run /live-preview." Do not attempt screenshots against a dead server.125- **Port is not 3000**: Check common alternatives (3001, 5173, 4173, 8080) before asking. Read `package.json` scripts for a `--port` flag or `PORT` env variable.126- **Screenshot tool unavailable** (Playwright not installed): Output what to check manually — list the modified routes, describe what each should render, and suggest installing Playwright: `npm i -D playwright`. Exit gracefully without crashing.127- **`.planning/screenshots/` does not exist**: Create the directory before writing artifacts. Never error on a missing output directory.128- **No view-layer files modified**: Exit immediately with "No view-layer files modified. Nothing to preview." This is expected and correct for non-UI repos.129130## Contextual Gates131132**Disclosure:** "Taking screenshots for visual verification. Images saved to `.planning/screenshots/`."133**Reversibility:** green — screenshots only; saves to `.planning/screenshots/`. No source files modified.134**Trust gates:**135- Any: full screenshot capture, verify, and fix workflow.136137## Quality Gates138139- Every modified view file must have a corresponding screenshot140- BLANK results are critical failures (never acceptable)141- Screenshots must be saved as artifacts (not just checked and discarded)142- Fix attempts capped at 2 per component (prevent infinite loops)143144## Exit Protocol145146```147---HANDOFF---148- Live Preview: {N} routes verified149- Results: {pass}/{total} passed150- Failures: {list of routes that failed and what was wrong}151- Screenshots: .planning/screenshots/{path}152- Reversibility: green — delete .planning/screenshots/ to remove artifacts; no source files modified153---154```