react-component-generator
Skill1 starsChanged 5 months agoApache-2.0View on GitHub
Generates production-ready React functional components with TypeScript, props interface, default props, and JSDoc. Use when scaffolding new React components from descriptions or design specs.
5 other projects use a version of this.
Adopted by
Most recently taken up by
- nek1987/auto-agent-harnesstheir own version, first seen Oct 11, 2026
- OneWave-AI/claude-skillstheir own version, first seen Sep 21, 2026
- jsrockstaranks/claude-skillstheir own version, first seen Jun 8, 2026
- Nembie/claude-code-skillstheir own version, first seen Feb 17, 2026
- ehtbanton/ClaudeSkillsRepotheir own version, first seen Dec 17, 2025
Other versions5 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 5
- OneWave-AI/claude-skills★ 378same name
- nek1987/auto-agent-harness★ 4same name
- Nembie/claude-code-skills★ 3same name
- jsrockstaranks/claude-skills★ 1same name
- ehtbanton/ClaudeSkillsRepo★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository58 other files it gives its agents.
- agent-chain-designerSkill
- api-wrapper-builderSkill
- embeddings-builderSkill
- evaluation-harnessSkill
- fine-tuning-preparerSkill
- llm-router-builderSkill
- ml-model-trainerSkill
- model-benchmarkerSkill
- prompt-engineerSkill
- rag-pipeline-builderSkill
- synthetic-data-generatorSkill
- vector-db-integratorSkill
- csv-processorSkill
- database-schema-designerSkill
- data-pipeline-builderSkill
- etl-workflow-designerSkill
- json-transformerSkill
- pandas-data-cleanerSkill
- report-generatorSkill
- sql-query-optimizerSkill
- time-series-analyzerSkill
- visualization-generatorSkill
- backup-strategySkill
- ci-cd-optimizerSkill
- docker-compose-generatorSkill
- github-actions-pipelineSkill
- kubernetes-deploymentSkill
- load-balancer-configSkill
- log-aggregator-setupSkill
- monitoring-dashboardSkill
- nginx-config-generatorSkill
- security-hardeningSkill
- ssl-certificate-managerSkill
- terraform-module-builderSkill
- api-security-auditorSkill
- compliance-checkerSkill
- dependency-checkerSkill
- incident-responderSkill
- jwt-security-auditorSkill
- owasp-checkerSkill
- penetration-test-plannerSkill
- secret-detectorSkill
- threat-model-designerSkill
- vulnerability-scannerSkill
- accessibility-auditorSkill
- api-route-builderSkill
- auth-flow-builderSkill
- css-animation-crafterSkill
- form-validatorSkill
- graphql-schema-designerSkill
- html-component-builderSkill
- nextjs-app-scaffoldSkill
- performance-auditorSkill
- pwa-setupSkill
- responsive-layout-systemSkill
- seo-optimizerSkill
- tailwind-design-systemSkill
- websocket-integrationSkill
The file
Show its rules and text
We split this skill into the rules it gives an agent
23 rules. 0 are common, 7 are distinctive, and 16 are very specific to this project.
0
Common
Most of the 4 edited versions we read keep these.
7
Distinctive
This author's own choices. Worth a look.
16
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 43
Use interface ComponentNameProps { ...
- Very specific: line 45
Use union types for variants (e.g., variant?: 'primary' | 'secondary' | 'danger').
- Distinctive: line 47
Add JSDoc to every prop.
- Very specific: line 50
Use arrow function with explicit return type React.FC<ComponentNameProps> or just the function for better tree-shaking.
- Very specific: line 53
Use React.memo only when the component is pure and props are frequently stable (document the decision).
- Distinctive: line 57
Use semantic HTML elements inside the component.
- Very specific: line 58
Add role only when necessary (avoid over-using).
- Very specific: line 61
Add data-testid={testId || 'component-name'} on the root or key interactive elements.
- Very specific: line 65
Create a .stories.tsx file with the component imported.
- Distinctive: line 67
Add a "Playground" story and 2-3 specific stories (e.g., "Primary", "Disabled", "WithIcon").
- Very specific: line 70
If Tailwind: use clsx or template literals with conditional classes.
- Very specific: line 72
Keep style logic inside the component or extract to a separate variants.ts when complex.
- Very specific: line 85
If form-related, suggest form-validator.
- Very specific: line 86
If animation needed, suggest css-animation-crafter.
- Very specific: line 192
Complex children: Document when to use children vs dedicated props (e.g., title and description for a card).
- Very specific: line 193
Performance: If the component renders lists or has expensive children, document when to wrap with React.memo and provide a custom areEqual …
- Very specific: line 194
TypeScript strictness: Always use strict mode friendly types.
- Distinctive: line 200
Create the files in the project.
- Very specific: line 201
Run npm run build or tsc --noEmit — zero TypeScript errors.
- Distinctive: line 202
Import and render the component in a page or Storybook.
- Distinctive: line 204
Run Storybook and interact with all controls.
- Very specific: line 205
Write a quick test using the data-testid and run it with your test runner.
- Distinctive: line 206
Check accessibility with axe or Lighthouse on a story that exercises all states.
“Common” is measured: kept by at least 6 in 10 of the 4 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Overview
Creates complete, production-grade React functional components using TypeScript. The skill outputs a component with a strict Props interface (using interface or type), sensible default props via destructuring, full JSDoc, proper forwardRef when needed, React.memo guidance, data-testid attributes for testing, a basic Storybook story stub, and accessibility considerations baked in.
When to Use This Skill
- Scaffolding a new UI component in a React + TypeScript project.
- The user provides a component name, list of props, behavior description, or a design spec/wireframe.
- You need consistent, high-quality component boilerplate that follows team conventions (props naming, JSDoc, testing attributes).
- Starting a component library, design system, or feature with many similar components.
Prerequisites
- Existing React project (Next.js, Vite, CRA, or custom) using TypeScript.
- Component library conventions already established (or the skill will propose sensible defaults).
reactand@types/reactinstalled (version 18+ recommended).- For Storybook stories: Storybook 7+ or 8+ configured in the project.
- Optional but recommended:
clsxortailwind-mergefor className merging if using Tailwind.
Steps
- Gather component specification:
- Component name (PascalCase).
- List of props with types and whether they are required.
- Behavioral description (what it does, variants, states).
- Accessibility requirements.
- Whether it needs
refforwarding, children, or complex state. - Styling approach (Tailwind, CSS Modules, styled-components, plain CSS).
- Define the Props interface:
- Use
interface ComponentNameProps { ... }(preferred for declaration merging). - Make optional props explicit with
?. - Use union types for variants (e.g.,
variant?: 'primary' | 'secondary' | 'danger'). - Include
className?: stringandchildren?: React.ReactNodewhere appropriate. - Add JSDoc to every prop.
- Use
- Implement the component function:
- Use arrow function with explicit return type
React.FC<ComponentNameProps>or just the function for better tree-shaking. - Destructure props with defaults:
const { variant = 'primary', ... } = props;. - Apply
React.forwardRefwhen the component renders a DOM element that should expose a ref (buttons, inputs, etc.). - Use
React.memoonly when the component is pure and props are frequently stable (document the decision).
- Use arrow function with explicit return type
- Add accessibility and ARIA:
- Include
aria-*attributes based on role and state. - Use semantic HTML elements inside the component.
- Add
roleonly when necessary (avoid over-using).
- Include
- Include testing helpers:
- Add
data-testid={testId || 'component-name'}on the root or key interactive elements. - Suggest a basic test file structure using React Testing Library.
- Add
- Generate a Storybook story stub:
- Create a
.stories.tsxfile with the component imported. - Include controls for all variants and states.
- Add a "Playground" story and 2-3 specific stories (e.g., "Primary", "Disabled", "WithIcon").
- Create a
- Handle styling:
- If Tailwind: use
clsxor template literals with conditional classes. - Provide a
cnutility example if the project doesn't have one. - Keep style logic inside the component or extract to a separate
variants.tswhen complex.
- If Tailwind: use
- Add JSDoc and displayName:
- Top-level JSDoc describing the component purpose and usage.
Component.displayName = 'ComponentName';for better debugging in React DevTools.
- Output files:
- The main component file (
ComponentName.tsx). - The story file (
ComponentName.stories.tsx). - Optional: a basic test file skeleton.
- Usage example in the skill response.
- The main component file (
- Recommend follow-up:
- If form-related, suggest
form-validator. - If animation needed, suggest
css-animation-crafter.
- If form-related, suggest
Examples
Example 1: Button Component
User request: "Create a Button component in React + TS. Variants: primary, secondary, ghost, danger. Sizes: sm, md, lg. Supports disabled, loading, left/right icon, and full width. Use Tailwind."
Generated Component (abbreviated for brevity in this example; full in real output):
import React from 'react';
import { clsx } from 'clsx';
export interface ButtonProps {
/** Visual style variant */
variant?: 'primary' | 'secondary' | 'ghost' | 'danger';
/** Size variant */
size?: 'sm' | 'md' | 'lg';
/** Whether the button is in a loading state */
isLoading?: boolean;
/** Left icon element */
leftIcon?: React.ReactNode;
/** Right icon element */
rightIcon?: React.ReactNode;
/** Make button take full width of container */
fullWidth?: boolean;
/** Disable the button */
disabled?: boolean;
children: React.ReactNode;
className?: string;
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
}
/**
* A versatile, accessible button component with multiple variants and states.
*
* @example
* <Button variant="primary" size="md">Click me</Button>
*/
export const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
(
{
variant = 'primary',
size = 'md',
isLoading = false,
leftIcon,
rightIcon,
fullWidth = false,
disabled,
children,
className,
...props
},
ref
) => {
const baseStyles = 'inline-flex items-center justify-center font-medium rounded-lg transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none';
const variantStyles = {
primary: 'bg-blue-600 text-white hover:bg-blue-700 focus:ring-blue-500',
secondary: 'bg-gray-100 text-gray-900 hover:bg-gray-200 focus:ring-gray-500',
ghost: 'text-gray-700 hover:bg-gray-100 focus:ring-gray-500',
danger: 'bg-red-600 text-white hover:bg-red-700 focus:ring-red-500',
};
const sizeStyles = {
sm: 'px-3 py-1.5 text-sm gap-1.5',
md: 'px-4 py-2 text-base gap-2',
lg: 'px-6 py-3 text-lg gap-2.5',
};
return (
<button
ref={ref}
type="button"
disabled={disabled || isLoading}
className={clsx(
baseStyles,
variantStyles[variant],
sizeStyles[size],
fullWidth && 'w-full',
className
)}
aria-busy={isLoading}
data-testid="button"
{...props}
>
{isLoading && <span className="animate-spin mr-2">⏳</span>}
{leftIcon && <span className="mr-2">{leftIcon}</span>}
{children}
{rightIcon && <span className="ml-2">{rightIcon}</span>}
</button>
);
}
);
Button.displayName = 'Button';Storybook stub also generated with all controls.
Example 2: Card with children and ref forwarding (similar detailed output).
Edge Cases & Error Handling
- Polymorphic component (as="a" or as="div"): Provide an
asprop using a generic orasChildpattern with Radix-style slot if the project uses it. Otherwise, keep it simple with aComponentvariable. - Complex children: Document when to use
childrenvs dedicated props (e.g.,titleanddescriptionfor a card). - Performance: If the component renders lists or has expensive children, document when to wrap with
React.memoand provide a customareEqualexample. - TypeScript strictness: Always use
strictmode friendly types. Avoidany. UseReact.ComponentPropsWithoutRef<'button'>for native props spreading when appropriate. - Icon libraries: Show how to accept
React.ReactNodefor icons so any icon library works (Heroicons, Lucide, etc.). - Ref forwarding with generics: Provide the correct generic signature for
forwardRef.
Verification
- Create the files in the project.
- Run
npm run buildortsc --noEmit— zero TypeScript errors. - Import and render the component in a page or Storybook. Verify it matches the spec.
- Open React DevTools — confirm
displayNameis set and props look clean. - Run Storybook and interact with all controls.
- Write a quick test using the
data-testidand run it with your test runner. - Check accessibility with axe or Lighthouse on a story that exercises all states.
- Success: Component is typed correctly, renders without warnings, passes tests, and is easy for other developers to use and extend.
References
- React TypeScript Cheatsheet
- Storybook for React
- React.forwardRef Documentation
- React.memo
- Project's existing component library for style alignment (ask user for link or examples)
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

