generic-react-feature-developer — Claude Code skill: how to install
generic-react-feature-developer is a Claude Code skill that defines React feature architecture, including directory layout, Zustand, React Query, IndexedDB, and lazy loading.
MIT 139 installs ★ 114 updated 2026-10-25
npx skills add travisjneuman/.claude --skill generic-react-feature-developer -a claude-codeWhat generic-react-feature-developer does
This skill sets architectural boundaries for React development. It establishes a project layout separating components into ui, features, and layout, while placing state logic into dedicated stores/ and services/ folders.
The guide outlines clear rules for state management. Standard React Context is reserved for static values like themes, while Zustand handles fast-updating data and storage persistence. Once stored client data exceeds 5MB or includes binary files, the skill instructs the assistant to implement an IndexedDBService wrapper instead of localStorage. Server data relies on React Query with explicit cache invalidation.
Because it extends generic-feature-developer, broader feature scoping decisions depend on that base prompt. Any component exceeding 20KB must use React.lazy alongside Suspense.
What it helps with
- Structure directories and code layers for new React feature modules
- Choose between React Context, Zustand, and IndexedDB based on payload size
- Configure server queries using React Query with targeted cache invalidation
- Split route bundles and heavy components using React.lazy
Example prompts for the agent
- Scaffold a cart feature using Zustand persistence and an IndexedDB fallback
- Refactor our catalog state into Zustand selectors to minimize re-renders
- Build a compound Tabs component using React context and lazy panels
How to install generic-react-feature-developer
1Skills CLI (Vercel)
npx skills add travisjneuman/.claude --skill generic-react-feature-developer -a claude-code2Manually: put the files in place
~/.claude/skills/generic-react-feature-developer/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/generic-react-feature-developer/
1Skills CLI (Vercel)
npx skills add travisjneuman/.claude --skill generic-react-feature-developer -a codex2Manually: put the files in place
.agents/skills/generic-react-feature-developer/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add travisjneuman/.claude --skill generic-react-feature-developer -a cursor2Manually: put the files in place
.cursor/skills/generic-react-feature-developer/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install travisjneuman/.claude skills/generic-react-feature-developer2Manually: put the files in place
.github/skills/generic-react-feature-developer/SKILL.md1Skills CLI (Vercel)
npx skills add travisjneuman/.claude --skill generic-react-feature-developer -a gemini-cli2Platform CLI
gemini skills install https://github.com/travisjneuman/.claude --path skills/generic-react-feature-developerManually: put the files in place
.devin/skills/generic-react-feature-developer/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add travisjneuman/.claude --skill generic-react-feature-developer -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 generic-react-feature-developer
How do I install generic-react-feature-developer in Claude Code?
Run npx skills add travisjneuman/.claude --skill generic-react-feature-developer -a claude-code. The file will be placed in ~/.claude/skills/generic-react-feature-developer/SKILL.md.
When does the skill choose IndexedDB over localStorage?
IndexedDB is required when total data exceeds 5MB, when persisting binary blobs like images, or when complex key queries are needed.
What state management setup does the skill recommend?
It prescribes Zustand for client-side state and React Query for server data fetching, reserving basic React Context for rarely updated settings.
Source text
SKILL.md · MIT
---
name: generic-react-feature-developer
description: Guide feature development for React applications with architecture focus. Covers Zustand/Redux patterns, IndexedDB usage, component systems, lazy loading strategies, and seamless integration. Use when adding new features, refactoring existing code, or planning major changes.
---
# React Feature Developer
Guide feature development with React architecture patterns.
**Extends:** [Generic Feature Developer](../generic-feature-developer/SKILL.md) - Read base skill for development workflow, scope assessment, and build vs integrate decisions.
## React Architecture
### Project Structure
```
src/
├── components/
│ ├── ui/ # Reusable primitives (Button, Input)
│ ├── features/ # Feature-specific components
│ └── layout/ # Layout components (Header, Sidebar)
├── hooks/ # Custom hooks (useAuth, useStore)
├── stores/ # Zustand stores
├── services/ # API clients, IndexedDB wrappers
├── types/ # TypeScript interfaces
└── lib/ # Utilities
```
## State Management Patterns
### Zustand Store (Preferred)
```typescript
// stores/useFeatureStore.ts
interface FeatureState {
items: Item[];
isLoading: boolean;
// Actions
addItem: (item: Item) => void;
removeItem: (id: string) => void;
}
const useFeatureStore = create<FeatureState>()(
persist(
(set) => ({
items: [],
isLoading: false,
addItem: (item) => set((s) => ({ items: [...s.items, item] })),
removeItem: (id) =>
set((s) => ({
items: s.items.filter((i) => i.id !== id),
})),
}),
{
name: "feature-storage",
version: 1,
migrate: (state, version) => {
// Handle migrations between versions
return state as FeatureState;
},
},
),
);
```
### Zustand Selectors (Performance)
```typescript
// Avoid re-renders with selectors
const items = useFeatureStore((state) => state.items);
const addItem = useFeatureStore((state) => state.addItem);
// Shallow compare for objects
import { shallow } from "zustand/shallow";
const { items, isLoading } = useFeatureStore(
(state) => ({ items: state.items, isLoading: state.isLoading }),
shallow,
);
```
### Context vs Zustand Decision
| Use Context | Use Zustand |
| ------------------------------ | -------------------------- |
| Theme, locale (rarely changes) | Frequently updated data |
| Authentication state | Complex state with actions |
| Provider already exists | Need persistence |
| Prop drilling 1-2 levels | Cross-cutting concern |
## Server State (React Query)
```typescript
// Server state - React Query
const { data, isLoading, error } = useQuery({
queryKey: ["items", userId],
queryFn: () => fetchItems(userId),
staleTime: 5 * 60 * 1000, // 5 minutes
});
// Mutations
const mutation = useMutation({
mutationFn: createItem,
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ["items"] });
},
});
```
## IndexedDB Integration
### When to Use
| Scenario | Solution |
| --------------------------- | -------------------------------- |
| < 5MB total | localStorage via Zustand persist |
| > 5MB total | IndexedDB |
| Binary data (images, files) | IndexedDB |
| Simple key-value | localStorage |
| Complex queries | IndexedDB |
### Service Wrapper Pattern
```typescript
// services/indexedDBService.ts
class IndexedDBService {
private db: IDBDatabase | null = null;
async init() {
return new Promise<void>((resolve, reject) => {
const request = indexedDB.open("AppDB", 1);
request.onerror = () => reject(request.error);
request.onsuccess = () => {
this.db = request.result;
resolve();
};
request.onupgradeneeded = (event) => {
const db = (event.target as IDBOpenDBRequest).result;
db.createObjectStore("items", { keyPath: "id" });
};
});
}
async setItem<T>(store: string, value: T): Promise<void> {
// Implementation
}
async getItem<T>(store: string, key: string): Promise<T | null> {
// Implementation
}
}
export const indexedDBService = new IndexedDBService();
```
## Lazy Loading
### Component Lazy Loading
```typescript
// Heavy components (>20KB)
const HeavyChart = lazy(() => import('./HeavyChart'));
const RichTextEditor = lazy(() => import('./RichTextEditor'));
// Pages
const SettingsPage = lazy(() => import('./pages/Settings'));
// Usage with Suspense
<Suspense fallback={<Skeleton />}>
<HeavyChart data={data} />
</Suspense>
```
### Route-Level Code Splitting
```typescript
// React Router example
const routes = [
{
path: '/dashboard',
element: <DashboardLayout />,
children: [
{
path: 'settings',
lazy: () => import('./pages/Settings'),
},
],
},
];
```
## Custom Hook Patterns
### Feature Hook
```typescript
// hooks/useItems.ts
function useItems() {
const items = useFeatureStore((s) => s.items);
const addItem = useFeatureStore((s) => s.addItem);
const sortedItems = useMemo(
() => [...items].sort((a, b) => b.createdAt - a.createdAt),
[items],
);
return { items: sortedItems, addItem };
}
```
### Compound Hook (Combining Sources)
```typescript
// hooks/useDashboard.ts
function useDashboard() {
// Local state
const [filter, setFilter] = useState("all");
// Server state
const { data: items } = useQuery({ queryKey: ["items"] });
// Client state
const preferences = usePreferencesStore((s) => s.dashboard);
// Derived
const filteredItems = useMemo(
() => items?.filter((i) => filter === "all" || i.status === filter),
[items, filter],
);
return { filter, setFilter, items: filteredItems, preferences };
}
```
## Component Composition
### Compound Components
```tsx
// Usage: <Tabs><Tabs.List /><Tabs.Panel /></Tabs>
const TabsContext = createContext<TabsContextValue | null>(null);
function Tabs({ children, defaultValue }: TabsProps) {
const [active, setActive] = useState(defaultValue);
return (
<TabsContext.Provider value={{ active, setActive }}>
{children}
</TabsContext.Provider>
);
}
Tabs.List = function TabsList({ children }: { children: ReactNode }) {
return <div role="tablist">{children}</div>;
};
Tabs.Panel = function TabsPanel({ value, children }: TabsPanelProps) {
const { active } = useContext(TabsContext)!;
if (value !== active) return null;
return <div role="tabpanel">{children}</div>;
};
```
## React Feature Checklist
**Before Starting:**
- [ ] Read CLAUDE.md for project patterns
- [ ] Check existing components for reuse
- [ ] Plan state management approach
- [ ] Estimate bundle size impact
**During Development:**
- [ ] Follow project design system
- [ ] TypeScript strict mode
- [ ] Implement keyboard navigation
- [ ] Add ARIA labels
- [ ] Support dark mode
**Before Completion:**
- [ ] Unit tests only if the user asked for them
- [ ] Lazy load heavy components
- [ ] Review bundle impact of new imports and dependencies
- [ ] Review with code-reviewer skill
## See Also
- [Generic Feature Developer](../generic-feature-developer/SKILL.md) - Workflow, decisions
- [Code Review Standards](../_shared/CODE_REVIEW_STANDARDS.md) - Quality requirements
- [Design Patterns](../_shared/DESIGN_PATTERNS.md) - UI patterns
© travisjneuman · MIT · travisjneuman/.claude