[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M75JRC7VRTZKA8W3579JWE0K":3,"skill-same:01M75JRC7VRTZKA8W3579JWE0K":56},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":17,"publishedAt":18,"linkOnly":19,"markdownContent":20,"markdownBody":21,"frontMatter":22,"refName":23,"commitSha":24,"skillDirectory":25,"forksCount":26,"repositoryHtmlUrl":27,"repositoryHomepageUrl":28,"ownerHtmlUrl":29,"ownerBlogUrl":30,"ownerDescription":6,"updatedAt":31,"install":32,"resources":45},"01M75JRC7VRTZKA8W3579JWE0K","state-management",null,"Deep workflow for client (and hybrid) state—modeling domain vs UI state, server cache vs client store, async and consistency, DevTools, persistence, and testing. Use when choosing Redux\u002FZustand\u002FRecoil\u002FContext, fixing stale UI, or designing data flow in React\u002FVue\u002FSvelte apps.","agisota\u002Fold-one","agisota","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F121413592?v=4","01M75B4BRNT67EC1NDRT8QZEP2","01M75B4BS7QR9VP580MSCPTS3X",3,"MIT","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management\u002FSKILL.md",[],[],"2026-11-12 13:55:43",false,"---\nname: state-management\ndescription: Deep workflow for client (and hybrid) state—modeling domain vs UI state, server cache vs client store, async and consistency, DevTools, persistence, and testing. Use when choosing Redux\u002FZustand\u002FRecoil\u002FContext, fixing stale UI, or designing data flow in React\u002FVue\u002FSvelte apps.\n---\n\n# State Management (Deep Workflow)\n\nMost “state bugs” are **ownership** and **lifecycle** bugs: who writes, when it syncs, and what happens on failure. Guide users to **explicit models** instead of ad-hoc globals.\n\n## When to Offer This Workflow\n\n**Trigger conditions:**\n\n- Prop drilling pain, inconsistent UI, duplicate sources of truth\n- Stale data after mutations; optimistic UI gone wrong\n- Choosing a library vs Context vs server-state library (React Query, SWR, Apollo)\n- SSR\u002Fhydration + client state mismatches\n\n**Initial offer:**\n\nUse **six stages**: (1) inventory state kinds, (2) assign ownership, (3) server vs client boundaries, (4) async & updates, (5) persistence & URLs, (6) testing & DevTools. Confirm **framework** and **data fetching** approach.\n\n---\n\n## Stage 1: Inventory State Kinds\n\n**Goal:** Classify **what** state exists before picking tools.\n\n### Categories\n\n- **Remote\u002Fserver state**: API responses, pagination, staleness—often **not** Redux-shaped\n- **URL state**: filters, tabs, selection when shareable\u002Fbookmarkable\n- **Session UI state**: modals, toggles, transient form drafts\n- **Client-derived**: sorted\u002Ffiltered views of remote data—**avoid** storing both raw and derived as writable truths\n- **Global cross-cutting**: auth user, theme, feature flags—with clear **read-only** vs **mutable** rules\n\n**Exit condition:** Table of **state slices** → **source of truth** → **consumers**.\n\n---\n\n## Stage 2: Assign Ownership\n\n**Goal:** **One writer** per piece of truth (or strict reducer pattern).\n\n### Rules of Thumb\n\n- **Colocate** state where it’s used if not shared—don’t globalize prematurely\n- **Lift** only when multiple subtrees need it or prop chains hurt **and** ownership is clear\n- **Avoid** copying server entities into multiple stores without sync rules\n\n**Exit condition:** For each slice: **who sets**, **who reads**, **invalidation** story.\n\n---\n\n## Stage 3: Server vs Client Boundaries\n\n**Goal:** Prefer **server-state libraries** for remote data; use **client stores** for true client concerns.\n\n### Guidance\n\n- **React Query \u002F SWR \u002F RTK Query**: caching, dedupe, refetch, background refresh—use for HTTP JSON\n- **GraphQL clients**: normalized cache + mutations with **update** policies\n- **Redux**: great for **predictable** global client state + middleware—not every fetch response\n\n### Anti-patterns\n\n- Storing **full API JSON** in Redux without normalization when Apollo\u002FQuery would fit\n- **Double fetch**: SSR then client refetch without coordination—use **hydration** patterns\n\n**Exit condition:** Remote data has **defined cache keys**, **stale time**, and **mutation** flow.\n\n---\n\n## Stage 4: Async & Consistency\n\n**Goal:** **Loading**, **error**, **empty**, and **retry** are first-class; **optimistic** updates are safe or scoped.\n\n### Practices\n\n- **Optimistic UI**: rollback path; idempotent mutations; **server reconciliation**\n- **Ordering**: serial vs parallel requests; **race** cancellation (AbortController)\n- **Pagination\u002Finfinite scroll**: cursor stability; dedupe pages\n\n### Concurrency\n\n- **Last write wins** awareness; versioning or ETags if server supports\n\n**Exit condition:** User-visible **failure modes** handled; no silent stale success.\n\n---\n\n## Stage 5: Persistence & URL\n\n**Goal:** Decide **what survives refresh**, **what is shareable**, and **security**.\n\n### Options\n\n- **URL query** for filters\u002Ftabs when users share links\n- **localStorage\u002FsessionStorage** for drafts—mind **XSS** risk (sensitive data → not localStorage)\n- **IndexedDB** for offline—complexity tax\n\n**Exit condition:** Sensitive data **never** persisted client-side inappropriately.\n\n---\n\n## Stage 6: Testing & DevTools\n\n**Goal:** State logic is **unit-testable**; time-travel\u002Fdebug when needed.\n\n### Practices\n\n- **Pure reducers** \u002F small hooks for rules\n- **Integration tests** for critical flows with **MSW** or mock server\n- **DevTools**: Redux\u002FQuery panels—ensure team knows how to inspect cache\n\n---\n\n## Final Review Checklist\n\n- [ ] State classified: remote vs UI vs URL vs derived\n- [ ] Single owner per truth; invalidation clear\n- [ ] Server cache strategy chosen for API data\n- [ ] Async\u002Ferror\u002Fempty\u002Foptimistic paths specified\n- [ ] Persistence\u002Fsecurity boundaries respected\n\n## Tips for Effective Guidance\n\n- **Start minimal**: Context + server-state library solves many “Redux-sized” problems.\n- Always ask: “**What is the source of truth** after mutation returns?”\n- Mention **React Strict Mode** double-invoke when debugging weird effect behavior.\n\n## Handling Deviations\n\n- **Legacy Redux everywhere**: incremental migration—**feature modules** first, remote data to Query next.\n- **Non-React**: map patterns to **signals\u002Fstores** (Vue Pinia, Svelte stores) with same ownership discipline.\n","# State Management (Deep Workflow)\n\nMost “state bugs” are **ownership** and **lifecycle** bugs: who writes, when it syncs, and what happens on failure. Guide users to **explicit models** instead of ad-hoc globals.\n\n## When to Offer This Workflow\n\n**Trigger conditions:**\n\n- Prop drilling pain, inconsistent UI, duplicate sources of truth\n- Stale data after mutations; optimistic UI gone wrong\n- Choosing a library vs Context vs server-state library (React Query, SWR, Apollo)\n- SSR\u002Fhydration + client state mismatches\n\n**Initial offer:**\n\nUse **six stages**: (1) inventory state kinds, (2) assign ownership, (3) server vs client boundaries, (4) async & updates, (5) persistence & URLs, (6) testing & DevTools. Confirm **framework** and **data fetching** approach.\n\n---\n\n## Stage 1: Inventory State Kinds\n\n**Goal:** Classify **what** state exists before picking tools.\n\n### Categories\n\n- **Remote\u002Fserver state**: API responses, pagination, staleness—often **not** Redux-shaped\n- **URL state**: filters, tabs, selection when shareable\u002Fbookmarkable\n- **Session UI state**: modals, toggles, transient form drafts\n- **Client-derived**: sorted\u002Ffiltered views of remote data—**avoid** storing both raw and derived as writable truths\n- **Global cross-cutting**: auth user, theme, feature flags—with clear **read-only** vs **mutable** rules\n\n**Exit condition:** Table of **state slices** → **source of truth** → **consumers**.\n\n---\n\n## Stage 2: Assign Ownership\n\n**Goal:** **One writer** per piece of truth (or strict reducer pattern).\n\n### Rules of Thumb\n\n- **Colocate** state where it’s used if not shared—don’t globalize prematurely\n- **Lift** only when multiple subtrees need it or prop chains hurt **and** ownership is clear\n- **Avoid** copying server entities into multiple stores without sync rules\n\n**Exit condition:** For each slice: **who sets**, **who reads**, **invalidation** story.\n\n---\n\n## Stage 3: Server vs Client Boundaries\n\n**Goal:** Prefer **server-state libraries** for remote data; use **client stores** for true client concerns.\n\n### Guidance\n\n- **React Query \u002F SWR \u002F RTK Query**: caching, dedupe, refetch, background refresh—use for HTTP JSON\n- **GraphQL clients**: normalized cache + mutations with **update** policies\n- **Redux**: great for **predictable** global client state + middleware—not every fetch response\n\n### Anti-patterns\n\n- Storing **full API JSON** in Redux without normalization when Apollo\u002FQuery would fit\n- **Double fetch**: SSR then client refetch without coordination—use **hydration** patterns\n\n**Exit condition:** Remote data has **defined cache keys**, **stale time**, and **mutation** flow.\n\n---\n\n## Stage 4: Async & Consistency\n\n**Goal:** **Loading**, **error**, **empty**, and **retry** are first-class; **optimistic** updates are safe or scoped.\n\n### Practices\n\n- **Optimistic UI**: rollback path; idempotent mutations; **server reconciliation**\n- **Ordering**: serial vs parallel requests; **race** cancellation (AbortController)\n- **Pagination\u002Finfinite scroll**: cursor stability; dedupe pages\n\n### Concurrency\n\n- **Last write wins** awareness; versioning or ETags if server supports\n\n**Exit condition:** User-visible **failure modes** handled; no silent stale success.\n\n---\n\n## Stage 5: Persistence & URL\n\n**Goal:** Decide **what survives refresh**, **what is shareable**, and **security**.\n\n### Options\n\n- **URL query** for filters\u002Ftabs when users share links\n- **localStorage\u002FsessionStorage** for drafts—mind **XSS** risk (sensitive data → not localStorage)\n- **IndexedDB** for offline—complexity tax\n\n**Exit condition:** Sensitive data **never** persisted client-side inappropriately.\n\n---\n\n## Stage 6: Testing & DevTools\n\n**Goal:** State logic is **unit-testable**; time-travel\u002Fdebug when needed.\n\n### Practices\n\n- **Pure reducers** \u002F small hooks for rules\n- **Integration tests** for critical flows with **MSW** or mock server\n- **DevTools**: Redux\u002FQuery panels—ensure team knows how to inspect cache\n\n---\n\n## Final Review Checklist\n\n- [ ] State classified: remote vs UI vs URL vs derived\n- [ ] Single owner per truth; invalidation clear\n- [ ] Server cache strategy chosen for API data\n- [ ] Async\u002Ferror\u002Fempty\u002Foptimistic paths specified\n- [ ] Persistence\u002Fsecurity boundaries respected\n\n## Tips for Effective Guidance\n\n- **Start minimal**: Context + server-state library solves many “Redux-sized” problems.\n- Always ask: “**What is the source of truth** after mutation returns?”\n- Mention **React Strict Mode** double-invoke when debugging weird effect behavior.\n\n## Handling Deviations\n\n- **Legacy Redux everywhere**: incremental migration—**feature modules** first, remote data to Query next.\n- **Non-React**: map patterns to **signals\u002Fstores** (Vue Pinia, Svelte stores) with same ownership discipline.\n",{"name":5,"description":7},"main","f37de8f681f0c0ca0e0ebab6e5fddf764ca7553d","skills\u002Fstate-management",1,"https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one","https:\u002F\u002Fagisota.github.io\u002Fold-one\u002F","https:\u002F\u002Fgithub.com\u002Fagisota","pzd.world","2026-07-04 22:32:06",{"source":8,"skillName":5,"commands":33,"prompt":43,"zipAvailable":44},[34,37,40],{"tool":35,"command":36},"npx","npx skills add agisota\u002Fold-one --skill state-management",{"tool":38,"command":39},"bunx","bunx skills add agisota\u002Fold-one --skill state-management",{"tool":41,"command":42},"pnpm","pnpm dlx skills add agisota\u002Fold-one --skill state-management","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management\u002FSKILL.md",true,[46,52],{"path":47,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":50,"sourceHtmlUrl":51},"_meta.json","REFERENCE","参考文档",135,"https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management\u002F_meta.json",{"path":53,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":54,"sourceHtmlUrl":55},".clawhub\u002Forigin.json",148,"https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fstate-management\u002F.clawhub\u002Forigin.json",[57,64,71,80,87,94],{"skillNo":58,"name":59,"nameZh":6,"description":60,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":61,"categories":62,"keywords":63,"publishedAt":18},"01M75KRGZWQWE9JDBS6RX42NWV","zoom-out","Tell the agent to zoom out and give broader context or a higher-level perspective. Use when you're unfamiliar with a section of code or need to understand how it fits into the bigger picture.","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fzoom-out\u002FSKILL.md",[],[],{"skillNo":65,"name":66,"nameZh":6,"description":67,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":68,"categories":69,"keywords":70,"publishedAt":18},"01M75KRCZHKE0ZYAQFFYHS0YNP","zeroize-audit","Detects missing zeroization of sensitive data in source code and identifies zeroization removed by compiler optimizations, with assembly-level analysis, and control-flow verification. Use for auditing C\u002FC++\u002FRust code handling secrets, keys, passwords, or other sensitive data.","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fzeroize-audit\u002FSKILL.md",[],[],{"skillNo":72,"name":73,"nameZh":6,"description":74,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":75,"licenseFileUrl":76,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":18},"01M75KR94KYQ30DTE1P9WNDAE0","yeet","Use only when the user explicitly asks to stage, commit, push, and open a GitHub pull request in one flow using the GitHub CLI (`gh`).","Apache-2.0","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fyeet\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fyeet\u002FSKILL.md",[],[],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":18},"01M75KR3H13YJ9QHMD49818FA1","yara-rule-authoring","Guides authoring of high-quality YARA-X detection rules for malware identification. Use when writing, reviewing, or optimizing YARA rules. Covers naming conventions, string selection, performance optimization, migration from legacy YARA, and false positive reduction. Triggers on: YARA, YARA-X, malware detection, threat hunting, IOC, signature, crx module, dex module.","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fyara-rule-authoring\u002FSKILL.md",[],[],{"skillNo":88,"name":89,"nameZh":6,"description":90,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":91,"categories":92,"keywords":93,"publishedAt":18},"01M75KQMPY8A4Y8XTDD2DT0M9T","x-twitter-growth","X\u002FTwitter growth engine for building audience, crafting viral content, and analyzing engagement. Use when the user wants to grow on X\u002FTwitter, write tweets or threads, analyze their X profile, research competitors on X, plan a posting strategy, or optimize engagement. Complements social-content (generic multi-platform) with X-specific depth: algorithm mechanics, thread engineering, reply strategy, profile optimization, and competitive intelligence via web search.","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fx-twitter-growth\u002FSKILL.md",[],[],{"skillNo":95,"name":96,"nameZh":6,"description":97,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":9,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":98,"categories":99,"keywords":100,"publishedAt":18},"01M75KQHNZ0ANZNJGZY6M8MDAK","x-api","X\u002FTwitter API integration for posting tweets, threads, reading timelines, search, and analytics. Covers OAuth auth patterns, rate limits, and platform-native content posting. Use when the user wants to interact with X programmatically.","https:\u002F\u002Fgithub.com\u002Fagisota\u002Fold-one\u002Fblob\u002Fmain\u002Fskills\u002Fx-api\u002FSKILL.md",[],[]]