Agent SkillsSethGammon/Citadel › live-preview

live-preview

GitHub

通过构建时截图验证前端组件视觉渲染,检测回归与不可见特性。自动检测UI文件变更,使用Playwright等工具捕获页面截图,人工或AI核对布局、数据及设计匹配度,修复渲染失败问题并保存验证产物。

skills/live-preview/SKILL.md SethGammon/Citadel

Trigger Scenarios

修改了 .tsx, .jsx, .vue, .svelte, .html 等视图层文件 完成组件创建或替换后 进行视觉重设计期间 Agent代理UI工作时

Install

npx skills add SethGammon/Citadel --skill live-preview -g -y
More Options

Use without installing

npx skills use SethGammon/Citadel@live-preview

指定 Agent (Claude Code)

npx skills add SethGammon/Citadel --skill live-preview -a claude-code -g -y

安装 repo 全部 skill

npx skills add SethGammon/Citadel --all -g -y

预览 repo 内 skill

npx skills add SethGammon/Citadel --list

SKILL.md

Frontmatter
{
    "name": "live-preview",
    "license": "MIT",
    "description": "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.",
    "auto-trigger": false,
    "last-updated": 1774051200,
    "user-invocable": true,
    "trigger_keywords": [
        "preview",
        "screenshot",
        "visual check",
        "does it render"
    ]
}

/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:

  1. Check which files were modified in the current session/phase
  2. Filter to view-layer files (.tsx, .jsx, .vue, .svelte, .html, .css)
  3. 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).
  4. 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:

  1. Ensure the dev server is running (start it if not)
  2. Take a screenshot:
    npx playwright screenshot http://localhost:{port}/{route} .planning/screenshots/{route-slug}.png --full-page
    
  3. 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:

  1. 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?
  2. 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:

  1. Diagnose: is it a data issue, a rendering issue, or a missing import?
  2. Fix the root cause (not a band-aid)
  3. Re-capture and re-verify
  4. Maximum 2 fix attempts per component. If still failing, log it and move on.

Step 5: ARTIFACT

Save verification artifacts:

  1. Screenshots go to .planning/screenshots/{campaign-slug}/ (if in a campaign) or .planning/screenshots/ (if standalone)
  2. 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
    
  3. Verify registered artifacts:
    node scripts/codex-app-artifacts.js verify --require-artifacts
    
  4. 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:

  1. After the sub-agent completes, Archon invokes /live-preview on the modified routes
  2. If any route is BLANK or FAIL, the phase is NOT marked complete
  3. The fix cycle runs before proceeding to the next phase
  4. 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
---

Version History

  • 4bac8cd Current 2026-07-25 08:45

Same Skill Collection

skills/architect/SKILL.md
skills/archon/SKILL.md
skills/ascii-diagram/SKILL.md
skills/autopilot/SKILL.md
skills/cost/SKILL.md
skills/create-app/SKILL.md
skills/create-skill/SKILL.md
skills/daemon/SKILL.md
skills/dashboard/SKILL.md
skills/decision-map/SKILL.md
skills/deploy-steward/SKILL.md
skills/design/SKILL.md
skills/do/SKILL.md
skills/doc-gen/SKILL.md
skills/evolve/SKILL.md
skills/experiment/SKILL.md
skills/fleet/SKILL.md
skills/grill/SKILL.md
skills/houseclean/SKILL.md
skills/improve/SKILL.md
skills/infra-audit/SKILL.md
skills/learn/SKILL.md
skills/loop/SKILL.md
skills/map/SKILL.md
skills/marshal/SKILL.md
skills/merge-review/SKILL.md
skills/organize/SKILL.md
skills/postmortem/SKILL.md
skills/pr-watch/SKILL.md
skills/prd/SKILL.md
skills/qa/SKILL.md
skills/refactor/SKILL.md
skills/research-fleet/SKILL.md
skills/research/SKILL.md
skills/review/SKILL.md
skills/scaffold/SKILL.md
skills/schedule/SKILL.md
skills/session-handoff/SKILL.md
skills/setup/SKILL.md
skills/systematic-debugging/SKILL.md
skills/telemetry/SKILL.md
skills/test-gen/SKILL.md
skills/triage/SKILL.md
skills/unharness/SKILL.md
skills/verify/SKILL.md
skills/watch/SKILL.md
skills/wiki/SKILL.md
skills/workspace/SKILL.md
scripts/fixtures/ecosystem/anthropics-template-skill/SKILL.md

Metadata

Files
0
Version
d33c70c
Hash
baed4aab
Indexed
2026-07-25 08:45

inicio - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-20 06:14
浙ICP备14020137号-1 $mapa de visitantes$