8.6 Idempotent scripts¶
Running a script or a skill twice is harmless: each step checks what is in place and skips it
(SPEC.md Q-6; root CLAUDE.md (CLAUDE.md), "Rules the scripts follow"). The reason:
the scripts are run again after every new repository and every token change, and a machine,
sandbox or session that restarts runs its setup again
(chapter 2;
lessons-learned.md).
Rules¶
- A second run changes nothing. A script compares the state it wants with the state it
finds and acts only on the difference, as
sandboxes.sh setupdoes for a sandbox and its network rules (setup/linux-host.md, setup/network-allowlist.md). - It says what it did. A step reports whether it found the state in place or wrote it, as
the dev-env baseline's
okandwrittenlines do (setup/claude-baseline.md). - Drift is reported, not overwritten. What a script does not own—an allow rule added by
hand, a branch with a later commit—is reported and left alone until the owner or a flag such
as
--prune-networksays otherwise (setup/network-allowlist.md, sdlc/quality-gate.md). - A root step skips what is in place too, so the owner can run the printed
sudocommand again without harm (setup/linux-host.md). - A skill that copies a template never overwrites an existing file without asking
(
SPEC.mdREQ-8).
Where it is described¶
| Topic | How-to |
|---|---|
| The host scripts and what each sets up | setup/linux-host.md |
| The owner's workstation's scripts | setup/owners-workstation.md |
The environment check and its -Fix |
dev-env README (plugins/dev-env/README.md) |