/react:create-react-modletfrom react
Creates React components, hooks, and utilities following the modlet pattern with self-contained folders including index.ts, implementation, tests, stories, and types.
Ships in react. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
This skill teaches how to create React components, hooks, and utilities following the modlet pattern in this project.
A modlet is a self-contained folder that houses everything related to a specific module. Each modlet includes its implementation, tests, stories (for visual components), and types—all in one place.
Use this skill when:
Search the codebase for the right location to create your modlet.
EditableTitle/, Header/, Button/inline-edit/, common/components/, hooks/, helpers/ComponentName/
├── index.ts # Re-export entry point (required)
├── ComponentName.tsx # Component implementation (required)
├── ComponentName.test.tsx # Tests (required)
├── ComponentName.stories.tsx # Storybook story (required)
└── types.ts # Custom types (optional)
useMyHook/
├── index.ts # Re-export entry point (required)
├── useMyHook.ts # Implementation (required)
├── useMyHook.test.ts # Tests (required)
└── types.ts # Custom types (optional)
/Button exports Button)index.ts, only re-export from within the modlet<modlet-name>.test.tsx/components subfolder, hooks in /hooks, helpers in /helpers - each as its own modletUse manage_todo_list to track progress:
1. Create modlet folder
2. Add index.ts with re-exports
3. Add main component/hook file
4. Add test file
5. (Visual) Add story file
6. (If needed) Add types.ts
7. Verify tests pass
8. Verify TypeScript compiles
9. (Visual) Verify story renders
export { ComponentName } from './ComponentName';
export type { ComponentNameProps } from './types';
import { cn } from '@/lib/utils';
import type { ComponentNameProps } from './types';
export function ComponentName({ className, ...props }: ComponentNameProps) {
return (
<div className={cn('component-styles', className)}>
{/* Implementation */}
</div>
);
}
import { describe, it, expect, vi } from 'vitest';
import { render, screen } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import { ComponentName } from './ComponentName';
describe('ComponentName', () => {
it('should render correctly', () => {
render(<ComponentName />);
expect(screen.getByText('expected text')).toBeInTheDocument();
});
it('should handle user interaction', async () => {
const user = userEvent.setup();
const handleClick = vi.fn();
render(<ComponentName onClick={handleClick} />);
await user.click(screen.getByRole('button'));
expect(handleClick).toHaveBeenCalled();
});
});
import type { Meta, StoryObj } from '@storybook/react';
import { ComponentName } from './ComponentName';
const meta: Meta<typeof ComponentName> = {
component: ComponentName,
title: 'Common/ComponentName', // Use: Common/, InlineEdit/, Feature name, etc.
tags: ['autodocs'],
};
export default meta;
type Story = StoryObj<typeof ComponentName>;
export const Default: Story = {
args: {
// Default props
},
};
export const Variant: Story = {
args: {
// Variant props
},
};
export interface ComponentNameProps {
/** Additional CSS classes */
className?: string;
// Other props
}
export type ComponentNameVariant = 'primary' | 'secondary';
Run these commands from the project root:
# Run tests
npm run test
# Type check
npm run typecheck
# Start Storybook (for visual verification)
npm run storybook
Use the @/ alias for imports:
import { cn } from '@/lib/utils';
import { Button } from '@/components/ui/button';
import { SomeComponent } from '@/components/common/SomeComponent';
Reuse components from @/components/ui/:
import { Button } from '@/components/ui/button';
import { Input } from '@/components/ui/input';
import { Card, CardHeader, CardContent } from '@/components/ui/card';
Use Tailwind classes for styling. Use cn() for conditional classes:
import { cn } from '@/lib/utils';
<div className={cn('base-classes', isActive && 'active-classes', className)} />
When components need context providers:
import { BrowserRouter } from 'react-router-dom';
const meta: Meta<typeof ComponentName> = {
component: ComponentName,
decorators: [
(Story) => (
<BrowserRouter>
<Story />
</BrowserRouter>
),
],
};
For complex components with internal sub-components:
ComplexComponent/
├── index.ts
├── ComplexComponent.tsx
├── ComplexComponent.test.tsx
├── ComplexComponent.stories.tsx
├── types.ts
├── components/
│ ├── SubComponentA/
│ │ ├── index.ts
│ │ ├── SubComponentA.tsx
│ │ └── SubComponentA.test.tsx
│ └── SubComponentB/
│ ├── index.ts
│ ├── SubComponentB.tsx
│ └── SubComponentB.test.tsx
└── hooks/
└── useComponentLogic/
├── index.ts
├── useComponentLogic.ts
└── useComponentLogic.test.ts
Before completing any modlet:
index.ts exists and only contains re-exportsnpm run test)npm run typecheck passesindex.tsindex.ts fileindex.ts instead of re-exportingReference these existing modlets for patterns:
Full modlet with types:
components/Header/ - Has index.ts, component, test, story, typesModlet in grouping folder:
components/inline-edit/EditableText/ - Inline edit componentCommon component:
components/common/ConfirmationDialog/ - Dialog component in common folderWhat SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
5 skills in this plugin
/component-registryTrack reusable UI components and unextracted patterns. Maintains a REGISTRY.md inventory of extracted components and patterns that need extraction. Use when auditing components, planning extractions, or checking what components exist./component-reuseEnsure existing UI components are reused before creating new ones. Must run BEFORE any UI implementation. Audits the codebase for matching components and reports whether to REUSE, WRAP, or CREATE./extract-ui-componentExtract reusable UI components from inline patterns. Covers component design, TypeScript props, Storybook stories, refactoring strategy, and best practices for creating shared UI primitives.npx claudepluginhub bitovi/ai-enablement-prompts --plugin reactOther plugins' skills for the same job