OverviewHistoryStatsSecurity
npx skills add ...
Documentation
SKILL.md
npx skills add cursor/plugins --skill 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.
npx skills add cursor/plugins --skill principle-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:
lastX field into one state.json is still shared mutation. indexer-state.json + metrics-state.json is not.