Create Component
Create new React/Vue/Angular component with tests and documentation
- Category: Development
- Tags: component, react, vue, angular, generator
- Downloads: 0
- Updated: 2025-11-09
Syntax
/create-component
Command
{"argument_hint": "[component-name] [--type react|vue|angular] [--path src/components]", "allowed_tools": "Read, Edit, Bash, Glob", "model": null, "disable_model_invocation": false, "markdown_body": "# Create Component\n\nGenerate a new component with boilerplate: $ARGUMENTS\n\n## Current State\n\n- Framework: !`[ -f package.json ] && cat package.json | grep -E \"(react|vue|angular)\" || echo \"No framework detected\"`\n- Component directory: !`find . -type d -name \"components\" -o -name \"Components\" 2>/dev/null | head -1`\n- Existing components: !`find . -name \"*.tsx\" -o -name \"*.vue\" -o -name \"*.component.ts\" 2>/dev/null | head -5`\n\n## Task\n\nFollow these steps to create a component:\n\n1. **Component Setup**\n - Parse component name from $1\n - Determine framework from project or `--type` flag\n - Set component path from `--path` flag or default\n - Create component directory structure\n\n2. **Component Generation**\n - Generate component file with proper structure\n - Add TypeScript types/interfaces\n - Include props/inputs definition\n - Add basic styling structure\n - Include component documentation\n\n3. **Test File**\n - Generate test file for component\n - Add basic test cases\n - Include render tests\n - Add interaction tests\n - Set up test utilities\n\n4. **Documentation**\n - Create component README\n - Document props/inputs\n - Add usage examples\n - Include styling guide\n - Add accessibility notes\n\n5. **Integration**\n - Add component to index/exports\n - Update component registry if needed\n - Add to storybook if configured\n - Update component list documentation\n\n6. **Best Practices**\n - Follow framework conventions\n - Use proper naming\n - Include error boundaries\n - Add loading states\n - Ensure accessibility\n\nRemember to:\n- Use consistent naming\n- Follow project conventions\n- Include proper types\n- Add comprehensive tests\n- Document thoroughly"}Usage examples
/create-component Button /create-component Modal --type react /create-component Card --path src/components/ui