Back to Brain Lab Skill · Designer Frontend Contract · designer-frontend-contract/
Skill Claude

Designer Frontend Contract

designer-frontend-contract/

2 views 0 downloads

Freeze an approved mockup into a reference, port it 1:1 on any stack, and verify every page, state and breakpoint with screenshot diffs before merge.

Designer Frontend Contract: Brain Lab skill for Claude Code

The tech-agnostic contract between designer and frontend dev, and the gate that mechanically enforces it.

Why use it

  • "Matches the design" asserted from a screenshot glance, while a whole page region is missing.
  • The build quietly re-styles the mockup, and the drift is only noticed after launch.
  • HTTP 200 and a green CI badge say nothing about whether the UI is actually right.

What it does

  • Designer side: freeze the approved mockup into a canonical oracle: manifest, baseline renders, a region/element inventory, token parity, a visual acceptance contract.
  • Frontend side: port the oracle 1:1 (transcribe, never redesign) and self-gate census → DOM → pixel before handoff.
  • Verifier side: independently screenshot every page × access state × pinned breakpoint against the frozen baseline; census FIRST, then pixel diff, then interaction hit-testing.
  • Report-only verification: findings route to the dev (drift) or the designer (a legitimate design change).

Benefits

  • Ship what was actually designed. Fidelity becomes an enforced gate, not an assumption.
  • Catch the missing region the pixel diff would have waved through.
  • No more launch-day drift: every page, state and breakpoint is checked before merge.
  • Any stack. Dev server, template language and tokens all come from your project config.

Install

Download this skill and copy the designer-frontend-contract folder to .claude/skills/designer-frontend-contract/ in your project, or to ~/.claude/skills/designer-frontend-contract/ to use it in every project. Claude Code finds it on its own; you can also call it with /designer-frontend-contract.

Part of the Web Dev Design Pipeline bundle. To get the whole set as a Claude Code plugin: /plugin marketplace add endorphin-ai/hasbrains-agent-kit, then /plugin install web-dev@hasbrains-agent-kit.

Source: endorphin-ai/hasbrains-agent-kit. License: MIT.

Files (18)

Files

{
  "version": "2.0",
  "notes": [
    {
      "id": "contract-and-communication",
      "path": "references/contract-and-communication.md",
      "title": "The designer ↔ frontend contract — artifacts, storage, communication, and the data-test three-way",
      "summary": "The contract itself — what each side owes the other, the shared artifact/link graph, where every piece of data lives (docs/design/ library, docs/frontend/ KB, .ai_log/ evidence, pipeline-state paths), the communication protocol (handoff timing, ask-don't-guess, findings routing, deviations ledger, refresh loop), and the three-way data-test hook contract with QE.",
      "tags": ["contract/roles", "contract/storage", "contract/communication", "contract/handoff"],
      "tokens_est": 1600,
      "load_when": "Deciding where an artifact lives, how the two roles hand off, who to ask or route a finding to, or what each side owes the other."
    },
    {
      "id": "designer-handoff",
      "path": "workflows/designer-handoff.md",
      "title": "PRODUCER — freeze the approved mockup into the canonical oracle + write the acceptance contract",
      "summary": "The designer's handoff playbook: freeze the approved mockup (pin widths, self-host fonts, snapshot baseline renders), register it in oracle-manifest.json, emit the region/element inventory with data-test hooks, declare token parity on the project's single styling source, write the four-part visual acceptance contract, hand off PATHS.",
      "tags": ["contract/producer", "contract/freeze", "contract/handoff"],
      "tokens_est": 1150,
      "load_when": "An approved mockup must become a measurable build target the frontend is held to."
    },
    {
      "id": "frontend-port",
      "path": "workflows/frontend-port.md",
      "title": "CONSUMER — consume the acceptance contract, port the oracle 1:1, self-gate census→DOM→pixel",
      "summary": "The frontend dev's playbook: read the six binding inputs, verify token parity, PASS A static 1:1 transcription, PASS B interactivity without DOM change, self-gate census→DOM→pixel per component and assembled page/state, prove interactions, report evidence + docs/frontend/ KB write-back + deviations ledger.",
      "tags": ["contract/consumer", "contract/port", "contract/self-gate"],
      "tokens_est": 1300,
      "load_when": "Building or fixing a page that has a frozen oracle + a visual acceptance contract."
    },
    {
      "id": "design-diff",
      "path": "workflows/design-diff.md",
      "title": "VERIFIER — screenshot the built pages and diff against the approved oracle (report-only)",
      "summary": "End-to-end design-diff run: resolve the oracle via the manifest, capture the RUNNING app post-settle per page × access state × pinned breakpoint, census FIRST, pixel-diff vs the frozen baseline, rule-check tokens/60-30-10/8pt, hit-test interactions, emit per-page PASS/FAIL + a gate verdict. Report-only; findings routed.",
      "tags": ["contract/verifier", "contract/design-diff", "contract/gate"],
      "tokens_est": 1200,
      "load_when": "Verifying built pages against the approved design (the pipeline verify gate, the fan-out audit's visual finder, or an ad-hoc pass)."
    },
    {
      "id": "region-census",
      "path": "references/region-census.md",
      "title": "The region/element completeness census — the FIRST check (catches whole-missing sections)",
      "summary": "How to census a built page against the oracle's region/element inventory BEFORE any pixel diff — build the oracle list, walk the built DOM, tick each region/element off by data-test hook, FAIL on any missing/reordered/extra region. Run by BOTH the frontend self-gate and the verifier; needs no pixel baseline.",
      "tags": ["contract/census", "contract/checks", "contract/completeness"],
      "tokens_est": 950,
      "load_when": "Gating a page against the oracle; a whole section may be missing; the pixel diff looks fine but the page feels incomplete; no baseline exists."
    },
    {
      "id": "baseline-and-oracle",
      "path": "references/baseline-and-oracle.md",
      "title": "The oracle + establishing/refreshing a baseline (incl. the design-phase-skipped migration case)",
      "summary": "What the design oracle is (frozen renderable mockup = pixel oracle; design-tokens + design-system = rule oracle), how to resolve it per page/state via oracle-manifest.json, canvas-export de-framing, and how to ESTABLISH a baseline when none exists or REFRESH one when the design legitimately changed.",
      "tags": ["contract/oracle", "contract/baseline", "contract/migration"],
      "tokens_est": 1000,
      "load_when": "Resolving/refreshing the baseline; no oracle exists yet for a page; the design legitimately changed; a design-phase-skipped migration run."
    },
    {
      "id": "fidelity-checks",
      "path": "references/fidelity-checks.md",
      "title": "Fidelity checks + thresholds — completeness, layout, spacing (8pt), color (60/30/10 + tokens), type, DOM, interactions",
      "summary": "The measurable checks both the frontend self-gate and the verifier run — completeness census (first), layout, spacing on the 8pt grid, color against palette + 60/30/10 + token conformance against the project's declared token source, type, DOM-structure preservation, and broken/obscured-interaction hit-testing — plus the severity model and the PASS/FAIL rule.",
      "tags": ["contract/checks", "contract/thresholds", "contract/tokens"],
      "tokens_est": 1150,
      "load_when": "Deciding what to measure on a page; classifying a diff as PASS/FAIL; setting/holding the drift threshold; explaining a failing diff."
    }
  ]
}