Component Spec Generator
Purpose
Transforms wireframe markdown into detailed React component implementation specifications with TypeScript interfaces, state management requirements, accessibility specs, and test stubs.
Process
- Parse Wireframe: Read wireframe markdown from
wireframe-annotator - Generate TypeScript Interface: Create complete props and types definition
- Define State Management: Specify local vs global state requirements
- Accessibility Spec: Define ARIA roles, labels, keyboard navigation
- Map Design Tokens: Generate exact CSS-in-JS / Tailwind classes
- Create Test Stubs: Generate Jest + React Testing Library test cases
- Output README: Write
src/components/[name]/README.md
When to Use
- After wireframe annotation is complete
- Before implementing React components
- When defining component contracts
- When ensuring design token compliance
Input
Wireframe markdown files from wireframe-annotator
Output
README.md file in component directory (src/components/[name]/README.md)
Content Generated
- TypeScript Interface: complete props + types definition
- State Management: local vs global state requirements
- Accessibility Spec: ARIA roles, labels, keyboard navigation
- Design Token Mapping: Exact CSS-in-JS / Tailwind classes
- Test Stubs: Jest + React Testing Library test cases
Usage
"Generate specs for [Component Name] based on [Wireframe File]"
Validation
Checks token validity using design-token-validator.
If design-token-validator is not available, perform manual review against TERMINOLOGY_GUIDE.md or use m3-expressive-ui-evaluator scoring as a proxy for compliance.
INPUT
raw_spec: JSON array from scaffoldertokens_path: "frontend/src/design/tokens/tokens.json"
ENHANCEMENTS REQUIRED
Each spec gains:
"motion": {"type": "spring", "stiffness": "--sys-motion-stiffness-hero"}"shapes": {"pebble_variance": ">0.2", "asymmetric": true}"typography": ["Fraunces 700+", "Work Sans", "JetBrains Mono"]