react-agent
Pragmatic React development focused on avoiding over-engineering, effective state management, and render optimization. Use when building React components or features where you need clear guidance on (1) choosing appropriate state management solutions, (2) optimizing component rendering and performance, (3) avoiding common over-engineering patterns, (4) implementing TypeScript with React, or (5) making architectural decisions that balance simplicity with scalability.
What this skill does
# React Agent
Pragmatic React development that prioritizes simplicity, maintainable state management, and optimal rendering performance.
## Core Principles
### 1. Start Simple, Add Complexity Only When Needed
**Default approach:**
- Use local state (`useState`) first
- Lift state up when components need to share
- Add Context only when prop drilling becomes painful (>3 levels)
- Consider external state management (Zustand/Redux) only for truly global state
**Red flags of over-engineering:**
- Creating abstractions before they're needed
- Adding state management libraries for 2-3 shared values
- Implementing complex patterns for simple forms
- Premature optimization without measuring
### 2. State Management Decision Tree
Follow this decision tree when choosing state solutions:
```
Is this state used in only one component?
├─ YES → useState
└─ NO → Is it shared by 2-3 closely related components?
├─ YES → Lift state to nearest common parent
└─ NO → Does it need to be accessed across distant components?
├─ YES → Is it truly global (auth, theme, i18n)?
│ ├─ YES → Context API or Zustand
│ └─ NO → Still use props/composition when possible
└─ NO → Re-evaluate component structure
```
**Quick reference:**
- **1 component** → `useState`
- **2-3 related** → Lift state + props
- **Many components (same branch)** → Context API
- **App-wide global** → Zustand (recommended) or Redux Toolkit
- **Server data** → TanStack Query or SWR
### 3. Rendering Optimization Rules
**Only optimize when:**
1. Profiler shows actual performance issue
2. Component re-renders are visibly slow
3. Working with large lists (>100 items)
4. Expensive computations are occurring
**Optimization toolkit:**
- `React.memo` - for expensive components that receive same props
- `useMemo` - for expensive calculations
- `useCallback` - when passing callbacks to memoized children
- `useTransition` - for non-urgent updates (React 18+)
**Don't optimize prematurely:**
- Avoid wrapping everything in `memo` by default
- Don't use `useMemo` for simple calculations
- Don't optimize before measuring
## Quick Start Workflow
### 1. Analyze Requirements
```typescript
// Ask yourself:
// - What data do I need? (local vs shared)
// - How many components need this data?
// - Is this data from server or client?
// - Are there performance concerns?
```
### 2. Choose State Pattern
See `references/state-patterns.md` for detailed patterns and examples.
**Local State Example:**
```typescript
function Counter() {
const [count, setCount] = useState(0);
return <button onClick={() => setCount(c => c + 1)}>{count}</button>;
}
```
**Lifted State Example:**
```typescript
function Parent() {
const [items, setItems] = useState([]);
return (
<>
<ItemList items={items} />
<ItemForm onAdd={(item) => setItems([...items, item])} />
</>
);
}
```
### 3. Implement with TypeScript
```typescript
// Always type props and state
interface Props {
userId: string;
onUpdate: (data: UserData) => void;
}
function UserProfile({ userId, onUpdate }: Props) {
const [isLoading, setIsLoading] = useState(false);
// implementation
}
```
### 4. Add Optimization (Only If Needed)
```typescript
// Measure first with React DevTools Profiler
// Then optimize specific bottlenecks
const MemoizedList = memo(ExpensiveList);
const handleClick = useCallback(() => {
// Only when passing to memoized children
}, [dependencies]);
const expensiveValue = useMemo(() => {
// Only for truly expensive calculations
return heavyComputation(data);
}, [data]);
```
## Common Patterns
### Pattern 1: Form Handling
**Simple form (controlled):**
```typescript
function SimpleForm() {
const [email, setEmail] = useState('');
const handleSubmit = (e: FormEvent) => {
e.preventDefault();
// handle submission
};
return (
<form onSubmit={handleSubmit}>
<input
value={email}
onChange={(e) => setEmail(e.target.value)}
/>
</form>
);
}
```
**Complex form:** Use React Hook Form or Formik (only for 5+ fields)
### Pattern 2: Data Fetching
```typescript
// Prefer TanStack Query for server state
import { useQuery } from '@tanstack/react-query';
function UserProfile({ userId }: Props) {
const { data, isLoading, error } = useQuery({
queryKey: ['user', userId],
queryFn: () => fetchUser(userId),
});
if (isLoading) return <Spinner />;
if (error) return <Error error={error} />;
return <div>{data.name}</div>;
}
```
### Pattern 3: Conditional Rendering
```typescript
// Simple ternary
{isLoading ? <Spinner /> : <Content />}
// Multiple conditions - extract to variable
const content = (() => {
if (isLoading) return <Spinner />;
if (error) return <Error />;
if (!data) return <Empty />;
return <Content data={data} />;
})();
```
## Performance Checklist
Before optimizing, verify with React DevTools Profiler:
1. Identify which components re-render
2. Measure render time
3. Check why re-renders happen (props/state/context)
**Quick wins:**
- Extract expensive operations outside component
- Use proper key props for lists (not index unless static)
- Split large components into smaller ones
- Use Code Splitting for large bundles (`React.lazy`)
**For lists:**
```typescript
// Virtualization for 100+ items
import { useVirtualizer } from '@tanstack/react-virtual';
// Key requirement: stable, unique IDs
{items.map(item => (
<Item key={item.id} {...item} />
))}
```
## Anti-Patterns to Avoid
❌ **Over-abstraction:**
```typescript
// Don't create generic wrappers unnecessarily
<GenericForm config={complexConfig} />
```
❌ **Premature memoization:**
```typescript
// Don't wrap everything by default
export default memo(SimpleButton); // unnecessary
```
❌ **Prop drilling Context:**
```typescript
// Don't use Context just to avoid 2 levels of props
<Context.Provider value={simpleValue}>
```
❌ **Mutations:**
```typescript
// Never mutate state
items.push(newItem); // Wrong
setItems([...items, newItem]); // Correct
```
## References
Load these references for deeper guidance:
- **State Management** → `references/state-patterns.md` - Detailed patterns with examples
- **Performance** → `references/performance-guide.md` - Optimization techniques and profiling
- **TypeScript** → `references/typescript-patterns.md` - Type patterns and utilities
- **Hooks** → `references/hooks-guide.md` - Custom hooks and patterns
- **Testing** → `references/testing-guide.md` - Testing with React Testing Library
## Key Constraints
**MUST DO:**
- Type all props and state with TypeScript
- Use stable keys for lists (not array index for dynamic lists)
- Clean up effects (return cleanup function)
- Handle loading and error states
- Validate before optimizing (use Profiler)
**MUST NOT:**
- Mutate state or props
- Use index as key for dynamic lists
- Create functions inside JSX
- Forget useEffect cleanup (memory leaks)
- Over-engineer simple solutions
- Optimize without measuringRelated in Design
contribute
IncludedLocal-only OSS contribution command center. Auto-refreshes the user's in-flight PR and issue state on invoke so conversations start with full context — no need to brief Claude on what's in flight. Helps the user find issues to contribute to on GitHub, builds per-repo dossiers of what each upstream expects (CLA, DCO, branch convention, AI policy, draft-first, review bots, issue templates), runs deterministic gates before any external action so AI-assisted contributions don't reach maintainers as slop. State is markdown-only: candidate files at ~/.contribute-system/candidates/, repo dossiers at ~/.contribute-system/research/, append-only event log at ~/.contribute-system/log.jsonl. No database, no cloud calls. Use when the user asks about their PRs / issues / contributions, wants to find new work to take on, claim an issue, build/refresh a repo's dossier, or draft a Design Issue or PR. Trigger with "/contribute", "what's my PR status", "find a contribution", "claim issue X", "draft a Design Issue for Y", "refresh dossier for Z".
architectural-analysis
IncludedUser-triggered deep architectural analysis of a codebase or scoped subtree across eight modes — information architecture, data flow, integration points, UI surfaces, interaction patterns, data model, control flow, and failure modes. This skill should be used when the user asks to "diagram this codebase," "map the architecture," "show the data flow," "give me an ERD," "trace control flow," "find the integration points," "verify the layout pattern," "audit the UX architecture," or any similar request whose primary deliverable is mermaid diagrams plus cited reports under docs/architecture/. Dispatches haiku/sonnet sub-agents in parallel for per-mode exploration, then verifies every citation mechanically before any node lands in a diagram. Not for one-off prose explanations of code (use code-explanation) or for high-level system design from scratch (use system-design).
mcp
IncludedModel Context Protocol (MCP) server development and tool management. Languages: Python, TypeScript. Capabilities: build MCP servers, integrate external APIs, discover/execute MCP tools, manage multi-server configs, design agent-centric tools. Actions: create, build, integrate, discover, execute, configure MCP servers/tools. Keywords: MCP, Model Context Protocol, MCP server, MCP tool, stdio transport, SSE transport, tool discovery, resource provider, prompt template, external API integration, Gemini CLI MCP, Claude MCP, agent tools, tool execution, server config. Use when: building MCP servers, integrating external APIs as MCP tools, discovering available MCP tools, executing MCP capabilities, configuring multi-server setups, designing tools for AI agents.
react-native-skia
IncludedDesign, build, debug, and optimise high-polish animated graphics in React Native or Expo using @shopify/react-native-skia, Reanimated, and Gesture Handler. Use when the user wants canvas-driven UI, shaders, paths, rich text, image filters, sprite fields, Skottie, video frames, snapshots, web CanvasKit setup, or performance tuning for custom motion-heavy elements such as loaders, hero art, cards, charts, progress indicators, particle systems, or gesture-driven surfaces. Also use when the user asks for fluid, glow, glass, blob, parallax, 60fps/120fps, or GPU-friendly animated effects in React Native, even if they do not explicitly say "Skia". Do not use for ordinary form/layout work with standard views.
plaid
IncludedProduct Led AI Development — guides founders from idea to launched product. Six capabilities: Idea (discover a product idea), Validate (pressure-test the idea against fatal flaws, problem reality, competition, and 2-week MVP feasibility), Plan (vision intake + document generation), Design (translate image references into a design.md spec), Launch (go-to-market strategy), and Build (roadmap execution). Use when someone says "PLAID", "plaid idea", "help me find an idea", "product idea", "idea from my business", "idea from my expertise", "plaid validate", "validate my idea", "pressure-test", "is this idea good", "find fatal flaws", "validate the problem", "plan a product", "define my vision", "generate a PRD", "product strategy", "plaid design", "design from image", "translate image to design", "create design.md", "extract design tokens", "plaid launch", "go-to-market", "launch plan", "GTM strategy", "launch playbook", "plaid build", "build the app", "start building", or "execute the roadmap".
nextjs-framer-motion-animations
IncludedAdds production-safe Motion for React or Framer Motion animations to Next.js apps, including reveal, hover and tap micro-interactions, whileInView, stagger, AnimatePresence, layout and layoutId transitions, reorder, scroll-linked UI, and lightweight route-content transitions. Use when the user asks to add, refactor, or debug Motion or Framer Motion in App Router or Pages Router codebases, especially around server/client boundaries, reduced motion, LazyMotion, bundle size, hydration, or route transitions. Avoid for GSAP-style timelines, WebGL or 3D scenes, heavy scroll storytelling, or CSS-only effects unless Motion is explicitly requested.