[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M78ECYMS3MWDPXVPZFFCX7V7":3,"skill-same:01M78ECYMS3MWDPXVPZFFCX7V7":47},{"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":28,"repositoryHtmlUrl":29,"repositoryHomepageUrl":6,"ownerHtmlUrl":30,"ownerBlogUrl":31,"ownerDescription":32,"updatedAt":33,"install":34,"resources":46},"01M78ECYMS3MWDPXVPZFFCX7V7","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.","mikeyobrien\u002Fpi-tidy-tools","mikeyobrien","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F11792047?v=4","01M78EA4XJ7CY5SB8V7EPB1581","Mikey O'Brien","01M78EA4YD4ECB9199H176CNQY",63,"MIT","https:\u002F\u002Fgithub.com\u002Fmikeyobrien\u002Fpi-tidy-tools\u002Fblob\u002Fmain\u002F.claude\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,"main","b253d1504091e48e3d60ebab19535bf0d1cec363",".claude\u002Fskills\u002Fprinciple-separate-before-serializing-shared-state",3,"https:\u002F\u002Fgithub.com\u002Fmikeyobrien\u002Fpi-tidy-tools","https:\u002F\u002Fgithub.com\u002Fmikeyobrien","mobrienv.dev","Sr. SDE @ Amazon. Austin, TX. AI Enthusiast. \r\n","2026-10-13 08:29:57",{"source":8,"skillName":5,"commands":35,"prompt":45,"zipAvailable":24},[36,39,42],{"tool":37,"command":38},"npx","npx skills add mikeyobrien\u002Fpi-tidy-tools --skill principle-separate-before-serializing-shared-state",{"tool":40,"command":41},"bunx","bunx skills add mikeyobrien\u002Fpi-tidy-tools --skill principle-separate-before-serializing-shared-state",{"tool":43,"command":44},"pnpm","pnpm dlx skills add mikeyobrien\u002Fpi-tidy-tools --skill principle-separate-before-serializing-shared-state","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmikeyobrien\u002Fpi-tidy-tools\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fprinciple-separate-before-serializing-shared-state\u002FSKILL.md",[],[48,55,62,69,76,83],{"skillNo":49,"name":50,"nameZh":6,"description":51,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":52,"categories":53,"keywords":54,"publishedAt":19},"01M78EEXKEADXTNBVN3096T211","pi-tidy-bots-cli","Drive the pi-tidy-bots fleet runtime from an agent — init, daemonized start, status, stop, hot bot onboarding, and the HTTP+WS machine API (messages, transcripts, compaction, question cards) — all non-interactive with checked exit codes and --json shapes.","https:\u002F\u002Fgithub.com\u002Fmikeyobrien\u002Fpi-tidy-tools\u002Fblob\u002Fmain\u002Fskills\u002Fpi-tidy-bots-cli\u002FSKILL.md",[],[],{"skillNo":56,"name":57,"nameZh":6,"description":58,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":59,"categories":60,"keywords":61,"publishedAt":19},"01M78EES9YE4WYNC6NJZNZD628","qa-loop","Run a human-gated QA and repair loop for pi-tidy-tools.","https:\u002F\u002Fgithub.com\u002Fmikeyobrien\u002Fpi-tidy-tools\u002Fblob\u002Fmain\u002F.pi\u002Fskills\u002Fqa-loop\u002FSKILL.md",[],[],{"skillNo":63,"name":64,"nameZh":6,"description":65,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":66,"categories":67,"keywords":68,"publishedAt":19},"01M78EEP74RPPZYAZYEJRJ2DXK","pi-tidy-tools-ethos","Narrative guardrails for @mobrienv\u002Fpi-tidy-tools. Use when designing, implementing, reviewing, or documenting non-release changes to that package.","https:\u002F\u002Fgithub.com\u002Fmikeyobrien\u002Fpi-tidy-tools\u002Fblob\u002Fmain\u002F.pi\u002Fskills\u002Fpi-tidy-tools-ethos\u002FSKILL.md",[],[],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":19},"01M78EEJAAK2GZ2FXR8PT6SPSY","npm-release","Releases one @mobrienv\u002Fpi-tidy-* workspace through GitHub and npm Trusted Publishing. Use when asked to prepare changelog entries, cut, publish, or monitor a patch, minor, major, or explicit-version release.","https:\u002F\u002Fgithub.com\u002Fmikeyobrien\u002Fpi-tidy-tools\u002Fblob\u002Fmain\u002F.pi\u002Fskills\u002Fnpm-release\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":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":19},"01M78EEEWYRACQEPDPC039DEK0","build-loop","Build and independently verify one ready implementation ticket through a human-gated repair loop.","https:\u002F\u002Fgithub.com\u002Fmikeyobrien\u002Fpi-tidy-tools\u002Fblob\u002Fmain\u002F.pi\u002Fskills\u002Fbuild-loop\u002FSKILL.md",[],[],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":19},"01M78EEA9XNRCCR1SKEFSPXPTC","why","Use for 'why does X work this way', 'why we picked Y', design rationale, regressions, postmortems, or data-backed thresholds. Discovers available MCPs and queries each evidence category (source control, issue tracker, long-form docs, real-time chat, infrastructure observability, error tracking, product analytics warehouse) in parallel, then returns a cited read on decisions and tradeoffs. Use how for runtime behavior.","https:\u002F\u002Fgithub.com\u002Fmikeyobrien\u002Fpi-tidy-tools\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fwhy\u002FSKILL.md",[],[]]