context
Analyze and optimize Claude Code's context configuration (analyze, optimize, or reset).
Health-check the scaffolding install and report install problems plus exact fixes (diagnose-only, never mutates).
> /plugin marketplace add komluk/scaffolding > /plugin install scaffolding@komluk-scaffolding
How it fires
How this command gets triggered: by you, by Claude, or both.
/doctorContext preview
What this command does when you run it.
Health-check the scaffolding install and report install problems plus exact fixes (diagnose-only, never mutates).
name: doctor description: Health-check the scaffolding install and report install problems plus exact fixes (diagnose-only, never mutates).
Run a health check of the scaffolding plugin install and report problems with the exact command to fix each one. Diagnoses the documented first-run gotchas (the #1 being `Agent type 'scaffolding:...' not found` after a fresh install) and groups findings by severity.
/doctor
Run from any project. No arguments. Safe to run repeatedly.
This command **only diagnoses and prints fixes**. It MUST NEVER:
It only reads files, runs read-only shell, and spawns **one trivial probe agent** (check #2). Print the exact command for the *user* to run — matches the propose-don't-mutate posture of `/memory`.
Follow these steps exactly, in order.
Run the block below verbatim. It performs the file/shell checks (#1, #3–#10) and prints a grouped report. It writes nothing.
# ---- scaffolding /doctor — read-only health check ----
BLOCKING=0; RECOMMENDED=0; OPTIONAL=0
pass() { printf ' [PASS] %s\n' "$1"; }
fail() { printf ' [FAIL] %s\n fix: %s\n' "$1" "$2"; }
# Locate the installed plugin root (same multi-base discovery as /init-scaffolding)
PLUGIN_ROOT=""
find_plugin_root() {
local base="$1"; [ -d "$base" ] || return
local latest
latest=$(find "$base" -name "CLAUDE.md" -path "*/scaffolding/*/CLAUDE.md" 2>/dev/null | sort -V | tail -1 | xargs dirname 2>/dev/null || true)
if [ -n "$latest" ] && [ -f "$latest/CLAUDE.md" ]; then echo "$latest"; return; fi
latest=$(find "$base" -name "CLAUDE.md" 2>/dev/null | sort -V | tail -1 | xargs dirname 2>/dev/null || true)
if [ -n "$latest" ] && [ -f "$latest/CLAUDE.md" ]; then echo "$latest"; return; fi
}
# Prefer the env var Claude Code injects when the plugin is loaded
if [ -n "${CLAUDE_PLUGIN_ROOT:-}" ] && [ -f "${CLAUDE_PLUGIN_ROOT}/CLAUDE.md" ]; then
PLUGIN_ROOT="${CLAUDE_PLUGIN_ROOT}"
fi
if [ -z "$PLUGIN_ROOT" ]; then
for base in \
"$HOME/.claude/plugins/cache/komluk-scaffolding" \
"$HOME/.claude/plugins/marketplaces/komluk-scaffolding" \
"${USERPROFILE:-}/.claude/plugins/cache/komluk-scaffolding" \
"${LOCALAPPDATA:-}/claude/plugins/cache/komluk-scaffolding"; do
[ -n "$base" ] || continue
found=$(find_plugin_root "$base")
if [ -n "$found" ]; then PLUGIN_ROOT="$found"; break; fi
done
fi
echo "=== BLOCKING (install will not work until these pass) ==="
# Check 1 — plugin installed / loaded
if [ -n "$PLUGIN_ROOT" ] && [ -f "$PLUGIN_ROOT/CLAUDE.md" ]; then
if [ -n "${CLAUDE_PLUGIN_ROOT:-}" ]; then
pass "Plugin installed & loaded (CLAUDE_PLUGIN_ROOT set; root: $PLUGIN_ROOT)"
else
pass "Plugin installed (cache root: $PLUGIN_ROOT)"
echo " note: CLAUDE_PLUGIN_ROOT not set in this shell — fine for /doctor, but if hooks misbehave, restart Claude Code."
fi
else
BLOCKING=$((BLOCKING+1))
fail "Plugin not installed / not found" "/plugin marketplace add komluk/scaffolding then /plugin install scaffolding@komluk-scaffolding"
fi
# Check 1b — agent files present (13) — needed for resolution
if [ -n "$PLUGIN_ROOT" ]; then
AGENT_COUNT=$(find "$PLUGIN_ROOT/agents" -maxdepth 1 -name '*.md' 2>/dev/null | wc -l | tr -d ' ')
if [ "$AGENT_COUNT" = "13" ]; then
pass "All 13 agent definitions present in plugin root"
else
BLOCKING=$((BLOCKING+1))
fail "Incomplete install — found ${AGENT_COUNT:-0}/13 agent files" "/plugin update scaffolding@komluk-scaffolding then /reload-plugins"
fi
fi
# Check 4 — plugin.json valid + hooks registered
if [ -n "$PLUGIN_ROOT" ]; then
PJ="$PLUGIN_ROOT/.claude-plugin/plugin.json"
[ -f "$PJ" ] || PJ="$PLUGIN_ROOT/plugin.json"
if [ -f "$PJ" ] && python3 -c "import json,sys; d=json.load(open(sys.argv[1])); assert d.get('hooks')" "$PJ" 2>/dev/null; then
pass "plugin.json valid and hooks registered"
else
BLOCKING=$((BLOCKING+1))
fail "plugin.json missing/invalid or no hooks registered" "/plugin update scaffolding@komluk-scaffolding then /reload-plugins"
fi
fi
echo ""
echo "=== RECOMMENDED (protocol / hooks / memory tiers) ==="
# Check 3a — settings.json present in plugin root
if [ -n "$PLUGIN_ROOT" ] && [ -f "$PLUGIN_ROOT/settings.json" ] \
&& python3 -c "import json,sys; json.load(open(sys.argv[1]))" "$PLUGIN_ROOT/settings.json" 2>/dev/null; then
pass "settings.json present and valid in plugin root"
else
RECOMMENDED=$((RECOMMENDED+1))
fail "settings.json missing or unparseable in plugin root" "/plugin update scaffolding@komluk-scaffolding (reinstall)"
fi
# Check 3b — hook .sh files present + executable (9 plugin-registered hooks; refresh-mcp-token.sh is opt-in)
if [ -n "$PLUGIN_ROOT" ] && [ -d "$PLUGIN_ROOT/hooks" ]; then
NONEXEC=$(find "$PLUGIN_ROOT/hooks" -maxdepth 1 -name '*.sh' ! -perm -u+x 2>/dev/null | wc -l | tr -d ' ')
SH_COUNT=$(find "$PLUGIN_ROOT/hooks" -maxdepth 1 -name '*.sh' 2>/dev/null | wc -l | tr -d ' ')
if [ "${NONEXEC:-0}" = "0" ] && [ "${SH_COUNT:-0}" -gt 0 ]; then
pass "All $SH_COUNT hook scripts present and executable"
else
RECOMMENDED=$((RECOMMENDED+1))
fail "$NONEXEC hook script(s) not executable — hooks will silently no-op" "chmod +x \"$PLUGIN_ROOT/hooks/\"*.sh (or reinstall the plugin)"
fi
else
RECOMMENDED=$((RECOMMENDED+1))
fail "hooks/ directory not found in plugin root" "/plugin update scaffolding@komluk-scaffolding (reinstall)"
fi
# Check 5 — in-repo CLAUDE.md (per-project routing)
if [ -f "./CLAUDE.md" ]; then
pass "In-repo CLAUDE.md present — routing protocol travels to this repo"
# Check 5b — routing section intact (HARD INVARIANT: neverSpec-driven multi-agent orchestration for Claude Code — pure markdown, zero backend, runs on the stock runtime. 13 agents, 36 skills, 19 commands, 15 hooks, per-phase model tiers, opt-in lifecycle hooks, optional cross-device semantic memory.
Repo: komluk/scaffolding
Analyze and optimize Claude Code's context configuration (analyze, optimize, or reset).
Scaffold a new scaffolding-compatible skill: an interactive flow that creates `skills/<name>/SKILL.md` from the canonical template, composes a `TRIGGER`/`SKIP`…
Initialize OpenSpec in a project directory with the scaffolding-workflow schema.
Scaffold opt-in path-scoped nested CLAUDE.md rule files into the project to lazy-load per-area conventions while keeping routing always-loaded.
Bootstrap a new project with the scaffolding CLAUDE.md, settings.json, and `.scaffolding/` directory structure.