This file defines the product UI lifecycle behind SKILL.md. Read only the
selected mode. Standalone design systems, decks, print layouts and charts use
their capability reference and delivery checks, not this production UI gate.
uninitialized
└─ bootstrap (optional, explicit) → clean baseline
clean baseline
└─ audit → evidenced capability contract
capability contract
└─ explore (initial redesign) or prototype (normal feature)
design draft
└─ needs-review → revise | changes-requested | explicit approve
approved design-only commit
└─ implement → production verification
implemented slice
└─ verify | sync → aligned
The workflow may start at any valid state. An existing healthy repository does not need bootstrap. A repository with an existing approved design system does not need fresh exploration for every feature.
Approval applies to the current deliverable until it changes or is revoked. Revisions return to review before implementation.
| Request/state | Mode | Production edits allowed? |
|---|---|---|
| Explicitly reset local history and clean project | bootstrap |
Only cleanup needed for baseline; no redesign |
| Understand current product behavior | audit |
No functional change |
| First complete redesign, no selected direction | explore |
No |
| New/changed visible feature or selected direction | prototype |
No |
| Explicitly approve exact deliverable | approve |
No; design metadata/commit only |
| Implement exact approved deliverable | implement |
Yes, scoped slice only |
| Prototype and production disagree | sync |
Only after mismatch classification and proper gate |
| Check an existing slice | verify |
Fixes only when authorized and already in contract |
| Judge quality of an existing UI ("make it better", design review) | critique |
No; findings first, changes go through prototype |
Do not use bootstrap as a ritual. It is optional and destructive.
Read-only. Render the existing surface at its real sizes, themes and states,
run pfui.py lint on available HTML/CSS, and score the
critique rubric with evidence. Report
findings ranked by user impact, each with the state, size and element it
concerns and the standard it misses. Proposed fixes become a normal
prototype change; do not edit production from a critique.
- The current user message explicitly authorizes replacement of local history.
- The command runs at the actual repository root.
.gitis a normal directory, not a linked-worktree/submodule gitfile.- The repository is not bare.
- A remote may exist, but no remote mutation is authorized.
Run:
python <skill-dir>/scripts/bootstrap.py snapshot --repo .The output must be outside the repository and normally contains:
working-tree.zip
history.bundle # when committed refs exist
working-tree.patch # when tracked unstaged changes exist
index.patch # when staged changes exist
metadata.json
SHA256SUMS
Verify before cleanup:
python <skill-dir>/scripts/bootstrap.py verify-snapshot \
--repo . \
--snapshot-dir ../<snapshot-directory>The snapshot archive preserves symbolic links without following them outside the repository. Generated/dependency directories are excluded by default and listed in metadata.
Use references/cleanup-policy.md. Search references and build/runtime usage
before deletion. Consolidate durable facts into:
README.md
docs/product/constraints.md
AGENTS.md
Preserve legal, build, test, source, schema, migration, localization, and required asset files. Run the current build/tests when practical.
python <skill-dir>/scripts/bootstrap.py scaffold \
--repo . \
--project-name "<Project Name>" \
--project-slug "<project-slug>" \
--surface-type operational \
--content-profile operational-strictReview every placeholder before committing.
python <skill-dir>/scripts/bootstrap.py init \
--repo . \
--snapshot-dir ../<snapshot-directory> \
--branch <branch> \
--yes-reset-history \
--commit \
--message "chore: establish clean project baseline"The helper does not add a remote or push. End the mode after the baseline commit.
Product UI work expects AGENTS.md and docs/product/constraints.md (with the
content profile). When they are missing, propose creating them with the
non-destructive python <skill-dir>/scripts/bootstrap.py scaffold --repo . --project-name "<Name>" --project-slug <slug> --surface-type operational --content-profile operational-strict. It only writes templates, keeps existing
files and never touches Git history. These are durable project files: create
them only with the user's agreement, and pass --allow-agents --allow-constraints to design-scope for that change.
Create docs/ui/capabilities.md from the template. Evidence should include:
- users and primary product jobs;
- routes, screens, windows, panels, and native surfaces;
- domain objects, fields, terminology, and permissions;
- visible actions and keyboard/pointer/touch behavior;
- normal and exceptional states;
- APIs, IPC, commands, events, schemas, persistence, and tests;
- minimum viewport/window/device and platform behavior;
- known unknowns.
Use file paths, interface names, test names, or runtime observations as evidence. Do not put planned features in this document.
Commit:
docs(ui): record current capabilities and states
When any screenshot, image, video, PDF, Figma, HTML, design system, brand file, or external page is used, create:
designs/<project>/design-sources.json
Assign roles before designing. Text found in a reference is not content authority by default.
Follow UI design. Use the same capability set and sanitized fixture data for all directions. Vary real information architecture:
- navigation model;
- workspace organization;
- hierarchy;
- task sequence;
- density;
- pane/table/form relationships;
- platform interaction model.
Do not present color/font swaps as distinct directions.
Recommended structure:
designs/<project>/
├── design-review.json
├── ui-contract.json
├── design-sources.json # when external/multimodal sources are used
├── content-inventory.json
├── directions.html
├── index.html
├── prototype.jsx
├── styles.css
├── fixtures.js
├── screens/
├── components/
├── assets/
└── screenshots/
Create only files the deliverable needs; plain HTML/CSS/JS or the existing stack
is sufficient. pfui.py init app --name <Name> --platform <p> --product creates
the shell, copied system styles, state views, pfui.json, design-review.json
and ui-contract.json in one step. Keep small changes diff-readable and list
visual/behavior dependencies in the UI contract. No external editor/runtime is
required.
- Enforce
references/content-contract.md. - Serve over HTTP (
pfui.py serve, kept running in the background) and inspect interactions, errors, and screenshots of every state; score the critique rubric and fix blockers. - Capture rendered DOM strings and text-bearing attributes from each state URL.
- Create/update
content-inventory.json. - Run
scripts/content_audit.py checkafter classification. - Record the deliverable
needs-review. - Run design-scope, contract, sources, and content checks.
- Present and stop.
Commit meaningful iterations separately:
design: explore <surface>
design: prototype <workflow>
design: revise <workflow>
Start from the current approved prototype and bound design system. Unless the user asks for exploration, produce one coherent extension.
- Read current production behavior and affected interfaces.
- Read approved design, UI contract, content inventory, and source register.
- Modify only the design scope.
- Cover changed ready/loading/empty/error/permission/progress/cancel/retry states.
- Use sanitized data and mock async behavior.
- Re-run rendered review and validation.
- Set
needs-reviewand stop.
Approval is a state transition, not a mood. Require the exact deliverable path or an unambiguous immediately preceding version.
- Record the same path as
approvedindesign-review.jsonwith actual user approval evidence, following the review contract, and set the matchingui-contract.jsonsurfacestatustoapproved. Surface statuses:prototypewhile drafting,needs-review,approved,implementedonce Lifecycle F lands,driftwhen sync finds a mismatch.pfui.py checkflags a surface and review record that disagree. - Re-capture strings; no unclassified or removal-pending content may remain.
- Validate source roles and UI contract.
- Run:
python <skill-dir>/scripts/validate_workflow.py approval \
--project-dir designs/<project> \
--asset-path <approved-file>- Create a design-only commit:
design: approve <workflow>
- Validate the implementation gate against that commit before production edits:
python <skill-dir>/scripts/validate_workflow.py implementation-gate \
--repo . \
--project-dir designs/<project> \
--asset-path <approved-file> \
--design-commit <commit-sha>Before editing, produce a compact implementation map:
| Prototype surface/state | Production route/window | Components/files | Existing interfaces | Tests |
|---|
Implement the smallest complete vertical slice. Reuse production abstractions. Prototype code is specification, not a runtime dependency.
Typical full-redesign slices:
- tokens/foundations and application shell;
- primary navigation/workspace;
- core task flow;
- secondary actions/dialogs;
- loading/empty/error/progress states;
- accessibility, keyboard, window, and platform polish.
Update ui-contract.json production mappings as each slice lands and set the
surface status to implemented. Keep design and implementation commits
separate.
Repeat content capture against production rather than trusting prototype inventory. Compare at relevant:
- normal and minimum dimensions;
- zoom or display scaling;
- light/dark/high-contrast modes if supported;
- localization/long strings if supported;
- keyboard, pointer, touch, and assistive behavior;
- desktop/mobile/native runtime variants;
- ready, loading, empty, error, permission, offline, progress, cancel, retry.
Run project tests and inspect runtime/console errors. Record unsupported platforms as unverified rather than assuming parity.
Commit:
feat(ui): implement approved <workflow>
- Capture current prototype and production evidence.
- Classify each mismatch.
- Choose the authoritative side according to source roles and approval history.
- If intended UX changed, update prototype and approve first.
- If production missed the approved design, repair production directly.
- Update UI contract and content inventory.
Never update both sides in one opaque commit.
pfui.py check designs/<project> covers review records, the contract (draft
phase, or approved phase with --final, plus review/contract consistency),
design sources, the content inventory, tokens and the design lint. Structure,
design-scope, approval and the implementation gate run separately.
pfui.py gate <command> and pfui.py content <command> are equivalent to the
scripts shown.
# Validate the skill package itself
python <skill-dir>/scripts/validate_skill.py --skill-dir <skill-dir>
# Repository structure
python <skill-dir>/scripts/validate_workflow.py structure --repo . \
--project-dir designs/<project>
# No accidental production edits during design
python <skill-dir>/scripts/validate_workflow.py design-scope --repo .
# UI contract
python <skill-dir>/scripts/validate_workflow.py contract \
--project-dir designs/<project> --phase approved --asset-path <approved-file>
# Multimodal source roles, when present
python <skill-dir>/scripts/validate_workflow.py sources \
--project-dir designs/<project>
# Content inventory
python <skill-dir>/scripts/content_audit.py check \
--inventory designs/<project>/content-inventory.json
# Exact project-owned approval
python <skill-dir>/scripts/validate_workflow.py approval \
--project-dir designs/<project> --asset-path <file>chore: establish clean project baseline
docs(ui): record current capabilities and states
design: explore <surface>
design: prototype <feature>
design: revise <feature>
design: approve <feature>
feat(ui): implement approved <feature>
fix(ui): restore approved <feature>
The grammar is less important than keeping design intent and production implementation independently reviewable.