claude-design-system-hooks
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseClaude Design System Hooks
Claude Design System Hooks
What This Project Does
项目功能介绍
Claude Design System Hooks is a neuro-adaptive design orchestration engine that transforms natural language descriptions into production-ready UI code. It bridges Claude AI's cognitive capabilities with multi-framework code generation, allowing you to create entire design systems, component libraries, and responsive UI patterns through conversational prompts.
Key capabilities:
- Design-as-Dialogue: Describe UIs in natural language, get framework-specific code
- Multi-Framework Output: Generate identical designs in React, Vue, Angular, or vanilla HTML/CSS
- Design Token Extraction: Automatically parse color palettes, typography, spacing from specs
- Accessibility-First: Built-in WCAG 2.2 compliance checks during generation
- Plugin Ecosystem: Extend with Figma sync, Storybook integration, A11y auditing
Claude Design System Hooks是一款神经自适应设计编排引擎,可将自然语言描述转换为可投入生产的UI代码。它将Claude AI的认知能力与多框架代码生成能力相结合,让你通过对话式提示创建完整的设计系统、组件库和响应式UI模式。
核心功能:
- 对话式设计:用自然语言描述UI,生成特定框架的代码
- 多框架输出:在React、Vue、Angular或原生HTML/CSS中生成相同设计
- 设计令牌提取:自动从规格中解析调色板、排版、间距
- 无障碍优先:生成过程中内置WCAG 2.2合规性检查
- 插件生态:可通过Figma同步、Storybook集成、无障碍审计等功能扩展
Installation
安装
Prerequisites
前置要求
bash
undefinedbash
undefinedRequires Node.js 18.x or higher
Requires Node.js 18.x or higher
node --version # should be >= 18.0.0
node --version # should be >= 18.0.0
Requires npm 10.x or higher
Requires npm 10.x or higher
npm --version # should be >= 10.0.0
undefinednpm --version # should be >= 10.0.0
undefinedBasic Installation
基础安装
bash
undefinedbash
undefinedClone the repository
Clone the repository
git clone https://github.com/BharathKumarSuresh/claude-design-system-hooks.git
cd claude-design-system-hooks
git clone https://github.com/BharathKumarSuresh/claude-design-system-hooks.git
cd claude-design-system-hooks
Install core dependencies
Install core dependencies
npm install @claude-design/core @claude-design/cli
npm install @claude-design/core @claude-design/cli
Configure with your Claude API key
Configure with your Claude API key
claude-design configure --api-key $CLAUDE_API_KEY
claude-design configure --api-key $CLAUDE_API_KEY
Verify installation
Verify installation
claude-design --version
undefinedclaude-design --version
undefinedDocker Installation
Docker安装
bash
undefinedbash
undefinedPull official image
Pull official image
docker pull claude-design-engine:2026-stable
docker pull claude-design-engine:2026-stable
Run containerized
Run containerized
docker run -p 3000:3000
-e CLAUDE_API_KEY=$CLAUDE_API_KEY
claude-design-engine:2026-stable
-e CLAUDE_API_KEY=$CLAUDE_API_KEY
claude-design-engine:2026-stable
undefineddocker run -p 3000:3000
-e CLAUDE_API_KEY=$CLAUDE_API_KEY
claude-design-engine:2026-stable
-e CLAUDE_API_KEY=$CLAUDE_API_KEY
claude-design-engine:2026-stable
undefinedConfiguration
配置
Profile Configuration File
配置文件
Create in your project root:
.claude-design.jsonjson
{
"profile": {
"name": "my-design-profile",
"version": "2026.3",
"preferences": {
"framework": "react",
"version": "18.x",
"styling": "tailwind",
"component_library": "shadcn-ui",
"responsive_breakpoints": ["sm", "md", "lg", "xl", "2xl"],
"accessibility_level": "wcag_22_aa",
"code_style": "typescript_strict"
},
"design_tokens": {
"primary": "#6366f1",
"secondary": "#8b5cf6",
"accent": "#f59e0b",
"neutral": "#64748b",
"spacing_scale": [4, 8, 12, 16, 24, 32, 48, 64, 96],
"border_radius": {
"sm": 4,
"md": 8,
"lg": 12,
"xl": 16
}
},
"plugins": [
{
"name": "a11y-auditor",
"enabled": true,
"config": {
"strict_mode": true,
"auto_fix": false
}
}
]
}
}在项目根目录创建 :
.claude-design.jsonjson
{
"profile": {
"name": "my-design-profile",
"version": "2026.3",
"preferences": {
"framework": "react",
"version": "18.x",
"styling": "tailwind",
"component_library": "shadcn-ui",
"responsive_breakpoints": ["sm", "md", "lg", "xl", "2xl"],
"accessibility_level": "wcag_22_aa",
"code_style": "typescript_strict"
},
"design_tokens": {
"primary": "#6366f1",
"secondary": "#8b5cf6",
"accent": "#f59e0b",
"neutral": "#64748b",
"spacing_scale": [4, 8, 12, 16, 24, 32, 48, 64, 96],
"border_radius": {
"sm": 4,
"md": 8,
"lg": 12,
"xl": 16
}
},
"plugins": [
{
"name": "a11y-auditor",
"enabled": true,
"config": {
"strict_mode": true,
"auto_fix": false
}
}
]
}
}Environment Variables
环境变量
bash
undefinedbash
undefinedRequired
Required
export CLAUDE_API_KEY="your-claude-api-key"
export CLAUDE_API_KEY="your-claude-api-key"
Optional - for hybrid AI workflows
Optional - for hybrid AI workflows
export OPENAI_API_KEY="your-openai-api-key"
export OPENAI_API_KEY="your-openai-api-key"
Optional - configure output directory
Optional - configure output directory
export CLAUDE_DESIGN_OUTPUT_DIR="./generated-components"
undefinedexport CLAUDE_DESIGN_OUTPUT_DIR="./generated-components"
undefinedKey Commands
核心命令
Interactive Mode
交互模式
bash
undefinedbash
undefinedStart conversational design session
Start conversational design session
claude-design interact --profile my-design-profile
claude-design interact --profile my-design-profile
With custom framework
With custom framework
claude-design interact --framework vue --styling scss
claude-design interact --framework vue --styling scss
With accessibility constraints
With accessibility constraints
claude-design interact --accessibility wcag-22-aaa
undefinedclaude-design interact --accessibility wcag-22-aaa
undefinedBatch Generation
批量生成
bash
undefinedbash
undefinedGenerate from YAML specification
Generate from YAML specification
claude-design generate
--input ./design-specs/dashboard.yaml
--output ./src/components
--framework react
--styling tailwind
--include-tests
--include-stories
--input ./design-specs/dashboard.yaml
--output ./src/components
--framework react
--styling tailwind
--include-tests
--include-stories
claude-design generate
--input ./design-specs/dashboard.yaml
--output ./src/components
--framework react
--styling tailwind
--include-tests
--include-stories
--input ./design-specs/dashboard.yaml
--output ./src/components
--framework react
--styling tailwind
--include-tests
--include-stories
Generate from Figma export
Generate from Figma export
claude-design generate
--input ./figma-export.json
--output ./components
--framework angular
--accessibility wcag-22-aa
--input ./figma-export.json
--output ./components
--framework angular
--accessibility wcag-22-aa
claude-design generate
--input ./figma-export.json
--output ./components
--framework angular
--accessibility wcag-22-aa
--input ./figma-export.json
--output ./components
--framework angular
--accessibility wcag-22-aa
Generate entire design system
Generate entire design system
claude-design generate
--input ./design-system-spec.yaml
--output ./design-system
--framework react
--include-tokens
--include-docs
--verbose
--input ./design-system-spec.yaml
--output ./design-system
--framework react
--include-tokens
--include-docs
--verbose
undefinedclaude-design generate
--input ./design-system-spec.yaml
--output ./design-system
--framework react
--include-tokens
--include-docs
--verbose
--input ./design-system-spec.yaml
--output ./design-system
--framework react
--include-tokens
--include-docs
--verbose
undefinedComponent Generation
组件生成
bash
undefinedbash
undefinedGenerate single component
Generate single component
claude-design component create
--name ProductCard
--description "Card displaying product image, title, price, and add-to-cart button"
--framework react
--output ./src/components/ProductCard
--name ProductCard
--description "Card displaying product image, title, price, and add-to-cart button"
--framework react
--output ./src/components/ProductCard
claude-design component create
--name ProductCard
--description "Card displaying product image, title, price, and add-to-cart button"
--framework react
--output ./src/components/ProductCard
--name ProductCard
--description "Card displaying product image, title, price, and add-to-cart button"
--framework react
--output ./src/components/ProductCard
Generate with props specification
Generate with props specification
claude-design component create
--name DataTable
--props-file ./specs/datatable-props.json
--framework vue
--with-types
--name DataTable
--props-file ./specs/datatable-props.json
--framework vue
--with-types
undefinedclaude-design component create
--name DataTable
--props-file ./specs/datatable-props.json
--framework vue
--with-types
--name DataTable
--props-file ./specs/datatable-props.json
--framework vue
--with-types
undefinedDesign Token Management
设计令牌管理
bash
undefinedbash
undefinedExtract tokens from image/mockup
Extract tokens from image/mockup
claude-design tokens extract
--input ./mockups/homepage.png
--output ./tokens/design-tokens.json
--input ./mockups/homepage.png
--output ./tokens/design-tokens.json
claude-design tokens extract
--input ./mockups/homepage.png
--output ./tokens/design-tokens.json
--input ./mockups/homepage.png
--output ./tokens/design-tokens.json
Generate CSS/SCSS variables from tokens
Generate CSS/SCSS variables from tokens
claude-design tokens generate
--input ./tokens/design-tokens.json
--format css-variables
--output ./styles/tokens.css
--input ./tokens/design-tokens.json
--format css-variables
--output ./styles/tokens.css
claude-design tokens generate
--input ./tokens/design-tokens.json
--format css-variables
--output ./styles/tokens.css
--input ./tokens/design-tokens.json
--format css-variables
--output ./styles/tokens.css
Validate token consistency
Validate token consistency
claude-design tokens validate ./tokens/*.json
undefinedclaude-design tokens validate ./tokens/*.json
undefinedPlugin Management
插件管理
bash
undefinedbash
undefinedList available plugins
List available plugins
claude-design plugins list
claude-design plugins list
Install plugin
Install plugin
claude-design plugins install @claude-design/figma-sync
claude-design plugins install @claude-design/figma-sync
Configure plugin
Configure plugin
claude-design plugins configure figma-sync
--token $FIGMA_TOKEN
--sync-mode bidirectional
--token $FIGMA_TOKEN
--sync-mode bidirectional
claude-design plugins configure figma-sync
--token $FIGMA_TOKEN
--sync-mode bidirectional
--token $FIGMA_TOKEN
--sync-mode bidirectional
Browse marketplace
Browse marketplace
claude-design marketplace browse --category animation
claude-design marketplace browse --category animation
Install community skill
Install community skill
claude-design marketplace install @community/lottie-animator
undefinedclaude-design marketplace install @community/lottie-animator
undefinedUsage Patterns
使用模式
Pattern 1: Natural Language Component Generation
模式1:自然语言组件生成
javascript
// In your Node.js script or AI agent workflow
const { ClaudeDesign } = require('@claude-design/core');
const designer = new ClaudeDesign({
apiKey: process.env.CLAUDE_API_KEY,
framework: 'react',
styling: 'tailwind'
});
async function generateLoginForm() {
const result = await designer.generate({
prompt: `Create a modern login form with:
- Email and password fields
- Remember me checkbox
- Forgot password link
- Social login buttons (Google, GitHub)
- Dark theme with purple accent
- Fully accessible with keyboard navigation`,
options: {
includeTests: true,
includeStorybook: true,
accessibility: 'wcag-22-aa'
}
});
console.log('Generated files:', result.files);
// Writes to ./src/components/LoginForm/
await result.save('./src/components/LoginForm');
}
generateLoginForm();javascript
// In your Node.js script or AI agent workflow
const { ClaudeDesign } = require('@claude-design/core');
const designer = new ClaudeDesign({
apiKey: process.env.CLAUDE_API_KEY,
framework: 'react',
styling: 'tailwind'
});
async function generateLoginForm() {
const result = await designer.generate({
prompt: `Create a modern login form with:
- Email and password fields
- Remember me checkbox
- Forgot password link
- Social login buttons (Google, GitHub)
- Dark theme with purple accent
- Fully accessible with keyboard navigation`,
options: {
includeTests: true,
includeStorybook: true,
accessibility: 'wcag-22-aa'
}
});
console.log('Generated files:', result.files);
// Writes to ./src/components/LoginForm/
await result.save('./src/components/LoginForm');
}
generateLoginForm();Pattern 2: Design System Specification
模式2:设计系统规格
yaml
undefinedyaml
undefineddesign-system-spec.yaml
design-system-spec.yaml
system:
name: "Corporate Design System"
version: "1.0.0"
framework: "react"
styling: "tailwind"
tokens:
colors:
primary: "#0066cc"
secondary: "#6b7280"
accent: "#f59e0b"
success: "#10b981"
error: "#ef4444"
warning: "#f59e0b"
typography:
scale: "major-third"
base_size: 16
fonts:
heading: "Inter, sans-serif"
body: "Inter, sans-serif"
mono: "Fira Code, monospace"
spacing:
unit: 4
scale: [1, 2, 3, 4, 6, 8, 12, 16, 24, 32]
breakpoints:
sm: 640
md: 768
lg: 1024
xl: 1280
"2xl": 1536
components:
-
name: "Button" variants: ["primary", "secondary", "outline", "ghost"] sizes: ["sm", "md", "lg"] states: ["default", "hover", "active", "disabled"]
-
name: "Card" props:
- name: "variant" type: "string" values: ["default", "bordered", "elevated"]
- name: "padding" type: "spacing" default: 4
-
name: "Modal" features: ["backdrop", "close-button", "keyboard-escape"] accessibility: "wcag-22-aa"
pages:
- name: "Dashboard" layout: "sidebar-content" components: ["StatCard", "DataTable", "ChartWidget"]
```bashsystem:
name: "Corporate Design System"
version: "1.0.0"
framework: "react"
styling: "tailwind"
tokens:
colors:
primary: "#0066cc"
secondary: "#6b7280"
accent: "#f59e0b"
success: "#10b981"
error: "#ef4444"
warning: "#f59e0b"
typography:
scale: "major-third"
base_size: 16
fonts:
heading: "Inter, sans-serif"
body: "Inter, sans-serif"
mono: "Fira Code, monospace"
spacing:
unit: 4
scale: [1, 2, 3, 4, 6, 8, 12, 16, 24, 32]
breakpoints:
sm: 640
md: 768
lg: 1024
xl: 1280
"2xl": 1536
components:
-
name: "Button" variants: ["primary", "secondary", "outline", "ghost"] sizes: ["sm", "md", "lg"] states: ["default", "hover", "active", "disabled"]
-
name: "Card" props:
- name: "variant" type: "string" values: ["default", "bordered", "elevated"]
- name: "padding" type: "spacing" default: 4
-
name: "Modal" features: ["backdrop", "close-button", "keyboard-escape"] accessibility: "wcag-22-aa"
pages:
- name: "Dashboard" layout: "sidebar-content" components: ["StatCard", "DataTable", "ChartWidget"]
```bashGenerate entire system
Generate entire system
claude-design generate
--input design-system-spec.yaml
--output ./design-system
--include-docs
--include-storybook
--input design-system-spec.yaml
--output ./design-system
--include-docs
--include-storybook
undefinedclaude-design generate
--input design-system-spec.yaml
--output ./design-system
--include-docs
--include-storybook
--input design-system-spec.yaml
--output ./design-system
--include-docs
--include-storybook
undefinedPattern 3: Programmatic API Usage
模式3:程序化API使用
typescript
// advanced-usage.ts
import { ClaudeDesign, DesignConfig } from '@claude-design/core';
import { FigmaSyncPlugin } from '@claude-design/figma-sync';
import { A11yAuditor } from '@claude-design/a11y-auditor';
const config: DesignConfig = {
apiKey: process.env.CLAUDE_API_KEY,
framework: 'react',
typescript: true,
styling: 'tailwind',
plugins: [
new FigmaSyncPlugin({
token: process.env.FIGMA_TOKEN,
fileKey: 'abc123def456'
}),
new A11yAuditor({
strictMode: true,
level: 'wcag-22-aaa'
})
]
};
const designer = new ClaudeDesign(config);
async function buildNavigationComponent() {
// Generate component from description
const nav = await designer.component.create({
name: 'MainNavigation',
description: `
Responsive navigation bar with:
- Logo on left
- Menu items in center
- User profile dropdown on right
- Mobile hamburger menu
- Sticky header on scroll
`,
responsive: true,
a11y: {
ariaLabels: true,
keyboardNav: true,
screenReader: true
}
});
// Audit accessibility
const auditResults = await designer.audit.a11y(nav.code);
console.log('Accessibility score:', auditResults.score);
// Generate tests
const tests = await designer.tests.generate(nav.code, {
framework: 'jest',
coverage: 'full'
});
// Save all artifacts
await nav.save('./src/components/MainNavigation', {
includeTests: true,
includeStorybook: true,
includeTypes: true
});
}
buildNavigationComponent();typescript
// advanced-usage.ts
import { ClaudeDesign, DesignConfig } from '@claude-design/core';
import { FigmaSyncPlugin } from '@claude-design/figma-sync';
import { A11yAuditor } from '@claude-design/a11y-auditor';
const config: DesignConfig = {
apiKey: process.env.CLAUDE_API_KEY,
framework: 'react',
typescript: true,
styling: 'tailwind',
plugins: [
new FigmaSyncPlugin({
token: process.env.FIGMA_TOKEN,
fileKey: 'abc123def456'
}),
new A11yAuditor({
strictMode: true,
level: 'wcag-22-aaa'
})
]
};
const designer = new ClaudeDesign(config);
async function buildNavigationComponent() {
// Generate component from description
const nav = await designer.component.create({
name: 'MainNavigation',
description: `
Responsive navigation bar with:
- Logo on left
- Menu items in center
- User profile dropdown on right
- Mobile hamburger menu
- Sticky header on scroll
`,
responsive: true,
a11y: {
ariaLabels: true,
keyboardNav: true,
screenReader: true
}
});
// Audit accessibility
const auditResults = await designer.audit.a11y(nav.code);
console.log('Accessibility score:', auditResults.score);
// Generate tests
const tests = await designer.tests.generate(nav.code, {
framework: 'jest',
coverage: 'full'
});
// Save all artifacts
await nav.save('./src/components/MainNavigation', {
includeTests: true,
includeStorybook: true,
includeTypes: true
});
}
buildNavigationComponent();Pattern 4: Design Token Extraction
模式4:设计令牌提取
javascript
const { TokenExtractor } = require('@claude-design/core');
async function extractFromMockup() {
const extractor = new TokenExtractor({
apiKey: process.env.CLAUDE_API_KEY
});
// Extract from image
const tokens = await extractor.fromImage('./mockups/homepage.png', {
extractColors: true,
extractTypography: true,
extractSpacing: true,
extractBorderRadius: true
});
console.log('Extracted tokens:', tokens);
/*
{
colors: {
primary: { hex: '#6366f1', name: 'Indigo' },
secondary: { hex: '#8b5cf6', name: 'Purple' },
accent: { hex: '#f59e0b', name: 'Amber' }
},
typography: {
headings: { family: 'Inter', weight: 700, scale: [32, 24, 20] },
body: { family: 'Inter', weight: 400, size: 16 }
},
spacing: [4, 8, 12, 16, 24, 32, 48],
borderRadius: { sm: 4, md: 8, lg: 12 }
}
*/
// Generate CSS variables
const css = await extractor.toCSS(tokens);
await fs.writeFile('./styles/tokens.css', css);
// Generate Tailwind config
const tailwindConfig = await extractor.toTailwind(tokens);
await fs.writeFile('./tailwind.config.js', tailwindConfig);
}
extractFromMockup();javascript
const { TokenExtractor } = require('@claude-design/core');
async function extractFromMockup() {
const extractor = new TokenExtractor({
apiKey: process.env.CLAUDE_API_KEY
});
// Extract from image
const tokens = await extractor.fromImage('./mockups/homepage.png', {
extractColors: true,
extractTypography: true,
extractSpacing: true,
extractBorderRadius: true
});
console.log('Extracted tokens:', tokens);
/*
{
colors: {
primary: { hex: '#6366f1', name: 'Indigo' },
secondary: { hex: '#8b5cf6', name: 'Purple' },
accent: { hex: '#f59e0b', name: 'Amber' }
},
typography: {
headings: { family: 'Inter', weight: 700, scale: [32, 24, 20] },
body: { family: 'Inter', weight: 400, size: 16 }
},
spacing: [4, 8, 12, 16, 24, 32, 48],
borderRadius: { sm: 4, md: 8, lg: 12 }
}
*/
// Generate CSS variables
const css = await extractor.toCSS(tokens);
await fs.writeFile('./styles/tokens.css', css);
// Generate Tailwind config
const tailwindConfig = await extractor.toTailwind(tokens);
await fs.writeFile('./tailwind.config.js', tailwindConfig);
}
extractFromMockup();Pattern 5: Multi-Framework Generation
模式5:多框架生成
javascript
const { ClaudeDesign } = require('@claude-design/core');
async function generateForAllFrameworks() {
const designer = new ClaudeDesign({
apiKey: process.env.CLAUDE_API_KEY
});
const description = `
Product card with image, title, price, rating stars,
and add-to-cart button. Include hover effects.
`;
// Generate React version
const reactComponent = await designer.generate({
prompt: description,
framework: 'react',
styling: 'tailwind',
typescript: true
});
await reactComponent.save('./output/react/ProductCard');
// Generate Vue version
const vueComponent = await designer.generate({
prompt: description,
framework: 'vue',
styling: 'scss',
composition: true
});
await vueComponent.save('./output/vue/ProductCard');
// Generate Angular version
const angularComponent = await designer.generate({
prompt: description,
framework: 'angular',
styling: 'scss',
standalone: true
});
await angularComponent.save('./output/angular/ProductCard');
// Generate vanilla HTML/CSS
const vanillaComponent = await designer.generate({
prompt: description,
framework: 'html',
styling: 'css',
modern: true
});
await vanillaComponent.save('./output/vanilla/ProductCard');
}
generateForAllFrameworks();javascript
const { ClaudeDesign } = require('@claude-design/core');
async function generateForAllFrameworks() {
const designer = new ClaudeDesign({
apiKey: process.env.CLAUDE_API_KEY
});
const description = `
Product card with image, title, price, rating stars,
and add-to-cart button. Include hover effects.
`;
// Generate React version
const reactComponent = await designer.generate({
prompt: description,
framework: 'react',
styling: 'tailwind',
typescript: true
});
await reactComponent.save('./output/react/ProductCard');
// Generate Vue version
const vueComponent = await designer.generate({
prompt: description,
framework: 'vue',
styling: 'scss',
composition: true
});
await vueComponent.save('./output/vue/ProductCard');
// Generate Angular version
const angularComponent = await designer.generate({
prompt: description,
framework: 'angular',
styling: 'scss',
standalone: true
});
await angularComponent.save('./output/angular/ProductCard');
// Generate vanilla HTML/CSS
const vanillaComponent = await designer.generate({
prompt: description,
framework: 'html',
styling: 'css',
modern: true
});
await vanillaComponent.save('./output/vanilla/ProductCard');
}
generateForAllFrameworks();Common Workflows
常见工作流
Workflow 1: Rapid Prototyping
工作流1:快速原型开发
bash
undefinedbash
undefinedStart interactive session
Start interactive session
claude-design interact --framework react --styling tailwind
claude-design interact --framework react --styling tailwind
Example conversation:
Example conversation:
You: "Create a landing page for a SaaS product"
You: "Create a landing page for a SaaS product"
Claude: [generates hero section, features grid, pricing table, CTA]
Claude: [generates hero section, features grid, pricing table, CTA]
You: "Make it dark theme with purple accent"
You: "Make it dark theme with purple accent"
Claude: [updates color scheme]
Claude: [updates color scheme]
You: "Add testimonials section"
You: "Add testimonials section"
Claude: [adds testimonial carousel]
Claude: [adds testimonial carousel]
Export when satisfied
Export when satisfied
Files saved to ./generated-components/
Files saved to ./generated-components/
undefinedundefinedWorkflow 2: Design System Migration
工作流2:设计系统迁移
bash
undefinedbash
undefinedStep 1: Extract tokens from existing design
Step 1: Extract tokens from existing design
claude-design tokens extract
--input ./current-app/styles
--output ./tokens/legacy-tokens.json
--input ./current-app/styles
--output ./tokens/legacy-tokens.json
claude-design tokens extract
--input ./current-app/styles
--output ./tokens/legacy-tokens.json
--input ./current-app/styles
--output ./tokens/legacy-tokens.json
Step 2: Generate new design system
Step 2: Generate new design system
claude-design generate
--input ./specs/new-design-system.yaml
--tokens ./tokens/legacy-tokens.json
--output ./new-design-system
--input ./specs/new-design-system.yaml
--tokens ./tokens/legacy-tokens.json
--output ./new-design-system
claude-design generate
--input ./specs/new-design-system.yaml
--tokens ./tokens/legacy-tokens.json
--output ./new-design-system
--input ./specs/new-design-system.yaml
--tokens ./tokens/legacy-tokens.json
--output ./new-design-system
Step 3: Create migration guide
Step 3: Create migration guide
claude-design docs migration
--from ./tokens/legacy-tokens.json
--to ./new-design-system/tokens.json
--output ./MIGRATION.md
--from ./tokens/legacy-tokens.json
--to ./new-design-system/tokens.json
--output ./MIGRATION.md
undefinedclaude-design docs migration
--from ./tokens/legacy-tokens.json
--to ./new-design-system/tokens.json
--output ./MIGRATION.md
--from ./tokens/legacy-tokens.json
--to ./new-design-system/tokens.json
--output ./MIGRATION.md
undefinedWorkflow 3: CI/CD Integration
工作流3:CI/CD集成
yaml
undefinedyaml
undefined.github/workflows/design-system.yml
.github/workflows/design-system.yml
name: Generate Design System
on:
push:
paths:
- 'design-specs/**'
jobs:
generate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install Claude Design
run: |
npm install -g @claude-design/cli
claude-design configure --api-key ${{ secrets.CLAUDE_API_KEY }}
- name: Generate Components
run: |
claude-design generate \
--input ./design-specs/components.yaml \
--output ./src/components \
--framework react \
--include-tests \
--include-stories
- name: Audit Accessibility
run: |
claude-design audit a11y ./src/components \
--level wcag-22-aa \
--fail-on-warnings
- name: Commit Changes
run: |
git config user.name "Claude Design Bot"
git add src/components
git commit -m "chore: regenerate design system"
git pushundefinedname: Generate Design System
on:
push:
paths:
- 'design-specs/**'
jobs:
generate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install Claude Design
run: |
npm install -g @claude-design/cli
claude-design configure --api-key ${{ secrets.CLAUDE_API_KEY }}
- name: Generate Components
run: |
claude-design generate \
--input ./design-specs/components.yaml \
--output ./src/components \
--framework react \
--include-tests \
--include-stories
- name: Audit Accessibility
run: |
claude-design audit a11y ./src/components \
--level wcag-22-aa \
--fail-on-warnings
- name: Commit Changes
run: |
git config user.name "Claude Design Bot"
git add src/components
git commit -m "chore: regenerate design system"
git pushundefinedTroubleshooting
故障排除
Issue: API Rate Limiting
问题:API速率限制
bash
undefinedbash
undefinedCheck current rate limit status
Check current rate limit status
claude-design status --api-limits
claude-design status --api-limits
Configure request throttling
Configure request throttling
claude-design configure
--rate-limit 10
--rate-limit-window 60000
--rate-limit 10
--rate-limit-window 60000
undefinedclaude-design configure
--rate-limit 10
--rate-limit-window 60000
--rate-limit 10
--rate-limit-window 60000
undefinedIssue: Generated Code Doesn't Match Framework Version
问题:生成的代码与框架版本不匹配
bash
undefinedbash
undefinedSpecify exact framework version
Specify exact framework version
claude-design generate
--framework react@18.2.0
--input ./spec.yaml
--framework react@18.2.0
--input ./spec.yaml
claude-design generate
--framework react@18.2.0
--input ./spec.yaml
--framework react@18.2.0
--input ./spec.yaml
Update framework adapters
Update framework adapters
npm update @claude-design/react-adapter
undefinednpm update @claude-design/react-adapter
undefinedIssue: Accessibility Audit Failures
问题:无障碍审计失败
javascript
// Enable auto-fix mode
const designer = new ClaudeDesign({
apiKey: process.env.CLAUDE_API_KEY,
plugins: [
new A11yAuditor({
autoFix: true, // Automatically fix common issues
strictMode: false // Use warnings instead of errors
})
]
});
// Generate with explicit a11y requirements
const component = await designer.generate({
prompt: 'Login form',
accessibility: {
level: 'wcag-22-aa',
requirements: [
'keyboard-navigation',
'screen-reader-labels',
'color-contrast-4.5:1',
'focus-indicators'
]
}
});javascript
// Enable auto-fix mode
const designer = new ClaudeDesign({
apiKey: process.env.CLAUDE_API_KEY,
plugins: [
new A11yAuditor({
autoFix: true, // Automatically fix common issues
strictMode: false // Use warnings instead of errors
})
]
});
// Generate with explicit a11y requirements
const component = await designer.generate({
prompt: 'Login form',
accessibility: {
level: 'wcag-22-aa',
requirements: [
'keyboard-navigation',
'screen-reader-labels',
'color-contrast-4.5:1',
'focus-indicators'
]
}
});Issue: Design Tokens Not Applying
问题:设计令牌未生效
bash
undefinedbash
undefinedValidate token file structure
Validate token file structure
claude-design tokens validate ./tokens/design-tokens.json
claude-design tokens validate ./tokens/design-tokens.json
Regenerate CSS variables
Regenerate CSS variables
claude-design tokens generate
--input ./tokens/design-tokens.json
--format css-variables
--output ./styles/tokens.css
--force
--input ./tokens/design-tokens.json
--format css-variables
--output ./styles/tokens.css
--force
claude-design tokens generate
--input ./tokens/design-tokens.json
--format css-variables
--output ./styles/tokens.css
--force
--input ./tokens/design-tokens.json
--format css-variables
--output ./styles/tokens.css
--force
Verify token references in generated code
Verify token references in generated code
claude-design audit tokens ./src/components
undefinedclaude-design audit tokens ./src/components
undefinedIssue: Plugin Conflicts
问题:插件冲突
bash
undefinedbash
undefinedList active plugins
List active plugins
claude-design plugins list --active
claude-design plugins list --active
Disable conflicting plugin
Disable conflicting plugin
claude-design plugins disable @community/conflicting-plugin
claude-design plugins disable @community/conflicting-plugin
Reset plugin configuration
Reset plugin configuration
claude-design plugins reset --all
claude-design plugins reset --all
Reinstall core plugins
Reinstall core plugins
npm install @claude-design/figma-sync@latest
undefinednpm install @claude-design/figma-sync@latest
undefinedDebug Mode
调试模式
bash
undefinedbash
undefinedEnable verbose logging
Enable verbose logging
claude-design generate
--input ./spec.yaml
--verbose
--debug
--log-file ./debug.log
--input ./spec.yaml
--verbose
--debug
--log-file ./debug.log
claude-design generate
--input ./spec.yaml
--verbose
--debug
--log-file ./debug.log
--input ./spec.yaml
--verbose
--debug
--log-file ./debug.log
Check system diagnostics
Check system diagnostics
claude-design diagnostics --full
undefinedclaude-design diagnostics --full
undefinedAdvanced Configuration
高级配置
Custom Subagents
自定义子代理
json
{
"subagents": [
{
"id": "color-theorist",
"priority": 1,
"specialties": ["color_harmony", "contrast_ratios"],
"model": "claude-sonnet-4"
},
{
"id": "layout-architect",
"priority": 2,
"specialties": ["grid_systems", "responsive_design"],
"model": "claude-sonnet-4"
},
{
"id": "typography-curator",
"priority": 3,
"specialties": ["font_pairing", "readability"],
"model": "claude-haiku-3.5"
}
]
}json
{
"subagents": [
{
"id": "color-theorist",
"priority": 1,
"specialties": ["color_harmony", "contrast_ratios"],
"model": "claude-sonnet-4"
},
{
"id": "layout-architect",
"priority": 2,
"specialties": ["grid_systems", "responsive_design"],
"model": "claude-sonnet-4"
},
{
"id": "typography-curator",
"priority": 3,
"specialties": ["font_pairing", "readability"],
"model": "claude-haiku-3.5"
}
]
}Hybrid AI Configuration
混合AI配置
bash
undefinedbash
undefinedConfigure Claude as primary, OpenAI as fallback
Configure Claude as primary, OpenAI as fallback
claude-design configure
--ai-provider hybrid
--primary claude
--claude-key $CLAUDE_API_KEY
--openai-key $OPENAI_API_KEY
--fallback-on-rate-limit true
--ai-provider hybrid
--primary claude
--claude-key $CLAUDE_API_KEY
--openai-key $OPENAI_API_KEY
--fallback-on-rate-limit true
This skill enables AI coding agents to leverage Claude's design capabilities for generating production-ready UI components, design systems, and accessible interfaces from natural language descriptions.claude-design configure
--ai-provider hybrid
--primary claude
--claude-key $CLAUDE_API_KEY
--openai-key $OPENAI_API_KEY
--fallback-on-rate-limit true
--ai-provider hybrid
--primary claude
--claude-key $CLAUDE_API_KEY
--openai-key $OPENAI_API_KEY
--fallback-on-rate-limit true
该Skill使AI编码代理能够利用Claude的设计能力,将自然语言描述转换为可投入生产的UI组件、设计系统和无障碍界面。