# design-check - scope grammar, requirements, the target ledger and notes

Detail behind the command's scope argument, its requirements, the Phase 3 ledger and the Phase 4 gate. The binding rules (halts, confirmation, the coverage gate) stay in the command's SKILL.md; this file carries the grammar and the reasoning.

## Scope grammar (`$ARGUMENTS`)

The scope decides which inventory targets (Phase 0 step 5) the run must audit. It never changes how thoroughly each target is audited.

| Form | Example | Scope |
|------|---------|-------|
| empty / `module` | (no argument) | Every target in the module's inventory |
| screen name | `order-status` | Every target whose `screen` matches (case/separator-insensitive) |
| `screen@variant` | `order-status@expired` | One target |
| target id | `scenario-case:orderstatusoutcome-expired` | One target, exactly |
| Figma URL(s) | `https://figma.com/design/...?node-id=1-2` | Only the frames those URLs name |
| `--resume` | `--resume` | The unaudited remainder of the most recent run for this repo + module |
| combinations | `seat-map summary@semi-success` | Union of the above, space- or newline-separated |

A scope that matches no inventory target is an error, not an empty run: print the closest inventory ids and halt.

**Whole-module is the default, and it is meant to finish.** The inventory prices each target (`cost: relaunch | in-app`) and batches them into a run `plan`, so a 50-target module is typically about a dozen relaunches rather than fifty: a full audit is one sitting, not a project. Scope exists for resuming an interrupted run and for re-checking one screen after a fix, not for trimming an audit down to what feels affordable. The coverage gate applies to the scoped target set, so a deliberate scoped run is never penalised for out-of-scope targets, and `--resume` closes the remainder.

## Requirements

- **iOS**: Xcode + an available Simulator. **Android**: Android SDK + a running emulator / device.
- **MCP**: the `multi-agent` MCP server (>= 2.8.0, for `design_scenario_inventory`, the `design_report` coverage gate, and `design_visual_compare` region alignment). The Figma MCP (`mcp__claude_ai_Figma__*`) must be authenticated; the user supplies the Figma URL.
- The selected module must be auditable: a **mock mode** (preferred, it can toggle variants) or a **snapshot capture** of the screen's view model. Phase 0 decides which. Neither means the command halts.

## Phase tracker detail

Register the five tiles (`0:Init & Gate`, `1:Build & Launch`, `2:Figma`, `3:Drive & Compare`, `4:Report`) with `phase-tracker.sh init` + `add` in strict order before any update. On Claude Code also drive the native TaskList widget: fire all `TaskCreate` calls in phase order (0 to 4) first, persist each `taskId` via `phase-tracker.sh meta <N> tasklist_id`, then flip status with `TaskUpdate` + `phase-tracker.sh update` at every boundary. On Copilot CLI or a plain shell there is no TaskList widget: call `phase-tracker.sh render` after every state change and never call TaskCreate. Full spec: `tracker-contract.md`.

## Why Phase 3 iterates the inventory

Phase 3 iterates `state.designCheck.scope.targetIds`, a finite list decided in Phase 0, and ends when every id is resolved, not when the UI stops offering new taps. Tap-walking alone cannot reach a state that needs a different launch argument, scenario case, or typed scenario code, which is how a module's error and edge states go missing.

Driving `inventory.plan` batch by batch is what makes full coverage affordable: each batch is one launch, the relaunch target opens a screen, and every in-app target for that screen is flipped while the app sits there, with no relaunch between them.

`features/design-conformance.md` owns the per-component catalog, the scope tags, and the three rules that decide whether Phase 3 produced a result or an impression: enumerate first (a blank cell is a fail-to-verify), measure never the token, and converge per component (two consecutive clean attempts, cap 8). The screen is done when every component converged, not when the walk reached the bottom. Every skipped `[DYNAMIC]` / `[CAPTURE+]` item is listed in the report rather than omitted.

## The ledger (Phase 3.5)

Every scoped target id ends in exactly one bucket:

- **covered**: captured AND compared.
- **skipped**: with a concrete reason recorded in 3.1 or 3.3. A screen the user declined to map in the 3.3 batch-ask is a skip with reason "no Figma frame supplied". "Requires a scenario / prefix / launch-arg" is not a reason: it describes the work, which is Phase 3's job.

`run-state.json` in the Phase 0 report dir holds `{ targetIds, covered, skipped }` so `--resume` can pick up the remainder. An id in neither bucket is a bug in Phase 3, and Phase 4's gate fails the run for it.

The `covered.length + skipped.length` versus `scope.targetIds.length` check exists because reaching Phase 4 with a mismatch is the worst of both outcomes: the work is undone AND the run is marked incomplete.

## The report's `walk` block and the gate

`walk` (`components`, `converged`, `didNotConverge`, `notVerified`) separates a checked screen from a viewed one: an empty `notVerified` on a run that never captured a dark or mirrored pass is a false clean, so list the skip. Pass ids, not counts.

The coverage gate is a last line of defence, not the plan. If it fires, Phase 3 left work undone: drive the missing targets, and only then report. Do not present an incomplete audit as a finished one, and do not bury the miss in a footnote.

## Notes

- **Feasibility is real**: a project with no launchable app or no runtime switch cannot be audited. Report that honestly and stop; never substitute a fabricated or partial comparison.
- **The inventory is the contract**: Phase 0 step 5 decides what "done" means. An audit that visits the linear happy path and lists the rest as "not visited" is the failure mode this command exists to prevent; the gate makes it visible instead of polite.
- **Chunk with scope, not with silence**: a 50-target module is a legitimate multi-run job. Scope it, finish each run's gate cleanly, and let `--resume` carry the remainder.
- **"Pixel perfect" is perceptual + geometric**: scale normalized, chrome cropped; findings carry px / pt / hex deltas and a tolerance.
- The `design_*` engine is project-agnostic; project specifics (mock keys, launch args / targets, node overrides, status-bar crop, coverage floor, Confluence toggle) come from `design-check-config.json` / prefs, never hardcoded. The file's shape is `$HOME/.claude/schemas/design-check-config.schema.json`; `$HOME/.claude/schemas/examples/design-check-config.json` is a complete example.
