一键导入
design-to-code
Outlines the process for converting Figma designs into a structured, platform-aware Flutter implementation.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Outlines the process for converting Figma designs into a structured, platform-aware Flutter implementation.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Process for creating mock data sources in the infrastructure layer.
Process for building, exporting, and registering reusable UI components in the packages/app_ui package. References design-to-code.md for design tokens (typography, colors, spacing).
Use when completely removing the web platform from the project. Details how to delete directories/configurations, clean up app_ui web components, remove web-specific feature views (*_view_web.dart), prune conditional imports/logic, and run validation.
Use when asked to add, update, or group routes using GoRouter, or manage redirection guards.
Step-by-step workflow for creating, configuring, and updating Flutter golden tests using the Alchemist package.
Use when asked to create a new feature or sub-feature following the DDD-lite architecture, or set up state, view, and page layers for a domain.
| name | design-to-code |
| description | Outlines the process for converting Figma designs into a structured, platform-aware Flutter implementation. |
All assets must be placed in the packages/app_ui/assets/ directory following this structure:
assets/svg/assets/svg/icons/assets/svg/images/assets/images/ (PNG, JPEG, WebP — e.g., photos, hero banners)login/, auth/) within these asset directories. Keep the structure flat by asset type to avoid issues if an asset is later reused in another feature.packages/app_ui/assets/ to see if it already exists.melos run generate to update the AppAssets class.AppAssets to reference the asset in code:
AppAssets.icons.google.svg();
When extracting from Figma via the MCP server, assets might not be marked for export or could be missing entirely:
TODO comment for traceability:
const SizedBox(width: 120, height: 120); // TODO(design): Replace with exported asset. @Source: <Page> > <Frame> > <Element>
https://www.figma.com/api/mcp/asset/...) directly in the code (e.g. via Image.network).const _kUiPackage = 'app_ui'; locally.kUiPackage: Rely on the exported kUiPackage from app_ui when required, but avoid using it outside the package if possible.app_colors.dart.Color(0xFF...)) in UI; always use context.$.colors.static const _color = Color(...)), or files for colors inside views or widgets. All colors MUST be defined in app_colors.dart.If the design lacks a defined palette or uses inconsistent, ad-hoc hex codes (e.g., from junior designers):
app_colors.dart (e.g., primary, secondary, surface).AppTextTheme.any field combined with copyWith to maintain consistency while allowing flexibility.
Text('Design Text', style: context.$.style.any.copyWith(fontSize: 18, color: context.$.colors.primary))
AppSpacing tokens.AppSpacing.md (16px) over AppSpacing.lg (20px) since 18 is equidistant).AppSpacing constants over hardcoded double values.slang).context.$.tr (e.g., context.$.tr.auth.login.title)._view.dart files (or their specific local widgets). NEVER pass translated strings down from parent pages or via ViewProps.melos run translate after updating translation files.Break the design into reusable components. Before creating anything:
packages/app_ui/lib/src/widgets/ before writing the feature's _view.dart file. The _view.dart file must ONLY compose pre-built app_ui widgets. DO NOT build UI blocks directly inside _view.dart and absolutely DO NOT create private widget classes (e.g., _FeatureHeader, _CustomAction) inside the _view.dart file.YzPrimaryButton rather than YzLoginButton, or YzIconButton rather than _UserAvatarButton, even if it is currently only used on a specific screen.const _headerHeight = 295.0;).packages/app_ui/lib/src/widgets/ for existing components and their design @Source.
grep_search to find matching @Source breadcrumbs (e.g., Login > Hero > CTA).grep_search on the widgets directory for specific @Style or @Layout tokens (e.g., @Style:.*Bg: primary).view_file to read the specific candidate .dart files to verify properties.
If the element visually matches, reuse that class. Do not create a duplicate.package:app_ui/app_ui.dart. Avoid internal file imports.[!NOTE] For widget implementation rules (naming, structure, exports, and code annotations), follow the UI Widget Creation Skill.
Follow the Feature Creation Skill to set up the directory structure.
auth/login/).Implement the view for the target platform (e.g., mobile):
login_view.dart (Mobile)login_view_web.dart (Web).AppSpacing and AppAssets consistently.To maintain a single source of truth and prevent redundant extraction, we use a Code-as-Truth approach for widgets, and a dedicated manifest for file tracking.
packages/app_ui/figma_manifest.yaml acts as the manifest to track active Figma file(s) and sync status:
figma_file_ids:
- id: "<figma_file_id_1>"
name: "Main App Design"
last_sync: "<ISO 8601 timestamp>"
We do not use a centralized markdown table. Instead, components are tracked directly via doc-comment annotations (see UI Widget Creation Skill).
@UI, @Source, @Style, and @Layout annotations directly above the class.[!NOTE] Design Evolution: If a Figma design has changed since the last sync, update the
@Statusof the affected widget's doc-comment tooutdated.