sgds-workflow
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSGDS Skill Workflow
SGDS技能工作流
This skill maps out the available SGDS skills and the order to use them. Start here when unsure which skill applies, or to understand how skills fit together.
本技能梳理了可用的SGDS技能及其使用顺序。当不确定适用哪个技能,或想了解技能间的关联时,请从此处开始。
Are you starting a new app or working on an existing one?
你是在启动新应用还是维护现有应用?
New Application
新应用
Work through these stages in order. Within each stage, read the referenced skills as needed.
请按以下阶段依次推进。每个阶段内,可根据需要阅读对应的技能文档。
Stage 1 — Project Setup (always first)
阶段1 — 项目设置(始终优先)
→ Read sgds-getting-started
Covers: Inter font, CSS import order ( → → ), component registration, and the two app layout templates (simple app vs sidebar app).
themes/day.csscss/sgds.csscss/utility.cssComplete all four steps in this skill before writing any component or page code.
→ 阅读 sgds-getting-started
涵盖:Inter字体、CSS导入顺序( → → )、组件注册,以及两种应用布局模板(简易应用 vs 侧边栏应用)。
themes/day.csscss/sgds.csscss/utility.css在编写任何组件或页面代码前,请完成此技能中的全部四个步骤。
Stage 2 — Build the UI (read concurrently as needed)
阶段2 — 构建UI(按需同步阅读)
These skills are your day-to-day references while building. You will move between them frequently — read whichever is relevant to what you are building at any moment.
→ sgds-components — Every web component (accordion through tooltip). Check here first before building anything with plain HTML. If an SGDS component exists for your need, use it.
<sgds-*>→ sgds-utilities — All Tailwind utility classes: spacing, layout grid, typography, colors, borders, opacity. Use for layout, spacing, and styling between and around components.
sgds:→ Application Shell — Mandatory page chrome and layout templates (simple app and sidebar app) with sticky headers, sidebar column sizing, and container class reference. Read when Step 4 is not enough detail.
sgds-getting-started→ sgds-theming (optional) — Brand colour overrides, night/dark mode, and font customisation. Read this alongside the above when the app requires visual customisation beyond the default SGDS style. Skip if the default style is acceptable.
这些技能是你日常开发中的参考文档。你会经常在它们之间切换——根据当前构建内容阅读对应的技能即可。
→ sgds-components — 所有 Web组件(从折叠面板到提示框)。在使用纯HTML构建任何内容前,请先查看此处。如果已有满足需求的SGDS组件,请优先使用。
<sgds-*>→ sgds-utilities — 所有 Tailwind工具类:间距、布局网格、排版、颜色、边框、透明度。用于组件之间及组件周围的布局、间距和样式设置。
sgds:→ Application Shell — 强制要求的页面框架和布局模板(简易应用和侧边栏应用),包含粘性头部、侧边栏列宽设置及容器类参考。当的步骤4不够详细时,请阅读此文档。
sgds-getting-started→ sgds-theming(可选)—— 品牌颜色覆盖、夜间/暗黑模式及字体自定义。当应用需要超出SGDS默认样式的视觉定制时,请结合上述技能阅读此文档。若默认样式可满足需求,则可跳过。
Stage 3 — Assemble Pages and Blocks (when building full pages or sections)
阶段3 — 组装页面和区块(构建完整页面或页面区块时)
→ sgds-blocks — Reusable UI blocks for page sections and layouts. Includes: hero sections, CTAs, feature blocks, card grids, statistics displays, page headers, filters, forms, detail cards, application shell, and custom blocks. Start here when a user asks to build a landing page, dashboard, specific page section like "I need a call to action", or requests any page layout.
→ sgds-patterns — Typography and text patterns for consistent text styling: headings, display text, content headers, lists, and paragraphs. Use when styling content text, creating text hierarchies, or the user mentions "make a nice heading" or "style the page text".
→ sgds-templates — Ready-made full-page layouts: dashboard, login, form page, list page, settings. Start here when a user asks to build a complete page.
→ sgds-forms — Form submission, constraint validation, , , and . Read when any with SGDS components is involved.
hasFeedbacksetInvalidFormData<form>→ sgds-blocks — 用于页面区块和布局的可复用UI区块。包括:英雄区、CTA、功能区块、卡片网格、数据统计展示、页面头部、筛选器、表单、详情卡片、应用框架及自定义区块。当用户要求构建着陆页、仪表盘、特定页面区块(如“我需要一个呼叫行动区”)或任何页面布局时,请从此处开始。
→ sgds-patterns — 用于保持文本样式一致性的排版和文本模式:标题、展示文本、内容标题、列表及段落。当设置内容文本样式、创建文本层级,或用户提及“制作美观的标题”“设置页面文本样式”时使用。
→ sgds-templates — 现成的完整页面布局:仪表盘、登录页、表单页、列表页、设置页。当用户要求构建完整页面时,请从此处开始。
→ sgds-forms — 表单提交、约束验证、、及。当涉及使用SGDS组件的表单时,请阅读此文档。
hasFeedbacksetInvalidFormData<form>Stage 4 — Data Visualisation (if charts or dashboards are needed)
阶段4 — 数据可视化(需要图表或仪表盘时)
→ Read sgds-data-visualisation
Covers ECharts setup and applying the SGDS colour palette to charts. Only needed if the app includes charts, graphs, or data dashboards.
→ 阅读 sgds-data-visualisation
涵盖ECharts设置及为图表应用SGDS配色方案。仅当应用包含图表、图形或数据仪表盘时需要。
Existing Application
现有应用
Do not re-read setup skills. Go directly to the skill that covers the current task.
Quick check — if utilities or components look broken, verify setup is complete before anything else:
- →
themes/day.css→css/sgds.cssimported in that order in the main CSS filecss/utility.css - is processed by Tailwind (not imported as a plain JS import)
utility.css - present in the JS entry point
import "@govtechsg/sgds-web-component"
If setup is confirmed correct, navigate using the table below.
无需重新阅读设置类技能。直接跳转到涵盖当前任务的技能即可。
快速排查——若工具类或组件显示异常,请先确认设置是否完整:
- 主CSS文件中按→
themes/day.css→css/sgds.css的顺序导入css/utility.css - 由Tailwind处理(而非作为普通JS导入)
utility.css - JS入口文件中存在
import "@govtechsg/sgds-web-component"
若确认设置无误,请根据下表导航。
Skill Map — What to Read for Each Task
技能映射表——不同任务对应的技能
| What you need to do | Skill to read |
|---|---|
| Set up a new SGDS project from scratch | sgds-getting-started |
Use any | sgds-components |
| Apply spacing, colors, typography, layout utilities | sgds-utilities |
| Structure the app shell (masthead, mainnav, footer, containers) | Application Shell |
| Change brand color, enable dark mode, change font | sgds-theming |
| Build page sections: hero, CTA, cards, feature, stats, filter, form, or custom blocks | sgds-blocks |
| Style text: headings, display text, lists, paragraphs | sgds-patterns |
| Build a full page (dashboard, login, list, form, settings) | sgds-templates |
Add form validation, read FormData, use | sgds-forms |
| Add charts, graphs, or data dashboards | sgds-data-visualisation |
| 你需要完成的任务 | 需阅读的技能 |
|---|---|
| 从零开始搭建新的SGDS项目 | sgds-getting-started |
使用任何 | sgds-components |
| 应用间距、颜色、排版、布局工具类 | sgds-utilities |
| 构建应用框架(页头、主导航、页脚、容器) | Application Shell |
| 修改品牌颜色、启用暗黑模式、更换字体 | sgds-theming |
| 构建页面区块:英雄区、CTA、卡片、功能区、数据统计、筛选器、表单或自定义区块 | sgds-blocks |
| 设置文本样式:标题、展示文本、列表、段落 | sgds-patterns |
| 构建完整页面(仪表盘、登录页、列表页、表单页、设置页) | sgds-templates |
添加表单验证、读取FormData、使用 | sgds-forms |
| 添加图表、图形或数据仪表盘 | sgds-data-visualisation |
For AI Agents
针对AI Agent的说明
- When a user says "I'm building a new SGDS app" or "where do I start", always begin with sgds-getting-started (Stage 1) before reading any other skill.
- During Stage 2, do not read all three skills upfront — read sgds-components when a component is needed and sgds-utilities when styling/layout is needed. They are references, not sequential reads.
- sgds-theming is part of Stage 2 — read it concurrently with components and utilities when branding, dark mode, or font customisation is needed. Do not treat it as a separate sequential step.
- sgds-blocks and sgds-patterns are concurrent Stage 3 skills — read them as needed based on user requests (blocks for page sections, patterns for text styling).
- sgds-templates and sgds-blocks can be used independently or together — a user may need one, both, or neither depending on how far along they are.
- sgds-forms is only needed when a element is involved. Do not proactively read it for non-form UIs.
<form> - sgds-data-visualisation is only needed when charts or graphs are explicitly requested.
- For existing apps, use the Skill Map table to navigate directly. Do not re-read sgds-getting-started unless there is a setup problem.
- If a user's request does not clearly match any skill, read this workflow skill first to orient, then navigate to the appropriate skill.
- Never use attributes or inline CSS. All styling must be applied via
styleattributes usingclassutility classes from sgds-utilities. Writingsgds:whenstyle="margin-top: 16px"exists is a violation.sgds:mt-4
- 当用户说“我正在构建新的SGDS应用”或“我该从哪里开始”时,务必先从sgds-getting-started(阶段1)开始,再阅读其他技能。
- 在阶段2,无需预先阅读全部三个技能——需要组件时阅读sgds-components,需要样式/布局时阅读sgds-utilities。它们是参考文档,而非按顺序阅读的内容。
- sgds-theming属于阶段2的内容——当需要品牌定制、暗黑模式或字体自定义时,可结合组件和工具类技能同步阅读。不要将其视为单独的顺序步骤。
- sgds-blocks和sgds-patterns是阶段3的并行技能——根据用户需求按需阅读(区块用于页面部分,模式用于文本样式)。
- sgds-templates和sgds-blocks可独立使用或结合使用——用户可能需要其中一个、两个都需要,或都不需要,具体取决于开发进度。
- sgds-forms仅在涉及元素时需要。不要为非表单UI主动阅读此技能。
<form> - sgds-data-visualisation仅在明确要求图表或图形时需要。
- 对于现有应用,请使用技能映射表直接导航。除非存在设置问题,否则无需重新阅读sgds-getting-started。
- 如果用户的请求与任何技能都不明确匹配,请先阅读此工作流技能以明确方向,再导航到合适的技能。
- 切勿使用属性或内联CSS。所有样式必须通过
style属性使用sgds-utilities中的class工具类来应用。当sgds:可用时,编写sgds:mt-4属于违规操作。style="margin-top: 16px"