react-patterns
Skill678 starsChanged 2 months agoMITView on GitHub
Do/don't code examples for this repo's React conventions (Suspense data fetching, shadcn styling with no margins or hard-coded colors, FormData + Zod forms). Use when writing or reviewing React components.
Files
React patterns — examples
The rules are in the React Patterns section of AGENTS.md; these are the examples for the ones that go against habit.
Data fetching
// ❌ useState + useEffect
const [user, setUser] = useState(null);
const [isLoading, setIsLoading] = useState(true);
useEffect(() => { fetch(...).then(r => r.json()).then(d => { setUser(d); setIsLoading(false); }); }, [userId]);
if (isLoading) return <div>Loading...</div>;
// ✅ TanStack Query + Suspense — no isLoading checks
const UserContent: React.FC<{ userId: string }> = ({ userId }) => {
const { data: user } = useQuery({ queryKey: ['user', userId], queryFn: () => fetchUser(userId), suspense: true });
return <div>{user.name}</div>;
};
export const UserProfile: React.FC<{ userId: string }> = (props) => (
<Suspense fallback={<Skeleton className="h-6 w-32" />}><UserContent {...props} /></Suspense>
);Styling
// ❌ Hard-coded colors, dark variants, margin on the component
<div className="w-[300px] m-4 p-6 bg-white dark:bg-slate-900 text-slate-900 dark:text-white rounded-xl shadow-lg border border-slate-200 dark:border-slate-700">
<h3 className="text-xl font-bold mb-2">{frame.title}</h3>
</div>
// ✅ shadcn base handles theming; Tailwind for layout only; gap on parent (not margin on child)
<Card onClick={onSelect} className="cursor-pointer">
<CardHeader><CardTitle>{frame.title}</CardTitle><CardDescription>{frame.description}</CardDescription></CardHeader>
</Card>
// Parent owns spacing:
<div className="grid grid-cols-3 gap-4">
{frames.map(f => <FrameCard key={f.id} frame={f} />)}
</div>Forms
// ❌ Controlled inputs everywhere, manual validation, setState per field
// ✅ Uncontrolled + FormData + Zod + TanStack Query mutation
export const ScriptForm: React.FC = () => {
const mutation = useMutation({ mutationFn: createScript });
const onSubmit = (e: React.FormEvent<HTMLFormElement>) => {
e.preventDefault();
const result = scriptSchema.safeParse(
Object.fromEntries(new FormData(e.currentTarget))
);
if (!result.success) return; // surface errors inline
mutation.mutate(result.data);
};
return (
<form onSubmit={onSubmit} className="flex flex-col gap-4">
<Input name="title" placeholder="Script title…" required />
<Button type="submit" disabled={mutation.isPending}>
{mutation.isPending ? 'Creating…' : 'Create'}
</Button>
</form>
);
};Other versions37 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 37
- involvex/youtube-music-cli★ 468same name
- xenitV1/Antigravity-Workflows★ 130same name
- jh941213/my-claude-code-asset★ 126same name
- TangleML/tangle-ui★ 104same name
- maxyeh0817/Forge★ 34same name
- VoDaiLocz/kilo-kit-mcp★ 28same name
- Fandry96/k3-agentic-skills★ 27same name
- komluk/scaffolding★ 15same name
- xfstudio/skills★ 9same name
- gongyijie85/dsh-ecc★ 8same name
27 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
Used alongsideProjects with it also use typescript-strict, docker-expert and 10 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
Greg-KleinSkilltypescript-strict
TypeScript strict mode conventions and type safety rules
Also in 3 projects that use this
xfstudioSkilldocker-expert
Docker containerization expert with deep knowledge of multi-stage builds, image optimization, container security, Docker Compose orchestration, and production deployment patterns. Use PROACTIVELY for Dockerfile optimization, container issues, image size problems, security hardening, networking, and orchestration challenges.
Also in 3 projects that use this
BlockSkilltesting-strategy
Guidelines for writing effective tests in this project
Also in 4 projects that use this
etewiahSkille2e-testing
Playwright E2E testing and Lighthouse performance auditing. Use when setting up E2E tests, running Playwright tests, performing Lighthouse audits, or debugging E2E test failures.
Also in 5 projects that use this
LangChainSkilldocker-patterns
Best practices for Docker containerization and multi-stage builds
Also in 3 projects that use this
mstuder-slalomSkillgolang-patterns
Idiomatic Go patterns, best practices, and conventions for building robust, efficient, and maintainable Go applications.
Also in 3 projects that use this
In this repository15 other files it gives its agents.
- AGENTS.mdAGENTS.md
- .cursor/rules/bun-test.mdcCursor rule
- .cursor/rules/context7-integration.mdcCursor rule
- .cursor/rules/drizzle-patterns.mdcCursor rule
- .cursor/rules/production-review-panel.mdcCursor rule
- .cursor/rules/project-context.mdcCursor rule
- .cursor/rules/react-rules.mdcCursor rule
- .cursor/rules/tanstack-react-router_api.mdcCursor rule
- .cursor/rules/tanstack-react-router_guide.mdcCursor rule
- .cursor/rules/tanstack-react-router_installation.mdcCursor rule
- .cursor/rules/tanstack-react-router_routing.mdcCursor rule
- .cursor/rules/tanstack-react-router_setup-and-architecture.mdcCursor rule
- .cursor/rules/use-bun-instead-of-node-vite-npm-pnpm.mdcCursor rule
- sd25-peSkill
- update-model-versionsSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

