Command Palette

Search for a command to run...

Назад к скиллам
скилл № 23817

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…

БесплатноБез исполняемых скриптов
jeremybrasherот jeremybrasher★ 41 звезда на GitHub

Установить principle-separate-before-serializing-shared-state в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Об этом скилле

Separate Before Serializing Shared State

When to use

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.

Do not use when:

  • The trigger in the description is not met
  • A narrower operational skill already covers the same decision
  • You would only be citing the name without changing a choice

Intake — before you proceed

You need all of the following. If any is missing, stop.

  1. A concrete situation (change, bug, design fork, or review object) that might invoke this principle
  2. Enough context to tell whether the trigger actually fires
  3. The decision or action this principle would change

If any is missing, stop. Say what is missing and what you need. Do not invent inputs to keep moving.

HOLD — stop and return this, not a polished guess

When you cannot proceed, return the gap.

Condition What is missing What it needs Return instead
Trigger unclear Evidence the trigger fires A fact from the work that matches the description Name the gap. Do not cite the principle as decoration.
No situation object A change, bug, fork, or review target One sentence naming the object I need the object of work before applying this principle.
Would only rename the same plan A choice the principle actually changes A different next action, or silence Holding. Citing without changing a choice is noise.
Conflicts with a hard user constraint Alignment with stated constraints User confirmation or a different principle State the conflict. Do not override the user constraint.

A HOLD is a return value, not a delay before you guess.

Defaults: cut first

This operation defaults to less, not more.

  • Do not expand scope to fully apply the principle
  • Prefer the smallest structural change the principle demands
  • If the principle says delete, delete before adding
  • Do not write an essay about the principle; show the changed choice
  • Expansion needs evidence from the request or the observed system — not from a habit of completeness.

Will not produce

  • A decorative citation with no changed decision
  • A rewrite of the whole system when a local application suffices
  • Invented project facts to make the principle fit

Before you return

Run this check. If any item fails, fix or HOLD — do not hand over a guess.

  • Trigger was evidenced or you HOLDed
  • The principle changed a named choice, or you HOLDed
  • No decorative citation
  • Domain purpose of the surrounding task is unchanged

What this process changes

The recipe is not a neutral mirror. It changes the work:

  • Naming a principle early anchors the agent on that frame and can hide better-fitting principles
  • Stop-rules can freeze useful exploration when the census or premise is incomplete
  • Delete-first readings can discard still-needed scaffolding if the dead-weight call is wrong

What still needs a human: Whether the trigger truly fired, whether the structural fix is worth the blast radius, and whether to override for a product reason.

Method card — same family every run

A later agent runs this from this file alone.

  1. Intake: situation + trigger evidence + decision to change. Gap -> HOLD.
  2. State the trigger match in one sentence.
  3. Apply the pattern in the Domain recipe below.
  4. Return the changed choice (or HOLD), not a principle lecture.

Domain recipe

The following is the domain behavior to keep. Alignment sections above constrain intake, pauses, cuts, and refusals; they do not replace this recipe.

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.
Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

  • SCORE.json
  • SOURCE.md

FAQ

Что делает скилл 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. Observe required inputs first; HOLD when they are missing rather than guessing.

Как установить скилл principle-separate-before-serializing-shared-state?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл principle-separate-before-serializing-shared-state запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить principle-separate-before-serializing-shared-state с