Some Assembly Required · Level 3 of 5

Say Who Runs It, and How

In this level, you'll add frontmatter that controls who can start tidy-imports, which model it runs on and which tools it may never use.

Colour key: 3.1 Who May Start It 3.2 Pin the Model and Effort 3.3 Promises the Frontmatter Enforces

Scroll and the sheet below builds the files one step at a time, pinning each step's notes. One scroll moves one step; the step buttons, the arrow keys or j and k do the same.

Where Level 2 Left It

Specimen tidy-imports/SKILL.md Where Level 2 Left It

Here's SKILL.md at the end of level 2. Its frontmatter says nothing yet about who may start it or which model it runs on.

The files at the start

.claude/skills/tidy-imports/SKILL.md

---name: tidy-importsdescription: Sort the import statements at the top of a filearguments: [path]argument-hint: "[file]"allowed-tools: Bash(${CLAUDE_SKILL_DIR}/scripts/sort-imports.sh:*)---Tidy the imports in $path.Read .claude/tidy-imports.log if it exists. If $path isalready listed there, say so before going on.Run the script on the file, by exactly this path:```bash${CLAUDE_SKILL_DIR}/scripts/sort-imports.sh "$path"```It sorts the import block in place. Do not reorder anylines yourself or edit the file after it runs. If thescript exits non-zero, report its message and stop.The script also writes the ledger line. Never write to.claude/tidy-imports.log yourself.

By default, both you and Claude can start a skill. Setting disable-model-invocation: true makes it yours alone; user-invocable: false makes it Claude's alone. Leave tidy-imports open to both, write the line out anyway 3.1b with a comment saying why 3.1c, and add when_to_use to tell Claude when to reach for it 3.1a.

The files after step 3.1

.claude/skills/tidy-imports/SKILL.md

---name: tidy-importsdescription: Sort the import statements at the top of a filewhen_to_use: "After you add or remove imports in a file, or when the user asks to sort or tidy a file's imports."arguments: [path]argument-hint: "[file]"disable-model-invocation: false # Claude may start it after changing a file's imports; the script only reorders import linesallowed-tools: Bash(${CLAUDE_SKILL_DIR}/scripts/sort-imports.sh:*)---Tidy the imports in $path.Read .claude/tidy-imports.log if it exists. If $path isalready listed there, say so before going on.Run the script on the file, by exactly this path:... lines 17 to 21 left outIt sorts the import block in place. Do not reorder anylines yourself or edit the file after it runs. If thescript exits non-zero, report its message and stop.The script also writes the ledger line. Never write to.claude/tidy-imports.log yourself.
  1. 3.1a Claude sees when_to_use alongside the description, so use it to name the moment: just after Claude has changed a file's imports.

  2. 3.1b disable-model-invocation: false is already the default; writing it out gives the comment somewhere to say why Claude may start this skill unasked.

  3. 3.1c The comment names the only safeguard so far: the script touches nothing but import lines. That doesn't cover a file with uncommitted changes, which git can't restore; step 4.3 adds a gate for it.

  4. 3.1d If this line were true, the description and when_to_use would drop out of Claude's context entirely. when_to_use only matters on a skill Claude is allowed to start.

Reading a ledger and running one script doesn't need your most capable model, so pin a mid-sized one at low effort. model and effort override the session for the rest of the turn the skill runs in 3.2c; your next message brings the session's own settings back.

The files after step 3.2

.claude/skills/tidy-imports/SKILL.md

