[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7B2KXEW4DM6CPDD50245JDC":3,"skill-same:01M7B2KXEW4DM6CPDD50245JDC":51},{"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":16,"sourceHtmlUrl":17,"categories":18,"keywords":19,"publishedAt":20,"linkOnly":21,"markdownContent":22,"markdownBody":23,"frontMatter":24,"refName":25,"commitSha":26,"skillDirectory":27,"forksCount":14,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":30,"ownerDescription":31,"updatedAt":32,"install":33,"resources":46},"01M7B2KXEW4DM6CPDD50245JDC","pstack-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.","sandeepsalwan1\u002Fmac-setup","sandeepsalwan1","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F118837112?v=4","01M7B2ETGSAY4K5RNVZPF6MEEG","Sandeep Salwan","01M7B2ETHDG8W38G9GV8PR146B",0,"MIT","https:\u002F\u002Fgithub.com\u002Fsandeepsalwan1\u002Fmac-setup\u002Fblob\u002Fmain\u002Fskills\u002Fpstack-principle-separate-before-serializing-shared-state\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fsandeepsalwan1\u002Fmac-setup\u002Fblob\u002Fmain\u002Fskills\u002Fpstack-principle-separate-before-serializing-shared-state\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: pstack-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.\"\n---\n\n# Separate Before Serializing Shared State\n\nApply 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.\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\nApply 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.\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},"main","1d52087de3c5ac2a463b108745b704f3f7eca32e","skills\u002Fpstack-principle-separate-before-serializing-shared-state","https:\u002F\u002Fgithub.com\u002Fsandeepsalwan1\u002Fmac-setup","https:\u002F\u002Fgithub.com\u002Fsandeepsalwan1","sandeeps.tech","GenAI @ Amazon | Builder","2026-11-13 09:45:54",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add sandeepsalwan1\u002Fmac-setup --skill pstack-principle-separate-before-serializing-shared-state",{"tool":39,"command":40},"bunx","bunx skills add sandeepsalwan1\u002Fmac-setup --skill pstack-principle-separate-before-serializing-shared-state",{"tool":42,"command":43},"pnpm","pnpm dlx skills add sandeepsalwan1\u002Fmac-setup --skill pstack-principle-separate-before-serializing-shared-state","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fsandeepsalwan1\u002Fmac-setup\u002Fblob\u002Fmain\u002Fskills\u002Fpstack-principle-separate-before-serializing-shared-state\u002FSKILL.md",true,[47],{"path":48,"resourceType":48,"resourceTypeDesc":49,"sizeBytes":50,"sourceHtmlUrl":16},"LICENSE","许可证",1067,[52,60,68,76,84,92],{"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":56,"sourceHtmlUrl":57,"categories":58,"keywords":59,"publishedAt":20},"01M7B2NQWYHKR94T1P7BTC8V14","teach","Teach the user a new skill or concept, within this workspace.","https:\u002F\u002Fgithub.com\u002Fsandeepsalwan1\u002Fmac-setup\u002Fblob\u002Fmain\u002Fskills\u002Fteach\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fsandeepsalwan1\u002Fmac-setup\u002Fblob\u002Fmain\u002Fskills\u002Fteach\u002FSKILL.md",[],[],{"skillNo":61,"name":62,"nameZh":6,"description":63,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":64,"sourceHtmlUrl":65,"categories":66,"keywords":67,"publishedAt":20},"01M7B2NJ7N4B1W33GY3KCE6HVY","stop-overthinking","Manually-invoked skill that stops overthinking and forces a short, practical decision. Use only when the user explicitly invokes stop-overthinking.","https:\u002F\u002Fgithub.com\u002Fsandeepsalwan1\u002Fmac-setup\u002Fblob\u002Fmain\u002Fskills\u002Fstop-overthinking\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fsandeepsalwan1\u002Fmac-setup\u002Fblob\u002Fmain\u002Fskills\u002Fstop-overthinking\u002FSKILL.md",[],[],{"skillNo":69,"name":70,"nameZh":6,"description":71,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":72,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":20},"01M7B2NAJEG8FCG4NTTSQZ95QP","remind","Rewrite the last response simpler and shorter in plain English, prefixed with a 3-5 sentence TLDR of the conversation so far. Manual-only, invoked as \u002Fremind.","https:\u002F\u002Fgithub.com\u002Fsandeepsalwan1\u002Fmac-setup\u002Fblob\u002Fmain\u002Fskills\u002Fremind\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fsandeepsalwan1\u002Fmac-setup\u002Fblob\u002Fmain\u002Fskills\u002Fremind\u002FSKILL.md",[],[],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":80,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":20},"01M7B2N8BSH4VY69BM98QKW2XV","read-all-adrs","Read every ADR markdown file in the project's docs\u002Fadr\u002F folder so you have full context on past decisions. Use only when the user explicitly calls it.","https:\u002F\u002Fgithub.com\u002Fsandeepsalwan1\u002Fmac-setup\u002Fblob\u002Fmain\u002Fskills\u002Fread-all-adrs\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fsandeepsalwan1\u002Fmac-setup\u002Fblob\u002Fmain\u002Fskills\u002Fread-all-adrs\u002FSKILL.md",[],[],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":88,"sourceHtmlUrl":89,"categories":90,"keywords":91,"publishedAt":20},"01M7B2N09R80Y1ECQVFH6YQWQ8","pstack-why","Find evidence for design choices and historical constraints through relevant authorized read-only sources; distinguish facts, inferences, and gaps.","https:\u002F\u002Fgithub.com\u002Fsandeepsalwan1\u002Fmac-setup\u002Fblob\u002Fmain\u002Fskills\u002Fpstack-why\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fsandeepsalwan1\u002Fmac-setup\u002Fblob\u002Fmain\u002Fskills\u002Fpstack-why\u002FSKILL.md",[],[],{"skillNo":93,"name":94,"nameZh":6,"description":95,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":96,"sourceHtmlUrl":97,"categories":98,"keywords":99,"publishedAt":20},"01M7B2MY9HZ0F1RZ93VTFVVQRR","pstack-unslop","Cut AI tells from any writing.","https:\u002F\u002Fgithub.com\u002Fsandeepsalwan1\u002Fmac-setup\u002Fblob\u002Fmain\u002Fskills\u002Fpstack-unslop\u002FLICENSE","https:\u002F\u002Fgithub.com\u002Fsandeepsalwan1\u002Fmac-setup\u002Fblob\u002Fmain\u002Fskills\u002Fpstack-unslop\u002FSKILL.md",[],[]]