frontend-component

Create React components with TypeScript, Storybook stories, and tests.

Updated Feb 4, 2026
One-click install
npx skills add https://github.com/hakushun/ai-dev-starter --skill frontend-component-hakushun
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: frontend-component
Source: https://github.com/hakushun/ai-dev-starter/tree/main/.cursor/skills/frontend-component
Command: npx skills add https://github.com/hakushun/ai-dev-starter --skill frontend-component-hakushun

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill streamlines adding new React components by enforcing a consistent file structure, typings, and accompanying Storybook stories and tests, reducing boilerplate and errors.

Core Features & Use Cases

  • Create a typed React component file at src/components/<Name>.tsx with a functional component.
  • Generate a corresponding Storybook story at src/components/<Name>.stories.tsx, including a simple story and optional decorators for state management.
  • Create unit tests at src/components/<Name>.test.tsx using testing utilities and query scoping with within(container).
  • Optionally re-export the component from an index barrel (e.g., src/components/index.ts) to simplify imports.

Quick Start

Add a new React component named <Name>, place its TSX file under src/components, create its Storybook story and test files, and ensure it exports cleanly for easy consumption by the app and other components.

Frequently Asked Questions about frontend-component

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I generate a React component with Storybook stories and Vitest tests?

Generate a React component with stories and tests by creating a functional TSX file under src/components, alongside a corresponding .stories.tsx file for Storybook and a .test.tsx file using Vitest. This ensures a consistent component structure with proper TypeScript typings and exports.

What is the best way to structure a new React component with TypeScript?

The best way to structure a new React component is placing the typed TSX file under src/components, adding a Storybook story, creating a Vitest test file, and optionally re-exporting it from an index barrel. This enforces consistent typings, file structure, and easy consumption.

Do I need Tailwind and Vitest to create new React components?

Yes, you need a standard React and TypeScript project setup with Tailwind for styling and Vitest for testing. The component generation process requires these specific frameworks to ensure proper styling, unit tests, and Storybook integration.

How do I write unit tests for a React component using Vitest?

Write unit tests for a React component using Vitest by creating a .test.tsx file under src/components. Apply testing utilities and query scoping with within(container) to ensure isolated and reliable component testing alongside your generated Storybook stories.

Can I automatically re-export new React components from an index barrel file?

Yes, you can automatically re-export new React components from an index barrel file like src/components/index.ts. This optional step simplifies imports, ensuring the component exports cleanly for easy consumption by the app and other components.