[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7CQSV660R0Q3WSMJYPBYRF7":3,"skill-same:01M7CQSV660R0Q3WSMJYPBYRF7":44},{"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":25,"commitSha":26,"skillDirectory":27,"forksCount":14,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":30,"install":31,"resources":43},"01M7CQSV660R0Q3WSMJYPBYRF7","principle-separate-before-serializing-shared-state",null,"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.","thalhath2234\u002Ftimely-app","thalhath2234","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F69391707?v=4","01M7CQNWTHSAP0D50RQY6W9YZQ","Thalhath","01M7CQNWVQN600VKQXRGTWCDPH",0,"MIT","https:\u002F\u002Fgithub.com\u002Fthalhath2234\u002Ftimely-app\u002Fblob\u002Fdev\u002F.agents\u002Fpstack\u002Fskills\u002Fprinciple-separate-before-serializing-shared-state\u002FSKILL.md",[],[],"2026-11-15 14:19:17",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":24},true,"dev","4d9b346961dd1d220a07fe4e6ed44b52daa57e0b",".agents\u002Fpstack\u002Fskills\u002Fprinciple-separate-before-serializing-shared-state","https:\u002F\u002Fgithub.com\u002Fthalhath2234\u002Ftimely-app","https:\u002F\u002Fgithub.com\u002Fthalhath2234","2026-11-14 05:26:10",{"source":8,"skillName":5,"commands":32,"prompt":42,"zipAvailable":24},[33,36,39],{"tool":34,"command":35},"npx","npx skills add thalhath2234\u002Ftimely-app --skill principle-separate-before-serializing-shared-state",{"tool":37,"command":38},"bunx","bunx skills add thalhath2234\u002Ftimely-app --skill principle-separate-before-serializing-shared-state",{"tool":40,"command":41},"pnpm","pnpm dlx skills add thalhath2234\u002Ftimely-app --skill principle-separate-before-serializing-shared-state","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fthalhath2234\u002Ftimely-app\u002Fblob\u002Fdev\u002F.agents\u002Fpstack\u002Fskills\u002Fprinciple-separate-before-serializing-shared-state\u002FSKILL.md",[],[45,52,59,66,73,80],{"skillNo":46,"name":47,"nameZh":6,"description":48,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":49,"categories":50,"keywords":51,"publishedAt":19},"01M7CRJRHHG68Q3XZX37TD85JB","timely","Test fixture standing in for the Timely skill (IDs, markdown dialect, workspace rule).","https:\u002F\u002Fgithub.com\u002Fthalhath2234\u002Ftimely-app\u002Fblob\u002Fdev\u002Fapps\u002Fagent\u002Ftests\u002Ffixtures\u002Fskills\u002Ftimely\u002FSKILL.md",[],[],{"skillNo":53,"name":54,"nameZh":6,"description":55,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":56,"categories":57,"keywords":58,"publishedAt":19},"01M7CRJPPNS8SKWVTDP3TJ9EHG","product-price-monitor","Test fixture override of the upstream product-price-monitor skill.","https:\u002F\u002Fgithub.com\u002Fthalhath2234\u002Ftimely-app\u002Fblob\u002Fdev\u002Fapps\u002Fagent\u002Ftests\u002Ffixtures\u002Fskills\u002Foverrides\u002Fproduct-price-monitor\u002FSKILL.md",[],[],{"skillNo":60,"name":61,"nameZh":6,"description":62,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":63,"categories":64,"keywords":65,"publishedAt":19},"01M7CRJKRY4QH4RAA2MKHNZT04","blocked-page-recovery","Use when a fetch fails: 403\u002F429, paywall, WAF, bot wall.","https:\u002F\u002Fgithub.com\u002Fthalhath2234\u002Ftimely-app\u002Fblob\u002Fdev\u002Fapps\u002Fagent\u002Fhermes\u002Fskills\u002Fweb\u002Fblocked-page-recovery\u002FSKILL.md",[],[],{"skillNo":67,"name":68,"nameZh":6,"description":69,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":70,"categories":71,"keywords":72,"publishedAt":19},"01M7CRJG3JC6PRSTH3MW62KTH6","test-driven-development","TDD: enforce RED-GREEN-REFACTOR, tests before code.","https:\u002F\u002Fgithub.com\u002Fthalhath2234\u002Ftimely-app\u002Fblob\u002Fdev\u002Fapps\u002Fagent\u002Fhermes\u002Fskills\u002Fsoftware-development\u002Ftest-driven-development\u002FSKILL.md",[],[],{"skillNo":74,"name":75,"nameZh":6,"description":76,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":19},"01M7CRJ8K3ACJYKSYDJWKJM6HV","systematic-debugging","4-phase root cause debugging: understand bugs before fixing.","https:\u002F\u002Fgithub.com\u002Fthalhath2234\u002Ftimely-app\u002Fblob\u002Fdev\u002Fapps\u002Fagent\u002Fhermes\u002Fskills\u002Fsoftware-development\u002Fsystematic-debugging\u002FSKILL.md",[],[],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":19},"01M7CRJ3Q5QP1CVBG959M3A3BM","spike","Throwaway experiments to validate an idea before build.","https:\u002F\u002Fgithub.com\u002Fthalhath2234\u002Ftimely-app\u002Fblob\u002Fdev\u002Fapps\u002Fagent\u002Fhermes\u002Fskills\u002Fsoftware-development\u002Fspike\u002FSKILL.md",[],[]]