Agent skill

State Management

by compozy in compozy/compozy

Model, review, and refactor application state so source state stays minimal, derived state is computed instead of synchronized, impossible states are not representable, and each piece of state lives…

MITAuto-check passedFrontend & Design

Install State Management

skills CLI
$ npx skills add compozy/compozy --skill state-management -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install compozy/compozy state-management --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/compozy/compozy.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.agents/skills/state-management .claude/skills/state-management && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
state-management
GitHub stars
2.8k
Token cost
~2.5k tokens
SKILL.md length
1,299 words
Files
10 (incl. references)
Skills in repo
47
Repo updated
First seen
Licence
MIT

At a glance

Model, review, and refactor application state so source state stays minimal, derived state is computed instead of synchronized, impossible states are not representable, and each piece of state lives…

  • Works in 4 steps: Inspect local package.json files and… → Read the component, store, reducer, and… → Identify which state is local, global,… → …
  • Mentions state management
  • SKILL.md covers First pass, Task mode, Core taxonomy and Core principles, plus 8 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

State Management is an agent skill from compozy/compozy. Model, review, and refactor application state so source state stays minimal, derived state is computed instead of synchronized, impossible states are not representable, and each piece of state lives in the right place. Use this whenever the user mentions state management, reducers, stores, Redux, Zustand, React state, Vue state, Pinia, selectors, derived state, duplicated state, boolean flags, invalid states, async status, useEffect soup, forms, wizards, filters, URL state, server state, or confusing UI logic…

Its SKILL.md is about 2.5k tokens, which your agent loads only when the skill is triggered. The skill folder holds 11 other files, including reference files (for example `evals/evals.json`, `references/async-state.md` and `references/no-library.md`).

It sits in Frontend & Design, covering State management. It works with Redux, Zustand and Vue.js. The repository describes itself as: An operating system for AI agents. Plug in the agent CLIs you already use (Claude Code, Codex, Gemini CLI, Cursor) and they become a team: they split the work, hand tasks to each… The licence is MIT.

When your agent uses it

  • Mentions state management
  • Duplicated state
  • Confusing UI logic
  • Even if they do not explicitly ask for a state model

Example prompts

  • “state model.”
  • “/state-management”

Workflow steps

4 steps, taken from the first numbered list in SKILL.md.

  1. Inspect local package.json files and imports.
  2. Read the component, store, reducer, and selector/getter code near the problem.
  3. Identify which state is local, global, remote, URL-backed, or external.
  4. Separate current implementation details from the actual domain model before suggesting changes.

What it can do on your machine

Read from SKILL.md and the folder at commit eec2ed1. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

State Management loads about 2.5k tokens when it runs, and up to ~5.7k if it reads all its reference files. Until then it costs about 147 tokens; SKILL.md has 1,299 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~147
When it runs · the whole SKILL.md, loaded when a task matches
~2.5k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~5.7k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from compozy/compozy at commit eec2ed1, republished under its MIT licence (© compozy). 1,299 words, ~2,482 tokens.

