Frontend Component Generator
Workflow
- Clarify requirements — confirm component type, data shape, and key interactions if the request is vague
- Detect framework — check for React vs Vue from project context. If unclear, ask
- Read conventions — load the relevant reference file for patterns
- Generate — create
.tsx/.vuecomponent file +.test.tsxtest file
React Components (primary)
Target: React 18+ with TypeScript, Next.js App Router
Read references/react-patterns.md before generating React components. Key rules:
- Named exports,
'use client'when using hooks, interfaces above component - Ant Design 5 imports from
antd, type-only imports fromantd/es/ - useMessage() / useModal() with contextHolder pattern for feedback
- Prefer local state + custom hooks, no global state libs
Vue Components (secondary)
Target: Vue 3 (Composition API) or Vue 2 (Options API)
Read references/vue-patterns.md before generating Vue components. Confirm Vue version if not obvious.
Testing
Read references/test-patterns.md before generating test files. Generate *.test.tsx co-located with the component.
- Always generate test file alongside the component
- Use
vitest+@testing-library/react+userEvent - Mock antd
message.useMessage()to avoid side effects - Cover: render, loading state, key interactions
Framework Detection
package.jsonwithantdin dependencies → Reactpackage.jsonwithant-design-vuein dependencies → Vuetsconfig.jsonwith"jsx": "react-jsx"→ React.vuefiles in project → Vue- Default to React if uncertain, and ask the user
Reference Files
| File | When to read |
|---|---|
references/react-patterns.md |
Every React component generation |
references/vue-patterns.md |
Every Vue component generation |
references/test-patterns.md |
Every test file generation |



