generate_code
Generate React components with shadcn/ui and Tailwind CSS from design specifications. Converts saved specs into production-ready code files organized by atomic design structure.
Instructions
Generate shadcn/ui + Tailwind component code from a saved spec and write output files to the project.
Prerequisites: The spec must exist in the registry (use get_specs to list names, create_spec to create one). Output is written into atomic design folders: atoms → components/ui/, molecules → components/molecules/, organisms → components/organisms/, templates → components/templates/.
Returns on success: { entryFile: string (absolute path to main generated file), files: string[] (all generated file paths), generatedAt: ISO timestamp }
Error behavior: Throws if specName is not found. If code generation fails (e.g. schema mismatch), an error message is returned with the failure reason.
Use this tool: after create_spec to turn a spec into working code. For pages, the page spec must reference template and component specs that already exist. Run npm install to add any missing shadcn components after generation.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| specName | Yes | Name of the spec to generate code for (case-sensitive, must match a spec returned by get_specs). |