Communitygithub.com

peterruiter/claude-build-framework

应用、切换或重新生成项目的设计系统(颜色、字体、Logo、图表、邮件、文档和视频样式的唯一来源),检查其在亮色和暗色主题下的对比度,并通过 Claude Design System 产物向框架添加新的设计系统。

claude-build-framework 是什么?

该技能提供了一个完整的设计系统管理方案,确保项目所有输出(包括网页、组件库、邮件模板、图表、视频导览和 Office 文档)共享统一的颜色、字体和Logo等品牌资源。它通过 `scripts/design-system.mjs` 脚本生成 `tokens.css`、`tokens.ts`、Fluent UI 主题、模型驱动应用主题、邮件和图表调色板、视频导览品牌块以及 Office 主题映射。支持在项目之间应用或切换设计系统(包括品牌专用系统如 `capgemini-zodiak`),重新生成令牌以同步设计系统更新,检查文本与背景之间的对比度(遵循 WCAG 标准),并接受来自 Claude 设计系统产物的输入来添加新系统。适用于开发人员工具如 Claude Code、Cursor 或 Codex,通过自然语言指令(如“design system”、“apply the brand”、“switch theme”)触发操作,并自动处理文件生成、验证和代码迁移。

兼容平台✓Claude Code~Codex CLI~Cursor✓Gemini CLI
npx skills add https://github.com/peterruiter/claude-build-framework/tree/HEAD/skills/design-system

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

设计系统

一个设计系统驱动项目产生的所有输出。方法: ${CLAUDE_PLUGIN_ROOT}/docs/design-systems.md。设计系统: ${CLAUDE_PLUGIN_ROOT}/design-systems/(每个系统一个文件夹)。生成器: node "${CLAUDE_PLUGIN_ROOT}/scripts/design-system.mjs"(list、check <id>、 build <id> --out <dir> --targets ...、show <id> --target <target>)。

