Bootstrap Skill
Plugin root:
${CLAUDE_PLUGIN_ROOT}. Claude Code replaces this with the plugin's absolute path when it loads this file. Where it appears unreplaced — in a file this skill reads with the Read tool, or on Codex, Cursor or Pi — the plugin root is the directory that contains this skill'sskills/folder (two levels above the folder of this SKILL.md). Write that absolute path literally into every command that starts a plugin script: the Bash tool has no plugin variable, and shell variables do not survive between tool calls.
Invocation
The user invokes /bootstrap with arguments: $ARGUMENTS. Direct invocation runs with
INVOCATION_MODE = direct (see § Invocation Context) and is standalone: after bootstrap
completes, report the files created and the git commit hash, and do NOT automatically
continue into any other skill.
TL;DR — for first-time users: Run /bootstrap with no flags. The skill auto-detects the right tier (fast/standard/deep) from your repo, recommends one with a one-line reason, then walks a fixed questionnaire — tier/stack (1–2 prompts), owner persona (5), dispatcher autonomy (1); 7–9 prompts on a first-run full bootstrap. Bestätigen → fertig. Keine weiteren Schritte.
The flags below cover special cases (re-adopting an existing repo, upgrading a tier, syncing rules). If you don't recognize the case in the description, you don't need the flag.
Instruction file alias: Bootstrap creates and reads
CLAUDE.md(orAGENTS.mdon Codex CLI). The two are transparent aliases — pick one, never both. Resolution rule: seeskills/_shared/instruction-file-resolution.md.
Standard usage (no flags)
This is the path 95 % of users want.
| Invocation | Behavior |
|------------|----------|
| /bootstrap | Auto-detect tier (fast / standard / deep) from repo context. Present recommendation via AskUserQuestion with options to confirm or override. Tier/stack: 1–2 questions; first-run full bootstrap adds owner interview (5, owner-interview.mjs) + dispatcher-autonomy capture (1). Then scaffold files + commit. |
What the user sees:
Skill: "Repo leer. Empfehle 'standard' weil <reason>. Passt das?"
User: [Enter on "standard (Empfohlen)"]
Skill: <writes files, commits, prints summary>
Flag reference (special cases)
Only use a flag if you have one of the situations described. Parsed flags decide the mode
dispatch in § Invocation Context — --fast / --standard / --deep skip the tier
confirmation question, while --retroactive, --refresh-lock, --sync-rules and
--ecosystem-health are standalone short-circuit flows that run to completion in this
skill without dispatching to a tier template.
| Flag | When to use it |
|------|----------------|
| --upgrade <tier> | You bootstrapped fast earlier and now need standard or deep. Idempotent — writes only the delta. Refuses downgrade. Valid: fast → standard, fast → deep, standard → deep. |
| --retroactive | The repo already has CLAUDE.md (or AGENTS.md on Codex CLI) + ## Session Config but no bootstrap.lock (manually bootstrapped before the gate existed). Writes the lock based on file inventory; makes no scaffolding changes. Commit: chore: bootstrap lock (retroactive). |
| --refresh-lock | Your bootstrap.lock already has valid version/tier fields but the freshness probe flags it as stale or plugin-version-drifted — --retroactive is a no-op here. Acknowledges the current plugin version and resets the freshness clock (refreshed-at + refreshed-plugin-version) without touching the lock's original bootstrap provenance. Also appends missing runtime and hook-log .gitignore lines. No scaffolding, no auto-commit. |
| --sync-rules | Pull canonical rules from the plugin's rules/ library into .claude/rules/. Preserves local rules (files without the plugin source header). Standalone — does not touch bootstrap.lock. |
| --ecosystem-health | Run the ecosystem-health wizard: detects CI provider + package manager, prompts for health endpoints, pipelines, and critical issue labels. Writes the config block + .orchestrator/policy/ecosystem.json. No scaffolding, no auto-commit. |
| --fast / --standard / --deep | Skip the tier confirmation question (e.g., for scripted runs). Equivalent to running /bootstrap and selecting that option. |
| --no-interview | Non-interactive run (scripted or headless). No AskUserQuestion and no numbered-list question anywhere — tier, archetype, vault, owner interview, dispatcher autonomy. This row is the contract; the phase sites below only point here. Defaults: tier = RECOMMENDED_TIER (a tier flag wins); archetype: public path → detected or node-minimal, private path → detected or abort with a one-line error (private-contract.md § Select) — never the public default on the private path; vault registration skipped; dispatcher autonomy = off without asking; owner.yaml not written. Never end a turn on a question: if a required value cannot be defaulted, abort with a one-line error. |
All flag-driven flows are idempotent — running twice with no upstream change is a no-op.
Overview
This skill runs when the Bootstrap Gate is closed (missing CLAUDE.md, Session Config, or .orchestrator/bootstrap.lock) or when the user invokes /bootstrap directly. It scaffolds the minimum structure required by all session-orchestrator skills, commits it, and writes the lock file that opens the gate for all future invocations.
Anti-bureaucracy contract: On a first-time full bootstrap (no tier flags, no --no-interview), expect 7–9 AskUserQuestion prompts in three fixed blocks — not an open-ended wizard. (1) Tier/stack (Phase 2): one tier-confirmation question, plus an optional second archetype question when PATH_TYPE = public and archetype confidence is low (Standard/Deep only). (2) Owner persona (Phase 3.5): five questions from scripts/lib/owner-interview.mjs (first-run only). (3) Dispatcher autonomy (Phase 3.5.1): one question from scripts/lib/config/dispatcher-autonomy-capture.mjs. Flagged flows (--upgrade, --retroactive, --sync-rules, --ecosystem-health) and --no-interview skip some or all of these blocks. In a headless run (codex exec, claude -p) a question is a failed bootstrap, not a pause: measured 2026-11-02 under codex exec, 2 of 4 --fast --no-interview runs stopped on the tier question and wrote no bootstrap.lock.
Invocation Context
Before starting, determine how this skill was invoked:
- Transitive (gate-closed): Invoked from another skill's Phase 0. The user's original intent (their first prompt) is available in context. After bootstrap completes, execution must return to the original skill's Phase 1.
- Direct (
/bootstrap): User invoked manually. Parse$ARGUMENTSfor flags:--fast,--standard,--deep,--no-interview,--upgrade <tier>,--retroactive. See § Invocation above for flag semantics.
Store INVOCATION_MODE = transitive | direct.
Mode dispatch (direct invocation only):
- If
--upgrade <tier>is present in$ARGUMENTS: jump to Upgrade Flow section. Do not proceed to Phase 1. - If
--retroactiveis present in$ARGUMENTS: jump to Retroactive Flow section. Do not proceed to Phase 1. - If
--refresh-lockis present in$ARGUMENTS: jump to Refresh-Lock Flow section. Do not proceed to Phase 1. - If
--sync-rulesis present in$ARGUMENTS: jump to Sync-Rules Flow section. Do not proceed to Phase 1. - If
--ecosystem-healthis present in$ARGUMENTS: jump to Ecosystem-Health Flow section. Do not proceed to Phase 1. - Otherwise: continue to Phase 1 below.
Phase 0.5: Determine Private vs. Public Path
Before dispatching to any tier template, read skills/bootstrap/public-fallback.md and execute Step 1 (PATH_TYPE detection). Store the result as PATH_TYPE = private | public. This detection is silent — no user interaction.
private: the existing host-local config resolution found a baseline directory and its reduced contract validated. Useprivate-contract.mdfor selection, templates, commands, CI and rules.public: the resolved baseline is absent, empty, or points to a missing directory. Use plugin-bundled templates.- Existing but invalid configured baseline: abort before dispatch; report the reader's sanitized error reason; for
producer-missingalso surface themessageand the migrate-or-unconfigure choice (seepublic-fallback.md§ Step 1).
Pass PATH_TYPE into Phase 1 and all subsequent phases. All tier templates (fast-template.md, standard-template.md, deep-template.md) must consult public-fallback.md for CLAUDE.md generation and archetype file sourcing when PATH_TYPE = public.
Phase 1: Detect Tier + Archetype
Read skills/bootstrap/intensity-heuristic.md and execute the tier + archetype recommendation algorithm.
Inputs to the heuristic:
- User's first prompt — the message that triggered this skill (most important signal)
- Repo name —
basename $(git rev-parse --show-toplevel)(secondary signal) - Existing files —
ls -laof repo root (presence ofpackage.json,pyproject.toml, etc. shifts archetype) - $ARGUMENTS flags — if
--fast,--standard, or--deepis present, skip heuristic and use the specified tier directly
Measure first. Run node "${CLAUDE_PLUGIN_ROOT}/scripts/setup-precheck.mjs" --repo-root "$PWD" --json (read-only, one JSON line: items[] with key, status, value, reason). Use its vcs and packageManager items as the input for the heuristic instead of guessing from ls -la. Show the user one line per item before the tier question; a skipped item (for example test, typecheck, lint) reads "no check, reason: <reason>". Never write that text into a *-command key: the gate would run it as a shell command. Ceiling (#2230 cut 1): an absent or none command still falls back to the npm default in scripts/run-quality-gate.mjs extractCommand; revisit with the Stufe-0 cut that gives the gate a real "no check" value. If the command fails because the plugin path did not resolve (Codex CLI and Cursor do not substitute ${CLAUDE_PLUGIN_ROOT}, #2258), say "no measurement, plugin path unresolved" and continue with the inputs above.
Output from Phase 1:
RECOMMENDED_TIER=fast|standard|deepRECOMMENDED_ARCHETYPE= validated private contract ID, public ID, ornullHEURISTIC_REASON= one-sentence explanation of why this tier was chosen (shown to user)PATH_TYPE=private(plan-baseline-path configured and path exists) |public(no baseline)
Detecting PATH_TYPE: Already determined in Phase 0.5 — use the stored PATH_TYPE value. Do not re-run detection.
Fast tier: RECOMMENDED_ARCHETYPE is always null. No stack selection needed.
Phase 2: Present Tier Confirmation (One Question)
Present exactly one AskUserQuestion unless:
$ARGUMENTSincludes--fast,--standard, or--deep(tier pre-selected, skip question)$ARGUMENTSincludes--no-interview→CONFIRMED_TIER = RECOMMENDED_TIER, a tier flag wins (contract: SKILL.md § Invocation flag table)--retroactiveflag (no scaffolding at all, skip to Phase 4)
Language (#1562). The question texts in this skill are written in German. Render every question, option description and report line in the operator's language: owner.language from ~/.config/session-orchestrator/owner.yaml when that file exists (de or en), otherwise the language the operator writes in this session. Tier labels (fast, standard, deep) and archetype ids stay verbatim, because they are values; (Empfohlen) and Abbrechen follow the language ((Recommended), Cancel).
AskUserQuestion({
questions: [{
question: "Leeres Repo erkannt. Basierend auf '<HEURISTIC_REASON>' empfehle ich **<RECOMMENDED_TIER>**. Passt das?",
header: "Bootstrap",
options: [
{ label: "fast", description: "Nur CLAUDE.md + .gitignore + README. Für Demos, Spikes, Playgrounds." },
{ label: "standard", description: "Fast + package.json/Manifest + TypeScript + Linting + Tests. Für MVPs und echte Produkte." },
{ label: "deep", description: "Standard + CI + CODEOWNERS + CHANGELOG. Für Production, Team, Langlebige Repos." },
{ label: "Abbrechen", description: "Bootstrap abbrechen. Das ursprüngliche Kommando wird ebenfalls abgebrochen." }
],
multiSelect: false
}]
})
Before rendering: append (Empfohlen) to whichever of the three tier labels equals <RECOMMENDED_TIER>, and move that option to position 1. The recommended tier is one of the three — listing it a fourth time as its own option made five options, one more than AskUserQuestion accepts, and repeated the same choice twice.
If user selects "Abbrechen": stop. Report "Bootstrap abgebrochen. Kein Kommando wird ausgeführt." Do not continue.
Store confirmed tier as CONFIRMED_TIER.
Optional Second Question (Public Path + Standard/Deep + Ambiguous Archetype Only)
If ALL of the following are true:
PATH_TYPE = publicCONFIRMED_TIERisstandardordeepintensity-heuristic.mdreturnedARCHETYPE_CONFIDENCE = low(truly ambiguous)--no-interviewwas NOT passed — under--no-interviewon this public path:RECOMMENDED_ARCHETYPEwhen detected, elsenode-minimal(contract: SKILL.md § Invocation flag table)
Then ask one more question — and only then:
AskUserQuestion({
questions: [{
question: "Welchen Tech-Stack soll ich für das Grundgerüst verwenden?",
header: "Archetype",
options: [
{ label: "node-minimal", description: "package.json + TypeScript + Vitest. Für CLIs, Tools, Libraries." },
{ label: "nextjs-minimal", description: "Next.js bare setup. Für Web Apps, SaaS, Fullstack." },
{ label: "static-html", description: "HTML/CSS/JS, kein Build-Step. Für Animationen, Landingpages, Visualisierungen." },
{ label: "python-uv", description: "pyproject.toml + uv + pytest. Für Python Scripts, APIs, ML." }
],
multiSelect: false
}]
})
Store as CONFIRMED_ARCHETYPE.
For PATH_TYPE = private and Standard/Deep, execute private-contract.md's
Select section now. Reuse a valid detected or explicit ID; when evidence is
insufficient, select from the returned catalog before scaffolding. Tier flags
skip tier confirmation, not required private archetype selection. Under
--no-interview: insufficient evidence aborts with a one-line error (contract:
SKILL.md § Invocation flag table). Never pass a null private ID into the public
default. On upgrades, validate the lock's ID
against the currently configured contract before generating any files.
The tier/stack block contributes 1–2 questions; a first-run full bootstrap adds 6 more from the owner interview (Phase 3.5, five questions) and dispatcher-autonomy capture (Phase 3.5.1, one question) — 7–9 total (0 under --no-interview).
Upgrade Flow (`--upgrade <tier>`)
Entered when $ARGUMENTS contains --upgrade <tier>. No scaffolding questions are asked.
Steps:
- Read existing lock. Read
.orchestrator/bootstrap.lock. If missing, abort with:Error: No bootstrap.lock found. Run /bootstrap first to bootstrap this repo.
- Parse current and target tier.
CURRENT_TIER= value oftier:field in the lock file.TARGET_TIER= the<tier>argument supplied after--upgrade.- Valid values for both:
fast|standard|deep.
- Refuse downgrade. Tier order:
fast < standard < deep. IfTARGET_TIERranks lower than or equal toCURRENT_TIER, abort with:
Error: Cannot downgrade from <CURRENT_TIER> to <TARGET_TIER>. Upgrade path is one-directional (fast → standard → deep).
Exit non-zero.
- Resolve source and compute delta. Run Phase 0.5's read-only source
detection before dispatching any template. For a private contract, validate
the lock's archetype with --archetype; if the Fast lock has no archetype,
select from the returned catalog using private-contract.md. Use its staged,
additive scaffold and CI expectations; do not apply the public file matrix.
For the public path, determine which files the target tier adds:
fast → standard: all Standard-tier files (package.json/pyproject.toml,tsconfig.json,eslint.config.mjs,.prettierrc,.editorconfig,tests/,src/)standard → deep: all Deep-tier files (CI pipeline,CODEOWNERS,CHANGELOG.md, issue templates, MR/PR template, branch protection)fast → deep: union of both deltas (apply Standard first, then Deep)
- Check idempotency. For each file in the delta, skip if it already exists on disk. Only write files that are absent. This makes the operation safe to run twice.
- Apply delta files. Execute only the relevant template steps for the missing files. Read the appropriate template (
standard-template.mdand/ordeep-template.md) and execute ONLY the steps that produce the delta files. Do NOT re-run already-completed steps.
6a. Ignore runtime artifacts and hook logs (#1489 Pkt 17, #1495, #2246). Execute the bash block in