state-management-patterns

A guide for deciding where application data should live in a modern web app, such as in the interface, server data, the URL, or shared app state.

In plain words
What is it for?
Planning interactive features, reorganising state in React apps, connecting fetched data to interface state, and replacing an unnecessarily large shared store.
Why use it?
It helps avoid duplicated data, unnecessary screen updates, and bugs caused by keeping the same information in multiple places.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/kraitdev/skill.md/state-management-patterns
Any agent
npx skills add KraitDev/skiLL.Md --skill state-management-patterns
Clone the repo
git clone --depth 1 https://github.com/KraitDev/skiLL.Md

Made for: Claude Code, Codex.

Per session 19 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,664 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00019 $0.01664
Opus 5 $0.00010 $0.00832
Sonnet 5 $0.00004 $0.00333
Haiku 4.5 $0.00002 $0.00166

Measured yesterday against content hash c121388ea958, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

state-management-patterns scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/frontend/state-management-patterns/SKILL.md · 165 lines

How it starts

The opening of the file, as written. The whole thing — 165 lines — stays where its author put it; the contents beside it link to each section on GitHub.

State Management Patterns

Purpose

Applications suffer from bugs and performance issues when state lives in the wrong place. This skill guides teams to categorize state by its nature (UI, server, URL, global) and store it appropriately, eliminating duplication, excessive re-renders, and synchronization bugs.

When to use

  • Adding new interactive features that require data persistence across views
  • Refactoring an app suffering from excessive re-renders
  • Integrating external data fetching with local UI state
  • Deciding where a new piece of state should live
  • Migrating from Redux/global store when unnecessary

When NOT to use

  • Component-level prop decisions (use React Component Design skill)
  • Server caching strategy decisions (use Caching Strategies skill)
  • Real-time synchronization protocols (different concern)

Inputs required

  • Existing React application with state management code
  • Understanding of current state locations (Redux, Context, useState)
  • List of state mutations and their trigger sources

Workflow

  1. Categorize State: Classify each state piece as: UI-only, Server, URL-driven, or Truly Global
  2. URL First: Move ALL sort, filter, pagination, search, and tab parameters to URL search params
  3. Separate Server Cache: Use React Query / SWR / Tanstack Query for ALL server data (never Redux)
  4. Localize UI State: Keep form inputs, modals, toggles, tooltips in component useState only
  5. Identify Global: ONLY theme, auth, and language user preferences go to Context/Redux
  6. Implement Separation: Refactor code to respect these boundaries
  7. Verify Sync: Ensure no state is duplicated across layers

Rules

  • MUST store shareable states (filters, search, pagination) in URL, not Redux/Context
  • MUST use React Query/SWR for server data, NEVER Redux
  • MUST NOT manually sync server data between global store and cache layer
  • MUST NOT store UI-only state (modal open, form focus) in global store
  • MUST NOT mirror props into local state
  • MUST NOT have duplicate copies of state

Read the full file on GitHub · 165 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 165 lines · 19 tokens per session scan A c121388ea958

Subscribe to this mod's changes

state-management-patterns is a skill published in the GitHub repository KraitDev/skiLL.Md (7 stars, last pushed 2mo ago), licensed MIT. It adds 19 tokens to every session and 1,664 once invoked, about $0.0001 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

evaluate-pattern-adoption

Run or plan this repository's pattern-adoption evidence evaluation locally with signed-in Codex agents. Use when asked to refresh stale evidence, assess stable or exploratory patterns, evaluate one or all catalog patterns, discover possible new patterns, or prepare a reviewable evidence PR without model-backed GitHub…

PaulDuvall/ai-development-patterns · 68 tokens

studio

Architecture Studio control plane — initialize or inspect a studio workspace, create and register projects, or route an architecture/AEC task to the right agent or skill. Use when the user runs /as:studio, asks to set up or open their studio, manage its projects, or describes a task without naming a skill.

AlpacaLabsLLC/skills-for-architects · 65 tokens

epd-to-spec

Write CSI specification language for EPD submittals and sourced GWP limits. Use to add embodied-carbon or EPD requirements to specs; not to parse, find, or compare EPDs.

AlpacaLabsLLC/skills-for-architects · 45 tokens

learn

Guided, hands-on course teaching architects how to use Codex or Claude Code — six short modules, each built around an exercise on a bundled sandbox project (a fictional Brooklyn art museum expansion). Resumable across sessions via PROGRESS.md. Use when the user runs $learn or /as:learn, says they're new to AI-assisted…

AlpacaLabsLLC/skills-for-architects · 80 tokens

occupancy-calculator

Calculate code occupant loads by area with gross/net factors and jurisdiction checks. Use for "how many people can this space hold," IBC Table 1004.5, egress inputs, or occupancy-load reports; not for workplace headcount planning.

AlpacaLabsLLC/skills-for-architects · 55 tokens

workplace-programmer

Build office space programs through guided workplace strategy: area splits, room schedules, and planned seat counts. Use to program or size a workplace; not for code occupant-load calculations.

AlpacaLabsLLC/skills-for-architects · 40 tokens