Download SKILL.mdSave it as .claude/skills/state-management/SKILL.md (or your agent's skills folder). This skill also uses 9 other files; get the full folder from GitHub.
name
state-management
description
Model, review, and refactor application state so source state stays minimal, derived state is computed instead of synchronized, impossible states are not representable, and each piece of state lives in the right place. Use this whenever the user mentions state management, reducers, stores, Redux, Zustand, React state, Vue state, Pinia, selectors, derived state, duplicated state, boolean flags, invalid states, async status, useEffect soup, forms, wizards, filters, URL state, server state, or confusing UI logic, even if they do not explicitly ask for a "state model."

State Management

Use this skill for state modeling first and library mapping second.

The goal is not to recommend a favorite library. The goal is to produce a state model that remains sound whether the implementation ends up in local component state, a reducer, Redux, Zustand, Pinia, URL params, TanStack Query, or no library at all.

Your job:

  • reduce state to the smallest valid source of truth
  • move derived values into selectors, getters, computed values, or render-time calculations
  • replace boolean soup with explicit finite states when modes are mutually exclusive
  • define state changes in terms of events and transitions rather than arbitrary setter calls
  • place each piece of state in the right home
  • review existing code for invalid states, duplication, synchronization bugs, and misplaced effects
  • map the resulting model to the user's chosen library only after the model is clear

First pass

In an existing codebase:

  1. Inspect local package.json files and imports.
  2. Read the component, store, reducer, and selector/getter code near the problem.
  3. Identify which state is local, global, remote, URL-backed, or external.
  4. Separate current implementation details from the actual domain model before suggesting changes.

If the user wants a new design from scratch, model the domain directly and only then choose implementation.

Task mode

Choose a mode before answering:

  • Design: build a new state model from requirements.
  • Review: identify bugs, risks, invalid states, and misplaced state.
  • Refactor: preserve behavior while simplifying the model and tightening invariants.
  • Library mapping: translate an already-sound model into React, Redux, Zustand, Vue/Pinia, or plain functions.

Do not jump straight to API advice when the real problem is a broken model.

Core taxonomy

Classify every value before deciding where it belongs.

  • Source state: authoritative facts the app must store.
  • Derived state: values that can be computed from source state and props/input. Do not store these unless there is a proven boundary reason.
  • Finite state: mutually exclusive modes such as idle, editing, submitting, success, failure.
  • Server state: remote data with loading, freshness, cache, and invalidation concerns.
  • URL state: values that should survive refresh, support sharing, or participate in back/forward navigation.
  • Ephemeral mutable values: timers, DOM handles, AbortControllers, previous snapshots, subscriptions, and other non-visual mutable values.
  • History state: undo/redo stacks, audit logs, previous states, and snapshots.

If a value does not clearly fit, you probably have not understood its role yet.

Core principles

  • Keep source state minimal.
  • Prefer one source of truth for each fact.
  • Compute derived values instead of synchronizing them.
  • Represent mutually exclusive modes with one finite status field or a discriminated union, not several booleans.
  • Make invalid states hard or impossible to represent.
  • Model updates as domain events and transitions.
  • Keep effects at the boundary. Effects should react to state transitions, not serve as the primary coordination mechanism.
  • Put state as low as possible, but as high as necessary.
  • Distinguish client state from server cache and URL state.
  • If several values always change together, model that relationship explicitly.

Workflow

Use this sequence unless the user explicitly asks for something narrower.

  1. Inventory all current or proposed state values.
  2. Classify each value using the taxonomy above.
  3. Remove duplication:
    • delete mirrored props
    • delete values that can be derived
    • avoid storing both an object and its selected ID unless there is a clear cache boundary
  4. Define invariants:
    • what combinations are valid?
    • what combinations are impossible?
    • what must always be true in each mode?
  5. Identify finite modes:
    • where booleans actually describe one status, collapse them into a finite state
  6. List domain events:
    • what can happen?
    • who or what causes it?
    • what data does the event carry?
  7. Sketch transitions:
    • from which states is each event valid?
    • what changes?
    • what side effects happen at the boundary?
  8. Decide placement:
    • local component state
    • reducer/store
    • URL
    • server cache/query layer
    • ref or external mutable object
  9. Map the model to the chosen library.

When requirements are fuzzy, show the model before the code.

Modeling questions

Use these questions before writing or revising code:

  • What are the smallest facts we actually need to store?
  • Which values are derived views of those facts?
  • Which modes are mutually exclusive?
  • What states are impossible but currently representable?
  • What events can happen, and which ones are valid in each state?
  • Does this state need to survive navigation or refresh?
  • Is this really application state, or is it server cache?
  • Is this value needed for rendering, or is it an ephemeral mutable handle?
  • Who owns this state, and who is allowed to change it?
  • Are we storing implementation details instead of domain truth?
  • Are effects being used to synchronize state that should be derived?
Show full SKILL.md (534 more words)Show less

Choosing the representation

Prefer the simplest representation that preserves invariants.

  • Independent local values: use local state only when fields are actually independent.
  • Finite modes: use a string literal status or discriminated union, not several booleans.
  • Coordinated updates: use a reducer when several fields change together or event handling depends on current state.
  • Complex workflows: use a state machine or actor model when there are guards, retries, cancellation, concurrency, or child processes.
  • Relational collections: normalize entities when nested updates become awkward or inconsistent.
  • Derived reads: use selectors, getters, computed values, or render-time calculations.
  • Server data: prefer a query/cache tool instead of forcing remote lifecycle concerns into a UI store.
  • Non-rendering mutable data: use refs or external mutable objects.

Do not recommend a more complex abstraction unless the simpler one cannot enforce the needed invariants.

Placement guidance

Choose where state lives by asking:

  • Who reads it?
  • Who writes it?
  • How long must it live?
  • Must it survive refresh?
  • Must it be shareable by URL?
  • Is it authoritative app state or remote cache?

Strong defaults:

  • keep transient view-only state local
  • keep cross-component client state in a reducer/store only when multiple consumers truly need it
  • keep shareable navigation/filtering state in the URL
  • keep fetched data in a server-state/cache layer
  • keep non-visual handles out of render state

Anti-patterns

Flag these aggressively in reviews and refactors:

  • derived state stored and resynchronized with effects
  • mirrored props in local state
  • many booleans describing one mode
  • storing both selectedItem and selectedItemId without a clear reason
  • duplicated state across component, store, and URL
  • action names that describe setters instead of domain events
  • deep nested relational state that should be normalized
  • useEffect chains that coordinate business logic
  • putting most form state in a global store without a strong reason
  • nullable field soup used instead of explicit states
  • mixing server state, client state, and request lifecycle in one undifferentiated blob

Reference routing

Open only the relevant references for the current task:

  • React: references/react.md
  • Redux and Redux Toolkit: references/redux.md
  • Zustand: references/zustand.md
  • Vue and Pinia: references/vue-pinia.md
  • Plain JavaScript or library-agnostic implementation: references/no-library.md
  • TypeScript modeling and exhaustiveness: references/typescript-modeling.md
  • Async lifecycle modeling: references/async-state.md
  • Review pass and smell detection: references/review-checklist.md

If the problem is specifically about XState or actor systems in a codebase that already uses them, prefer the dedicated xstate-v5 skill for implementation details.

Output format

Prefer this answer shape:

  1. State inventory: what exists now or what must exist.
  2. Findings or invariants: duplication, impossible states, and design constraints.
  3. Recommended model:
    • source state
    • derived state
    • finite states or discriminated union
    • events and transitions
    • placement
  4. Library mapping: only if the user asked for implementation in a specific stack.
  5. Code: only after the model is clear enough.

For reviews, lead with concrete problems first. For design tasks, lead with the model first.

Final self-check

Before answering, verify:

  • every stored value really needs to be stored
  • derived values are not being mirrored as source state
  • mutually exclusive modes are not represented as unrelated booleans
  • invalid states are reduced or eliminated
  • state ownership and placement are explicit
  • effects are not doing the work of selectors or transitions
  • async status is modeled explicitly
  • the recommended abstraction is not more complex than the problem requires
  • library-specific advice matches the user's actual stack

© compozy, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 9 other files (references) in .agents/skills/state-management of compozy/compozy.

  • SKILL.md
  • evals/evals.json
  • references/async-state.md
  • references/no-library.md
  • references/react.md
  • references/redux.md
  • references/review-checklist.md
  • references/typescript-modeling.md
  • references/vue-pinia.md
  • references/zustand.md

Open the folder on GitHubat commit eec2ed1

Compare with similar skills

State Management next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

State Management compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
State Management this skillcompozy/compozy2.8k—~2.5kAutomated safety check: PassMIT
React State Managementinvolvex/youtube-music-cli45613 repos~3kAutomated safety check: PassMIT
React ExpertJeffallan/claude-skills12k—~1.4kAutomated safety check: PassMIT
Frontend Review Statemizchi/skills356—~1.4kAutomated safety check: PassNone
npm Package Comparatortinyfish-io/tinyfish-cookbook2.2k—~2kAutomated safety check: PassMIT
Zustand Patternsyonatangross/orchestkit289—~1.6kAutomated safety check: PassMIT

Similar skills

  • React State Management

    involvex/youtube-music-cli

    Master modern React state management with Redux Toolkit, Zustand, Jotai, and React Query.

    456 GitHub starsUsed in 13 repos~3k tokens
    Frontend & DesignAuto-check passed
  • React Expert

    Jeffallan/claude-skills

    Builds React 19 components in TypeScript with Server Components, useActionState forms, custom hooks and state libraries, checked with tsc and React Testing Library.

    12k GitHub stars~1.4k tokensUpdated 4 days ago
    Frontend & DesignAuto-check passed
  • A skill your agent uses when reviewing state management architecture — classifying state types (server/URL/form/UI), checking for over-globalization, Jotai/Zustand/Redux patterns, derived state, and…

    356 GitHub stars~1.4k tokensUpdated 5 days ago
    Frontend & DesignAuto-check passed
  • npm Package Comparator

    tinyfish-io/tinyfish-cookbook

    Compare two or more npm packages side by side using live data — downloads, bundle size, GitHub stars, last update, known vulnerabilities, and community sentiment.

    2.2k GitHub stars~2k tokensUpdated 6 days ago
    Frontend & DesignAuto-check passed
  • Zustand Patterns

    yonatangross/orchestkit

    Reference for Zustand 5.x state management including slices, middleware, Immer, useShallow, persistence, selectors, and devtools integration.

    289 GitHub stars~1.6k tokensUpdated today
    Frontend & DesignAuto-check passed
  • Zustand State Management

    secondsky/claude-skills

    Zustand state management for React with TypeScript. An agent skill from secondsky/claude-skills.

    227 GitHub stars~2.5k tokensUpdated 9 days ago
    Frontend & DesignAuto-check passed

More from compozy/compozy

All 47 skills in this repo
  • Eng Real Scenario QA

    compozy/compozy

    Dogfoods Compozy through an autonomous startup scenario with live providers, cross-surface observation, and strict evidence audit.

    2.8k GitHub stars~3.4k tokensUpdated today
    Auto-check passed
  • Eng Test Conventions

    compozy/compozy

    Go test-shape discipline for Compozy. An agent skill from compozy/compozy.

    2.8k GitHub stars~467 tokensUpdated today
    Auto-check passed
  • Assistant UI

    compozy/compozy

    Guide for assistant-ui library - AI chat UI components. An agent skill from compozy/compozy.

    2.8k GitHub stars~958 tokensUpdated today
    Auto-check passed
  • Guide for assistant-ui UI primitives - ThreadPrimitive, ComposerPrimitive, MessagePrimitive.

    2.8k GitHub stars~999 tokensUpdated today
    Auto-check passed
  • Assistant UI Runtime

    compozy/compozy

    Guide for assistant-ui runtime system and state management. An agent skill from compozy/compozy.

    2.8k GitHub stars~856 tokensUpdated today
    Auto-check passed
  • Assistant UI Streaming

    compozy/compozy

    Guide for assistant-stream package and streaming protocols. An agent skill from compozy/compozy.

    2.8k GitHub stars~813 tokensUpdated today
    Auto-check passed

Questions about State Management

What does State Management do?

Model, review, and refactor application state so source state stays minimal, derived state is computed instead of synchronized, impossible states are not representable, and each piece of state lives…. State Management is an agent skill from compozy/compozy. Model, review, and refactor application state so source state stays minimal, derived state is computed instead of synchronized, impossible states are not representable, and each piece of state lives in the right place.

When should I use State Management?

State Management fits situations like: mentions state management; duplicated state; confusing UI logic; even if they do not explicitly ask for a state model.

How do I install State Management in Claude Code?

Run `npx skills add compozy/compozy --skill state-management -a claude-code`. Or copy the skill folder (.agents/skills/state-management in compozy/compozy) into .claude/skills/state-management in your project. Claude Code loads it when a task matches its description.

How do I install State Management in Codex?

Run `npx skills add compozy/compozy --skill state-management -a codex`. Or copy the skill folder (.agents/skills/state-management in compozy/compozy) into .agents/skills/state-management in your project. Codex loads it when a task matches its description.

Can I use State Management in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add compozy/compozy --skill state-management -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/state-management, .gemini/skills/state-management, .github/skills/state-management and .opencode/skills/state-management in your project.

What does State Management need to run?

SKILL.md names no scripts, command-line tools or credentials: State Management is instructions for the agent only.

Does State Management access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is State Management safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does State Management use?

State Management is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does State Management use?

About 2.5k tokens (SKILL.md is roughly 9.9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 3.2k tokens, read only when the agent opens those files.

What are the alternatives to State Management?

Skills that share tags, products or a category with State Management: React State Management (involvex/youtube-music-cli, 456 stars), React Expert (Jeffallan/claude-skills, 12k stars), Frontend Review State (mizchi/skills, 356 stars) and npm Package Comparator (tinyfish-io/tinyfish-cookbook, 2.2k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains State Management?

compozy (a GitHub organization) maintains it in compozy/compozy, which has 2,792 GitHub stars. The repository holds 47 skills in this directory. The repository was last updated on October 8, 2026.

Source: compozy/compozy on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.