[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6BVCSCHW8VADEGHK1PWDP0J":3,"skill-same:01M6BVCSCHW8VADEGHK1PWDP0J":77},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":8,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":18,"categories":19,"keywords":30,"publishedAt":46,"linkOnly":47,"markdownContent":48,"markdownBody":49,"frontMatter":50,"refName":52,"commitSha":53,"skillDirectory":54,"forksCount":15,"repositoryHtmlUrl":55,"repositoryHomepageUrl":17,"ownerHtmlUrl":56,"ownerBlogUrl":17,"ownerDescription":17,"updatedAt":57,"install":58,"resources":70},"01M6BVCSCHW8VADEGHK1PWDP0J","principle-separate-before-serializing-shared-state","共享状态分离原则","Apply when concurrent actors might write to the same file, branch, key, or state object. Eliminate the sharing first; serialize structurally only when one shared writer is a real invariant.","当并发参与者可能写入同一文件、分支、键或状态对象时应用。先消除共享；只有当'单一共享写入者'是真正必须成立的不变量时，才在结构上采用序列化。","bnferguson\u002Fdotfiles","bnferguson","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F47749?v=4","01M6BV4H2TJKK8P14W86V1ZCPP","Brandon Ferguson","01M6BV4H7GJWTZJ1BVHQ1TX11Y",0,"MIT",null,"https:\u002F\u002Fgithub.com\u002Fbnferguson\u002Fdotfiles\u002Fblob\u002Fmain\u002Fpstack\u002Fupstream\u002Fskills\u002Fprinciple-separate-before-serializing-shared-state\u002FSKILL.md",[20,25],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BQ6TQZN6R52WBJ9H8NRMQM","软件开发工程师","PROFESSION","适用职业",{"categoryNo":26,"categoryName":27,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8CAAMN19HMY7B3JXN2CBP29","工程实践准则","SCENARIO","使用场景",[31,32,33,34,35,36,37,38,39,40,41,42,43,44,45],"state","principle separate before serializing shared state","shared","file","sharing","first","branch","write","only","writer","true","object","serialize","apply","when","2026-11-10 10:12:30",false,"---\nname: principle-separate-before-serializing-shared-state\ndescription: \"Apply when concurrent actors might write to the same file, branch, key, or state object. Eliminate the sharing first; serialize structurally only when one shared writer is a real invariant.\"\ndisable-model-invocation: true\n---\n\n# Separate Before Serializing Shared State\n\nWhen concurrent actors might share mutable state, first ask whether they need the same mutable object. If not, eliminate the sharing. When sharing is real, enforce serialization structurally: lockfiles, sequential phases, exclusive ownership. Instructions and conventions are not concurrency control.\n\n**Why:** Concurrent writes to shared state create race conditions that are intermittent, hard to reproduce, and expensive to debug.\n\n**Pattern:**\n1. **Identify shared mutable state** (files both read and write, branches both push to, APIs both define and consume).\n2. **Default: eliminate the shared write target.** Ask: do these actors need one canonical object, or are they publishing independent facts? Give each actor its own owned file, key, branch, or state directory, and merge only at the read\u002Freporting boundary. Two workers writing their own `lastX` field into one `state.json` is still shared mutation. `indexer-state.json` + `metrics-state.json` is not.\n3. **Only when one shared write target is a real invariant, serialize access structurally** (lockfiles, sequential phases, single-writer actor, or atomic compare-and-swap). Treat \"we need a lock\" as a design smell to check, not as the default answer.\n","# Separate Before Serializing Shared State\n\nWhen concurrent actors might share mutable state, first ask whether they need the same mutable object. If not, eliminate the sharing. When sharing is real, enforce serialization structurally: lockfiles, sequential phases, exclusive ownership. Instructions and conventions are not concurrency control.\n\n**Why:** Concurrent writes to shared state create race conditions that are intermittent, hard to reproduce, and expensive to debug.\n\n**Pattern:**\n1. **Identify shared mutable state** (files both read and write, branches both push to, APIs both define and consume).\n2. **Default: eliminate the shared write target.** Ask: do these actors need one canonical object, or are they publishing independent facts? Give each actor its own owned file, key, branch, or state directory, and merge only at the read\u002Freporting boundary. Two workers writing their own `lastX` field into one `state.json` is still shared mutation. `indexer-state.json` + `metrics-state.json` is not.\n3. **Only when one shared write target is a real invariant, serialize access structurally** (lockfiles, sequential phases, single-writer actor, or atomic compare-and-swap). Treat \"we need a lock\" as a design smell to check, not as the default answer.\n",{"name":5,"description":7,"disable-model-invocation":51},true,"main","e63965e4644984470d4cc8b3014a8b001f0c2666","pstack\u002Fupstream\u002Fskills\u002Fprinciple-separate-before-serializing-shared-state","https:\u002F\u002Fgithub.com\u002Fbnferguson\u002Fdotfiles","https:\u002F\u002Fgithub.com\u002Fbnferguson","2026-11-11 03:04:59",{"source":9,"skillName":5,"commands":59,"prompt":69,"zipAvailable":51},[60,63,66],{"tool":61,"command":62},"npx","npx skills add bnferguson\u002Fdotfiles --skill principle-separate-before-serializing-shared-state",{"tool":64,"command":65},"bunx","bunx skills add bnferguson\u002Fdotfiles --skill principle-separate-before-serializing-shared-state",{"tool":67,"command":68},"pnpm","pnpm dlx skills add bnferguson\u002Fdotfiles --skill principle-separate-before-serializing-shared-state","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fbnferguson\u002Fdotfiles\u002Fblob\u002Fmain\u002Fpstack\u002Fupstream\u002Fskills\u002Fprinciple-separate-before-serializing-shared-state\u002FSKILL.md",[71],{"path":72,"resourceType":73,"resourceTypeDesc":74,"sizeBytes":75,"sourceHtmlUrl":76},"repos\u002Fmetamask-mobile.md","REFERENCE","参考文档",8208,"https:\u002F\u002Fgithub.com\u002FMetaMask\u002Fskills\u002Fblob\u002Fmain\u002Fdomains\u002Fplatform\u002Fskills\u002Fanalytics\u002Frepos\u002Fmetamask-mobile.md",[78,113,130,163,180,195],{"skillNo":79,"name":80,"nameZh":81,"description":82,"descriptionZh":83,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":84,"licenseFileUrl":85,"sourceHtmlUrl":86,"categories":87,"keywords":94,"publishedAt":46},"01M6BVA3RS3M016FANZ6792F9H","skill-creator","Claude 技能创建指南","Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.","创建有效技能的指南。当用户想要创建新技能（或更新现有技能），以通过专业知识、工作流或工具集成来扩展 Claude 的能力时，应使用此技能。","Apache-2.0","https:\u002F\u002Fgithub.com\u002Fbnferguson\u002Fdotfiles\u002Fblob\u002Fmain\u002Fclaude\u002Fconfig\u002Fskills\u002Fskill-creator\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fbnferguson\u002Fdotfiles\u002Fblob\u002Fmain\u002Fclaude\u002Fconfig\u002Fskills\u002Fskill-creator\u002FSKILL.md",[88,91],{"categoryNo":89,"categoryName":90,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BRN0CV1NMDZ5TEJX1GVM29","插件与技能管理",{"categoryNo":92,"categoryName":93,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BRZZF9D7PVFN5MXSPWWD61","AI 工程师",[95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,45,112],"creator","skill creator","specialized","workflows","create","update","capabilities","knowledge","tool","integrations","guide","new skill","existing skill","users","with","for","Existing","new",{"skillNo":114,"name":115,"nameZh":116,"description":117,"descriptionZh":118,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":119,"categories":120,"keywords":127,"publishedAt":46},"01M6BV94WN2RPYM8N6PN8TBNT8","writing-shape","素材成文逐段撰写","Writing, exploit: shape raw material into an article, paragraph by paragraph.","写作，利用（exploit）：将原始素材逐段塑造成一篇文章。","https:\u002F\u002Fgithub.com\u002Fbnferguson\u002Fdotfiles\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fwriting-shape\u002FSKILL.md",[121,124],{"categoryNo":122,"categoryName":123,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8C55A3R2M9C8CAKG3W16HTA","内容创作者",{"categoryNo":125,"categoryName":126,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8CA3WT74BY17JY9YCJY42FJ","创意写作与内容编排",[128,129],"writing shape","writing",{"skillNo":131,"name":132,"nameZh":133,"description":134,"descriptionZh":135,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":84,"licenseFileUrl":136,"sourceHtmlUrl":137,"categories":138,"keywords":145,"publishedAt":46},"01M6BV8QDFJ6PXBVK5NFBZT5M7","webapp-testing","Playwright 网页应用测试","Test local web applications using Playwright. Use when verifying frontend functionality, debugging UI behavior, capturing browser screenshots, or viewing browser logs.","使用 Playwright 测试本地 Web 应用。适用于验证前端功能、调试 UI 行为、截取浏览器截图或查看浏览器日志。","https:\u002F\u002Fgithub.com\u002Fbnferguson\u002Fdotfiles\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fwebapp-testing\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fbnferguson\u002Fdotfiles\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fwebapp-testing\u002FSKILL.md",[139,142],{"categoryNo":140,"categoryName":141,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BQGD5WG86P4AQ5GPSSKBFR","测试工程师",{"categoryNo":143,"categoryName":144,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BQJH394GT47X57A9Q8G7HX","测试与质量保障",[146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,45],"webapp","webapp testing","testing","browser","frontend","screenshots","playwright","test","web","debugging","ui","logs","applications","behavior","use","local","test local",{"skillNo":164,"name":165,"nameZh":166,"description":167,"descriptionZh":168,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":169,"categories":170,"keywords":177,"publishedAt":46},"01M6BV8MDXKXNVHKS3QF3YDFTF","wait-what","消息重述","Stop. That last message did not land: re-pitch it.","停。上一条消息没有被理解（没说清楚）：换一种方式重新表述。","https:\u002F\u002Fgithub.com\u002Fbnferguson\u002Fdotfiles\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fwait-what\u002FSKILL.md",[171,174],{"categoryNo":172,"categoryName":173,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8BS5011KJDVSRXG1DC4P666","普通用户",{"categoryNo":175,"categoryName":176,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8C1YEW2680C003GGBD6QCKB","回复风格与输出控制",[178,179],"wait what","land",{"skillNo":181,"name":182,"nameZh":183,"description":184,"descriptionZh":185,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":186,"categories":187,"keywords":192,"publishedAt":46},"01M6BV756DJHT5BDA1HVRVHJJ7","prototype","快速原型构建","Build a throwaway prototype to answer a design question. Use when the user wants to sanity-check whether a state model or logic feels right, or explore what a UI should look like.","构建一个一次性原型来回答设计问题。当用户想要验证某个状态模型或逻辑是否合理，或探索 UI 应该是什么样子时使用。","https:\u002F\u002Fgithub.com\u002Fbnferguson\u002Fdotfiles\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fprototype\u002FSKILL.md",[188,189],{"categoryNo":21,"categoryName":22,"taxonomyType":23,"taxonomyTypeDesc":24},{"categoryNo":190,"categoryName":191,"taxonomyType":28,"taxonomyTypeDesc":29},"01M8BT7QTSZKB08EAW9P9ZCDNQ","设计评审与架构优化",[182,193,194,156,31],"design","explore",{"skillNo":196,"name":197,"nameZh":198,"description":199,"descriptionZh":200,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":17,"sourceHtmlUrl":201,"categories":202,"keywords":207,"publishedAt":46},"01M6BV6SBW166685KVBPWM2K4N","improve-codebase-architecture","代码库架构优化分析","Scan a codebase for deepening opportunities, present them as a visual HTML report, then grill through whichever one you pick.","扫描代码库以发现可深化改进的机会，将其以可视化 HTML 报告的形式呈现，然后对你选中的某一项进行深入质询。","https:\u002F\u002Fgithub.com\u002Fbnferguson\u002Fdotfiles\u002Fblob\u002Fmain\u002F.agents\u002Fskills\u002Fimprove-codebase-architecture\u002FSKILL.md",[203,204],{"categoryNo":190,"categoryName":191,"taxonomyType":28,"taxonomyTypeDesc":29},{"categoryNo":205,"categoryName":206,"taxonomyType":23,"taxonomyTypeDesc":24},"01M8C4ZVS0ZJKF2T2G58PW5VR2","系统架构师",[208,209,210,211],"architecture","improve","improve codebase architecture","report"]