Design Spine

v0.4.0
io.github.forbiddenlink/design-spine Checked 7 hours ago Published 7 hours ago

Read-only view of the latest Design Spine visual review run: status, tiles and changed screens.

Look at every screen before you ship it. Design Spine screenshots every route of your Next.js app in every state, width and theme, flags what broke, and gives you one contact sheet to approve or reject each screen. Approved screens become baselines, and spine diff fails CI when a screen drifts from what a person approved. Everything runs on your machine. No account, no upload, no per-snapshot bill.

Summary extracted from the README.

Design Spine

Look at every screen before you ship it.

Design Spine screenshots every route of your Next.js app in every state, width and theme, flags what broke, and gives you one contact sheet to approve or reject each screen. Approved screens become baselines, and spine diff fails CI when a screen drifts from what a person approved.

Everything runs on your machine. No account, no upload, no per-snapshot bill.

Design Spine contact sheet

Why

Most UI gets built and checked in one state: the happy path, at desktop width, in light mode. AI coding agents make this worse, because they build screen by screen and never open the 390px dark-mode empty state. Design Spine makes the full matrix visible and makes "someone looked at it" a recorded fact instead of a hope.

Quick start

Requires Node.js 22.12 or newer (engines in package.json) and a running copy of your app. The CLI runs on Bun, which the npm install bundles, so you do not install it yourself. A Bun 1.3.13+ already on your PATH is used first.

npm install -D design-spine
npx playwright install chromium

npx spine init        # guided first run: plan, doctor, capture; then run review

# or step by step:
npx spine plan        # reads app/ and drafts design-spine.json
npx spine capture     # screenshots route x state x 390/1280 x light/dark
                      # or: npx spine capture --start "npm run dev" to start and stop the app for you
npx spine review      # opens the contact sheet at http://localhost:4747

spine doctor, capture and diff in a terminal

In the contact sheet, press j/k to move, a to approve, r to reject, u to undo and Enter to inspect a screenshot at full size against its baseline. Screens byte-identical to an approved baseline show as Matches baseline and stay out of the queue. The "Contact sheet" toggle lays the same screens out as dense film strips, with approved frames circled and rejected frames crossed.

What it checks on every screenshot

  • HTTP errors, redirects and failed captures
  • Console errors and uncaught page errors
  • Horizontal overflow (the classic mobile bug), naming the element that causes it
  • Near-blank regions, such as cards that rendered empty
  • Broken images and clipped text
  • Fixed overlays covering content, such as cookie banners and chat widgets
  • Dark mode that never applied (a dark capture identical to light)
  • Optional: axe accessibility scan, accessibility-tree snapshots that fail diff when the structure changes under unchanged pixels, repeat-capture stability, retina captures, and a Claude vision critique

Automatic checks never count as approval. Only a person approves, and approving a screen with findings needs a written reason. How each check is detected, and its limits: docs/CHECKS.md.

Reach the states nobody opens

Empty, loading and error states need data. Describe them in design-spine.json with mocked responses and interaction steps instead of seeding a database:

{
  "path": "/dashboard",
  "states": [
    { "name": "ideal", "storageState": "auth/populated.json" },
    {
      "name": "error",
      "responses": [{ "url": "**/api/dashboard", "status": 503, "body": "Unavailable" }],
      "ready": { "selector": "[role=alert]" }
    }
  ]
}

Set "capture": { "stress": ["long-text", "rtl", "zoom-200"] } to also capture every route with translated-length text, right-to-left layout and 200% zoom, without writing those states yourself.

spine doctor lists every state you have not made capturable yet, so missing coverage stays visible instead of silently passing.

Hand off fixes

Rejected screens and their pinned notes turn into a brief an agent can act on:

spine handoff | claude -p "Fix these"        # Markdown brief to stdout
spine handoff --format json                  # same data, machine-readable
spine handoff --out fixes.md --crop          # also writes fixes-crops/<tile>.png, 400x300 around each pin
spine handoff --include-flagged              # add pending screens with automatic findings
spine handoff --pr 42                        # post or update one comment on pull request 42

Each screen lists route, state, viewport, theme, screenshot path, your note, the pinned x and y in image pixels, automatic findings and the baseline path when one exists. A pin whose screenshot changed after you placed it is marked STALE instead of being dropped, and gets no crop. --out follows the same overwrite rule as report: pass --force to replace a file.

--pr needs gh installed and logged in. It marks its comment with <!-- design-spine-handoff --> and edits that comment on later runs, so a pull request keeps one. It references screenshots by local path and uploads no images.

MCP clients get the same data from spine_rejections (read-only, optional includeFlagged), and spine_list_tiles now includes each tile's note and anchor.

Gate CI on approved screens

spine approve           # approved tiles become baselines
spine diff              # exit 1 when a screen differs from its approved baseline, including faint color shifts
spine diff --strict     # also require full coverage and a person's approval on this run
spine report --out review.html   # portable offline record of what was approved and why

In CI, add the action after the step that starts your app, and commit design-spine.json and .design-spine/baselines/:

- run: npm run build && (npm start &) && npx wait-on http://localhost:3000
- uses: forbiddenlink/design-spine@v0.4.0
  with:
    base-url: http://localhost:3000

