state-management
Skill0 starsChanged 2 months agoMITView on GitHub
Choose and wire state correctly — server cache vs client state, where state lives, colocation, undo/redo, and URL as state. Use when an app's data flow is getting tangled or before adding another state library.
27 other projects use a version of this.
Adopted by
Most recently taken up by
- komluk/scaffoldingtheir own version, first seen Nov 7, 2026
- compozy/compozytheir own version, first seen Nov 7, 2026
- omspradippatil/Claude-Skillstheir own version, first seen Nov 1, 2026
- github/replicatheir own version, first seen Nov 1, 2026
- darknecrocities/SkillBuildertheir own version, first seen Nov 1, 2026
- TheBeardedBearSAS/claude-crafttheir own version, first seen Oct 29, 2026
Used with
Projects with it also use error-handling, i18n and 9 more.
Other files people use alongside this one.
Files found in the same public projects as a version of this one, more often than they turn up anywhere else. Each project counts once, large collections count for less, and this file's own repository is left out.
MicrosoftSkillerror-handling
统一错误处理系统。在添加 API 端点、修改错误处理、添加前端 API 调用、编写错误相关测试时使用。
Also in 6 projects that use this
lbednerSkilli18n
Use when a code or template change introduces a new translation message key, in either the framework CLI (aegis/i18n/locales/) or a generated project's CLI (the app/i18n/locales/ template tree). Covers adding the real English string, stubbing the same key into every other locale for parity, and the separate translation PR that later replaces placeholders with reviewed native text.
Also in 4 projects that use this
mijunriSkilldatabase
数据库脚本与操作规范。脚本放在 db_scripts 目录,遵循查询优化、事务、安全等实践。
Also in 3 projects that use this
genomewalkerSkillresume
Resume a thread by loading its ~800-token context capsule
Also in 3 projects that use this
NVIDIASkilltesting
Run Python and Rust tests for physicsnemo-curator using uv + pytest with coverage reporting via pytest-cov, and cargo-nextest for Rust tests. Includes benchmark workflows with pytest-benchmark and criterion.
Also in 6 projects that use this
0xSeroSkillsecurity
Also in 4 projects that use this
Other versions27 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 27
- compozy/compozy★ 2.9ksame name
- github/replica★ 230same name
- conorluddy/xclaude-plugin★ 186same name
- cohen-liel/hivemind★ 108same name
- TheBeardedBearSAS/claude-craft★ 108same name
- EmeaAppGbb/spec2cloud★ 100same name
- statelyai/skills★ 48same name
- komluk/scaffolding★ 16same name
- darknecrocities/SkillBuilder★ 13same name
- PMDevSolutions/Aurelius★ 9same name
17 more not listed
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository11 other files it gives its agents.
- api-contract-designSkill
- browser-debuggingSkill
- component-reviewSkill
- css-architectureSkill
- frontend-testing-strategySkill
- nextjs-performanceSkill
- performance-budgetSkill
- react-hooks-disciplineSkill
- typescript-strictnessSkill
- vue3-compositionSkill
- web-a11ySkill
The file
We split this skill into the rules it gives an agent
2 rules. 0 are common, 1 is distinctive, and 1 is very specific to this project.
0
Common
Most of the 21 edited versions we read keep these.
1
Distinctive
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 57
Only model it where the product needs it (editors, canvases): keep a past/present/future triple of the *document* state, commit at …
- Distinctive: line 61
Prefer signals/atoms-style libs (Zustand, Jotai, Pinia) over single-tree flux for new code.
“Common” is measured: kept by at least 6 in 10 of the 21 edited versions of this file we could read. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
State management: put each piece where it belongs
The only taxonomy that matters
| Kind | Examples | Home |
| Server state | users, orders, search results | data-fetching cache (TanStack Query / SWR / RSC) |
| Client state | modal open, form draft, selection | useState/store, colocated |
| URL state | page, filters, tab, sort | the URL (search params) |
| Global UI | theme, auth session | tiny store + persistence |
Most "we need Redux" moments are really "our fetch cache and our UI state got tangled".
Server state ≠ client state
Server state has properties no client store models well: caching, invalidation, retries, race conditions, optimistic updates. Don't hand-roll these:
// ❌ hand-rolled cache
const [users, setUsers] = useState<User[]>([])
useEffect(() => { fetchUsers().then(setUsers) }, [])
// ✅ the cache handles dedupe/retry/race/invalidation
const { data: users } = useQuery({ queryKey: ['users'], queryFn: fetchUsers })Rules:
- Mutations invalidate keys, they don't patch arrays.
- Optimistic update = apply → rollback on error → always reconcile with server response.
- Track
updatedAt; stale-while-revalidate is a feature, not a bug.
Colocate before you centralize
Lift state only when a second consumer appears. State used by one component lives in that component. A "global store" with 40% single-consumer keys is a symptom.
URL is state (the most forgotten one)
Filters, tabs, pagination, sort → search params. You get shareability, back button, and SSR for free; refresh preserves context.
const [params, setParams] = useSearchParams()
setParams({ tab: 'advanced', page: '2' }) // not useState('advanced')Forms are their own domain
Controlled fields in local state (or a form library); never push keystrokes into a global store. Validation mirrors the server's contract; one source of truth for error shape.
Undo/redo
Only model it where the product needs it (editors, canvases): keep a past/present/future triple of the document state, commit at meaningful actions (not keystrokes), cap history depth.
When you do need a store
- Prefer signals/atoms-style libs (Zustand, Jotai, Pinia) over single-tree flux for new code.
- Selectors over subscriptions: components subscribe to slices, not the store; derived values are selectors/computed, never copied.
- One direction: actions mutate, components read. A store that both components write and components derive from in cycles is a design bug.
Definition of done (agent checklist)
- Server state lives in a query cache, not useEffect+setState
- Shareable view state (filters/tabs/page) is in the URL
- State colocated; store has no single-consumer keys
- No derived state kept in sync by effects
- Mutations invalidate; optimistic paths roll back
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.

