[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7F2QDJ6DHRJDQPGDJSV5NC3":3,"skill-same:01M7F2QDJ6DHRJDQPGDJSV5NC3":280},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":29,"ownerHtmlUrl":30,"ownerBlogUrl":31,"ownerDescription":32,"updatedAt":33,"install":34,"resources":47},"01M7F2QDJ6DHRJDQPGDJSV5NC3","state-management-zustand",null,"Builds Zustand 5 stores - pure reducers. Use when adding a store, action or selector, deciding where state lives, leaving Redux or persist+AsyncStorage, or on Maximum update depth. Not for server data (networking-and-server-state).","zakariaf\u002FReactNative-Skills","zakariaf","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F2259803?v=4","01M7DEF0YMPS6Y6RQ4WGA0JH9R","Zakaria Fatahi","01M7F1VKYEK96M7SYJE1EPGD0A",13,"MIT","https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002FSKILL.md",[],[],"2026-11-16 10:05:34",false,"---\nname: state-management-zustand\ndescription: Builds Zustand 5 stores - pure reducers. Use when adding a store, action or selector, deciding where state lives, leaving Redux or persist+AsyncStorage, or on Maximum update depth. Not for server data (networking-and-server-state).\n---\n\n# State management with Zustand\n\nClient state lives in thin Zustand 5 stores, one per domain, created once per app start over the\ndata layer's ports; every change is reduced by a pure reducer, written to disk, and only then shown;\nserver data stays in TanStack Query. Two zero-dependency scripts prove it on the app's own code.\n\n## Rules that must hold\n\n1. **One store per domain, made by a factory and created once per app start.** `create\u003CDomain>Store(deps)`\n   builds a vanilla store (`createStore` from `zustand\u002Fvanilla`) over the ports it receives;\n   `createStores(deps)` calls each factory once (the root layout's `useState` initializer, and\n   `test\u002Ftest-app.tsx` over fakes), `StoresProvider` hands the set down, components read\n   `use\u003CDomain>Store(selector)`. No `create` from `zustand`, no store at module level, no factory call in\n   feature or UI code; the one module-level store is an OS mirror listed in `contracts\u002Fstores.json`\n   (accessibility-as-code owns it). A store another skill ships with its own provider (the settings\n   store) is created once by its own opener and follows the same rules. Why: tests need fresh stores,\n   and Fast Refresh re-runs an edited module while components keep their state, so a module-level\n   store is made a second time; a `useState` initializer makes it once per React tree.\n2. **Persist before publish.** A change asks the reducer first (a refused or no-op change returns the\n   same object: no write, no render), writes through the port the factory received (a repository, the\n   document service, a preferences port: synchronous, committed when it returns ok), checks the result,\n   and only then calls `set`. A failed write publishes nothing but the failure (a returned `Result`, or a\n   `…Failure` field). When persistence assigns the id, persist first and publish the saved row through\n   the reducer. State a service produces (a Premium entitlement from the purchase flow) still enters\n   through a store method that writes it (`grantPremium(entitlement)`), never a publish-only `dispatch`.\n   A store meant to forget at restart says `\u002F\u002F memory-only: \u003Cwhy>`, never a store whose state is saved. Why: the screen never\n   shows a value that is not on disk, and iOS and Android both end background apps without warning.\n3. **All logic sits in pure reducers with imperative kebab-case actions, pinned by a cases table.**\n   `\u003Cdomain>Reducer(state, action)` imports no runtime code, never mutates, never reads the clock or\n   randomness (time and ids arrive in the action) and returns the same object when nothing changes; every\n   `set` publishes a reducer result; `\u003Cname>-reducer-cases.ts` beside it holds the rules as plain data (at\n   least one `same: true` case), run by its test and by `check-reducers`. Why: pure reducers replay the\n   same in Jest, Node and on both platforms, and a rule nobody pins drifts.\n4. **Selectors return a primitive or a reference already in the state; a built value goes through\n   `useShallow`; no store hook without a selector, no equality argument.** Named selectors live in\n   `\u003Cdomain>-selectors.ts`; a builder (`.filter`, `.map`, `{ … }`) is read as\n   `use\u003CDomain>Store(useShallow(selectX))`. Why: in Zustand 5 a selector returning a new reference each\n   call makes React throw \"Maximum update depth exceeded\" (verified, RNTL 14 on React 19.2), and the v4\n   equality argument is gone.\n5. **A write that spans stores is one transaction, then every store re-reads.**\n   `updateAndPublish(stores, () => tasks.removeList(id))`, with each such write named in\n   `contracts\u002Fstores.json` `crossStoreWrites`. Never several store calls, never the bare write. Why: a kill\n   between two writes leaves half a change, and a bare write leaves other stores showing deleted rows.\n6. **Server state and navigation state never enter a store.** Network data lives in the TanStack Query\n   cache (networking-and-server-state): no `fetch`, API client or React Query in a store, no effect that\n   copies `query.data` into one; route params belong to Expo Router. Stores hold client state: local\n   rows, UI choices, preferences, sessions. Why: two copies of server data drift on every refetch, and a\n   copied route goes stale on back (Android predictive back, the iOS swipe).\n7. **Stores are synchronous and persist only through the data layer's ports.** No `async`, `await` or\n   `.then` in a store; no zustand `persist` middleware anywhere, and no AsyncStorage, MMKV, SQLite, driver,\n   slot store or adapter import in a store (which engines the rest of the app may use is\n   persistence-and-migrations' one-engine rule); only a store's own methods change\n   it, never `setState` from outside. Why: an async action races itself and can publish a stale answer\n   last, and a second persistence path has no version, no migration and no backup.\n8. **An undoable session lives in a per-session store over a pure session reducer.** `past` stays in\n   memory for instant undo; the written form keeps `start`, the command log and the snapshot; restore\n   replays the log to rebuild undo, keeps the snapshot when the replay disagrees, and comes back paused;\n   persist before publish. Why: a kill mid-animation loses nothing, and a relaunch never moves on unseen.\n9. **Every reducer has a test beside it that runs its cases, and every persisting store a thin store\n   test** (a subscriber already sees the value on disk; a failed write publishes nothing; a no-op writes\n   nothing). Why: the order inside a store is invisible in review, and one moved line breaks it.\n\n## Workflow\n\n1. Read [references\u002Fstore-pattern.md](references\u002Fstore-pattern.md): the store shape, both persist orders,\n   composition, reducers and cases tables, selectors, cross-store writes, tests, every checker rule and\n   the contract. Read [references\u002Fstate-homes.md](references\u002Fstate-homes.md) when deciding where a piece\n   of state lives or when moving off Redux, Context, MobX or a `persist` + AsyncStorage store, and\n   [references\u002Fundoable-session.md](references\u002Fundoable-session.md) before building undo.\n2. Check the prerequisites: `src\u002Fcore\u002Fresult.ts` (error-handling-typed-results), the data layer\n   (persistence-and-migrations: repositories on `AppData`, or the document service) and the composition\n   root (architecture-and-boundaries). Install the pinned version from the repo root:\n   `npm install -E zustand@5.0.15` (stack table, verified 2026-10-03; re-verify with\n   `npm view zustand version`). When multi-package: run it in the app workspace (`-w apps\u002F\u003Capp>`).\n3. First stores: copy `templates\u002Fsrc\u002Fstores\u002F` (leave out `session\u002F` until step 7), `templates\u002Fcontracts\u002F`,\n   and replace the Tasks lists and tasks with the app's domains, keeping each file's shape (reducer +\n   cases + test, selectors + test, store + test). Wire `createStores` in AppRoot's `startApp` after the data layer and the error sink, as in\n   [examples\u002Fapp-root.tsx](examples\u002Fapp-root.tsx) with [examples\u002Fapp-providers.tsx](examples\u002Fapp-providers.tsx), add the stores to `test\u002Ftest-app.tsx`, and fill\n   `contracts\u002Fstores.json`.\n4. New action: add the failing case to `\u003Cname>-reducer-cases.ts` first (its test runs it), then the\n   union member and the reducer case, then the store method in the order of rule 2.\n5. New read: add or reuse a selector; read built values through `useShallow`, as\n   [examples\u002Fuse-tasks-model.ts](examples\u002Fuse-tasks-model.ts) does, and change state only in handlers.\n6. A write that spans stores: name it in `crossStoreWrites`, call it through `updateAndPublish`, and give\n   every new store holding rows a `reload` and a line in `updateAndPublish`.\n7. Undo: copy `templates\u002Fsrc\u002Fstores\u002Fsession\u002F` and `templates\u002Ftest\u002Fstores\u002F`; the feature creates one\n   session store per session in a `useState` initializer, with a `persist` callback that writes\n   `toSavedSession(...)` through a repository; restore with `restoreSession` (it comes back paused).\n8. Run `npx jest src\u002Fstores --ci --maxWorkers=2` and `npm run typecheck`.\n9. After changing a persisting store's write order, kill and relaunch a Release build on a named device\n   (iOS: `xcrun simctl terminate \u003Cudid> \u003Cbundle-id>`, then `xcrun simctl launch \u003Cudid> \u003Cbundle-id>`;\n   Android: `adb -s \u003Cserial> shell am force-stop \u003Cpackage>`, then\n   `adb -s \u003Cserial> shell monkey -p \u003Cpackage> -c android.intent.category.LAUNCHER 1`): what the screen\n   showed must still be there. persistence-and-migrations' kill test automates the data side.\n10. Run the checks from the repo root and fix every `FAIL` line (each names file, rule and fix) until\n    both print `RESULT: PASS`.\n\n## Definition of done\n\n- [ ] Every domain store comes from `create\u003CDomain>Store(deps)`, is created once (createStores in the root layout and the test app; a store another skill ships with its own provider, such as the settings store, once by its own opener) and is read through `use\u003CDomain>Store(selector)`; no `create` from zustand, no module-level store outside `osMirrorStores`.\n- [ ] Every store method reduces (same object: no write), persists through its port, checks the result, then publishes; failures are returned or recorded; service-fed state (an entitlement) enters through a writing store method; a memory-only store says so.\n- [ ] Every reducer is pure with imperative kebab-case actions, has a cases table with a `same: true` case, and a test that runs it.\n- [ ] Every selector call returns a primitive or a state reference, or goes through `useShallow`; no selectorless hook, no equality argument.\n- [ ] Every write that spans stores is in `contracts\u002Fstores.json` and goes through `updateAndPublish`.\n- [ ] No `fetch`, React Query or API client in a store, no effect copying query data into one, no `async` in a store, no persist middleware anywhere, no AsyncStorage or MMKV in a store.\n- [ ] `npx jest src\u002Fstores --ci --maxWorkers=2` passes and `npm run typecheck` is clean.\n- [ ] `node ${CLAUDE_SKILL_DIR}\u002Fscripts\u002Fcheck-reducers.mjs .` prints `RESULT: PASS` (the one expected SKIP: `SKIP src\u002Fstores\u002Fsettings\u002Fsettings-reducer-cases.ts [reducer-cases-missing] not yet created (settings-and-preferences creates it)`, only in an app that has not yet added that cases file).\n- [ ] `node ${CLAUDE_SKILL_DIR}\u002Fscripts\u002Fcheck-stores.mjs .` prints `RESULT: PASS`\n\n## Anti-patterns\n\n- **`export const useTasksStore = create(...)`.** A hook-store singleton shares state across tests and is\n  created again when Fast Refresh re-runs its module; write a factory and add it to `createStores`.\n- **`set(next)` and then the write, or a `setTimeout` \"debounced save\".** The screen shows unsaved data\n  and a kill loses it; persist first, synchronously, then publish.\n- **Ignoring the write's result** (`tasks.setDone(id, true); set(next);`). A full disk still shows the\n  change; keep the `Result` and return it when it failed.\n- **`useListsStore((state) => ({ count: …, failure: … }))`.** A new object every render loops forever in\n  Zustand 5; wrap it in `useShallow` or select two primitives.\n- **`useTasksStore()` or `useTasksStore((s) => s)` to \"get everything\".** Both re-render on every\n  change; select what is shown.\n- **Removing a list with `tasks.removeList(id)` and reloading only the lists store.** The tasks store\n  keeps the deleted tasks; use `updateAndPublish`.\n- **`useEffect(() => { setTasks(query.data) }, [query.data])`.** Two copies of server data drift; read\n  `useQuery` where it is shown and keep only client choices in a store.\n- **An `async` store action that fetches and then calls `set`.** Two calls race and the slower one\n  wins; fetch with TanStack Query, write locally through a synchronous port.\n- **`Date.now()`, `Math.random()` or `randomUUID()` in a reducer.** Pass the time in the action and let\n  the repository assign ids; reducers must replay identically.\n- **Event-style action names (`task-added`, `onToggle`).** Name the command: `add-task`, `set-done`.\n- **Pushing into `state.tasks` or `session.past`.** Spread into new arrays; `check-reducers` deep-freezes\n  the input to catch it.\n- **A publish-only Premium store (`dispatch: (action) => set(premiumReducer(get(), action))`) fed by a\n  purchase service that writes first.** Two writers own one fact and the store cannot report a failed\n  write; give the store `grantPremium(entitlement)`, which writes and then publishes.\n- **Keeping undo history on disk.** Save the start, the command log and the snapshot; replay on restore.\n- **A floating install (`npm install zustand`, `@latest`, a caret range).** It drifts from the verified\n  pin and can be younger than the release-age policy; install `zustand@5.0.15` exactly.\n\n## Files in this skill\n\n| File | What it is | Read\u002Frun when |\n|---|---|---|\n| [references\u002Fstore-pattern.md](references\u002Fstore-pattern.md) | Store shape, persist orders, entitlements and other service-fed state, composition, actions, reducers and cases tables, selectors and useShallow, cross-store writes, document mode, tests, platform notes, multi-package, checker rules, contract, limits | Workflow step 1, and on any store change |\n| [references\u002Fstate-homes.md](references\u002Fstate-homes.md) | Where each kind of state lives (server, navigation, forms, UI, preferences, secrets, OS state, sessions) and moving off Redux, Context, MobX or persist + AsyncStorage | Workflow step 1, when choosing a home for state |\n| [references\u002Fundoable-session.md](references\u002Fundoable-session.md) | The undoable session: types, actions, design choices, per-session store, when it is written, save and restore, property tests, the games hand-off | Workflow steps 1 and 7 |\n| `templates\u002Fsrc\u002Fstores\u002F` | `lists-*` and `tasks-*` reducers, cases tables, selectors and stores with tests; `reducer-cases.ts`; `stores-context.tsx`; `create-stores.ts`; `update-and-publish.ts`; all tests | Workflow steps 3 to 6 |\n| `templates\u002Fsrc\u002Fstores\u002Fsession\u002F` | Undoable session types, reducer, per-session store, saved session (save and restore), with tests | Workflow step 7 |\n| `templates\u002Ftest\u002Fstores\u002Fcounter-session-rules.ts` | Tiny session rules and codec the session tests use | Workflow step 7 |\n| `templates\u002Fcontracts\u002F` | `stores.json` (cross-store writes, OS mirror stores) and its JSON schema | Workflow step 3 |\n| [examples\u002Fuse-tasks-model.ts](examples\u002Fuse-tasks-model.ts) | A model hook reading two stores (primitive, reference and useShallow selectors) and changing state only in handlers | Workflow step 5 |\n| [examples\u002Fapp-root.tsx](examples\u002Fapp-root.tsx) | Where `createStores` joins the canonical AppRoot's `startApp` | Workflow step 3 |\n| [examples\u002Fapp-providers.tsx](examples\u002Fapp-providers.tsx) | AppRoot's outer providers with `StoresProvider` after the data layer | Workflow step 3 |\n| `scripts\u002Fcheck-stores.mjs` | Static checker of the store rules over `src\u002F`; options `--src-dir`, `--stores-dir`, `--contract` | Workflow step 10, and at the end |\n| `scripts\u002Fcheck-reducers.mjs` | Runs every reducer's cases table and the generic invariants, and the session reducer's rules, in Node | Workflow step 10, and at the end |\n| `scripts\u002Flib\u002Fstore-rules.mjs` | check-stores' rules, one function per concern | Never by hand |\n| `scripts\u002Flib\u002Fstore-scan.mjs` | check-stores' text helpers (calls, store initializers, builder selectors) | Never by hand |\n| `scripts\u002Flib\u002Freducer-cases.mjs` | check-reducers' case-table runner and generic reducer invariants | Never by hand |\n| `scripts\u002Flib\u002Fsession-checks.mjs` | check-reducers' undoable-session rules with the built-in counter | Never by hand |\n| `scripts\u002Flib\u002Fsource-scan.mjs` | Shared import resolution and code masking, synced from the library (do not edit here) | Never by hand |\n| `scripts\u002Flib\u002Fapp-modules.mjs` | Shared loader of the app's TypeScript in Node, synced from the library (do not edit here) | Never by hand |\n| `scripts\u002Fcheck-lib.mjs` | Shared script helper, synced from the library (do not edit here) | Never by hand |\n| `scripts\u002Fselftest.mjs` | Proves both checkers pass the templates and examples and catch every planted bug | After changing a checker or a template |\n| `assets\u002Fshared.json` | Declares the synced files above | When adding a shared file |\n| `tests\u002F` | `bases\u002Fapp` (the fixture app) and overlay fixtures (`bad-*`, `pass-*`, `error-*`) for both checkers | When adding a checker rule |\n\n## Related skills\n\n- `persistence-and-migrations` - the repositories, document service and SQLite the stores write through.\n- `networking-and-server-state` - server state in TanStack Query over the ApiClient port.\n- `settings-and-preferences` - the settings store, its storage port and its provider.\n- `react-components-and-hooks` - components and model hooks that read stores.\n- `architecture-and-boundaries` - the composition root, ports and where stores sit in the layers.\n- `unit-and-component-tests` - render helpers, `test\u002Ftest-app.tsx` and the store test forms.\n- `error-handling-typed-results` - the `Result` every store method returns.\n- `accessibility-as-code` - the OS-mirror store for the accessibility switches.\n- `game-session-host` - continues, hints and outcomes on top of the undoable session (games).\n- `forms-and-input` - form drafts in react-hook-form, not in a store.\n- `tdd-workflow` - the test-first loop for every reducer change.\n","# State management with Zustand\n\nClient state lives in thin Zustand 5 stores, one per domain, created once per app start over the\ndata layer's ports; every change is reduced by a pure reducer, written to disk, and only then shown;\nserver data stays in TanStack Query. Two zero-dependency scripts prove it on the app's own code.\n\n## Rules that must hold\n\n1. **One store per domain, made by a factory and created once per app start.** `create\u003CDomain>Store(deps)`\n   builds a vanilla store (`createStore` from `zustand\u002Fvanilla`) over the ports it receives;\n   `createStores(deps)` calls each factory once (the root layout's `useState` initializer, and\n   `test\u002Ftest-app.tsx` over fakes), `StoresProvider` hands the set down, components read\n   `use\u003CDomain>Store(selector)`. No `create` from `zustand`, no store at module level, no factory call in\n   feature or UI code; the one module-level store is an OS mirror listed in `contracts\u002Fstores.json`\n   (accessibility-as-code owns it). A store another skill ships with its own provider (the settings\n   store) is created once by its own opener and follows the same rules. Why: tests need fresh stores,\n   and Fast Refresh re-runs an edited module while components keep their state, so a module-level\n   store is made a second time; a `useState` initializer makes it once per React tree.\n2. **Persist before publish.** A change asks the reducer first (a refused or no-op change returns the\n   same object: no write, no render), writes through the port the factory received (a repository, the\n   document service, a preferences port: synchronous, committed when it returns ok), checks the result,\n   and only then calls `set`. A failed write publishes nothing but the failure (a returned `Result`, or a\n   `…Failure` field). When persistence assigns the id, persist first and publish the saved row through\n   the reducer. State a service produces (a Premium entitlement from the purchase flow) still enters\n   through a store method that writes it (`grantPremium(entitlement)`), never a publish-only `dispatch`.\n   A store meant to forget at restart says `\u002F\u002F memory-only: \u003Cwhy>`, never a store whose state is saved. Why: the screen never\n   shows a value that is not on disk, and iOS and Android both end background apps without warning.\n3. **All logic sits in pure reducers with imperative kebab-case actions, pinned by a cases table.**\n   `\u003Cdomain>Reducer(state, action)` imports no runtime code, never mutates, never reads the clock or\n   randomness (time and ids arrive in the action) and returns the same object when nothing changes; every\n   `set` publishes a reducer result; `\u003Cname>-reducer-cases.ts` beside it holds the rules as plain data (at\n   least one `same: true` case), run by its test and by `check-reducers`. Why: pure reducers replay the\n   same in Jest, Node and on both platforms, and a rule nobody pins drifts.\n4. **Selectors return a primitive or a reference already in the state; a built value goes through\n   `useShallow`; no store hook without a selector, no equality argument.** Named selectors live in\n   `\u003Cdomain>-selectors.ts`; a builder (`.filter`, `.map`, `{ … }`) is read as\n   `use\u003CDomain>Store(useShallow(selectX))`. Why: in Zustand 5 a selector returning a new reference each\n   call makes React throw \"Maximum update depth exceeded\" (verified, RNTL 14 on React 19.2), and the v4\n   equality argument is gone.\n5. **A write that spans stores is one transaction, then every store re-reads.**\n   `updateAndPublish(stores, () => tasks.removeList(id))`, with each such write named in\n   `contracts\u002Fstores.json` `crossStoreWrites`. Never several store calls, never the bare write. Why: a kill\n   between two writes leaves half a change, and a bare write leaves other stores showing deleted rows.\n6. **Server state and navigation state never enter a store.** Network data lives in the TanStack Query\n   cache (networking-and-server-state): no `fetch`, API client or React Query in a store, no effect that\n   copies `query.data` into one; route params belong to Expo Router. Stores hold client state: local\n   rows, UI choices, preferences, sessions. Why: two copies of server data drift on every refetch, and a\n   copied route goes stale on back (Android predictive back, the iOS swipe).\n7. **Stores are synchronous and persist only through the data layer's ports.** No `async`, `await` or\n   `.then` in a store; no zustand `persist` middleware anywhere, and no AsyncStorage, MMKV, SQLite, driver,\n   slot store or adapter import in a store (which engines the rest of the app may use is\n   persistence-and-migrations' one-engine rule); only a store's own methods change\n   it, never `setState` from outside. Why: an async action races itself and can publish a stale answer\n   last, and a second persistence path has no version, no migration and no backup.\n8. **An undoable session lives in a per-session store over a pure session reducer.** `past` stays in\n   memory for instant undo; the written form keeps `start`, the command log and the snapshot; restore\n   replays the log to rebuild undo, keeps the snapshot when the replay disagrees, and comes back paused;\n   persist before publish. Why: a kill mid-animation loses nothing, and a relaunch never moves on unseen.\n9. **Every reducer has a test beside it that runs its cases, and every persisting store a thin store\n   test** (a subscriber already sees the value on disk; a failed write publishes nothing; a no-op writes\n   nothing). Why: the order inside a store is invisible in review, and one moved line breaks it.\n\n## Workflow\n\n1. Read [references\u002Fstore-pattern.md](references\u002Fstore-pattern.md): the store shape, both persist orders,\n   composition, reducers and cases tables, selectors, cross-store writes, tests, every checker rule and\n   the contract. Read [references\u002Fstate-homes.md](references\u002Fstate-homes.md) when deciding where a piece\n   of state lives or when moving off Redux, Context, MobX or a `persist` + AsyncStorage store, and\n   [references\u002Fundoable-session.md](references\u002Fundoable-session.md) before building undo.\n2. Check the prerequisites: `src\u002Fcore\u002Fresult.ts` (error-handling-typed-results), the data layer\n   (persistence-and-migrations: repositories on `AppData`, or the document service) and the composition\n   root (architecture-and-boundaries). Install the pinned version from the repo root:\n   `npm install -E zustand@5.0.15` (stack table, verified 2026-10-03; re-verify with\n   `npm view zustand version`). When multi-package: run it in the app workspace (`-w apps\u002F\u003Capp>`).\n3. First stores: copy `templates\u002Fsrc\u002Fstores\u002F` (leave out `session\u002F` until step 7), `templates\u002Fcontracts\u002F`,\n   and replace the Tasks lists and tasks with the app's domains, keeping each file's shape (reducer +\n   cases + test, selectors + test, store + test). Wire `createStores` in AppRoot's `startApp` after the data layer and the error sink, as in\n   [examples\u002Fapp-root.tsx](examples\u002Fapp-root.tsx) with [examples\u002Fapp-providers.tsx](examples\u002Fapp-providers.tsx), add the stores to `test\u002Ftest-app.tsx`, and fill\n   `contracts\u002Fstores.json`.\n4. New action: add the failing case to `\u003Cname>-reducer-cases.ts` first (its test runs it), then the\n   union member and the reducer case, then the store method in the order of rule 2.\n5. New read: add or reuse a selector; read built values through `useShallow`, as\n   [examples\u002Fuse-tasks-model.ts](examples\u002Fuse-tasks-model.ts) does, and change state only in handlers.\n6. A write that spans stores: name it in `crossStoreWrites`, call it through `updateAndPublish`, and give\n   every new store holding rows a `reload` and a line in `updateAndPublish`.\n7. Undo: copy `templates\u002Fsrc\u002Fstores\u002Fsession\u002F` and `templates\u002Ftest\u002Fstores\u002F`; the feature creates one\n   session store per session in a `useState` initializer, with a `persist` callback that writes\n   `toSavedSession(...)` through a repository; restore with `restoreSession` (it comes back paused).\n8. Run `npx jest src\u002Fstores --ci --maxWorkers=2` and `npm run typecheck`.\n9. After changing a persisting store's write order, kill and relaunch a Release build on a named device\n   (iOS: `xcrun simctl terminate \u003Cudid> \u003Cbundle-id>`, then `xcrun simctl launch \u003Cudid> \u003Cbundle-id>`;\n   Android: `adb -s \u003Cserial> shell am force-stop \u003Cpackage>`, then\n   `adb -s \u003Cserial> shell monkey -p \u003Cpackage> -c android.intent.category.LAUNCHER 1`): what the screen\n   showed must still be there. persistence-and-migrations' kill test automates the data side.\n10. Run the checks from the repo root and fix every `FAIL` line (each names file, rule and fix) until\n    both print `RESULT: PASS`.\n\n## Definition of done\n\n- [ ] Every domain store comes from `create\u003CDomain>Store(deps)`, is created once (createStores in the root layout and the test app; a store another skill ships with its own provider, such as the settings store, once by its own opener) and is read through `use\u003CDomain>Store(selector)`; no `create` from zustand, no module-level store outside `osMirrorStores`.\n- [ ] Every store method reduces (same object: no write), persists through its port, checks the result, then publishes; failures are returned or recorded; service-fed state (an entitlement) enters through a writing store method; a memory-only store says so.\n- [ ] Every reducer is pure with imperative kebab-case actions, has a cases table with a `same: true` case, and a test that runs it.\n- [ ] Every selector call returns a primitive or a state reference, or goes through `useShallow`; no selectorless hook, no equality argument.\n- [ ] Every write that spans stores is in `contracts\u002Fstores.json` and goes through `updateAndPublish`.\n- [ ] No `fetch`, React Query or API client in a store, no effect copying query data into one, no `async` in a store, no persist middleware anywhere, no AsyncStorage or MMKV in a store.\n- [ ] `npx jest src\u002Fstores --ci --maxWorkers=2` passes and `npm run typecheck` is clean.\n- [ ] `node ${CLAUDE_SKILL_DIR}\u002Fscripts\u002Fcheck-reducers.mjs .` prints `RESULT: PASS` (the one expected SKIP: `SKIP src\u002Fstores\u002Fsettings\u002Fsettings-reducer-cases.ts [reducer-cases-missing] not yet created (settings-and-preferences creates it)`, only in an app that has not yet added that cases file).\n- [ ] `node ${CLAUDE_SKILL_DIR}\u002Fscripts\u002Fcheck-stores.mjs .` prints `RESULT: PASS`\n\n## Anti-patterns\n\n- **`export const useTasksStore = create(...)`.** A hook-store singleton shares state across tests and is\n  created again when Fast Refresh re-runs its module; write a factory and add it to `createStores`.\n- **`set(next)` and then the write, or a `setTimeout` \"debounced save\".** The screen shows unsaved data\n  and a kill loses it; persist first, synchronously, then publish.\n- **Ignoring the write's result** (`tasks.setDone(id, true); set(next);`). A full disk still shows the\n  change; keep the `Result` and return it when it failed.\n- **`useListsStore((state) => ({ count: …, failure: … }))`.** A new object every render loops forever in\n  Zustand 5; wrap it in `useShallow` or select two primitives.\n- **`useTasksStore()` or `useTasksStore((s) => s)` to \"get everything\".** Both re-render on every\n  change; select what is shown.\n- **Removing a list with `tasks.removeList(id)` and reloading only the lists store.** The tasks store\n  keeps the deleted tasks; use `updateAndPublish`.\n- **`useEffect(() => { setTasks(query.data) }, [query.data])`.** Two copies of server data drift; read\n  `useQuery` where it is shown and keep only client choices in a store.\n- **An `async` store action that fetches and then calls `set`.** Two calls race and the slower one\n  wins; fetch with TanStack Query, write locally through a synchronous port.\n- **`Date.now()`, `Math.random()` or `randomUUID()` in a reducer.** Pass the time in the action and let\n  the repository assign ids; reducers must replay identically.\n- **Event-style action names (`task-added`, `onToggle`).** Name the command: `add-task`, `set-done`.\n- **Pushing into `state.tasks` or `session.past`.** Spread into new arrays; `check-reducers` deep-freezes\n  the input to catch it.\n- **A publish-only Premium store (`dispatch: (action) => set(premiumReducer(get(), action))`) fed by a\n  purchase service that writes first.** Two writers own one fact and the store cannot report a failed\n  write; give the store `grantPremium(entitlement)`, which writes and then publishes.\n- **Keeping undo history on disk.** Save the start, the command log and the snapshot; replay on restore.\n- **A floating install (`npm install zustand`, `@latest`, a caret range).** It drifts from the verified\n  pin and can be younger than the release-age policy; install `zustand@5.0.15` exactly.\n\n## Files in this skill\n\n| File | What it is | Read\u002Frun when |\n|---|---|---|\n| [references\u002Fstore-pattern.md](references\u002Fstore-pattern.md) | Store shape, persist orders, entitlements and other service-fed state, composition, actions, reducers and cases tables, selectors and useShallow, cross-store writes, document mode, tests, platform notes, multi-package, checker rules, contract, limits | Workflow step 1, and on any store change |\n| [references\u002Fstate-homes.md](references\u002Fstate-homes.md) | Where each kind of state lives (server, navigation, forms, UI, preferences, secrets, OS state, sessions) and moving off Redux, Context, MobX or persist + AsyncStorage | Workflow step 1, when choosing a home for state |\n| [references\u002Fundoable-session.md](references\u002Fundoable-session.md) | The undoable session: types, actions, design choices, per-session store, when it is written, save and restore, property tests, the games hand-off | Workflow steps 1 and 7 |\n| `templates\u002Fsrc\u002Fstores\u002F` | `lists-*` and `tasks-*` reducers, cases tables, selectors and stores with tests; `reducer-cases.ts`; `stores-context.tsx`; `create-stores.ts`; `update-and-publish.ts`; all tests | Workflow steps 3 to 6 |\n| `templates\u002Fsrc\u002Fstores\u002Fsession\u002F` | Undoable session types, reducer, per-session store, saved session (save and restore), with tests | Workflow step 7 |\n| `templates\u002Ftest\u002Fstores\u002Fcounter-session-rules.ts` | Tiny session rules and codec the session tests use | Workflow step 7 |\n| `templates\u002Fcontracts\u002F` | `stores.json` (cross-store writes, OS mirror stores) and its JSON schema | Workflow step 3 |\n| [examples\u002Fuse-tasks-model.ts](examples\u002Fuse-tasks-model.ts) | A model hook reading two stores (primitive, reference and useShallow selectors) and changing state only in handlers | Workflow step 5 |\n| [examples\u002Fapp-root.tsx](examples\u002Fapp-root.tsx) | Where `createStores` joins the canonical AppRoot's `startApp` | Workflow step 3 |\n| [examples\u002Fapp-providers.tsx](examples\u002Fapp-providers.tsx) | AppRoot's outer providers with `StoresProvider` after the data layer | Workflow step 3 |\n| `scripts\u002Fcheck-stores.mjs` | Static checker of the store rules over `src\u002F`; options `--src-dir`, `--stores-dir`, `--contract` | Workflow step 10, and at the end |\n| `scripts\u002Fcheck-reducers.mjs` | Runs every reducer's cases table and the generic invariants, and the session reducer's rules, in Node | Workflow step 10, and at the end |\n| `scripts\u002Flib\u002Fstore-rules.mjs` | check-stores' rules, one function per concern | Never by hand |\n| `scripts\u002Flib\u002Fstore-scan.mjs` | check-stores' text helpers (calls, store initializers, builder selectors) | Never by hand |\n| `scripts\u002Flib\u002Freducer-cases.mjs` | check-reducers' case-table runner and generic reducer invariants | Never by hand |\n| `scripts\u002Flib\u002Fsession-checks.mjs` | check-reducers' undoable-session rules with the built-in counter | Never by hand |\n| `scripts\u002Flib\u002Fsource-scan.mjs` | Shared import resolution and code masking, synced from the library (do not edit here) | Never by hand |\n| `scripts\u002Flib\u002Fapp-modules.mjs` | Shared loader of the app's TypeScript in Node, synced from the library (do not edit here) | Never by hand |\n| `scripts\u002Fcheck-lib.mjs` | Shared script helper, synced from the library (do not edit here) | Never by hand |\n| `scripts\u002Fselftest.mjs` | Proves both checkers pass the templates and examples and catch every planted bug | After changing a checker or a template |\n| `assets\u002Fshared.json` | Declares the synced files above | When adding a shared file |\n| `tests\u002F` | `bases\u002Fapp` (the fixture app) and overlay fixtures (`bad-*`, `pass-*`, `error-*`) for both checkers | When adding a checker rule |\n\n## Related skills\n\n- `persistence-and-migrations` - the repositories, document service and SQLite the stores write through.\n- `networking-and-server-state` - server state in TanStack Query over the ApiClient port.\n- `settings-and-preferences` - the settings store, its storage port and its provider.\n- `react-components-and-hooks` - components and model hooks that read stores.\n- `architecture-and-boundaries` - the composition root, ports and where stores sit in the layers.\n- `unit-and-component-tests` - render helpers, `test\u002Ftest-app.tsx` and the store test forms.\n- `error-handling-typed-results` - the `Result` every store method returns.\n- `accessibility-as-code` - the OS-mirror store for the accessibility switches.\n- `game-session-host` - continues, hints and outcomes on top of the undoable session (games).\n- `forms-and-input` - form drafts in react-hook-form, not in a store.\n- `tdd-workflow` - the test-first loop for every reducer change.\n",{"name":5,"description":7},"main","41a0e66d4d09de5b46e6537f59a97c7192473486","skills\u002Fstate-management-zustand",2,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills","https:\u002F\u002Fzakaria.dev\u002FReactNative-Skills\u002F","https:\u002F\u002Fgithub.com\u002Fzakariaf","https:\u002F\u002Fzakaria.dev","Seniore Software Engineer","2026-10-22 07:05:00",{"source":8,"skillName":5,"commands":35,"prompt":45,"zipAvailable":46},[36,39,42],{"tool":37,"command":38},"npx","npx skills add zakariaf\u002FReactNative-Skills --skill state-management-zustand",{"tool":40,"command":41},"bunx","bunx skills add zakariaf\u002FReactNative-Skills --skill state-management-zustand",{"tool":43,"command":44},"pnpm","pnpm dlx skills add zakariaf\u002FReactNative-Skills --skill state-management-zustand","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002FSKILL.md",true,[48,54,60,64,70,76,80,84,88,92,96,100,104,108,112,116,120,124,128,131,135,139,143,147,151,155,159,163,167,171,175,179,183,187,191,195,199,203,207,211,215,219,223,227,231,235,239,243,247,251,255,259,263,266,270,274,277],{"path":49,"resourceType":50,"resourceTypeDesc":51,"sizeBytes":52,"sourceHtmlUrl":53},"assets\u002Fshared.json","ASSET","资产文件",237,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Fassets\u002Fshared.json",{"path":55,"resourceType":56,"resourceTypeDesc":57,"sizeBytes":58,"sourceHtmlUrl":59},"examples\u002Fapp-providers.tsx","OTHER","其他",1280,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Fexamples\u002Fapp-providers.tsx",{"path":61,"resourceType":56,"resourceTypeDesc":57,"sizeBytes":62,"sourceHtmlUrl":63},"examples\u002Fapp-root.tsx",3837,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Fexamples\u002Fapp-root.tsx",{"path":65,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":68,"sourceHtmlUrl":69},"examples\u002Fuse-tasks-model.ts","SCRIPT","脚本",2675,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Fexamples\u002Fuse-tasks-model.ts",{"path":71,"resourceType":72,"resourceTypeDesc":73,"sizeBytes":74,"sourceHtmlUrl":75},"references\u002Fstate-homes.md","REFERENCE","参考文档",7192,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Freferences\u002Fstate-homes.md",{"path":77,"resourceType":72,"resourceTypeDesc":73,"sizeBytes":78,"sourceHtmlUrl":79},"references\u002Fstore-pattern.md",36921,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Freferences\u002Fstore-pattern.md",{"path":81,"resourceType":72,"resourceTypeDesc":73,"sizeBytes":82,"sourceHtmlUrl":83},"references\u002Fundoable-session.md",8549,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Freferences\u002Fundoable-session.md",{"path":85,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":86,"sourceHtmlUrl":87},"scripts\u002Fcheck-lib.mjs",119923,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Fscripts\u002Fcheck-lib.mjs",{"path":89,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":90,"sourceHtmlUrl":91},"scripts\u002Fcheck-reducers.mjs",8578,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Fscripts\u002Fcheck-reducers.mjs",{"path":93,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":94,"sourceHtmlUrl":95},"scripts\u002Fcheck-stores.mjs",13069,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Fscripts\u002Fcheck-stores.mjs",{"path":97,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":98,"sourceHtmlUrl":99},"scripts\u002Flib\u002Fapp-modules.mjs",8884,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Fscripts\u002Flib\u002Fapp-modules.mjs",{"path":101,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":102,"sourceHtmlUrl":103},"scripts\u002Flib\u002Freducer-cases.mjs",6759,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Fscripts\u002Flib\u002Freducer-cases.mjs",{"path":105,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":106,"sourceHtmlUrl":107},"scripts\u002Flib\u002Fsession-checks.mjs",4692,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Fscripts\u002Flib\u002Fsession-checks.mjs",{"path":109,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":110,"sourceHtmlUrl":111},"scripts\u002Flib\u002Fsource-scan.mjs",35908,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Fscripts\u002Flib\u002Fsource-scan.mjs",{"path":113,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":114,"sourceHtmlUrl":115},"scripts\u002Flib\u002Fstore-rules.mjs",33933,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Fscripts\u002Flib\u002Fstore-rules.mjs",{"path":117,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":118,"sourceHtmlUrl":119},"scripts\u002Flib\u002Fstore-scan.mjs",19540,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Fscripts\u002Flib\u002Fstore-scan.mjs",{"path":121,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":122,"sourceHtmlUrl":123},"scripts\u002Fselftest.mjs",993,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Fscripts\u002Fselftest.mjs",{"path":125,"resourceType":72,"resourceTypeDesc":73,"sizeBytes":126,"sourceHtmlUrl":127},"templates\u002Fcontracts\u002Fstores.json",152,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Ftemplates\u002Fcontracts\u002Fstores.json",{"path":129,"resourceType":72,"resourceTypeDesc":73,"sizeBytes":58,"sourceHtmlUrl":130},"templates\u002Fcontracts\u002Fstores.schema.json","https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Ftemplates\u002Fcontracts\u002Fstores.schema.json",{"path":132,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":133,"sourceHtmlUrl":134},"templates\u002Fsrc\u002Fstores\u002Fcreate-stores.ts",893,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Ftemplates\u002Fsrc\u002Fstores\u002Fcreate-stores.ts",{"path":136,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":137,"sourceHtmlUrl":138},"templates\u002Fsrc\u002Fstores\u002Flists-reducer-cases.ts",1202,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Ftemplates\u002Fsrc\u002Fstores\u002Flists-reducer-cases.ts",{"path":140,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":141,"sourceHtmlUrl":142},"templates\u002Fsrc\u002Fstores\u002Flists-reducer.test.ts",1673,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Ftemplates\u002Fsrc\u002Fstores\u002Flists-reducer.test.ts",{"path":144,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":145,"sourceHtmlUrl":146},"templates\u002Fsrc\u002Fstores\u002Flists-reducer.ts",1525,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Ftemplates\u002Fsrc\u002Fstores\u002Flists-reducer.ts",{"path":148,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":149,"sourceHtmlUrl":150},"templates\u002Fsrc\u002Fstores\u002Flists-selectors.test.ts",1160,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Ftemplates\u002Fsrc\u002Fstores\u002Flists-selectors.test.ts",{"path":152,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":153,"sourceHtmlUrl":154},"templates\u002Fsrc\u002Fstores\u002Flists-selectors.ts",1235,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Ftemplates\u002Fsrc\u002Fstores\u002Flists-selectors.ts",{"path":156,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":157,"sourceHtmlUrl":158},"templates\u002Fsrc\u002Fstores\u002Flists-store.test.ts",2374,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Ftemplates\u002Fsrc\u002Fstores\u002Flists-store.test.ts",{"path":160,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":161,"sourceHtmlUrl":162},"templates\u002Fsrc\u002Fstores\u002Flists-store.ts",2465,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Ftemplates\u002Fsrc\u002Fstores\u002Flists-store.ts",{"path":164,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":165,"sourceHtmlUrl":166},"templates\u002Fsrc\u002Fstores\u002Freducer-cases.test.ts",2615,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Ftemplates\u002Fsrc\u002Fstores\u002Freducer-cases.test.ts",{"path":168,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":169,"sourceHtmlUrl":170},"templates\u002Fsrc\u002Fstores\u002Freducer-cases.ts",3821,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Ftemplates\u002Fsrc\u002Fstores\u002Freducer-cases.ts",{"path":172,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":173,"sourceHtmlUrl":174},"templates\u002Fsrc\u002Fstores\u002Fsession\u002Fsaved-session.test.ts",3390,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Ftemplates\u002Fsrc\u002Fstores\u002Fsession\u002Fsaved-session.test.ts",{"path":176,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":177,"sourceHtmlUrl":178},"templates\u002Fsrc\u002Fstores\u002Fsession\u002Fsaved-session.ts",4327,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Ftemplates\u002Fsrc\u002Fstores\u002Fsession\u002Fsaved-session.ts",{"path":180,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":181,"sourceHtmlUrl":182},"templates\u002Fsrc\u002Fstores\u002Fsession\u002Fundoable-session-reducer.test.ts",4078,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Ftemplates\u002Fsrc\u002Fstores\u002Fsession\u002Fundoable-session-reducer.test.ts",{"path":184,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":185,"sourceHtmlUrl":186},"templates\u002Fsrc\u002Fstores\u002Fsession\u002Fundoable-session-reducer.ts",3213,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Ftemplates\u002Fsrc\u002Fstores\u002Fsession\u002Fundoable-session-reducer.ts",{"path":188,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":189,"sourceHtmlUrl":190},"templates\u002Fsrc\u002Fstores\u002Fsession\u002Fundoable-session-store.test.ts",3491,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Ftemplates\u002Fsrc\u002Fstores\u002Fsession\u002Fundoable-session-store.test.ts",{"path":192,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":193,"sourceHtmlUrl":194},"templates\u002Fsrc\u002Fstores\u002Fsession\u002Fundoable-session-store.ts",3043,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Ftemplates\u002Fsrc\u002Fstores\u002Fsession\u002Fundoable-session-store.ts",{"path":196,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":197,"sourceHtmlUrl":198},"templates\u002Fsrc\u002Fstores\u002Fsession\u002Fundoable-session-types.ts",1933,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Ftemplates\u002Fsrc\u002Fstores\u002Fsession\u002Fundoable-session-types.ts",{"path":200,"resourceType":56,"resourceTypeDesc":57,"sizeBytes":201,"sourceHtmlUrl":202},"templates\u002Fsrc\u002Fstores\u002Fstores-context.test.tsx",1273,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Ftemplates\u002Fsrc\u002Fstores\u002Fstores-context.test.tsx",{"path":204,"resourceType":56,"resourceTypeDesc":57,"sizeBytes":205,"sourceHtmlUrl":206},"templates\u002Fsrc\u002Fstores\u002Fstores-context.tsx",1372,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Ftemplates\u002Fsrc\u002Fstores\u002Fstores-context.tsx",{"path":208,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":209,"sourceHtmlUrl":210},"templates\u002Fsrc\u002Fstores\u002Ftasks-reducer-cases.ts",1919,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Ftemplates\u002Fsrc\u002Fstores\u002Ftasks-reducer-cases.ts",{"path":212,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":213,"sourceHtmlUrl":214},"templates\u002Fsrc\u002Fstores\u002Ftasks-reducer.test.ts",1917,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Ftemplates\u002Fsrc\u002Fstores\u002Ftasks-reducer.test.ts",{"path":216,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":217,"sourceHtmlUrl":218},"templates\u002Fsrc\u002Fstores\u002Ftasks-reducer.ts",2002,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Ftemplates\u002Fsrc\u002Fstores\u002Ftasks-reducer.ts",{"path":220,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":221,"sourceHtmlUrl":222},"templates\u002Fsrc\u002Fstores\u002Ftasks-selectors.test.ts",1023,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Ftemplates\u002Fsrc\u002Fstores\u002Ftasks-selectors.test.ts",{"path":224,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":225,"sourceHtmlUrl":226},"templates\u002Fsrc\u002Fstores\u002Ftasks-selectors.ts",1326,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Ftemplates\u002Fsrc\u002Fstores\u002Ftasks-selectors.ts",{"path":228,"resourceType":56,"resourceTypeDesc":57,"sizeBytes":229,"sourceHtmlUrl":230},"templates\u002Fsrc\u002Fstores\u002Ftasks-store.test.tsx",4298,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Ftemplates\u002Fsrc\u002Fstores\u002Ftasks-store.test.tsx",{"path":232,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":233,"sourceHtmlUrl":234},"templates\u002Fsrc\u002Fstores\u002Ftasks-store.ts",3314,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Ftemplates\u002Fsrc\u002Fstores\u002Ftasks-store.ts",{"path":236,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":237,"sourceHtmlUrl":238},"templates\u002Fsrc\u002Fstores\u002Fupdate-and-publish.test.ts",1930,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Ftemplates\u002Fsrc\u002Fstores\u002Fupdate-and-publish.test.ts",{"path":240,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":241,"sourceHtmlUrl":242},"templates\u002Fsrc\u002Fstores\u002Fupdate-and-publish.ts",984,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Ftemplates\u002Fsrc\u002Fstores\u002Fupdate-and-publish.ts",{"path":244,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":245,"sourceHtmlUrl":246},"templates\u002Ftest\u002Fstores\u002Fcounter-session-rules.ts",1291,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Ftemplates\u002Ftest\u002Fstores\u002Fcounter-session-rules.ts",{"path":248,"resourceType":72,"resourceTypeDesc":73,"sizeBytes":249,"sourceHtmlUrl":250},"tests\u002Fbases\u002Fapp\u002Fpackage.json",161,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Ftests\u002Fbases\u002Fapp\u002Fpackage.json",{"path":252,"resourceType":66,"resourceTypeDesc":67,"sizeBytes":253,"sourceHtmlUrl":254},"tests\u002Fbases\u002Fapp\u002Fsrc\u002Fui\u002Fa11y\u002Fsystem-a11y-store.ts",638,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Ftests\u002Fbases\u002Fapp\u002Fsrc\u002Fui\u002Fa11y\u002Fsystem-a11y-store.ts",{"path":256,"resourceType":72,"resourceTypeDesc":73,"sizeBytes":257,"sourceHtmlUrl":258},"tests\u002Fbases\u002Fapp\u002Ftsconfig.json",128,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Ftests\u002Fbases\u002Fapp\u002Ftsconfig.json",{"path":260,"resourceType":72,"resourceTypeDesc":73,"sizeBytes":261,"sourceHtmlUrl":262},"tests\u002Ffixtures\u002Fcheck-reducers\u002FCASES.json",13354,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Ftests\u002Ffixtures\u002Fcheck-reducers\u002FCASES.json",{"path":264,"resourceType":72,"resourceTypeDesc":73,"sizeBytes":14,"sourceHtmlUrl":265},"tests\u002Ffixtures\u002Fcheck-reducers\u002Fgood\u002FEXPECT.txt","https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Ftests\u002Ffixtures\u002Fcheck-reducers\u002Fgood\u002FEXPECT.txt",{"path":267,"resourceType":72,"resourceTypeDesc":73,"sizeBytes":268,"sourceHtmlUrl":269},"tests\u002Ffixtures\u002Fcheck-reducers\u002FSUITE.json",2145,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Ftests\u002Ffixtures\u002Fcheck-reducers\u002FSUITE.json",{"path":271,"resourceType":72,"resourceTypeDesc":73,"sizeBytes":272,"sourceHtmlUrl":273},"tests\u002Ffixtures\u002Fcheck-stores\u002FCASES.json",51751,"https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Ftests\u002Ffixtures\u002Fcheck-stores\u002FCASES.json",{"path":275,"resourceType":72,"resourceTypeDesc":73,"sizeBytes":14,"sourceHtmlUrl":276},"tests\u002Ffixtures\u002Fcheck-stores\u002Fgood\u002FEXPECT.txt","https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Ftests\u002Ffixtures\u002Fcheck-stores\u002Fgood\u002FEXPECT.txt",{"path":278,"resourceType":72,"resourceTypeDesc":73,"sizeBytes":268,"sourceHtmlUrl":279},"tests\u002Ffixtures\u002Fcheck-stores\u002FSUITE.json","https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management-zustand\u002Ftests\u002Ffixtures\u002Fcheck-stores\u002FSUITE.json",[281,288,294,301,308,315],{"skillNo":282,"name":283,"nameZh":6,"description":284,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":285,"categories":286,"keywords":287,"publishedAt":19},"01M7F2S4KZG97D21GEJ2GKKYK1","demo","Planted skill folder (never scanned).","https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fweb-support\u002Ftests\u002Fbases\u002Fapp\u002Fskills\u002Fdemo\u002FSKILL.md",[],[],{"skillNo":289,"name":283,"nameZh":6,"description":290,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":291,"categories":292,"keywords":293,"publishedAt":19},"01M7F2S1F4ATZ49909EDKWA9E6","Planted installed skill (its files must never be scanned).","https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fweb-support\u002Ftests\u002Fbases\u002Fapp\u002F.agents\u002Fskills\u002Fdemo\u002FSKILL.md",[],[],{"skillNo":295,"name":296,"nameZh":6,"description":297,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":298,"categories":299,"keywords":300,"publishedAt":19},"01M7F2RXGPZJ5Q1FV2HQ1PJ6AX","web-support","Ships the web build of an Expo app: platform files, APIs missing in react-native-web, expo-sqlite headers. Use when adding web, a .web.tsx file or expo export --platform web. Not for responsive layout (adaptive-layout).","https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fweb-support\u002FSKILL.md",[],[],{"skillNo":302,"name":303,"nameZh":6,"description":304,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":305,"categories":306,"keywords":307,"publishedAt":19},"01M7F2RQ43JFA4QFWQEHBET08G","value-objects-money-and-units","Stores money as ISO 4217 minor units, quantities in canonical units, instants as epoch ms. Use when adding a price, currency, tax, split, unit or timestamp, or a total is a cent off. Not for calendar days (dates-streaks-and-statistics).","https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fvalue-objects-money-and-units\u002FSKILL.md",[],[],{"skillNo":309,"name":310,"nameZh":6,"description":311,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":312,"categories":313,"keywords":314,"publishedAt":19},"01M7F2RHR7H8VVZDP16FJNJV11","unit-and-component-tests","Sets up Jest, checks unit, component and route tests (RNTL 14, renderWithProviders, SDK mocks, fakes, fast-check, Stryker). Use when writing a test or mock, or Jest fails or flakes. Not for goldens (golden-and-snapshot-tests).","https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Funit-and-component-tests\u002FSKILL.md",[],[],{"skillNo":316,"name":317,"nameZh":6,"description":318,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":319,"categories":320,"keywords":321,"publishedAt":19},"01M7F2RAEDWQ6H4514HFRWJAE6","ui-states-and-feedback","Builds loading, empty, failed and offline states, delayed skeletons, toasts, banners, confirms, Undo. Use when a screen loads data, shows a spinner, toast, retry or delete prompt. Not for failure values (error-handling-typed-results).","https:\u002F\u002Fgithub.com\u002Fzakariaf\u002FReactNative-Skills\u002Fblob\u002Fmain\u002Fskills\u002Fui-states-and-feedback\u002FSKILL.md",[],[]]