React component generator

From smallnest/langgraphgo · View interactive version

React component generator is an AI agent skill from the GitHub repository smallnest/langgraphgo. Generate React components following best practices with TypeScript, Tailwind CSS, and Zustand state management. Use this skill when the user requests creating React components, UI elements, or mentions component generation. Supports common component patterns including basic components, forms, lists,

How to use this skill

Skill file

React Component Generator

This skill provides templates and best practices for generating high-quality React components using TypeScript, Tailwind CSS, and Zustand for state management.

Purpose

Generate production-ready React components that follow industry best practices and maintain consistency across the codebase. The skill includes pre-built templates for common component patterns and comprehensive best practices documentation.

When to Use This Skill

Use this skill when:

Available Component Templates

The skill provides the following templates in the assets/ directory:

1. BasicComponent.tsx

A simple presentational component template for UI elements without complex state.

When to use:

Key features:

2. StatefulComponent.tsx

A component with integrated Zustand store for state management.

When to use:

Key features:

3. FormComponent.tsx

A form component with validation, error handling, and submission logic.

When to use:

Key features:

4. ListComponent.tsx

A reusable list component for displaying collections of items.

When to use:

Key features:

5. CardComponent.tsx

A flexible card component for content display.

When to use:

Key features:

6. ButtonComponent.tsx

A versatile button component with multiple variants and states.

When to use:

Key features:

7. ModalComponent.tsx

A modal/dialog component with backdrop and accessibility features.

When to use:

Key features:

How to Use Templates

When generating a component:

  1. Identify the component type - Determine which template best fits the user's requirements.
  1. Read the appropriate template - Load the template file from the assets/ directory:

```

Read assets/BasicComponent.tsx

```

  1. Customize the template - Replace placeholder names and add specific functionality:
  1. Follow naming conventions - Refer to references/best-practices.md for:
  1. Apply best practices - Consult references/best-practices.md for guidance on:

Component Naming Guidelines

Apply these naming rules when generating components:

  1. Component name: Use PascalCase based on the user's description
  1. Props interface: ComponentName + "Props"
  1. Zustand store: "use" + ComponentName + "Store"
  1. File name: Match the component name exactly

Best Practices Reference

For detailed guidance, consult references/best-practices.md which covers:

Example Workflow

User request: "Create a user login form component"

Steps:

  1. Identify that this requires a form component
  2. Read assets/FormComponent.tsx template
  3. Customize for login use case:
  1. Place in appropriate directory (e.g., components/auth/LoginForm.tsx)
  2. Verify accessibility and best practices

User request: "Create a product card with image and price"

Steps:

  1. Identify that this requires a card component
  2. Read assets/CardComponent.tsx template
  3. Customize for product use case:
  1. Place in components/products/ProductCard.tsx

User request: "Create a todo list with Zustand"

Steps:

  1. Identify that this requires a stateful list component
  2. Read both assets/StatefulComponent.tsx and assets/ListComponent.tsx
  3. Combine patterns:
  1. Name as TodoList with useTodoListStore
  2. Place in components/todos/TodoList.tsx

Notes

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.