/useful-loops:mockup-from-plan PLAN MOCKUP_DIRfrom useful-loops
This command should be used when the user asks to 'build a mockup from a plan', 'generate mockup from plan', 'create HTML mockup', or 'compare mockup against plan'. Runs one iteration: compares an HTML/CSS/JS mockup against a plan document, identifies gaps, and fixes them.
Ships in useful-loops. Installing the plugin adds it to Claude Code.
You are performing one complete mockup-from-plan iteration. The plan is the source of truth. You will deeply read both artifacts, perform a thorough gap analysis, and fix what's missing in the mockup. Report progress at each phase.
Parse the arguments: extract the PLAN path (a single .md file or a directory of .md files) and the MOCKUP_DIR path (a directory containing .html, .css, and .js files). Both are required.
Plan: <PLAN>
Mockup directory: <MOCKUP_DIR>
Prerequisite check: If either the plan file/directory or the mockup directory does not exist, stop immediately and tell the user: "Both the plan and the mockup directory must already exist before running this skill. Please create them first, then re-run." Do not create either artifact.
Plan format: The plan can be either:
screen-plan.md) — one document describing the full planplans/) — contains multiple .md files organized by topic (e.g., user-screens.md, admin-screens.md, api-endpoints.md). All files together form the complete plan.In-place editing only: All changes are made directly to existing files within <MOCKUP_DIR>. Do not create new directories. If a gap requires a new file (e.g., a new page), create it inside the existing mockup directory.
Run Phases 1-5 once. If Phase 3 finds zero gaps, output the completion promise and stop.
Read docs/plans/mockup-from-plan-tracking.md to find the last iteration number. Your iteration is N+1. If no iterations exist yet, you are iteration 1. If the tracking file does not exist, create it (run mkdir -p docs/plans first if the directory does not exist):
# Mockup from Plan — Tracking
**Plan:** <path> (file / directory)
**Mockup directory:** <path>
---
## Iteration Log
If this is iteration 2 or later, review the prior iteration entries in the tracking file. Understand what was already changed so you do not re-tread the same ground or revert prior improvements.
Deep-read the plan. Use an explorer agent to thoroughly read and understand the plan. The agent should:
<PLAN> is a single file, read the entire file<PLAN> is a directory, read every .md file in the directory and understand how the content is organized across filesDeep-read the mockup. Use a second explorer agent (in parallel with step 3) to thoroughly read and understand the current mockup directory. The agent should:
<MOCKUP_DIR>Both agents should return detailed, structured inventories — not summaries. The gap analysis in Phase 3 depends on having complete information from both sides. If an agent hits context limits, it should return its partial inventory and note where it stopped so a follow-up agent can continue.
With both inventories in hand, create a reconciliation matrix. For each item the plan specifies, determine whether the mockup has it, partially has it, or is missing it entirely. Organize this by dimension:
| Plan Requirement | Mockup Status | Gap? |
|---|---|---|
| ... | Present / Partial / Missing | YES / NO |
This matrix is your working document for Phase 3. It ensures nothing from the plan is overlooked.
Walk through the reconciliation matrix and identify all gaps across six dimensions.
Does the mockup contain all pages or screens described in the plan? Look for:
Does each page's layout match the plan? Look for:
Are all interactive and static elements present? Look for:
Does the mockup's text content match the plan? Look for:
Does the mockup's JavaScript behavior match the plan? Look for:
Does the mockup's appearance match any design specs in the plan? Look for:
For each gap found, classify its severity:
If zero gaps are found across all six dimensions, skip to Phase 6 (signal).
If gaps were found, proceed to Phase 4.
Before fixing, review the gaps for any that require interpretation. The plan may be vague or open to multiple visual/UX interpretations. For each ambiguous item, use AskUserQuestion to clarify:
AskUserQuestion:
question: "The plan says '<quote from plan>'. How should this appear in the mockup?"
header: "Clarify"
options:
- label: "<interpretation A> (Recommended)"
description: "<what this would look like>"
- label: "<interpretation B>"
description: "<what this would look like>"
- label: "Skip this for now"
description: "Defer to a later iteration"
Group related ambiguities into a single question when possible (max 4 options per question). Only ask about genuinely ambiguous items — if the plan is clear, just build it.
Apply gap fixes directly to the existing files in <MOCKUP_DIR>. Prioritize HIGH findings first, then MEDIUM, then LOW. Each edit should be surgical: add what's missing without disrupting what already works. Edit files in place — do not create new directories or restructure the mockup.
After all edits are applied, re-read the changed files to verify:
Append an iteration entry to docs/plans/mockup-from-plan-tracking.md:
### Iteration N (YYYY-MM-DD)
**Gaps found:** X (Y HIGH, Z MEDIUM, W LOW)
**Gaps fixed:** A
**Deferred:** B
**User clarifications:** C
#### Dimensions Covered
- Pages & Screens: [summary]
- Layout & Structure: [summary]
- Components & UI Elements: [summary]
- Content & Copy: [summary]
- Interactions & Behavior: [summary]
- Styling & Visual Design: [summary]
#### Changes Applied
- [HIGH] Description of change
- [MEDIUM] Description of change
- [LOW] Description of change
#### Deferred
- [ ] Description (reason)
#### User Decisions
- "<question>" → "<user's choice>"
If gaps were found and fixed: exit normally. If running in a Ralph Loop, the loop will re-invoke for the next iteration.
If NO gaps were found across all six dimensions: output exactly:
<promise>MOCKUP_MATCHES_PLAN</promise>
Only output this promise if you genuinely compared every dimension and found nothing actionable.
What the command file sets; muted values are Claude Code's defaults
7-day visitors to each command page
24 commands in this plugin
/beta-auditThis command should be used when the user asks to 'run a beta audit', 'check beta readiness', 'is the app ready for beta', or 'find beta-readiness gaps'. Runs one iteration: explores the app holistically for beta-readiness gaps, fixes code issues, collects manual to-dos, validates, PRs, runs CI, and merges./beta-audit-loopThis command should be used when the user asks to 'loop beta audit', 'keep auditing for beta readiness', or 'fix all beta issues'. Loops beta audit iterations until no HIGH/MEDIUM code findings remain. Requires ralph-loop plugin./ci-auditThis command should be used when the user asks to 'optimize CI', 'audit CI pipeline', 'speed up GitHub Actions', 'reduce CI time', 'make CI faster', or 'harden CI permissions'. Runs one iteration: analyzes 1-2 CI dimensions across multiple measurement axes (timing, billable minutes, hygiene, flakiness), applies fixes, re-measures, and merges./ci-loopThis command should be used when the user asks to 'loop CI audit', 'fully optimize CI', 'audit all CI dimensions', or 'do a full CI optimization sweep'. Loops CI audit iterations until all 9 dimensions are covered and no issues remain. Requires ralph-loop plugin./doc-refineThis command should be used when the user asks to 'refine a document', 'improve this doc', 'polish documentation', or 'apply a prompt to a document'. Runs one iteration: applies a prompt-driven analysis to a document, identifies improvements, and applies them./doc-refine-loopThis command should be used when the user asks to 'loop doc refine', 'keep refining a document', or 'iteratively improve documentation'. Loops doc-refine iterations until no further improvements are found. Requires ralph-loop plugin.npx claudepluginhub neonwatty/useful-loops --plugin useful-loops