The job fails when any screen changes from its approved baseline. The action writes a pass/fail summary with a table of changed tiles to the job summary, and uploads two artifacts: design-spine-run (the captures) and design-spine-report (a single offline HTML file with the screenshots). Reviewers open the report instead of unzipping the run. In a matrix, artifact names must be unique within a workflow run, so set name-suffix to a value that differs per job (for example name-suffix: ${{ matrix.os }}); the artifacts become design-spine-run-<suffix> and design-spine-report-<suffix>. Empty keeps the names above. To require the check in branch protection, set commit-status: "true" (needs statuses: write); it posts design-spine, or design-spine/<suffix>, as failure, pending ("Review needed: N changed screens") or success. See docs/USAGE.md.

To also post that summary on the pull request, set comment: "true" and grant the job write access to pull requests. The action keeps one comment, marked <!-- design-spine -->, and edits it on each push:

permissions:
  contents: read
  pull-requests: write
steps:
  - uses: forbiddenlink/design-spine@v0.4.0
    with:
      comment: "true"

Comments are skipped outside pull_request events. On pull requests from forks the token is read-only, so the comment step fails without failing the job. The job summary still appears.

To accept a change, download the artifact into .design-spine/runs/, run spine review --run <id>, approve, then spine approve --run <id> and commit the new baselines. Fonts render differently on macOS and Linux. Capture with spine capture --docker and approve those baselines; the action also captures in that image by default, so the two match pixel for pixel. The first run builds a local image, and amd64 emulation on Apple silicon is slower. See Matching CI baselines.

Upgrading from v0.1.0: that version captured with the runner's own Chromium and fonts. Baselines approved from those runs differ from docker captures, so either approve new baselines from a --docker capture, or keep the old behavior with docker: "false".

Moving from Lost Pixel

Lost Pixel's page shots map onto routes and states:

npx spine import lost-pixel        # reads lostpixel.config.ts/js, writes design-spine.json
npx spine doctor
npx spine capture --start "npm run start"

The import notes anything without an exact equivalent, such as per-page thresholds. Storybook and custom shots are not imported.

For the full walkthrough, a config mapping table and the CI swap, see docs/migrate-from-lost-pixel.md or the web version.

Use with Claude Code

Design Spine ships as a Claude Code plugin. It adds a skill that runs a check after you change UI, and registers the read-only MCP server (npx -y design-spine mcp) so Claude can read the latest run.

/plugin marketplace add forbiddenlink/design-spine
/plugin install design-spine@design-spine

Or from your shell:

claude plugin marketplace add forbiddenlink/design-spine
claude plugin install design-spine@design-spine

The skill runs as /design-spine:design-spine, and Claude also loads it on its own when you change UI in a project that has design-spine.json. The skill never approves screens for you; approval stays in spine review. To register only the MCP server, without the plugin, run claude mcp add spine -- spine mcp.

Commands

Command What it does
init Guided first run: plan, doctor, then capture with the start command from package.json; stops at the first problem
plan Drafts design-spine.json from app/ or src/app/, or from any site's sitemap with --sitemap <url>
doctor Validates the manifest and lists unfinished coverage, without a browser
capture Screenshots every route x state x viewport x theme and runs the checks
review Local contact sheet for approve, reject and notes
critique Optional Claude vision pass through the claude CLI
approve Promotes approved tiles to baselines
diff Compares a run with baselines; --strict requires complete approved evidence
report Self-contained HTML record of a review
handoff Fix brief (Markdown or JSON) from rejected screens and pinned notes; --pr posts it as a PR comment
lint Ratchet on arbitrary Tailwind values such as w-[37px]
status Writes .design-spine/status.json for dashboards
prune Deletes old runs, keeping the newest, latest and all baselines
import lost-pixel Writes design-spine.json from a Lost Pixel config's page shots
mcp Read-only MCP server over stdio for agents; see docs/USAGE.md

Full reference: docs/USAGE.md.

How it compares

Design Spine Chromatic, Percy, Argos Playwright toHaveScreenshot
Screenshots stay on your machine Yes No, uploaded to a hosted service Yes
Plans the route x state matrix from your app Yes No, captures the stories or tests you write No
Human approval per screenshot Yes, local review UI Yes, in the vendor's web app No, --update-snapshots accepts all at once
Needs an account No Yes No
Pricing Free, MIT Free tier of 5,000 screenshots a month on each, then paid plans billed by monthly screenshot allowance plus per-screenshot overage Free

Checked 2026-11-15 against each vendor's pages. Chromatic works with Storybook, React Native, Vitest, Playwright and Cypress. Argos is open source (MIT) and its hosted service is the default; the repo ships a Dockerfile and docker-compose.yml, but its docs were not checked for supported self-hosting, so the first row describes the hosted service. Sources by row:

Limits

  • plan reads the Next.js App Router. For any other framework, plan --sitemap https://your.site/sitemap.xml drafts the routes from a sitemap, or write the manifest by hand.
  • Chromium only. Tested on macOS, and the test suite runs on Linux in CI. Windows is not verified.
  • The CLI runs on Bun. The npm package bundles Bun 1.3.13 for macOS, Linux and Windows on x64 and arm64; other platforms need Bun 1.3.13+ installed. --docker also needs Docker and downloads a 2.6 GB image once.

License

MIT