← 返回
未分类

React 组件生成器

Generate React and Vue components following project conventions, including TypeScript types, Ant Design 5 integration, Tailwind CSS styling, and Vitest test files. Use when the user asks to create, generate, or scaffold frontend components — e.g. '帮我写一个表格组件', '生成一个弹窗', 'create a form component', '写一个列表页', '生成一个下拉选择器'. Triggers on any request involving React/TSX/Vue component generation, UI component creation, or test file generation for components.
Generate React and Vue components following project conventions, including TypeScript types, Ant Design 5 integration, Tailwind CSS styling, and Vitest test files. Use when the user asks to create, generate, or scaffold frontend components — e.g. '帮我写一个表格组件', '生成一个弹窗', 'create a form component', '写一个列表页', '生成一个下拉选择器'. Triggers on any request involving React/TSX/Vue component generation, UI component creation, or test file generation for components.
user_2bfe3424
未分类 community v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 65
下载
💾 0
安装
1
版本
#latest

概述

Frontend Component Generator

Workflow

  1. Clarify requirements — confirm component type, data shape, and key interactions if the request is vague
  2. Detect framework — check for React vs Vue from project context. If unclear, ask
  3. Read conventions — load the relevant reference file for patterns
  4. Generate — create .tsx / .vue component file + .test.tsx test 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 from antd/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.json with antd in dependencies → React
  • package.json with ant-design-vue in dependencies → Vue
  • tsconfig.json with "jsx": "react-jsx" → React
  • .vue files in project → Vue
  • Default to React if uncertain, and ask the user

Reference Files

FileWhen to read
------
references/react-patterns.mdEvery React component generation
references/vue-patterns.mdEvery Vue component generation
references/test-patterns.mdEvery test file generation

版本历史

共 1 个版本

  • v1.0.0 Initial release 当前
    2026-05-17 20:03 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

dev-programming

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 73 📥 182,203
dev-programming

Mcporter

steipete
使用 mcporter CLI 直接列出、配置、认证及调用 MCP 服务器/工具(支持 HTTP 或 stdio),涵盖临时服务器、配置编辑及 CLI/类型生成功能。
★ 196 📥 67,833
dev-programming

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 680 📥 328,587