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.
Install
npx skills add Dimon94/skills --skill principle-separate-before-serializing-shared-stategit clone --depth 1 https://github.com/Dimon94/skills.git /tmp/skills
mkdir -p ~/.claude/skills
cp -r /tmp/skills/skills/principle-separate-before-serializing-shared-state ~/.claude/skills/principle-separate-before-serializing-shared-statePersonal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.
From the SKILL.md
# Separate Before Serializing Shared State When 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. **Why:** Concurrent writes to shared state create race conditions that are intermittent, hard to reproduce, and expensive to debug. **Pattern:** 1. **Identify shared mutable state** (files both read and write, branches both push to, APIs both define and consume). 2. **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/reporting boundary. Two workers writing their own `lastX` field into one `state.json` is still shared mutation. `indexer-state.json` + `metrics-state.json` is not. 3. **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.
Details
- Skill name
principle-separate-before-serializing-shared-state- Repository
- Dimon94/skills
- Path
skills/principle-separate-before-serializing-shared-state/SKILL.md- Repo updated
- 18 November 2026
- Copies
- Found in 3 GitHub repos
FAQ
What does the Principle Separate Before Serializing Shared State skill do?
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.
How do I install the Principle Separate Before Serializing Shared State skill?
skills CLI (Claude Code, Cursor, Codex and more): npx skills add Dimon94/skills --skill principle-separate-before-serializing-shared-state. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.
Is Principle Separate Before Serializing Shared State popular?
It lives in Dimon94/skills, which has 107 GitHub stars and 21 forks, and is included in 2 curated skill lists.
Related skills
Maintain Verification Skill
107Dimon94/skills
Periodic pass that keeps a project's verification skill and feature map honest: parallel source readers per feature, one live session driving every feature, at most one PR of proven corrections. Use for /maintain-verification-skill or "audit the verify skill".
Create Verification Skill
107Dimon94/skills
Generate a project-local verification skill that drives your app the way a user does — any language, framework, or platform. Use for /create-verification-skill, "make a control skill for this repo", or when a project has no scripted way to prove UI/CLI/service behavior.
How
107Dimon94/skills
Use for "how does X work", code walkthroughs before changing something, and placement / ownership / layering questions ("where should this live", "which package owns this", "is this the right layer"). Explains subsystem architecture, runtime flow, onboarding mental models. Use why for motivation.
Content Tone Adjuster
260cafe3310/public-agent-skills
调整内容风格,提供「cafe3310 的移除 AI 常用滥用表达风格」「移除大词风格」「hexiecs 的极简直白风」「学术研究风(去公司战役感)」四种方向
Principle Foundational Thinking
107Dimon94/skills
Apply before writing logic: choosing core types and data structures, sequencing scaffold-vs-feature work, asking what concurrent actors share. Get the data structures right so downstream code becomes obvious.
Linkedin Launch Video
114cognyai/claude-code-marketing-skills
Produce a LinkedIn-native 1:1 (or 16:9) launch video using HyperFrames. Caption-first, sound-off, B2B register, anti-corporate-jargon. Optionally hand off to LinkedIn Ads to launch as a sponsored content campaign with ICP-aligned targeting.
Browse the most popular Claude skills, all writing & content skills, or write your own with the skills generator.