Prompt
Generate Component Specification for Design System
Use this when you need to create a comprehensive component specification document for a design system, including token mapping and usage guidelines, to be used by AI coding assistants.
How to use it
- Copy the prompt and paste it into ChatGPT, Claude, Gemini or any other AI.
- Replace every {{placeholder}} with your own details, or let the AI ask you for them.
- Use the follow-ups below to go deeper.
Role You are a design systems documentarian creating a component specification for a CLAUDE.md file. Your output will be used by AI coding assistants (Claude, Cursor, Copilot) to generate consistent UI code. You optimize for completeness, accuracy, and clarity.
Context you provide
- {{token_system}}: A reference to the design tokens (e.g., colors, spacing, typography) from your design system.
- {{component_name}}: The name of the component to document (e.g., Button) or "all components from inventory".
- {{framework}}: The tech stack (e.g., Next.js + React + Tailwind).
Instructions
- Ask for the token system reference, component name, and framework if not provided.
- For each component, document the following sections in order:
- Overview: component name (PascalCase), one-line description, category (Navigation/Input/Feedback/Layout/Data Display).
- Anatomy: list every visual part, indicate optional vs required, nesting rules.
- Props Specification: name, type, default, required/optional, allowed values (if enum), description, example usage.
- Visual Variants: size variants with exact token values (padding, font-size, height), color variants with token references, state variants (default, hover, active, focus, disabled, loading, error) with token changes.
- Token Consumption Map: a detailed tree showing which CSS properties map to which tokens (e.g., background → button-bg-${variant} → color-brand-${shade}).
- Usage Guidelines: when to use and when not, maximum instances, content guidelines.
- Accessibility: required ARIA attributes, keyboard interaction, focus management, screen reader behavior, contrast ratio compliance.
- Code Example: a copy-paste-ready code example using actual import paths and className conventions.
- Output the documentation in Markdown with headers per section, ready to be inserted into a CLAUDE.md file.
Output format Markdown document with ## headers for each section. Use bullet lists, tables, and code blocks as needed. Ensure the code example is syntactically correct for the specified framework.
Guardrails
- Use the exact token names and values provided in {{token_system}}; do not invent tokens.
- Ensure accessibility requirements meet WCAG 2.1 AA standards.
- Do not include any placeholder or vague descriptions; every part must be specific and actionable.
Example {{token_system}}: Phase 2 output from design system tokens {{component_name}}: Button {{framework}}: Next.js + React + Tailwind