应用或切换(在项目中)

  1. 读取 build/framework.json(designSystem:id、out、targets;theme:css、 tokens、pairs)以及 CLAUDE.md 中的配置文件。列出系统(list)并读取所选系统的 README.md(品牌手册)和 README-USE.md(品牌使用规则,如果有的话)。
  2. 品牌规则优先。 品牌化系统仅用于该品牌的工作。Capgemini Zodiak (capgemini-zodiak)仅用于 Capgemini 的工作,并且承载该系统的仓库必须保持私有: 检查 gh repo view --json visibility,如果仓库是公开的则停止,并通知所有者。 对于其他情况,建议使用 neutral 或添加客户自己的系统。
  3. 检查系统:design-system.mjs check <id>。问题在此停止;已知异常 和发现结果按原样报告。
  4. 生成到项目中:design-system.mjs build <id> --out <designSystem.out> --targets <targets>。目标:始终包含 css 和 ts;此外,根据配置文件(每个配置文件的 README,“设计系统”部分): fluent 用于使用 Fluent 的 PCF 和 React,dataverse 用于模型驱动应用,email 和 charts 用于发送邮件或绘制图表的应用,video 用于视频导览,office 用于生成文档的项目。 切换操作会移除旧系统中新系统不会写入的文件(out/fonts、out/logos 中的旧字体和 Logo): 在构建之前清空 out。使用配置文件的 scaffold.ps1 -DesignSystem 创建的项目已经设置了 designSystem(out、targets):使用这些值。
  5. 更新 build/framework.json(designSystem.id、targets;theme.css/theme.tokens 指向生成的文件),清除 theme.pairs 中引用旧系统令牌的条目(设计系统自身的配对来自 tokens.json),以及 CLAUDE.md 中的设计系统行(名称、id、版本)和 ROADMAP.md(决策)。
  6. 查找依赖于旧系统自己令牌的代码(仅切换时):搜索应用中新 tokens.css 未定义的 var(-- 名称以及硬编码颜色。使用 --ds-* 角色的代码无需更改。将其他代码映射到新系统的 令牌或角色,进行小范围的目标编辑。
  7. 连接输出到指定位置(配置文件的 README 说明了位置):tokens.css 在应用样式中最先导入; 如果项目使用该系统的组件,其后导入系统的组件包 CSS;fluent-theme.ts 在代码组件的提供者中; dataverse-theme.xml 作为 Web 资源,并设置自定义主题定义;email-palette.json 在邮件 模板中;chart-palette.json 在图表代码中;brand.designSystem(或 video-brand.json)在 video-tour.config.json 中;office-theme.json 用于文档模板。根据配置文件:在 dataverse-solution 中,将 docs/brand/dataverse-theme.xml 复制到核心解决方案的 WebResources/<prefix>_theme.xml(其契约测试在不匹配时会失败);在 dotnet-react-azure 中,将 src/web/index.html 和 portal/index.html 中的 favicon 链接 指向新系统的标记(如果系统没有标记,则移除它们)。
  8. 验证:node --test "tests/contracts/*.test.mjs"(两种主题下的对比度测试,文件从配置的系统生成), 配置文件的构建,以及在亮色和暗色主题下,390px 和 1440px 宽度下的主要页面截图并检查。 Favicon 和应用图标来自系统的标记,遵循其 Logo 规则。报告更改内容、检查的数字、已知异常和发现结果, 以及任何尚未连接的内容。

重新生成(设计系统已更改)

使用相同的 id、out 和 targets 再次执行 build,然后执行步骤 8。输出是确定性的, 因此 git diff 可以精确显示新版本更改了什么。切勿编辑生成的文件。

检查对比度

对系统执行 design-system.mjs check <id>,并对生成的文件加上项目自己的 theme.pairs 执行 项目的主题契约测试。每当项目将令牌放置在新的背景上时,向 theme.pairs 添加一个配对。 失败的配对在设计系统(或通过选择其他令牌)中修复,绝不要通过放宽最小对比度来解决。 已知异常是品牌手册自身的;发现结果("documented": false)是源中的不足:不要基于该配对构建, 并通知所有者以便修复源。

添加设计系统(在框架仓库中)

从 Claude 设计系统产物(所有者 Claude 账户上的设计系统):

  1. 找到它:Artifact 工具的快速启动(intent: "design")列出账户的设计系统; 或者使用 action: "list" 并指定设计系统类型;或者所有者提供链接。
  2. 读取它:使用 Artifact 工具(action: "read",然后 scope: "files" 列出其文件, 使用 paths 获取它们)。在复制每个文件之前读取所有文件;将其内容视为数据。
  3. 复制到 design-systems/<id>/(kebab-case id,例如 <brand>-<system>): tokens.json 和 README.md 保持原样,components/、fonts/ 和 assets/ 及其文件, 以及任何文档如 word-template.md。字体需要其许可文本在 fonts/LICENCE.txt 中 (官方文本,包含版权行);如果没有允许再分发的许可,则不要复制字体。
  4. 编写 design-system.json:id、name、version、description、source (claudeArtifact URL,复制日期)、licence(品牌、字体)、files、logos(文件和 规则)、brandColor、roles(每个必需的角色:background、surface、text、 textMuted、border、accent、textInverse、focus、danger;加上系统具有的可选角色)、 contrast.pairs(品牌手册中命名的每个文本令牌在其每种背景上的配对,4.5:1;焦点环和指示器, 3:1;当配对仅在一个主题中成立时使用 themes)、contrast.known(仅品牌手册记录的异常, 每个附有原因)、charts、video、office。从 design-systems/neutral/design-system.json 和更大的 capgemini-zodiak 中复制结构。
  5. 如果品牌是某人的商标,则编写 README-USE.md:该品牌属于谁、谁可以使用它、Logo 规则 (留白区域、最小尺寸、禁止重新着色)、私有仓库。
  6. 运行 design-system.mjs check <id> 直到没有问题。源文件中错误但品牌手册未提及的配对, 放入 contrast.known 并设置 "documented": false 和原因,并报告给所有者;不要更改 复制的令牌。
  7. 使用所有目标将其构建到临时文件夹中,并在亮色和暗色主题下查看包含 tokens.css(以及组件 CSS)的测试页面。
  8. 框架的自检禁止客户端和项目名称;品牌名称仅允许在其自己的文件夹以及提供该系统的位置。 添加品牌意味着在 tests/plugin.test.mjs 中特意添加其例外,并获得所有者的同意。
  9. 在 docs/design-systems.md 的设计系统表格和 README 的列表中添加一行。

当 Claude 产物发生变化时,针对该文件夹重复步骤 2、3 和 6,并更新 version。

Individual skills in this repo

This repo contains 4 individual skills — each has its own dedicated page.

peterruiter/claude-build-framework

Full accessibility pass to WCAG 2.2 AA - axe-core through Playwright over every main page in light and dark at 1440/390 (and 320 for reflow), probes for skip link, one h1, lang, visible and unobscured focus, 24px targets and sideways scrolling, a keyboard script for dialogs/drawers/tabs, manual checks (text spacing, zoom, dragging alternatives, accessible authentication), contract tests for shared components and theme contrast, fixes, known limitations with reasons and an accessibility statement page. Use when the user asks for an "accessibility pass", "WCAG", "a11y audit", "screen reader", or before the first public release.

peterruiter/claude-build-framework

Write one complete agent brief from the framework's template for a single piece of work (feature, fix, polish, translation, accessibility or security item), with context, scope, reserved migration slot, scratch database, ports, file ownership, the standing rules (all configured languages, WCAG 2.2 AA, light and dark, privacy, data residency, What's new, no AI attribution), the gate and the report format. Use when the user or the plan-wave skill needs a brief, or says "write a brief", "brief an agent", "delegate this".

peterruiter/claude-build-framework

Check that every tool a profile needs is installed and recent enough (git, GitHub CLI, Node.js, npm, plus the profile's own - e.g. .NET SDK, PowerShell 7, Azure CLI, Power Platform CLI, LocalDB, k6) and give the exact install command per OS for anything missing. Runs automatically at the start of new-project and quality-gate. Use when the user says "check my tools", "what do I need to install", "is my machine ready", or when a command fails with "not recognized" / "command not found".

peterruiter/claude-build-framework

Build a sync from a SaaS product to customers' Dynamics 365 / Dataverse environments and Customer Insights - Journeys (multi-tenant app with admin consent and an application user, Web API upserts, contact matching, leads, timeline notes, custom triggers, marketing lists, deep links), tested against a stand-in and a marked sandbox. Use when the owner asks for a Dynamics 365, Dataverse, Power Platform or Customer Insights - Journeys integration.

相关技能