react-component-architecture — Claude Code skill: React component
A skill that tells your coding agent how to structure React components: function components, hooks, composition and TypeScript. Useful once a shared component library starts growing.
npx skills add aj-geddes/useful-ai-prompts --skill react-component-architecture -a claude-codeWhat react-component-architecture does
The skill loads a set of conventions into the agent: function components with hooks, custom hooks, composition patterns, higher-order components and render props. Types come from TypeScript throughout. The package holds a short main guide plus a references/ folder where each pattern gets its own file.
The quick start walks through Button.tsx. Props are declared as an interface with primary, secondary and danger variants, sm, md and lg sizes, and a disabled flag. Variant and size styles sit in lookup objects, so a new variant is one line instead of another branch in the markup.
Make sure React and TypeScript are already in the project — the samples are TSX and will not compile without types. Nothing here locks you to a bundler or a styling library: the Tailwind classes in the example are just an illustration and can be swapped for whatever you use.
What it helps with
- design a reusable component library
- move repeated logic into a custom hook
- pick between composition, HOC and render props
- type component props with TypeScript
- split a large React app into layers
Example prompts for the agent
- help me design a Button component with variants and sizes
- extract the data fetching logic into a custom hook
- show me how to rewrite this component with composition instead of props
How to install react-component-architecture
1Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill react-component-architecture -a claude-code2Manually: put the files in place
~/.claude/skills/react-component-architecture/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/react-component-architecture/
1Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill react-component-architecture -a codex2Manually: put the files in place
.agents/skills/react-component-architecture/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill react-component-architecture -a cursor2Manually: put the files in place
.cursor/skills/react-component-architecture/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install aj-geddes/useful-ai-prompts react-component-architecture2Manually: put the files in place
.github/skills/react-component-architecture/SKILL.md1Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill react-component-architecture -a gemini-cli2Platform CLI
gemini skills install https://github.com/aj-geddes/useful-ai-prompts --path skills/react-component-architectureManually: put the files in place
.devin/skills/react-component-architecture/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add aj-geddes/useful-ai-prompts --skill react-component-architecture -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about react-component-architecture
How do I install react-component-architecture in Claude?
Run npx skills add aj-geddes/useful-ai-prompts --skill react-component-architecture -a claude-code. The skill file lands at ~/.claude/skills/react-component-architecture/SKILL.md.
What does react-component-architecture do?
It gives the agent conventions for React code: function components, hooks, composition, higher-order components, render props and TypeScript typing.
Which platforms are supported?
Besides Claude, the skill installs into Codex, Cursor, GitHub Copilot, Gemini CLI and OpenCode, each with its own install flag.
Source text
SKILL.md · MIT
---
name: react-component-architecture
description: >
Design scalable React components using functional components, hooks,
composition patterns, and TypeScript. Use when building reusable component
libraries and maintainable UI systems.
---
# React Component Architecture
## Table of Contents
- [Overview](#overview)
- [When to Use](#when-to-use)
- [Quick Start](#quick-start)
- [Reference Guides](#reference-guides)
- [Best Practices](#best-practices)
## Overview
Build scalable, maintainable React components using modern patterns including functional components, hooks, composition, and TypeScript for type safety.
## When to Use
- Component library design
- Large-scale React applications
- Reusable UI patterns
- Custom hooks development
- Performance optimization
## Quick Start
Minimal working example:
```typescript
// Button.tsx
import React, { useState, useCallback } from 'react';
interface ButtonProps {
variant?: 'primary' | 'secondary' | 'danger';
size?: 'sm' | 'md' | 'lg';
disabled?: boolean;
onClick?: () => void;
children: React.ReactNode;
}
export const Button: React.FC<ButtonProps> = ({
variant = 'primary',
size = 'md',
disabled = false,
onClick,
children
}) => {
const variantStyles = {
primary: 'bg-blue-500 hover:bg-blue-600',
secondary: 'bg-gray-500 hover:bg-gray-600',
danger: 'bg-red-500 hover:bg-red-600'
};
const sizeStyles = {
// ... (see reference guides for full implementation)
```
## Reference Guides
Detailed implementations in the `references/` directory:
| Guide | Contents |
|---|---|
| [Functional Component with Hooks](references/functional-component-with-hooks.md) | Functional Component with Hooks |
| [Custom Hooks Pattern](references/custom-hooks-pattern.md) | Custom Hooks Pattern |
| [Composition Pattern](references/composition-pattern.md) | Composition Pattern |
| [Higher-Order Component (HOC)](references/higher-order-component-hoc.md) | Higher-Order Component (HOC) |
| [Render Props Pattern](references/render-props-pattern.md) | Render Props Pattern |
## Best Practices
### ✅ DO
- Follow established patterns and conventions
- Write clean, maintainable code
- Add appropriate documentation
- Test thoroughly before deploying
### ❌ DON'T
- Skip testing or validation
- Ignore error handling
- Hard-code configuration values
© aj-geddes · MIT · aj-geddes/useful-ai-prompts