xinetzone/SpecWeave / .agents/skills/design-library-creator
design-library-creator
FlaggedCreate, expand, and refine professional Design Libraries / Design Systems with structured token architecture. ONLY invoke when user EXPLICITLY mentions design-system terminology: 'Design Library', 'Design System', '设计系统', '设计库', 'token system', 'design tokens', '组件库规范', or provides a parsed design-spec bundle (ZIP/Figma export). Also covers creating a new theme / color theme as a design-system deliverable (创建主题/新建暖色主题/深色主题等 — tokens + palette + component styling). Do NOT route here for: '素材库', '全套素材', '素材合集', '物料库', '生成素材', '做一套设计', '做几张图', '设计一套页面', '帮我出图', page/poster/landing-page creation, or any visual-asset generation intent where the user does not demonstrate knowledge of design-system concepts. Those belong to solo-design.
workflows/generate-additional-kit.md
View on GitHub# Generate Additional Kit Type
> Read when: User asks to add a new kit type to an existing Library (e.g., "add a website kit" when only an app kit exists).
## Prerequisites
- Existing Library with `colors_and_type.css` and `css.json`
- Preferred: `components/_evidence/index.json` and `uikit-plan.json`
- At least one kit already generated in `ui_kits/`
### TodoWrite Policy (per SKILL.md invariant #12)
HARD CAP = 2. Allowed positions: ① after kit type is confirmed, ② before final validation. Never standalone — always batch with the next action.
## Flow
### Step 1 — Analyze Existing Library (Main Agent)
1. Confirm `css.json` exists — pass it as the token understanding source
2. Read existing `ui_kits/*/index.html` — understand current kit scope and screens
3. Resolve ComponentContractFiles for the kit sub-agent: if `components/_evidence/index.json` exists, pass evidence index and relevant evidence files; otherwise pass `components/index.json` and relevant `components/{slug}.json` files
4. Read only the relevant `README.md` brand summary and file index, or pass the README path if the sub-agent can read files
5. Determine new kit type from user request
### Step 2 — Generate New Kit (Sub-Agent ×1)
```
Task: Generate interactive UI Kit (type: {newKitType}).
Output:
- ui_kits/{newKitType}/index.html
OutputDir: {output_dir}
OutputFileRel:
- ui_kits/{newKitType}/index.html
OutputFileAbs:
- {output_dir}/ui_kits/{newKitType}/index.html
Constraint files (MUST read before execution):
- {SKILL_DIR}/file-specs/ui-kit.md — React 18 standalone, screens
- {SKILL_DIR}/file-specs/design-library-output.md — Overall library structure
Input data:
- CSSFile: {output_dir}/colors_and_type.css
- CSSLink: "../../colors_and_type.css"
- READMEFile: {output_dir}/README.md
- ComponentEvidenceIndexFile: optional {output_dir}/components/_evidence/index.json
- ComponentContractFiles: {output_dir}/components/{slug}.json when exists; else {output_dir}/components/_evidence/{slug}.json — resolve per component
- ComponentIndexFile: {output_dir}/components/index.json when no per-component files exist
- UIKitPlanFile: {output_dir}/uikit-plan.json if present
- KitType: {newKitType}
- OutputFileRel: ui_kits/{newKitType}/index.html (return contract only)
- OutputFileAbs: {output_dir}/ui_kits/{newKitType}/index.html (physical Write target)
Write rule:
- Write to OutputFileAbs exactly.
- Do NOT write relative `ui_kits/{newKitType}/index.html`; that path is only for reported writtenFiles.
ReturnReportFileAbs: {tmp_dir}/agent-reports/additional-kit-{newKitType}.json
Report file format:
- writtenFiles: ["ui_kits/{newKitType}/index.html"]
- stats: { screensGenerated: 3, componentsUsed: N }
- warnings: string[]
Final response:
已完成 UI Kit。
```
### Step 3 — Update Documentation (Sub-Agent ×1)
Dispatch a documentation update sub-agent. Main Agent must not directly rewrite `README.md`.
```
Task: Update Design Library README after adding "{newKitType}" kit.
Output:
- README.md
Constraint files (MUST read before execution):
- {SKILL_DIR}/file-specs/documentation.md — README structure and content requirements
- {SKILL_DIR}/file-specs/design-library-output.md — Output directory structure and file roles
Input data:
- Existing README file index and brand summary: {relevant README excerpt}
- New kit files:
- ui_kits/{newKitType}/index.html
- New kit summary: {screensGenerated, componentsUsed, kitType}
- Do NOT modify SKILL.md (it's a short gateway, kit-type agnostic)
- OutputDir: {library output root path}
- ReturnReportFileAbs: {tmp_dir}/agent-reports/additional-kit-readme.json
Report file format:
- writtenFiles: ["README.md"]
- warnings: string[]
Final response:
已完成设计系统说明。
```
### Step 4 — Quality Gate (Main Agent)
From `operation-policies/quality-gates.md`, verify:
- **Gate 1** (Structure): new kit files exist at expected paths
- Main Agent MUST check `path.join(OutputDir, OutputFileRel)` / `OutputFileAbs`; do not trust reported `writtenFiles` as proof of physical output.
- **Gate 2** (CSS Reference): new index.html links `../../colors_and_type.css`
> Note: Screen count and visual quality are NOT blocking gates (see quality-gates.md Gate 4). The validator checks structural correctness only.
## Constraints
- Do NOT modify `colors_and_type.css`
- Do NOT regenerate existing kits or preview pages
- New kit MUST reuse the same token system
- New kit MUST use `<link rel="stylesheet" href="../../colors_and_type.css">` for tokens
- When component evidence exists, new kit MUST read the evidence ComponentContractFiles and MUST NOT read full component JSON during normal generation
- New kit MUST NOT invent component families absent from `components/_evidence/index.json` when evidence exists; otherwise use `components/index.json` as the allowed family list unless user explicitly requests inference mode
- Brand language and visual tone must be consistent with existing Library
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation). | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK). | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |