agentleFS
neeraj181-dotneeraj181-dot/ClaudeSkills/.claude/skills/state-manager/SKILL.md

state-manager

Skill0 starsChanged 3 months agoApache-2.0View on GitHub

Analyze and improve frontend state management — inspect state architecture, identify unnecessary complexity, find state bugs (stale state, race conditions, unnecessary re-renders), evaluate state management library choices, and recommend simpler alternatives where appropriate. Works with React (useState, useReducer, Context, Redux, Zustand, Jotai, Recoil), Vue (Pinia, Vuex), Svelte stores, Angular (NgRx, signals), and vanilla JS state. Use when the user wants to audit, simplify, debug, or improve their frontend state management.

2 other projects use a version of this.

Adopted by

Most recently taken up by

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    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
  1. Distinctive:

    Read-only by default: Do not modify state code. Fix only when explicitly requested (Phase 10).

    line 16
  2. Distinctive:

    Read: state store definitions, reducers, actions, selectors, state hooks.

    line 27
  3. Distinctive:

    Check for: unnecessary中间 steps, data transforming through too many layers.

    line 91

≈ “Common” is an estimate: at least 1 in 5 of the 364,980 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

State Manager

Act as a senior frontend architect who ensures state management is as simple as possible — but no simpler.

Core principle: the best state management is the least state management. Many apps use complex state libraries when simpler solutions (local state, URL state, server state) would work better. Complexity should be justified by actual need.

Two hard rules:

  1. Never claim state is broken without evidence. Trace the actual data flow before diagnosing state bugs.
  2. Read-only by default. Do not modify state code. Fix only when explicitly requested (Phase 10).

Work through the phases in order.


Phase 1 — State landscape detection

Map the state management architecture:

  • Detect: state library (Redux, Zustand, Jotai, Pinia, Vuex, Context API, signals), state patterns.
  • Read: state store definitions, reducers, actions, selectors, state hooks.
  • Identify: where state lives, how it flows, what's global vs local vs server.

Phase 2 — State categorization

Categorize all state in the application:

  • UI state — modals, drawers, tabs, form inputs, active selections.
  • Server/cache state — data fetched from APIs, cached client-side.
  • URL state — filters, pagination, search query reflected in URL.
  • Form state — form inputs, validation state, submission status.
  • Global app state — authentication, user preferences, theme.
  • Derived state — computed values from other state.

Key insight: server state (data from APIs) is often better managed by React Query/TanStack Query, SWR, or equivalent than by a global store. Mis-categorizing server state as global state is a common source of complexity.

Phase 3 — Architecture assessment

Evaluate the state architecture:

  • Over-engineering — complex state management for simple needs (Redux for a few boolean toggles).
  • Under-engineering — prop drilling through many levels, missing state management.
  • State duplication — same data stored in multiple places, risking inconsistency.
  • State location — global state that should be local, local state that should be URL state.
  • Separation of concerns — UI state mixed with server state, form state mixed with app state.

Phase 4 — State bug detection

Find common state bugs:

  • Stale closures — callbacks capturing outdated state values.
  • Stale state in effects — effects using state that has changed.
  • Race conditions — async operations overwriting each other's results.
  • Missing cleanup — subscriptions, timers, or listeners not cleaned up.
  • Immutable updates — state mutated directly instead of creating new references.
  • Selector efficiency — selectors returning new references every render, causing unnecessary re-renders.
  • State persistence — state lost on refresh when it should persist, or persisted when it shouldn't.

Phase 5 — Re-render analysis

Inspect unnecessary re-renders:

  • State changes triggering widespread re-renders — global state changes re-rendering unrelated components.
  • Missing memoization — expensive components re-rendering without need.
  • Over-memoization — memoization adding complexity without benefit.
  • Context overhead — Context value changing too frequently, re-rendering all consumers.
  • Derived state — computed values recalculated on every render instead of memoized.

Phase 6 — Library assessment

Evaluate the state library choice:

  • Appropriate for scale — the library matches the complexity of the app's state.
  • Alternatives considered — would a simpler solution work for some state?
  • Library overhead — bundle size, learning curve, boilerplate.
  • Server state library — TanStack Query or equivalent for server data (if not already used).
  • Form library — React Hook Form, Formik, or equivalent for complex forms.

Phase 7 — Data flow analysis

Trace important data flows:

  • Data fetching → store → component → user interaction → store update → component re-render
  • Identify: where data is fetched, how it's stored, how components access it, how it's updated.
  • Check for: unnecessary中间 steps, data transforming through too many layers.

Phase 8 — Recommendations

Prioritize improvements:

  • 🔴 High — state bugs causing incorrect behavior.
  • 🟠 Medium — architectural improvements reducing complexity.
  • 🔵 Low — cleanup, naming, organization.
  • ⚪ Info — opportunities for simplification.

Phase 9 — Final report

# State Management Summary
# State Library
# State Architecture
# State Categories
# State Bugs Found
# Re-render Issues
# Library Assessment
# Data Flow Analysis
# Recommendations

Guardrails, always: verify state bugs with evidence; recommend simpler solutions when they exist; don't add state management complexity without need; keep server state and UI state separate; prefer URL state for shareable/filter state; minimize global state; verify changes don't break existing behavior; and don't migrate state libraries unless the benefit clearly justifies the effort.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.