Some Assembly Required · Level 4 of 5

Skills That Call Skills

In this level, you'll split a read-only check out of tidy-imports into a skill of its own, call it from tidy-imports and add a gate before the one change git can't undo.

Colour key: 4.1 Split Out a Read-Only Check 4.2 Call It From tidy-imports 4.3 A Gate Before Anything Irreversible

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 3 Left It

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

Here's SKILL.md at the end of level 3. It does all its work on its own; step 4.1 starts a second skill beside it.

The files at the start

.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.

Checking whether a file's imports are already sorted is useful on its own, before a commit or to decide whether a tidy is needed at all. Because the check never writes, any skill can share it. Make it a skill called tidy-imports-check, with its own script that reports and changes nothing 4.1a.

On src/app.ts from 1.3, before tidying, the script prints

unsorted: 3 imports in src/app.ts; sorted, they would read:import express from 'express';import { readFileSync } from 'node:fs';import { serve } from './server';

The files after step 4.1

.claude/skills/tidy-imports-check/scripts/check-imports.sh

#!/usr/bin/env bash# Report whether the import lines at the top of a file are sorted. Never writes.set -euo pipefailexport LC_ALL=C # the same order sort-imports.sh usesfile="$1"count=$(awk '/^import /{n++; next} {exit} END{print n+0}' "$file")if [ "$count" -eq 0 ]; then	echo "no imports at the top of $file"	exit 0fiif head -n "$count" "$file" | sort -c 2>/dev/null; then	echo "sorted: $count imports in $file"else	echo "unsorted: $count imports in $file; sorted, they would read:"	head -n "$count" "$file" | sortfi
  1. 4.1a sort -c only checks the order and exits non-zero on the first line out of place, so the script never opens the file for writing.

  2. 4.1b export LC_ALL=C matches the line in sort-imports.sh, so the check and the tidy agree on what sorted means.

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

---name: tidy-imports-checkdescription: Report whether the import statements at the top of a file are sorted, without changing the filewhen_to_use: "Before tidy-imports rewrites a file, or when the user asks whether a file's imports are in order."arguments: [path]argument-hint: "[file]"model: sonneteffort: lowdisable-model-invocation: false # tidy-imports calls this skill, so Claude must be able to invoke itallowed-tools: Bash(${CLAUDE_SKILL_DIR}/scripts/check-imports.sh:*)disallowed-tools: [Edit, Write, NotebookEdit] # reads, never writes---Check the imports in $path.Run the script on the file, by exactly this path:```bash${CLAUDE_SKILL_DIR}/scripts/check-imports.sh "$path"```Report its output as it stands. Do not sort, fix or changeanything, even when the imports are out of order.
  1. 4.1c disable-model-invocation: false is already the default, and its comment records that another skill calls this one, so nobody flips it to true without seeing what 4.2 depends on.

  2. 4.1d disallowed-tools lists only the file-writing tools and leaves Bash alone, because the check runs its own script.

Have tidy-imports run the check first and stop when there's nothing to do. To call another skill, the body just tells Claude to load it by name 4.2a, and Claude uses its Skill tool, as it would for any skill. That tool refuses a skill marked disable-model-invocation: true unless your own message names that skill's command 4.2b, so a skill that another skill calls has to stay open to Claude.

The files after step 4.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:*)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.Load the tidy-imports-check skill on $path. If it reportsthe imports already sorted, say so and stop. If the checkcannot run, say why and stop.Run the script on the file, by exactly this path:... lines 24 to 34 left out
  1. 4.2a Load the tidy-imports-check skill on $path names the skill and its argument, which is all one skill needs to call another.

  2. 4.2b If the check cannot run, say why and stop covers the day someone marks the check disable-model-invocation: true and the call is refused.

  3. 4.2c Both files pin model: sonnet and effort: low. The check's effort carries on into the rest of the tidy, so a different effort there would change the tidy's too. Its model doesn't carry, so the tidy keeps the model it started on.

The script rewrites the file in place and keeps no copy. If the file is committed, git still has the old order; if it has uncommitted changes, or git has never seen it, nothing does. For that case, have tidy-imports stop and wait for a yes before the script runs.

The files after step 4.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; it stops for a yes before rewriting a file git has no copy ofallowed-tools: ["Bash(${CLAUDE_SKILL_DIR}/scripts/sort-imports.sh:*)", "Bash(git status:*)"]disallowed-tools: [Edit, Write, NotebookEdit] # the script changes the file; Claude never does---Tidy the imports in $path.... lines 16 to 21 left outRun `git status --porcelain -- "$path"`. If it printsanything, the file has changes git holds no copy of, andthe rewrite cannot be undone from git. Show the check'sreport, say this and stop. Run the script only after theuser replies yes.Run the script on the file, by exactly this path:... lines 30 to 40 left out
  1. 4.3a git status --porcelain -- "$path" prints nothing for a file git already holds as it is, so a clean file goes straight to the script with no question asked.

  2. 4.3b Show the check's report, say this and stop puts the planned order in front of you before you answer.

  3. 4.3c The yes arrives as a new message, which clears both the allowed-tools grant and the disallowed-tools removal, so Claude Code asks before the script runs unless your permission settings already allow it.

  4. 4.3d The comment on disable-model-invocation now names the gate, which is what makes it reasonable to leave a file-rewriting skill open to Claude.

The Real Thing

Three skills in this repository share one review method. pr-review-dry_run holds it and prints findings; pr-review and branch-qa_review both call it.

Caller and callee pin the same model: opus and effort: high, for the reason in step 4.2.

---name: "PR: Review (Dry Run)"...model: opuseffort: high...disable-model-invocation: false # required so pr-review can call it...disallowed-tools: ["Edit", "Write", "NotebookEdit"] # reviews, never fixes...---...Canonical review methodology. Produces structured findings only; **never posts to GitHub**. `pr-review` loads this skill and handles posting; keep all methodology here to avoid divergence....
  1. R.a disable-model-invocation: false # required so pr-review can call it does what you did in step 4.1, with the reason written beside it.