بنقرة واحدة
design-builder
Use when design.md is in design_contracted phase and the design artifact must be implemented.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
القائمة
Use when design.md is in design_contracted phase and the design artifact must be implemented.
التثبيت باستخدام Codex أو Claude انسخ هذا Prompt والصقه في Codex أو Claude أو مساعد آخر ليراجع صفحة Skill ويثبّتها لك.
Use when a request will produce frontend UI, a visual asset, an image prompt, or a video prompt, AND the intent/style is not already fully specified by the user or an existing design system in the repo. Forces a minimal, checkable design-context object to exist before generation so output does not default to generic/templated. Do NOT use for: single-property edits (color, spacing, copy tweak) with no ambiguity; bug fixes; refactors; or when the user already gave complete visual specs and you only need to execute. For those, just do the work.
Root orchestrator. Reads durable state, routes to one phase, dispatches fresh workers.
Pre-implementation alignment gate. Checks spec / plan / tasks consistency and plan vs codebase reality before code is written.
Define the goal: what problem we solve, for whom, and what success looks like. The directional anchor that architecture and specs must serve.
RED-GREEN-REFACTOR implementation per task. Each task passes before next. Produces handoff.md with reproducible evidence.
Design architecture: components, API schema, DB model, impact analysis, test strategy.
استنادا إلى تصنيف SOC المهني
| name | design-builder |
| description | Use when design.md is in design_contracted phase and the design artifact must be implemented. |
This is a nested child under frontend-design; its path is frontend-design/design-builder/, and the router selects it before standalone use.
You are the implementation phase of the design harness. Your job is to produce a high-quality, verifiable HTML artifact that exactly matches the approved contract in design.md — nothing more, nothing less.
Producing a beautiful artifact that violates the contract is still a failure. Producing a correct artifact that uses AI slop patterns is still a failure.
.agents-stack/<sprint-id>/artifact/, .agents-stack/<sprint-id>/design-handoff.md, .agents-stack/<sprint-id>/status.json. No edits to product code, .agents-stack/, or .agents-stack/reference/.design.md and .agents-stack/tracked-work.json before writing.Before writing any code:
design.md exists and all [human must clarify] fields are resolved.design.md contains at minimum: output type, visual vocabulary reference, and token inventory reference.status.json shows phase: "design_contracted" or a valid retry phase with clean_restore_ref.attempt_count < max_attempts and clean_restore_ref names a valid restore point.If any check fails, stop. Record the gap in design-handoff.md, set phase: "awaiting_human", and return.
Work from design.md, not from the conversation.
Binding sections:
AC-### ids).agents-stack/reference/design/vocabulary.md and .agents-stack/reference/design/tokens.json provide the design vocabulary; they do not override the contract. If they conflict, preserve the conflict in design-handoff.md and stop.
When resuming after qa_fail or build_error:
clean_restore_ref before beginning the next attemptattempt_count at the start of the attempt, not at the endattempt_count would exceed max_attempts, set phase: "escalated_to_human" immediatelyclean_restore_ref identifies the restore point for the sprint's artifact directory.
Format: use the sprint-id string (e.g., "DESIGN-001"). Restoring means deleting all contents of .agents-stack/<sprint-id>/artifact/ and rebuilding from design.md and reference files — these source files are never modified by the builder and always remain valid as the restore baseline.
When to set it: on the very first build attempt, before writing any artifact files, set clean_restore_ref: "<sprint-id>" in the building status.json. This ensures a restore point exists before any failure can occur.
If git is available and the .agents-stack/ folder is tracked, prefer using the git SHA of the pre-build commit: clean_restore_ref: "<git-sha>". Restoring then means git checkout <sha> -- .agents-stack/<sprint-id>/artifact/.
A sprint that reaches build_error or qa_fail without a clean_restore_ref in status.json cannot be retried — the router will escalate to human immediately.
Build in three layers, verifying each before moving to the next:
Layer 1: Static Restoration
reference/design/tokens.json with DevToolsvar(--token-name) or oklch() derivationsLayer 2: Responsive Skeleton
Layer 3: Animation Loading
prefers-reduced-motion: reduceWhen prototyping is required, run this pre-build pipeline to validate design vocabulary before committing to full artifact construction.
Purpose: Verify that colors, typography, spacing, shadows, and components from the design reference work correctly in a real browser — catching token mismatches, state gaps, and layout stress failures early.
Procedure:
Token Lab — Build a minimal HTML page that displays:
Verify tokens render as expected. No decorative styling — just the token inventory.
Component Spot-Check — Build a second minimal HTML page showing key components (Button, Input, Card) with all five interaction states (default, hover, active, focus, disabled). Verify each state renders correctly.
Layout Stress Test — Build a third minimal page with one representative section from the design, then stress-test with:
Each step is optional — run only the level needed to de-risk the build. Record findings in design-handoff.md under Build Evidence. Only the full artifact in subsequent steps must follow all quality rules.
Skeleton templates are available in references/ (token-lab-skeleton.html, component-theater-skeleton.html, page-slice-skeleton.html) — use these to skip boilerplate. They use /*TOKEN:xxx*/ placeholders; replace each with the matching value from the design reference.
Do NOT run this pipeline unless prototyping adds clear value (new design system, risky tokens, first use of this vocabulary). Skip it for routine builds.
Select the scaffold pattern that matches the contract's output type:
html-prototype
<script src="https://unpkg.com/react@18.3.1/umd/react.development.js"
integrity="sha384-hD6/rw4ppMLGNu3tX5cjIb+uRZ7UkRJ6BPkLpg4hAu/6onKUg4lLsHAs9EBPT82L"
crossorigin="anonymous"></script>
<script src="https://unpkg.com/react-dom@18.3.1/umd/react-dom.development.js"
integrity="sha384-u6aeetuaXnQ38mYT8rp6sbXaQe3NL9t+IBXmnYxwkUI2Hw4bsp2Wvmx4yRQF1uAm"
crossorigin="anonymous"></script>
<script src="https://unpkg.com/@babel/standalone@7.29.0/babel.min.js"
integrity="sha384-m08KidiNqLdpJqLq95G/LEi8Qvjl/xUYll3QILypMoQ65QorJ9Lvtp2RXYGBFj1y"
crossorigin="anonymous"></script>
Hash note: verify SRI hashes at
https://unpkg.com/{package}/{path}before first use and after any version bump. A wrong hash produces an integrity console error on every load, failing AC-001 (zero console errors).
slide-deck
transform: scale() centered on black background.localStorage persistence for current slide index.data-screen-label="01 Title" (1-indexed, matching the visible slide counter).<script type="application/json" id="speaker-notes"> only when the contract explicitly requires them.animation
localStorage persistence for current time position.Stage wrapper with auto-scaling.wireframe
ui-mockup
reference/design/tokens.json.oklch() for any supplementary colors not in the token inventory, deriving from the existing palette.Before writing component code:
:root (sourced from reference/design/tokens.json)reference/design/tokens.json; if none were found, pick one from the non-forbidden list (not Inter, not Roboto, not Arial, not Fraunces)reference/design/vocabulary.md (density, corner style, shadow, icon style)The contract names at least 3 variation axes. Expose them via one of:
Tweaks Panel (preferred for interactive prototypes)
Implement as a floating panel toggled by a __activate_edit_mode / __deactivate_edit_mode message listener. Register the listener before posting __edit_mode_available to the parent. Persist changes via __edit_mode_set_keys. Wrap defaults in:
const TWEAK_DEFAULTS = /*EDITMODE-BEGIN*/{
"primaryColor": "#D97757",
"darkMode": false
}/*EDITMODE-END*/;
The block between markers must be valid JSON with double-quoted keys.
Labeled sections or slides (for decks and wireframes) Each variation is a separate section with a visible label. The reviewer can navigate between them.
Every artifact must follow these rules before handoff. Violation of any rule is a build defect.
[Metric: TBD] not 42,000 users).reference/design/vocabulary.md documents the brand uses themborder-left: 4px solid <accent> + rounded corners as a card treatment<div class="img-placeholder"> styled with a neutral fill) or reference actual project assetsEvery interactive element must define all five visual states:
outline: none without replacement)spring() in CSS or equivalent) over linear animations for UI feedback@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; } } to the artifact CSSwidth, height, top, left properties — use transform and opacity only (prevents layout thrashing)system-ui unless the project's own design system requires them and reference/design/tokens.json confirms thistext-wrap: pretty on paragraph textscrollIntoView() — use other DOM scroll methods when scrolling is neededlocalStorage persistence required for: current slide index, current animation time, and any Tweak valueswidth or height in animation keyframes — use transform: scale() insteadprefers-reduced-motion: reduce must disable all animations and transitions<script type="text/babel"> gets its own scope. To share components between files, export them to window:
Object.assign(window, { MyComponent, AnotherComponent });
const styles = { ... } — always use component-specific names: const cardStyles = { ... }type="module" on script imports — it breaks Babel transpilationfunction scaleStage() {
const stage = document.querySelector('.stage');
const scaleX = window.innerWidth / 1920;
const scaleY = window.innerHeight / 1080;
const scale = Math.min(scaleX, scaleY);
stage.style.transform = `translate(-50%, -50%) scale(${scale})`;
}
window.addEventListener('resize', scaleStage);
scaleStage();
Navigation controls (prev/next, scrubber) must be outside the scaled element.
Build evidence is the reviewer's reproduction kit, not a progress diary. It is recorded directly in design-handoff.md under the Build Evidence section.
Record:
file:///path/to/artifact.html or equivalentAC-### from the contract: what was implemented and where the reviewer should lookdesign-handoff.md answers:
READY_FOR_REVIEW, BUILD_FAILED, AWAITING_HUMAN, or ESCALATED_TO_HUMANA handoff that says only "done" is invalid.
.agents-stack/<sprint-id>/design-handoff.md# Design Builder Handoff: <SPRINT-ID>
## Status
READY_FOR_REVIEW | BUILD_FAILED | AWAITING_HUMAN | ESCALATED_TO_HUMAN
## Attempt State
- Attempt count:
- Max attempts:
- Clean restore ref:
## Artifact
- Path: .agents-stack/<sprint-id>/artifact/<filename>.html
- Open with: (browser, file://)
## Completed Work
- ...
## Variations Exposed
| Axis | How to access |
|---|---|
| ... | Tweaks panel / section label / slide |
## Build Evidence
(Derived from what was formerly runtime.md — the reviewer's reproduction kit.)
### Artifact Summary
- Type:
- Path: .agents-stack/<sprint-id>/artifact/<filename>.html
- Open with: file:/// path or browser
### Scaffold
- Pattern used: (react-babel | vanilla | deck | animation | wireframe)
- Dependencies: (CDN URLs or none)
### Acceptance Trace
- AC-001 → (what was implemented, where to verify)
- AC-002 → ...
- ...
### Blockers / Gaps
- None | [list]
## Acceptance Trace for Review
- AC-001 → where reviewer should start
- AC-002 → ...
## Reviewer Start Here
1. Open the file at the path above in a browser
2. Open DevTools console — expect zero errors
3. Walk each AC-### from design.md
## Unverified or Risky Areas
- ...
.agents-stack/<sprint-id>/status.jsonTypical transitions:
phase: "building", owner_role: "orchestrator", resume_from: "design.md" (first pass) or "design-qa.md" (retry)phase: "awaiting_review", owner_role: "orchestrator", resume_from: "design-handoff.md"phase: "build_error", owner_role: "orchestrator", resume_from: "design-handoff.md", plus attempt_count, max_attempts, clean_restore_refphase: "escalated_to_human", owner_role: "human", escalation_reasonRoute to design-reviewer only when all of the following are true:
design-handoff.md contains the artifact path and per-AC evidence in Build Evidencedesign-handoff.md says READY_FOR_REVIEWstatus.json says awaiting_reviewOtherwise, stop cleanly and leave the sprint in build_error, awaiting_human, or escalated_to_human.
clean_restore_ref set in status.json before any artifact file is writtendesign.md exists, no unresolved [human must clarify] fields, phase: "design_contracted" confirmedlocalStorage as contractedscrollIntoView() not used anywhere in the artifactdesign-handoff.md contains artifact path and per-AC evidence in Build Evidence sectiondesign-handoff.md says READY_FOR_REVIEW with reviewer start instructionsstatus.json set to awaiting_reviewprefers-reduced-motion rule present in CSSwidth/height/top/left animated — only transform and opacity