pro-state-machine
Skill0 starsChanged 4 months agoMITView on GitHub
Professional React state-machine patterns. Use when implementing complex state logic, reducers, multi-step forms, async flows, or any component coordinating multiple states.
In this repository63 other files it gives its agents.
- .claude/skills/nestjs-best-practices/AGENTS.mdAGENTS.md
- accessibility-a11ySkill
- architecture-blueprint-generatorSkill
- backend-delivery-loopSkill
- backend-designSkill
- backend-dev-guidelinesSkill
- backend-testingSkill
- backend-to-frontend-handoff-docsSkill
- building-componentsSkill
- bullmq-specialistSkill
- canvas-designSkill
- code-patternsSkill
- components-composition-patternsSkill
- conventional-commitSkill
- core-web-vitalsSkill
- create-svgSkill
- css-architectureSkill
- cypress-authorSkill
- cypress-docsSkill
- cypress-explainSkill
- delivery-loop-retroSkill
- diagnoseSkill
- fastify-best-practicesSkill
- figma-code-connectSkill
- frontend-delivery-loopSkill
- frontend-fundamentalsSkill
- fullstack-delivery-loopSkill
- grill-meSkill
- hunt-race-conditionSkill
- impeccableSkill
- mermaid-diagramsSkill
- nestjs-best-practicesSkill
- nextjs-best-practicesSkill
- nextjs-performanceSkill
- nodejs-backend-patternsSkill
- owasp-security-reviewSkill
- performance-hunterSkill
- playwright-best-practicesSkill
- postgresql-code-reviewSkill
- postgresql-optimizationSkill
- postmanSkill
- prisma-postgresSkill
- race-conditionSkill
- react-best-practicesSkill
- react-performanceSkill
- react-querySkill
- redis-coreSkill
- redis-query-engineSkill
- redis-securitySkill
- refactorSkill
- review-panelSkill
- run-delivery-chainSkill
- spec-drivenSkill
- sql-optimizationSkill
- system-designSkill
- testing-strategySkill
- tune-skills-and-agentsSkill
- ui-ux-pro-maxSkill
- vercel-react-view-transitionsSkill
- viteSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
2 rules. About 0 are common, 2 are distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 13
Impossible States Prevention: Use TypeScript's type system to make invalid states unrepresentable
- Distinctive: line 14
Separation of Concerns: Keep pure state transitions separate from side effects
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Pro State Machine
Professional state machine patterns for managing complex React application state, focused on making invalid states impossible through type-safe design.
Architecture Philosophy
- Events Over State: Capture user intent explicitly rather than mutating state directly
- Impossible States Prevention: Use TypeScript's type system to make invalid states unrepresentable
- Separation of Concerns: Keep pure state transitions separate from side effects
Core Rules
- Derive, don't store — compute values during render instead of syncing them with
useState+useEffect. - Model state as a finite state machine — a single
statusdiscriminated union, never boolean flag soup (isLoading/isError/isSuccess). - Combine related state in a reducer — atomic updates, no intermediate invalid states;
useStateonly for simple independent values. - Drive side effects by events, not reactions — one effect watches
status, never cascadinguseEffectchains. - Fetch with a dedicated library — TanStack Query or SWR over hand-rolled
useEffectfetching. - Normalize entities — flat maps keyed by ID, not deeply nested arrays.
References
Each file is loaded on demand — read one only when the task needs that depth (progressive disclosure).
references/derived-state.md— why and how to compute derived values during render instead of storing them · read when a component syncs state withuseEffector holds totals/filters/computed strings in state.references/finite-state-machines.md— discriminated-union state with a singlestatusfield and exhaustive switches · read when modeling idle/loading/error/success or replacing boolean flag soup.references/reducers.md— combining related variables into oneuseReducerfor atomic, testable transitions (booking-form example) · read when 3+ variables change together or transitions get complex.references/event-driven-effects.md— event-driven side effects: explicit actions + a single effect watchingstatus(flight-search example) · read when you have cascading effects, race conditions, or unpredictable async flows.references/data-fetching.md— TanStack Query / SWR for queries and optimistic mutations, and when to use which · read when fetching server data or replacing manualuseEffect+useStatefetching.references/form-state.md— nativeFormData+useActionState+ schema validation for multi-field/multi-step forms · read when building complex or multi-step forms.references/normalization.md— flat entity maps keyed by ID with selector functions for O(1) updates · read when state holds deeply nested arrays or updates require deep traversal.references/testing-reducers.md— testing pure reducers directly with Vitest (transitions and guard invariants) · read when writing tests for state logic.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
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.

