
Principle separate before serializing shared state
Guides agents to avoid write conflicts by splitting shared state before adding locks
Principle separate before serializing shared state is an open-source agent skill for developer tools. It is available on Claude Code.
- Scripts
- None
- Platforms
- Claude Code
- GitHub stars
- 5.1K
- Last commit
- License
- MIT
- Listing updated
Similar skills
About Principle separate before serializing shared state
This skill gives the agent a design rule for situations where several concurrent actors could write to the same file, git branch, key or state object. Before reaching for coordination machinery, the agent is asked whether the actors truly need one shared target or are really publishing independent facts. The default answer is to give each actor its own file, key, branch or state directory, and to combine results only at the point where they are read.
The skill also explains when serialization is justified. If a single shared write target is a genuine invariant, the agent should pick a structural mechanism such as a lockfile, a single writer, sequential phases or compare-and-swap. It warns that written instructions do not count as concurrency control, and that a proposal to add a lock should be checked against the separation option first.
The skill is a short prose guideline with no scripts. It is written for Claude Code plugin use and needs no external tools or languages beyond the agent's own workflow.
When your agent uses it
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.
From the skill's SKILL.md. Your agent reads this description to decide when to load the skill.
What it can access
From a static check of its 2 files (981 bytes) on GitHub on 1 December 2026. Nothing was run. Read the files before you install a skill: it can tell your agent to run anything its tools allow.
Check another skill before you install it.
Install
This skill ships in the pstack plugin. In Claude Code, add the marketplace and install the plugin (it may include other skills too):
/plugin marketplace add michael-denyer/pstack-claude
/plugin install pstack@pstack-claudeOr copy only this skill to ~/.claude/skills/principle-separate-before-serializing-shared-state:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/michael-denyer/pstack-claude.git "$tmp" &&
mkdir -p ~/.claude/skills &&
rm -rf ~/.claude/skills/principle-separate-before-serializing-shared-state &&
cp -R "$tmp/plugins/pstack/skills/principle-separate-before-serializing-shared-state" ~/.claude/skills/principle-separate-before-serializing-shared-state &&
rm -rf "$tmp"For one project only, put the folder in .claude/skills/principle-separate-before-serializing-shared-state inside it instead.
Copy the skill folder to ~/.agents/skills/principle-separate-before-serializing-shared-state to use it in every repository:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/michael-denyer/pstack-claude.git "$tmp" &&
mkdir -p ~/.agents/skills &&
rm -rf ~/.agents/skills/principle-separate-before-serializing-shared-state &&
cp -R "$tmp/plugins/pstack/skills/principle-separate-before-serializing-shared-state" ~/.agents/skills/principle-separate-before-serializing-shared-state &&
rm -rf "$tmp"For one repository only, put the folder in .agents/skills/principle-separate-before-serializing-shared-state inside it instead.
Copy the skill folder to ~/.cursor/skills/principle-separate-before-serializing-shared-state to use it in every project:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/michael-denyer/pstack-claude.git "$tmp" &&
mkdir -p ~/.cursor/skills &&
rm -rf ~/.cursor/skills/principle-separate-before-serializing-shared-state &&
cp -R "$tmp/plugins/pstack/skills/principle-separate-before-serializing-shared-state" ~/.cursor/skills/principle-separate-before-serializing-shared-state &&
rm -rf "$tmp"For one project only, put the folder in .cursor/skills/principle-separate-before-serializing-shared-state inside it instead.
Run in a terminal (add --scope workspace to install it for the current workspace only):
gemini skills install https://github.com/michael-denyer/pstack-claude.git --path plugins/pstack/skills/principle-separate-before-serializing-shared-stateOr copy the folder to ~/.gemini/skills/principle-separate-before-serializing-shared-state yourself.
For GitHub Copilot in VS Code, copy the skill folder to ~/.copilot/skills/principle-separate-before-serializing-shared-state:
tmp=$(mktemp -d) &&
git clone --depth 1 https://github.com/michael-denyer/pstack-claude.git "$tmp" &&
mkdir -p ~/.copilot/skills &&
rm -rf ~/.copilot/skills/principle-separate-before-serializing-shared-state &&
cp -R "$tmp/plugins/pstack/skills/principle-separate-before-serializing-shared-state" ~/.copilot/skills/principle-separate-before-serializing-shared-state &&
rm -rf "$tmp"For one project only, put the folder in .github/skills/principle-separate-before-serializing-shared-state inside it instead.
Get the folder:
git clone --depth 1 https://github.com/michael-denyer/pstack-claude.gitThen copy pstack-claude/plugins/pstack/skills/principle-separate-before-serializing-shared-state into your agent's skills folder as principle-separate-before-serializing-shared-state. Agents that support SKILL.md read one folder per skill.
What it does
- Separation first default
- Prompts the agent to give each concurrent actor its own file, key, branch or state directory before anything else.
- Merge at read time
- Directs combining of separately written state only where it is actually read, not where it is written.
- Justified serialization
- Describes when a single shared writer is a real invariant and which structural mechanisms fit.
- Lock skepticism check
- Flags the impulse to add a lock as a smell to examine before implementing it.
- Instructions are not locks
- Reminds the agent that asking workers to behave is not a substitute for concurrency control.
Good for
- Plan parallel agent workers that write results without clobbering each other
- Review a multi-agent workflow for shared state writes that could conflict
- Decide whether a shared JSON status file needs a lock or separate per-worker files
- Design branch or directory layout for concurrent code generation tasks
Principle separate before serializing shared state FAQ
When does Principle separate before serializing shared state trigger?
It applies when concurrent actors might write to the same file, branch, key or state object, as stated in its description.
Does Principle separate before serializing shared state add scripts or tools to my project?
No. The skill has no scripts and its allowed tools are not set; it is a guideline the agent follows.
What does Principle separate before serializing shared state recommend when a lock is needed?
It says to serialize structurally, for example with a lockfile, a single writer, sequential phases or compare-and-swap, but only when one shared write target is a real invariant.
How do I install Principle separate before serializing shared state in Claude Code?
Copy the skill folder from GitHub to ~/.claude/skills/principle-separate-before-serializing-shared-state to use it in all your projects, or to .claude/skills/principle-separate-before-serializing-shared-state in one project. Or install the pstack plugin, which includes it: /plugin marketplace add michael-denyer/pstack-claude, then /plugin install pstack@pstack-claude.
Does Principle separate before serializing shared state run scripts?
No. It is instructions only, with no scripts. This comes from a static check of the files on GitHub; nothing was run. Read the files before you install it.
Which AI agents can use Principle separate before serializing shared state?
Claude Code. It reads skills in the SKILL.md format; the install steps on this page show where to put the folder.
What are the best alternatives to Principle separate before serializing shared state?
The closest alternatives to Principle separate before serializing shared state are Principle foundational thinking, Principle make operations idempotent, Principle never block on the human, Principle minimize reader load and Orchestration.
Where this comes from
- Description: from the skill's own SKILL.md.
More from michael-denyer/pstack-claude

Makes the agent read pstack's poteto-mode skill first and follow its routing
- Open source
- 5.1K GitHub stars
- Developer tools

Has the agent restate your goals and the problem you're solving in its own words
- Open source
- 5.1K GitHub stars
- Productivity

Prototype 2-3 competing designs and compare them before committing to one
- Open source
- 5.1K GitHub stars
- Developer tools

Sketches types, signatures and module layout before the agent writes code
- Open source
- 5.1K GitHub stars
- Developer tools

Runs parallel candidate attempts at a task, then merges the best parts into one artifact
- Open source
- 5.1K GitHub stars
- Developer tools

Drafts a personal working-style skill from your past agent conversations
- Open source
- 5.1K GitHub stars
- Developer tools

