Agent skill
bootstrap
Scaffolds the minimum repository structure required by session-orchestrator. Invoked automatically by the Bootstrap Gate when CLAUDE.md, Session Config, or bootstrap.lock is missing. Also available as /bootstrap for manual invocation. Three intensity tiers: fast (demos/spikes), standard (MVPs), deep (production/team).
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/bootstrap-kanevry-session-orchestrator
SKILL.md
Bootstrap Skill
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: At most ONE AskUserQuestion call in the normal case (tier confirmation). A second question is only asked when the archetype is truly ambiguous on the Public Path for Standard/Deep tiers. No wizard, no multi-step flow.
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,--upgrade <tier>,--retroactive. Seecommands/bootstrap.mdfor 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. - 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:plan-baseline-pathis present in Session Config AND the path exists on disk. Baseline templates will be used for CLAUDE.md generation and archetype file sourcing.public:plan-baseline-pathis absent, empty, or points to a non-existent path. Plugin-bundled templates fromtemplates/will be used.
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
Output from Phase 1:
RECOMMENDED_TIER=fast|standard|deepRECOMMENDED_ARCHETYPE=static-html|node-minimal|nextjs-minimal|python-uv|nullHEURISTIC_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)--retroactiveflag (no scaffolding at all, skip to Phase 4)
AskUserQuestion({
questions: [{
question: "Leeres Repo erkannt. Basierend auf '<HEURISTIC_REASON>' empfehle ich **<RECOMMENDED_TIER>**. Passt das?",
header: "Bootstrap",
options: [
{ label: "<RECOMMENDED_TIER> (Empfohlen)", description: "<one-line description of what this tier scaffolds>" },
{ 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
}]
})
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)
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. Maximum interactions in bootstrap flow: 2 questions total.
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. -
Compute delta. Determine which files the target tier adds over the current tier:
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. -
Update bootstrap.lock atomically. Overwrite
.orchestrator/bootstrap.lockwithtier: <TARGET_TIER>. Preservearchetype,timestamp(update to now), andsourcefrom the existing lock. -
Commit. Stage only the delta files that were just written and commit:
bash# DELTA_FILES must be populated with the explicit list of files written in step 6 for _f in "${DELTA_FILES[@]}"; do [[ -e "$_f" ]] && git add -- "$_f" done git commit -m "chore: bootstrap upgrade to <TARGET_TIER>" -
Report. Print a one-line summary:
Bootstrap upgraded from <CURRENT_TIER> to <TARGET_TIER>. <N> files added.
Retroactive Flow (--retroactive)
Entered when $ARGUMENTS contains --retroactive. No scaffolding changes are made — only the lock file is written.
Purpose: Adopt an existing repo that already has CLAUDE.md + ## Session Config but was bootstrapped manually (no bootstrap.lock). Writes the lock so the gate passes on all future invocations.
Steps:
-
Verify preconditions. Confirm
CLAUDE.md(orAGENTS.md) exists and contains## Session Config. If not, abort:Error: CLAUDE.md with Session Config required for retroactive bootstrap. -
Check lock not already present. If
.orchestrator/bootstrap.lockalready exists and has validversion+tierfields, report:bootstrap.lock already present (tier: <tier>). Nothing to do.and exit 0 (idempotent). -
Infer tier from file inventory. Examine the repo root:
Condition (evaluated in order) Inferred Tier CI file present ( .gitlab-ci.ymlOR.github/workflows/) ANDCHANGELOG.mdpresentdeepPackage manifest present ( package.jsonORpyproject.toml)standardNeither of the above fastStore as
INFERRED_TIER. -
Infer archetype. Best-effort detection from existing files:
pyproject.tomlpresent →python-uvpackage.jsonwithnextin dependencies →nextjs-minimalpackage.jsonwithoutnext→node-minimal- No manifest →
null
Store as
INFERRED_ARCHETYPE. -
Write bootstrap.lock. Create
.orchestrator/if needed, then write:yaml# .orchestrator/bootstrap.lock version: 1 tier: <INFERRED_TIER> archetype: <INFERRED_ARCHETYPE or null> timestamp: <current ISO 8601 UTC> source: retroactive -
Commit. Stage lock file only and commit:
bashmkdir -p .orchestrator git add .orchestrator/bootstrap.lock git commit -m "chore: bootstrap lock (retroactive)" -
Report. Print:
Retroactive bootstrap complete. Lock written (tier: <INFERRED_TIER>, source: retroactive). No files were changed.
Phase 3: Dispatch to Template
Based on CONFIRMED_TIER, read and execute the corresponding template file:
| Tier | Template File |
|---|---|
fast |
skills/bootstrap/fast-template.md |
standard |
skills/bootstrap/standard-template.md |
deep |
skills/bootstrap/deep-template.md |
Pass the following context into the template execution:
CONFIRMED_TIERCONFIRMED_ARCHETYPEPATH_TYPEREPO_ROOT=$(git rev-parse --show-toplevel)REPO_NAME=$(basename "$REPO_ROOT")PLATFORM= detected platform fromskills/_shared/platform-tools.md
Follow the template's instructions precisely. The template is responsible for creating all files and the initial git commit.
Platform note for CLAUDE.md generation:
When PATH_TYPE = public, read skills/bootstrap/public-fallback.md for the full platform-specific CLAUDE.md generation logic (claude init path for Claude Code; _minimal template synthesis for Codex/Cursor). When PATH_TYPE = private, use the baseline scripts at $BASELINE_PATH.
Phase 3.5: (Optional) Rules-Fetch Bridge
Closes session-orchestrator issue #110.
After the tier template completes scaffolding (Phase 3), the Standard and Deep templates run an optional rules-fetch step that pulls canonical .claude/rules/*.md (and optionally .claude/agents/*.md) directly from the baseline GitLab project. The step is opt-in and only fires when:
baseline-refis present in Session ConfigGITLAB_TOKENenv var is setscripts/lib/fetch-baseline.shis present in the plugin
When triggered, the step:
- Sources
scripts/lib/fetch-baseline.sh(definesfetch_baseline_file,fetch_baseline_files_batch,write_baseline_fetch_lock) - Fetches each rule listed in a default manifest from the configured
baseline-project-id(default52) at the configuredbaseline-ref - Writes
.claude/.baseline-fetch.lockrecording what was fetched - Populates
.claude/.baseline-cache/for offline fallback on subsequent invocations
When the fetch fails (network error, auth, missing file), bootstrap does not abort. Rules will arrive in the repo via Clank's weekly baseline sync MRs (the legacy path). A warning is printed.
Why opt-in: Repos without baseline-ref continue to receive rules via the existing Clank sync flow. The fetch bridge is a faster on-demand alternative for newly-bootstrapped repos that want current rules immediately.
Local edits: Re-running bootstrap with baseline-ref set will overwrite .claude/rules/*.md (rules are canonical). Repo-specific extensions belong in .claude/rules/local/*.md (not fetched, not overwritten).
See standard-template.md (Step S99) and deep-template.md (Step D99) for the implementation, and docs/session-config-reference.md for the baseline-ref and baseline-project-id field definitions.
.claude/.baseline-fetch.lock Schema
The lock file is committed to git and records what was fetched.
# .claude/.baseline-fetch.lock
version: 1
project_id: 52
baseline_ref: main
fetched_at: 2026-04-17T13:42:00Z # ISO 8601 UTC
files:
- .claude/rules/development.md
- .claude/rules/security.md
- .claude/rules/...
| Field | Description |
|---|---|
version |
Lock file schema version. Currently 1. |
project_id |
GitLab project ID the files were fetched from. |
baseline_ref |
The git ref (branch/tag/SHA) at fetch time. |
fetched_at |
ISO 8601 UTC timestamp. |
files |
List of fetched file paths (relative to repo root). |
Phase 4: Write bootstrap.lock
After all template files are written and committed, write .orchestrator/bootstrap.lock (and, if the rules-fetch bridge ran, also .claude/.baseline-fetch.lock — see Phase 3.5):
# .orchestrator/bootstrap.lock
version: 1
tier: <CONFIRMED_TIER>
archetype: <CONFIRMED_ARCHETYPE or null>
timestamp: <current ISO 8601 UTC timestamp>
source: <projects-baseline | plugin-template | claude-init>
Determine source:
projects-baselineifPATH_TYPE = privateand baseline scripts were usedclaude-initifclaude initwas used successfully on Claude Codeplugin-templateotherwise
The template's initial git commit includes bootstrap.lock. If the template already wrote the lock file (as fast-template.md does), skip this step — the lock is already committed.
Phase 5: Resume
Report bootstrap completion with a one-line summary:
Bootstrap complete (tier: <tier>, archetype: <archetype or "none">). Resuming <original command>…
If invoked transitively: return control to the originating skill. The original skill resumes from its Phase 1.
If invoked directly via /bootstrap: report the created files list and stop.
Critical Rules
- NEVER create application code during bootstrap — only structural files (CLAUDE.md, .gitignore, README.md, manifests, CI). The feature that follows brings its own implementation.
- NEVER skip the lock file write —
.orchestrator/bootstrap.lockis the gate's mechanical truth. Bootstrap without a lock file is incomplete. - NEVER ask more than 2 questions — even if the user's intent is unclear, make a best-effort recommendation and let the user correct via
/bootstrap --upgradelater. - ALWAYS commit — bootstrap ends with a git commit. The lock file is part of that commit.
- ALWAYS check for retroactive flag — if
--retroactiveis in$ARGUMENTS, skip all scaffolding and jump directly to writingbootstrap.lock(tier inferred from existing file inventory, fallback:fast). - NEVER abort bootstrap on rules-fetch failure — rules-fetch is opt-in and best-effort. The legacy Clank sync path is the safety net.
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?