design-to-code-expert
2
总安装量
2
周安装量
#64933
全站排名
安装命令
npx skills add https://github.com/bianxuerui/design-to-code-expert --skill design-to-code-expert
Agent 安装分布
amp
2
gemini-cli
2
github-copilot
2
codex
2
kimi-cli
2
cursor
2
Skill 文档
Design to Code Expert
Overview
Execute a deterministic, confirmation-first workflow to restore a local HTML design draft into the current project codebase.
- Start with analysis, not code generation.
- Auto-detect project stack and language first.
- Ask for confirmation at required checkpoints unless the user explicitly chooses
--quick. - Keep implementation consistent by using scripts and reference files.
Inputs and Options
Required input:
design_html_path: local.htmlfile path.
Optional options (full spec in references/argument-spec.md):
--target <path>: explicit output file path.--scope <page|component|section>: implementation scope.--framework <auto|next|react|nuxt|vue|taro|svelte|vanilla>: framework override.--style <auto|tailwind|css-modules|scss|less|styled-components|emotion|css>: style system override.--mode <strict|balanced|quick>: fidelity mode.--name <ComponentName>: component/page naming hint.--overwrite <ask|replace|patch|new>: file conflict behavior.--dry-run: analyze and plan only.--check-only: run checks only; no file edits.
Parse and conflict rules:
- Load
references/argument-spec.mdbefore parsing options. - Precedence: explicit option overrides auto-detection, and auto-detection overrides defaults.
Workflow
Copy this checklist and mark items while executing:
- Step 0: Validate local HTML input
BLOCKING - Step 1: Detect project stack
BLOCKING - Step 2: Inspect HTML structure and tokens
- Step 3: Build restoration strategy from mappings
- Step 4: Confirm plan with user
REQUIRED - Step 5: Implement restoration in target files
- Step 6: Run quality gates
- Step 7: Run pre-delivery checklist
REQUIRED - Step 8: Produce structured delivery output
- Step 9: Ask next-step fix scope
REQUIRED
Step 0: Validate local HTML input BLOCKING
- Verify
design_html_pathexists and is readable. - Verify file extension is
.html. - If invalid, stop and ask user for a valid local HTML file.
- If
--check-onlyis set, continue with analysis but do not write code.
Step 1: Detect project stack BLOCKING
- Run:
python3 scripts/detect_stack.py --project-root .
- If user passes framework/style overrides, apply them after detection.
- Read detection output fields:
framework,language,style_system,package_manager,confidence,evidence. - Load
references/stack-detection.mdfor confidence thresholds and fallback behavior. - If confidence is low and no explicit override exists, require user confirmation before coding.
Step 2: Inspect HTML structure and tokens
- Run:
python3 scripts/inspect_html.py --html "<design_html_path>"
- Parse output fields for:
- Structural summary (
top_tags,semantic_sections, repeated classes). - Visual tokens (
colors,font_sizes,spacings,radii,shadows). - Interaction points (
buttons, links, form controls, click targets).
- Structural summary (
- Load
references/html-analysis-questions.mdand answer the questions explicitly before coding.
Step 3: Build restoration strategy from mappings
- Select framework mapping file based on detected or overridden framework:
references/framework-mapping-react-next.mdreferences/framework-mapping-vue-nuxt.mdreferences/framework-mapping-taro.mdreferences/framework-mapping-svelte.mdreferences/framework-mapping-vanilla.md
- Load
references/style-system-mapping.mdto map styles into target styling approach. - Run target path suggestion:
python3 scripts/suggest_target_path.py --project-root . --scope <scope> --framework <framework> --name <name> --overwrite <overwrite>
- Convert analysis into a concrete file-level implementation plan.
Step 4: Confirm plan with user REQUIRED
- Load
references/confirmation-gates.md. - Present and confirm all required items:
- Detected stack and style system.
- Target file path(s) and overwrite mode.
- Scope and fidelity mode.
- Any known limitations from HTML source.
- Skip this step only when user explicitly passes
--quickand mode is notstrict.
Step 5: Implement restoration in target files
- Implement only after Step 4 is confirmed (unless valid
--quickpath). - Follow selected framework mapping and style system mapping.
- Respect scope:
page: full page structure.component: reusable component extraction.section: bounded section implementation.
- If
--dry-runor--check-onlyis set, output intended changes without writing files.
Step 6: Run quality gates
- Run available checks based on project toolchain:
- Lint if configured.
- Type check if TypeScript is used.
- Build or compile check if available.
- If checks fail, summarize blocker issues first, then non-blockers.
Step 7: Run pre-delivery checklist REQUIRED
- Load:
references/pre-delivery-checklist.mdreferences/severity-matrix.md
- Evaluate output and classify deviations as P0-P3.
- P0 or unresolved P1 requires explicit user sign-off before completion.
Step 8: Produce structured delivery output
- Load
references/output-template.md. - Report:
- Stack detection result and confidence.
- HTML analysis summary.
- Changed file list.
- Fidelity deviations with severity.
- Risks, assumptions, and follow-up actions.
Step 9: Ask next-step fix scope REQUIRED
After delivery, ask user how to proceed:
- Fix all deviations.
- Fix P0/P1 only.
- Fix specific items.
- Stop with current result.
Do not continue modifications until user selects one option.
Output Contract
Always output in this order:
- Detection summary.
- Implementation plan.
- Files changed or planned.
- Deviation grading P0-P3.
- Next-step decision request.
Resource Loading Index
| Resource | Load When |
|---|---|
references/argument-spec.md |
Before option parsing in Inputs phase |
references/workflow-checklist.md |
At workflow start for progress tracking |
references/stack-detection.md |
Step 1 confidence and fallback decisions |
references/html-analysis-questions.md |
Step 2 analysis before coding |
references/framework-mapping-react-next.md |
Step 3 when framework is React or Next |
references/framework-mapping-vue-nuxt.md |
Step 3 when framework is Vue or Nuxt |
references/framework-mapping-taro.md |
Step 3 when framework is Taro |
references/framework-mapping-svelte.md |
Step 3 when framework is Svelte |
references/framework-mapping-vanilla.md |
Step 3 when framework is Vanilla |
references/style-system-mapping.md |
Step 3 style mapping |
references/confirmation-gates.md |
Step 4 confirmation checkpoint |
references/pre-delivery-checklist.md |
Step 7 quality verification |
references/severity-matrix.md |
Step 7 severity grading |
references/output-template.md |
Step 8 structured result output |
Resources
- references/
argument-spec.mdworkflow-checklist.mdstack-detection.mdhtml-analysis-questions.mdframework-mapping-react-next.mdframework-mapping-vue-nuxt.mdframework-mapping-taro.mdframework-mapping-svelte.mdframework-mapping-vanilla.mdstyle-system-mapping.mdconfirmation-gates.mdpre-delivery-checklist.mdseverity-matrix.mdoutput-template.md
- scripts/
detect_stack.pyinspect_html.pysuggest_target_path.py