← LeaderboardThe Skill Leaderboard

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.

Published by backnotprop ↗backnotprop/pstack

Try your first task

Separate worker outputs before adding a shared lock

Start a fresh conversation.

Using the proposed local thumbnail workflow, give workers separate output paths and define where results are joined. Explain what shared state remains and sketch a test for two workers finishing at the same time.

    User-approved starter prompt based on a pinned source version; check current skill requirements before running. Task evidence ↗

    SKILL.md

    name: principle-separate-before-serializing-shared-statedescription: "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."disable-model-invocation: true

    Separate Before Serializing Shared State

    When concurrent actors might write the same file, branch, key, or object, first ask whether they need one shared object or are publishing independent facts. Default to giving each actor its own file, key, branch, or state directory, and merge only where the state is read. Two workers writing their own field into one state.json is still shared mutation.

    Only when one shared write target is a real invariant, serialize access structurally (a lockfile, a single writer, sequential phases, compare-and-swap). Instructions are not concurrency control, and "we need a lock" is a smell to check first.