/langs:lang-reactfrom langs
Build React SPAs where components are declarative UI consuming external state (Zustand/XState/TanStack Query). Logic lives in stores, not components.
Ships in langs. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
REACT_TASK: $ARGUMENTS (if provided) or current React implementation taskApply these patterns to $REACT_TASK.
Components consume external state, contain no logic:
| State Type | Solution |
|---|---|
| Remote (REST) | TanStack Query |
| Remote (GraphQL) | Apollo Client |
| Application state | Zustand |
| Complex machines | XState |
| Local UI state | useState (rare, last resort) |
// ✅ External hooks → Early returns → JSX
function UserProfile({ userId }: { userId: string }) {
const { user, isLoading } = useUser(userId);
const { updateProfile } = useUserActions();
if (isLoading) return <Spinner />;
return (
<div>
<h1>{user.name}</h1>
<button onClick={() => updateProfile({ email: '[email protected]' })}>
Update
</button>
</div>
);
}
| What | Tool | Why |
|---|---|---|
| Zustand stores | Vitest | Test without React |
| XState machines | Vitest | Deterministic transitions |
| Critical flows | Playwright | Real browser |
| Components | Never | Logic should be in stores |
// Test store directly
const { login } = useAuthStore.getState();
await login({ email: "[email protected]", password: "pass" });
expect(useAuthStore.getState().user).toBeDefined();
<Table
data={items}
loading={isLoading}
sortable
onSort={handleSort}
renderRow={(item) => <Row>{item.name}</Row>}
/>
// ✅ Inline - TypeScript infers types
<SearchableList
items={budgets}
renderItem={(budget) => <Card name={budget.name} />}
/>;
// ❌ Extract only if repeated 2+ times
const renderItem = (budget: Budget) => <Card name={budget.name} />;
import { match } from "ts-pattern";
{
match(state)
.with({ _tag: "loading" }, () => <Spinner />)
.with({ _tag: "success" }, (s) => <Data value={s.data} />)
.exhaustive();
}
| Technique | When |
|---|---|
| useMemo | Profiled as slow |
| useCallback | Repeated 2+ times |
| React.memo | Props rarely change |
| Code splitting | Route-level |
// ✅ Single component with CSS selectors
const Table = styled.table`
thead {
background: ${(p) => p.theme.colors.header};
}
tbody tr:hover {
background: ${(p) => p.theme.colors.hover};
}
td {
padding: ${(p) => p.theme.space.md};
}
`;
// ❌ Separate components for each element
const TableHeader = styled.thead`...`;
const TableRow = styled.tr`...`;
const TableCell = styled.td`...`;
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub codethread/claude-code-plugins --plugin langs