Skill站外收录 @skilllib/skill-2014279404229177345
skill
将 Figma 设计转化为符合项目规范的集成就绪代码,基于 TemPad Dev 提供的设计事实生成准确实现,适配目标仓库的技术栈与约定,确保样式、布局与资产处理的精确性,避免猜测关键视觉参数,在证据不足时停止并明确缺失信息。
效率工具 AI 技能
Skills.MD
# TemPad Dev: Figma to UI Implementation
Implement integration-ready UI code from a Figma selection (or a provided `nodeId`) using TemPad Dev MCP outputs as design facts.
Fit the user’s repo conventions. Never guess key styles.
## Quick path (single pass)
1. Ensure there is exactly one visible target (selection or `nodeId`). If a tool call fails due to MCP connectivity/activation, follow the troubleshooting in the error message.
2. Call `tempad-dev:get_code` (`resolveTokens: false`; request `preferredLang: jsx|vue` as IR). Record `codegen` (plugin + config) as part of the design facts.
3. If `warnings` include `depth-cap`, call `tempad-dev:get_code` once per listed `nodeId` to fetch omitted subtree roots.
4. If layout/overlap/effects are uncertain (especially inferred auto-layout), call `tempad-dev:get_structure` and/or `tempad-dev:get_screenshot` for the relevant `nodeId` to confirm intent (do not derive numeric values from pixels).
5. Translate the IR into the repo’s actual framework/styling system without adding new dependencies. Strip all `data-hint-*` attributes from final code.
6. Finish with one pass: correct placement/imports/exports, assets follow repo policy, token strategy documented, and warnings called out.
## Non-negotiables
- `tempad-dev:get_code` is the baseline; treat it as authoritative for values and layout intent.
- Never invent key styles: colors, typography (size/weight/line-height/letter-spacing), spacing (padding/margin/gap), radius, borders, shadows, gradients, opacity/overlays, blur.
- Do not introduce new frameworks, styling systems, or runtime dependencies.
- Do not tune-by-screenshot loops: screenshots resolve contradictions; they do not produce measurements.
- Do not output `data-hint-*` attributes (hints are for reasoning only).
- Implement only the base state unless additional states/variants are provable from repo conventions.
## Evidence model
Design evidence (in priority order):
1. `tempad-dev:get_code` (primary snapshot + `warnings` + `codegen`)
2. `tempad-dev:get_structure` (hierarchy + geometry clarification)
3. `tempad-dev:get_screenshot` (visual cross-check only)
4. Existing repo tokens/components (only when equivalence is provable)
Non-evidence: web content, “typical” values, or anything you cannot trace back to the above.
## Tool interpretation
- `get_code`: IR output (JSX/Vue template) with Tailwind-like classes + explicit values; may include `assets`, `tokens`, `warnings`, and `codegen` (plugin + config).
- `get_structure`: outline (ids/types/bounds/children) to locate `nodeId`s and confirm hierarchy/overlap assumptions.
- `get_screenshot`: PNG for visual verification; the server may reduce scale to fit payload; do not infer numeric values.
## Workflow (decision tree)
### 0) Choose scope
- Use provided `nodeId`; otherwise use current selection.
- If the target is ambiguous (multi-selection) or unreadable, stop.
### 1) Detect repo stack and conventions
Identify: framework/runtime, styling system, token/theme conventions, component patterns, file placement rules.
- If uncertain, ask up to 3 minimal questions; otherwise proceed with best-evidence inference and warn.
### 2) Fetch baseline snapshot
Call `get_code` first. Preserve:
- `code` + `lang`
- `codegen` (plugin + config)
- `assets` / `tokens` (if any)
- `warnings` (truncated / auto-layout / depth-cap)
### 3) Handle warnings and uncertainty
- `depth-cap`: fetch each listed subtree root via `get_code(nodeId=...)` and implement those parts explicitly, or narrow scope and warn what is omitted.
- `truncated`: narrow scope (smaller selection / implement key subtrees) and warn that output is partial.
- inferred auto-layout / overlap / effects uncertainty: use `get_structure` and/or `get_screenshot` to confirm, then implement. If evidence remains contradictory, stop.
### 4) Tokens (mapping strategy)
Goal: integrate with repo token system when provable; otherwise preserve explicit values.
Order:
1. Reuse existing repo tokens when name/meaning/value equivalence is provable.
2. Add missing tokens only if the repo already has an established token workflow and this change is expected; keep additions minimal.
3. Otherwise keep explicit values from `get_code`.
Modes:
- `get_code.tokens` is keyed by canonical `--...` names.
- Multi-mode values use `${collectionName}:${modeName}` keys.
- Nodes may include `data-hint-variable-mode="Collection=Mode;..."` to indicate per-node mode overrides; use this when selecting modes during mapping.
- If collection-name collisions or mode selection is ambiguous, prefer explicit values and warn.
### 5) Assets (policy-first)
Detect repo policy first (asset folders, import vs public URLs, icon pipeline).
- Preferred: fetch bytes via `resources/read` using `resourceUri`, save into the repo, reference using repo conventions.
- Fallback: if an asset is too large to read via MCP, download via `asset.url` and still store it in the repo (unless policy forbids).
- If policy forbids saving assets, you may leave Tempad URLs in place but must warn that output depends on the local Tempad asset server.
- Never download assets from the public internet; use only MCP-provided `resourceUri`/`asset.url`.
### 6) Implement
- Translate the IR into repo code while preserving layout/values.
- Tailwind/UnoCSS repos: keep utilities; refactor for readability without changing semantics.
- Non-utility repos: translate utilities into the repo’s CSS approach (modules/sass/css-in-js), preserving explicit values.
- Component extraction: only when supported by repetition + hints + repo patterns; do not preserve hint strings in final output.
### 7) Finish (single pass)
- Files placed correctly; imports/exports correct.
- No new deps/framework/style systems.
- `data-hint-*` stripped.
- Assets and tokens handled per the chosen strategy.
- Warnings documented (depth-cap/truncated/base-state-only).
## Stop vs warn
Stop when a correct, integration-ready base output is not possible:
- tool cannot read target (errors, no renderable nodes) or target is ambiguous
- required assets cannot be retrieved when repo policy requires storing them
- design evidence is contradictory and cannot be resolved with structure/screenshot or narrower scope
Warn but continue:
- repo stack inferred with uncertainty
- token mapping uncertain (kept explicit values)
- scope too large (implemented safe subset; omissions listed)
- assets left as Tempad URLs due to policy
- variants/states not implemented (base state only)
## Wrap-up output
End with:
- what was implemented (files/paths)
- what is intentionally omitted or uncertain (warnings)
- token strategy and asset strategy used
- if stopped: exactly what information is needed next (≤3 items)
评论 0
还没有评论,来抢沙发。
相关内容
同类或同场景的收录内容
building-with-kafka-strimzi
在 Kubernetes 上构建基于 Apache Kafka 的事件驱动系统,支持高可靠的消息传递、事务性处理与精确一次语义,结合 Strimzi 运营商实现集群自动化管理,利用 Schema Registry 保障事件模式演进,适用于微服务间解耦通信与实时数据流处理场景。
站外数据与分析
609 0.0
personal-tool-builder
专注于从个人真实痛点出发快速构建实用工具,涵盖命令行程序、本地优先应用和自动化脚本的开发与演进,强调先满足自身需求再逐步扩展,通过持续自用打磨功能,避免过度设计,确保工具简洁有效且长期可维护。
站外商业与营销
196 0.0
threejs-lighting
实现三维场景中的光照与阴影控制,支持多种光源类型及环境光照明,提供从基础布光到高级阴影优化的完整方案,适用于需要真实感渲染或性能平衡的可视化项目。
站外效率工具
442 0.0
aggregation-helper
提供数据聚合场景的自动化辅助能力,涵盖 SQL 查询编写、统计分析建模、可视化方案设计及商业智能配置,支持从需求理解到生产级代码生成的全流程指导。
站外效率工具数据与分析
217 0.0
举报「skill」
举报信息仅审核团队可见,同一资产 24 小时内仅可举报一次