设计组件与代码一致性审查
对照设计清单和代码组件,梳理命名、状态与变体差异,输出匹配表和分工修正计划。
完整提示词
<context>
Design libraries and component code drift apart quietly. Designers add a "tertiary" button that code never got, engineers add a `loading` prop that design never drew, states like focus and disabled exist only on one side, names differ (`Primary` versus `solid`, `Modal` versus `Dialog`), and design uses raw values where code uses tokens. Each mismatch costs a handoff conversation or, worse, a one-off implementation. A parity audit matches components across both sides, compares names, variants and properties, states and token use, and then decides case by case which side is right: code is usually the truth for behaviour and API, design for visual intent, but neither is always right. Mapping tables that link design components to code (some design tools offer this directly) keep the two aligned afterwards.
</context>
<task>
Audit parity between this design inventory and the code in {{repo_path}}. Do not change any files.
<design_inventory>
{{design_inventory}}
</design_inventory>
{{#component_dirs}}
<component_dirs>
{{component_dirs}}
</component_dirs>
{{/component_dirs}}
1. **Method.** Find components in the code (exports, folders, stories), and read each one's props, variants and states from its types or definitions. State what you read and what you could not.
2. **Component matching.** Match design components to code components by name and purpose; record confidence for matches that are by purpose only.
3. **Mismatches.** For each matched pair, a row per difference: naming (component, property and value names), variants and sizes, properties without a counterpart, states (focus, disabled, loading, error, selected), token use where visible (raw values in code), and behaviour that design cannot show.
4. **Missing on one side.** Components only in design and components only in code, with a guess at why (deprecated, in progress, local to a product).
5. **Source of truth decisions.** For each mismatch, recommend which side should change and why, or mark it as a decision for the team.
6. **Plan.** Fixes grouped and ordered by impact (how often the component is used and how confusing the mismatch is), separated into design changes and code changes, plus a mapping table to maintain going forward.
7. If the design inventory is too thin to compare (names only, no variants), say what export is needed and compare only what is possible.
</task>
<constraints>
- Read only. Do not modify code or design files.
- Do not guess design properties that the inventory does not state; never infer design values from code.
- Distinguish confirmed mismatches from suspected ones.
{{> guardrails/investigate-before-answering}}
{{> output/uncertainty}}
</constraints>
<output_format>
Markdown with the sections from the contract, in order. Component matching and mismatches as tables (Component, Aspect, Design, Code, Recommendation, Confidence). End with Open questions.
</output_format>可替换内容
- {{repo_path}}
- {{design_inventory}}
- {{#component_dirs}}
- {{component_dirs}}
- {{/component_dirs}}
- {{> guardrails/investigate-before-answering}}
- {{> output/uncertainty}}
分类与标签
设计创意、设计系统、组件审计、设计交付、代码对照