Skills DirectorySkills Directory
SkillsLearnSecurityCategoriesDocsBlogPro
Sign InSubmit Skill
Skills Directory

Security-tested agent skills for Claude, coding agents, and AI workflows.

Directory

  • Browse Skills
  • All Skills A–Z
  • Claude Skills
  • Claude Code Skills
  • Agent Skills
  • Categories
  • Authors
  • Submit a Skill

Learn

  • Learn Hub
  • Install Claude Skills
  • Write SKILL.md
  • Skills vs MCP
  • Directories Compared

Security

  • Security
  • Methodology
  • Secure Claude Skills
  • Security Badges
  • Chrome Extension
  • Skill Manager

Company

  • About
  • Community
  • Blog
  • API Docs
  • Advertise

2026 Skills Directory. All rights reserved.

ProTermsPrivacyRefunds
Back to skills

Pro State Machine

ASecurity

Professional React state-machine patterns. Use when implementing complex state logic, reducers, multi-step forms, async flows, or any component coordinating multiple states.

4 stars
0 votes
0 copies
1 views
Added 9/19/2026
developmenttypescriptreacttesting

Security Analysis

A100/100

Pro scans all 9 files and shows the line behind each finding

Scanned 9/19/2026

$npx -y skills add jgamaraalv/delivery-loop --skill pro-state-machine --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Pro State Machine?

Add the live security badge to your README — it updates automatically with every re-scan.

Security grade badge for Pro State Machine
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/jgamaraalv-pro-state-machine/badge)](https://www.skillsdirectory.com/skills/jgamaraalv-pro-state-machine)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
Files
SKILL.md
---
name: pro-state-machine
description: Professional React state-machine patterns. Use when implementing complex state logic, reducers, multi-step forms, async flows, or any component coordinating multiple states.
---

# 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

1. **Events Over State**: Capture user intent explicitly rather than mutating state directly
2. **Impossible States Prevention**: Use TypeScript's type system to make invalid states unrepresentable
3. **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 `status` discriminated union, never boolean flag soup (`isLoading`/`isError`/`isSuccess`).
- **Combine related state in a reducer** — atomic updates, no intermediate invalid states; `useState` only for simple independent values.
- **Drive side effects by events, not reactions** — one effect watches `status`, never cascading `useEffect` chains.
- **Fetch with a dedicated library** — TanStack Query or SWR over hand-rolled `useEffect` fetching.
- **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 with `useEffect` or holds totals/filters/computed strings in state.
- `references/finite-state-machines.md` — discriminated-union state with a single `status` field and exhaustive switches · read when modeling idle/loading/error/success or replacing boolean flag soup.
- `references/reducers.md` — combining related variables into one `useReducer` for 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 watching `status` (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 manual `useEffect` + `useState` fetching.
- `references/form-state.md` — native `FormData` + `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.

Attribution

jgamaraalvjgamaraalv
View sourceSee grades on GitHubMore from jgamaraalv →
SSkills Directory ProSkills Directory

Get any skill into Claude in one click.

Download any skill as a ZIP for Claude.ai, Claude Desktop, or .claude/skills. $9/mo.

See Pro

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments (0)

No comments yet. Be the first to comment!

SSkills Directory ProSkills Directory

Get any skill into Claude in one click.

Download any skill as a ZIP for Claude.ai, Claude Desktop, or .claude/skills. $9/mo.

See Pro

Related Skills

Clean Code

Pragmatic coding standards - concise, direct, no over-engineering, no unnecessary comments

304955 votes

Browser Extension Developer

Use this skill when developing or maintaining browser extension code in the `browser/` directory, including Chrome/Firefox/Edge compatibility, content scripts, background scripts, or i18n updates.

285172 votes

Seo Optimizer

SEO optimization with keyword analysis, readability assessment, technical validation, content quality. Use for search rankings, blog posts, content audits, or encountering keyword density, readability scores, meta tags, schema markup errors.

2222 votes

Google Official Seo Guide

Official Google SEO guide covering search optimization, best practices, Search Console, crawling, indexing, and improving website search visibility based on official Google documentation

1862 votes

Tanstack Start

Build a full-stack TanStack Start app on Cloudflare Workers from scratch — SSR, file-based routing, server functions, D1+Drizzle, better-auth, Tailwind v4+shadcn/ui. Use whenever the user mentions TanStack Start, asks to scaffold a full-stack Cloudflare app with SSR, wants an SSR dashboard, or asks for a React 19 + Cloudflare Workers app with file-based routing and server functions — even if they don't name TanStack Start specifically. No template repo — Claude generates every file fresh per ...

10311 votes
View all in development →