---name: tidy-importsdescription: Sort the import statements at the top of a filewhen_to_use: "After you add or remove imports in a file, or when the user asks to sort or tidy a file's imports."arguments: [path]argument-hint: "[file]"model: sonneteffort: lowdisable-model-invocation: false # Claude may start it after changing a file's imports; the script only reorders import linesallowed-tools: Bash(${CLAUDE_SKILL_DIR}/scripts/sort-imports.sh:*)---Tidy the imports in $path.Read .claude/tidy-imports.log if it exists. If $path isalready listed there, say so before going on.Run the script on the file, by exactly this path:... lines 19 to 23 left outIt sorts the import block in place. Do not reorder anylines yourself or edit the file after it runs. If thescript exits non-zero, report its message and stop.The script also writes the ledger line. Never write to.claude/tidy-imports.log yourself.
  1. 3.2a model takes the same aliases as /model. If your organisation's allowed list or auto mode rules the model out, the skill falls back to the session's model.

  2. 3.2b effort takes low, medium, high, xhigh or max; which of those are available depends on the model.

  3. 3.2c Both settings hold until your next message. If Claude starts the skill partway through other work, the rest of that turn drops to low effort and stays on the session's model. In Claude Code 2.1.329, model only switches when your own message starts the skill.

Since step 2.1, the body has told Claude never to edit the file itself. disallowed-tools enforces that 3.3a: while the skill is active, the tools it lists are out of Claude's reach. Where allowed-tools approves tools, disallowed-tools takes them away. Keep the sentence in the body too, because the removal only lasts until your next message 3.3c.

The files after step 3.3

.claude/skills/tidy-imports/SKILL.md

---name: tidy-importsdescription: Sort the import statements at the top of a filewhen_to_use: "After you add or remove imports in a file, or when the user asks to sort or tidy a file's imports."arguments: [path]argument-hint: "[file]"model: sonneteffort: lowdisable-model-invocation: false # Claude may start it after changing a file's imports; the script only reorders import linesallowed-tools: Bash(${CLAUDE_SKILL_DIR}/scripts/sort-imports.sh:*)disallowed-tools: [Edit, Write, NotebookEdit] # the script changes the file; Claude never does---Tidy the imports in $path.Read .claude/tidy-imports.log if it exists. If $path isalready listed there, say so before going on.Run the script on the file, by exactly this path:... lines 20 to 24 left outIt sorts the import block in place. Do not reorder anylines yourself or edit the file after it runs. If thescript exits non-zero, report its message and stop.The script also writes the ledger line. Never write to.claude/tidy-imports.log yourself.
  1. 3.3a disallowed-tools: [Edit, Write, NotebookEdit] removes the three file-writing tools, so Claude cannot fix up the file after the script runs even if it decides to.

  2. 3.3b The comment the script changes the file; Claude never does restates the promise from 2.1b, so a reader of the frontmatter alone sees why the list exists.

  3. 3.3c Do not reorder any lines yourself stays in the body, because the tool removal clears at your next message and the instruction does not.

  4. 3.3d The removal also lasts for the rest of the turn the skill started in, so if Claude runs the tidy partway through a task, it cannot edit any file again until you send your next message.

The Real Thing

pr-update rewrites a pull request's description after new commits land. Claude can start it, and a comment in its frontmatter names the gate that makes that safe R.c.

pr-update has no disallowed-tools line. For a real one, see line 13 of skills/project-tag_version/SKILL.md, which removes git push --tags because it would publish every stray local tag.

skills/pr-update/SKILL.md

---name: "PR: Update"description: "Update a PR description to account for commits made since it was last written"when_to_use: "When commits have been pushed to a branch after its PR was opened or last described; offer it whenever new work lands on a branch with an open PR rather than leaving the description stale."model: sonneteffort: medium...disable-model-invocation: false # invocable by Claude so it can offer a refresh when new commits leave the description stale; its approval step still gates the write...---...### 5. Show me the diffDisplay the updated body in full and a brief summary of what changed vs the previous description. **Wait for my approval.**...
  1. R.a when_to_use names a moment Claude sees first, new commits on a branch whose description has gone stale, as in step 3.1.

  2. R.b model: sonnet and effort: medium pin the run the same way 3.2 does, one notch higher on effort.

  3. R.c The comment on disable-model-invocation: false names the gate that makes it safe to leave open, as in step 3.1.

  4. R.d **Wait for my approval.** is that gate, and step 4.3 gives tidy-imports one of its own.