/skdd:setup — Install SkDD into the current project
You are installing SkDD (Skill Driven Development) assets into the project in
the current working directory. Follow the steps in order. Use your normal
Read/Write/Edit/Glob tools; there are no scripts to run except copying the hook
payload.
Plugin file references below use ${CLAUDE_PLUGIN_ROOT} — resolve it to the
skdd plugin's installation directory.
Step 1 — Preflight
- Confirm the current working directory is the intended project root (a
.git
directory is the usual signal). If there is no .git, ask the user to
confirm the target directory before continuing.
- If
AGENTS.md exists and contains the line <!-- skdd:begin -->: SkDD is
already set up. Read the <!-- skdd:config ... --> line, report the
installed version, tell the user to run /skdd:update instead, and STOP.
Do not write anything.
Step 2 — Gather parameters
Ask the user (one question round):
Skill prefix for project-specific skills. Default: pj-. Must match
^[a-z][a-z0-9]*-$ (lowercase alphanumeric, trailing hyphen; e.g. pj-,
mss-). Re-ask on mismatch.
Install the Stop hook? (recommended: yes). Explain: at every response
completion, the hook reminds the agent to run the SkDD harvest evaluation.
Dependency: bash on PATH in the hook environment (Git Bash on Windows).
Harvest threshold. Default: medium. One of low / medium / high /
max. Re-ask on any other value. Present it as one dial that controls how
selective harvesting is — offer these one-liners:
low — harvest eagerly; for a new or under-documented project
medium — the balanced default (propose at 3 of the 5 criteria)
high — keep the skill set small and sharp; prefers updating an existing
skill over adding one
max — only knowledge that changes how future work is judged
Step 3 — Read the plugin version and derive the threshold values
Read ${CLAUDE_PLUGIN_ROOT}/.claude-plugin/plugin.json and take its version
value as SKDD_VERSION for the placeholder substitution below.
Read the ## Harvest Threshold section of
${CLAUDE_PLUGIN_ROOT}/templates/skdd-harvest/SKILL.md. That section is the
single source of truth for the level → values mapping; do not derive the
numbers from memory. From the block matching the level chosen in Step 2, take:
SKDD_SCORE_MIN — the proposal bar as a bare integer (e.g. 4)
SKDD_PROTO_BAND — the Proto-Skill band exactly as written, ASCII hyphen
included (e.g. 2-3, or 1 for a single-value band)
SKDD_PROMOTE_SESSIONS — the promotion session count as a bare integer
Step 4 — Deploy the engine skill
Copy from ${CLAUDE_PLUGIN_ROOT}/templates/skdd-harvest/ into the project at
.claude/skills/skdd-harvest/ (create directories as needed):
| Source |
Target |
Substitution |
SKILL.md |
.claude/skills/skdd-harvest/SKILL.md |
yes |
references/harvest-protocol.md |
.claude/skills/skdd-harvest/references/harvest-protocol.md |
no (verbatim) |
references/adr-entry-schema.md |
.claude/skills/skdd-harvest/references/adr-entry-schema.md |
no (verbatim) |
.gitignore |
.claude/skills/skdd-harvest/.gitignore |
no (verbatim) |
Substitution = replace EVERY occurrence of these tokens while copying:
{{SKDD_PREFIX}} → the prefix from Step 2
{{SKDD_HOOKS}} → true or false per Step 2
{{SKDD_THRESHOLD}} → the level from Step 2
{{SKDD_SCORE_MIN}}, {{SKDD_PROTO_BAND}}, {{SKDD_PROMOTE_SESSIONS}} → the
values derived in Step 3
Note: the ## Harvest Threshold section describes all four levels and is copied
as-is. Only the "Active level" line carries a token — do not delete the other
levels' blocks, and do not rewrite their numbers.
Verification (mandatory): after writing, grep the written files for
{{SKDD_. Any hit is an error — fix before continuing.
Step 5 — Backlog seed
If .claude/skills/skdd-harvest/backlog.md does NOT exist, copy
${CLAUDE_PLUGIN_ROOT}/templates/backlog.md there (verbatim).
If it exists, DO NOT touch it — it is per-developer state.
Step 6 — Stop hook (only if opted in at Step 2)
- Copy
${CLAUDE_PLUGIN_ROOT}/templates/skdd-stop.sh to
.claude/hooks/skdd-stop.sh (create the directory). This file is
substituted — apply the same token replacement as Step 4, and include it in
the mandatory {{SKDD_ grep verification. The reminder text it prints must
state this project's actual bars, otherwise the highest-frequency trigger in
the system would contradict the configured threshold.
- Merge into
.claude/settings.json:
If the file does not exist, create it with exactly:
{
"hooks": {
"Stop": [
{
"hooks": [
{
"type": "command",
"command": "bash $CLAUDE_PROJECT_DIR/.claude/hooks/skdd-stop.sh",
"timeout": 5
}
]
}
]
}
}
If the file exists, Read and parse it. If it fails to parse as JSON,
STOP and report — never overwrite a file you could not parse.
Otherwise: ensure hooks.Stop exists as an array; scan every existing
Stop entry's command strings for the substring skdd-stop.sh — if found,
skip (already installed); if not found, APPEND the matcher-group object
shown above to the Stop array. Never remove, reorder, or modify existing
entries or any other settings keys. Write back with 2-space indentation.
Step 7 — AGENTS.md managed section
- Render
${CLAUDE_PLUGIN_ROOT}/templates/agents-section.md with the same
substitutions as Step 4.
- If
AGENTS.md does not exist: create it containing exactly the rendered block.
- If it exists: append the rendered block at the end of the file, separated by
one blank line. Never modify existing content.
Step 8 — CLAUDE.md import
Claude Code does not natively read AGENTS.md; the official workaround is a
CLAUDE.md that imports it.
- If
CLAUDE.md does not exist: create it containing the single line @AGENTS.md.
- If it exists: check for a line that, trimmed, equals
@AGENTS.md or
@./AGENTS.md. If none, append @AGENTS.md on its own line at the end.
Step 9 — Report
Tell the user:
- Every file created or modified (full list)
backlog.md is intentionally gitignored (per-developer state); everything
else under .claude/ plus AGENTS.md/CLAUDE.md should be committed
- If the hook was installed: it takes effect after the session restarts
(hooks are snapshotted at startup); it can be reviewed with
/hooks
- The chosen harvest threshold, and that
/skdd:config changes it later
- Suggest trying a first harvest at the end of the next substantial task
Recovery notes
- The
<!-- skdd:begin --> marker is the source of truth for "already set up".
If the marker is absent but .claude/skills/skdd-harvest/ exists (a partial
or broken install), proceed as a normal setup — Step 5's existence check
protects the backlog, and everything else is safely re-copied.
1---2name: setup3description: Install SkDD into the current project. Deploys the skdd-harvest engine skill, backlog seed, optional Stop hook, the managed AGENTS.md section, and the CLAUDE.md import. Explicit invocation only (/skdd:setup).4---56# /skdd:setup — Install SkDD into the current project78You are installing SkDD (Skill Driven Development) assets into the project in9the current working directory. Follow the steps in order. Use your normal10Read/Write/Edit/Glob tools; there are no scripts to run except copying the hook11payload.1213Plugin file references below use `${CLAUDE_PLUGIN_ROOT}` — resolve it to the14skdd plugin's installation directory.1516## Step 1 — Preflight17181. Confirm the current working directory is the intended project root (a `.git`19 directory is the usual signal). If there is no `.git`, ask the user to20 confirm the target directory before continuing.212. If `AGENTS.md` exists and contains the line `<!-- skdd:begin -->`: SkDD is22 already set up. Read the `<!-- skdd:config ... -->` line, report the23 installed version, tell the user to run `/skdd:update` instead, and STOP.24 Do not write anything.2526## Step 2 — Gather parameters2728Ask the user (one question round):29301. **Skill prefix** for project-specific skills. Default: `pj-`. Must match31 `^[a-z][a-z0-9]*-$` (lowercase alphanumeric, trailing hyphen; e.g. `pj-`,32 `mss-`). Re-ask on mismatch.332. **Install the Stop hook?** (recommended: yes). Explain: at every response34 completion, the hook reminds the agent to run the SkDD harvest evaluation.35 Dependency: `bash` on PATH in the hook environment (Git Bash on Windows).363. **Harvest threshold.** Default: `medium`. One of `low` / `medium` / `high` /37 `max`. Re-ask on any other value. Present it as one dial that controls how38 selective harvesting is — offer these one-liners:3940 - `low` — harvest eagerly; for a new or under-documented project41 - `medium` — the balanced default (propose at 3 of the 5 criteria)42 - `high` — keep the skill set small and sharp; prefers updating an existing43 skill over adding one44 - `max` — only knowledge that changes how future work is judged4546## Step 3 — Read the plugin version and derive the threshold values47481. Read `${CLAUDE_PLUGIN_ROOT}/.claude-plugin/plugin.json` and take its `version`49 value as `SKDD_VERSION` for the placeholder substitution below.502. Read the `## Harvest Threshold` section of51 `${CLAUDE_PLUGIN_ROOT}/templates/skdd-harvest/SKILL.md`. That section is the52 single source of truth for the level → values mapping; do not derive the53 numbers from memory. From the block matching the level chosen in Step 2, take:5455 - `SKDD_SCORE_MIN` — the proposal bar as a bare integer (e.g. `4`)56 - `SKDD_PROTO_BAND` — the Proto-Skill band exactly as written, ASCII hyphen57 included (e.g. `2-3`, or `1` for a single-value band)58 - `SKDD_PROMOTE_SESSIONS` — the promotion session count as a bare integer5960## Step 4 — Deploy the engine skill6162Copy from `${CLAUDE_PLUGIN_ROOT}/templates/skdd-harvest/` into the project at63`.claude/skills/skdd-harvest/` (create directories as needed):6465| Source | Target | Substitution |66|---|---|---|67| `SKILL.md` | `.claude/skills/skdd-harvest/SKILL.md` | yes |68| `references/harvest-protocol.md` | `.claude/skills/skdd-harvest/references/harvest-protocol.md` | no (verbatim) |69| `references/adr-entry-schema.md` | `.claude/skills/skdd-harvest/references/adr-entry-schema.md` | no (verbatim) |70| `.gitignore` | `.claude/skills/skdd-harvest/.gitignore` | no (verbatim) |7172Substitution = replace EVERY occurrence of these tokens while copying:7374- `{{SKDD_PREFIX}}` → the prefix from Step 275- `{{SKDD_HOOKS}}` → `true` or `false` per Step 276- `{{SKDD_THRESHOLD}}` → the level from Step 277- `{{SKDD_SCORE_MIN}}`, `{{SKDD_PROTO_BAND}}`, `{{SKDD_PROMOTE_SESSIONS}}` → the78 values derived in Step 37980Note: the `## Harvest Threshold` section describes all four levels and is copied81as-is. Only the "Active level" line carries a token — do not delete the other82levels' blocks, and do not rewrite their numbers.8384**Verification (mandatory):** after writing, grep the written files for85`{{SKDD_`. Any hit is an error — fix before continuing.8687## Step 5 — Backlog seed8889If `.claude/skills/skdd-harvest/backlog.md` does NOT exist, copy90`${CLAUDE_PLUGIN_ROOT}/templates/backlog.md` there (verbatim).91If it exists, DO NOT touch it — it is per-developer state.9293## Step 6 — Stop hook (only if opted in at Step 2)94951. Copy `${CLAUDE_PLUGIN_ROOT}/templates/skdd-stop.sh` to96 `.claude/hooks/skdd-stop.sh` (create the directory). This file **is97 substituted** — apply the same token replacement as Step 4, and include it in98 the mandatory `{{SKDD_` grep verification. The reminder text it prints must99 state this project's actual bars, otherwise the highest-frequency trigger in100 the system would contradict the configured threshold.1012. Merge into `.claude/settings.json`:102 - If the file does not exist, create it with exactly:103104 ```json105 {106 "hooks": {107 "Stop": [108 {109 "hooks": [110 {111 "type": "command",112 "command": "bash $CLAUDE_PROJECT_DIR/.claude/hooks/skdd-stop.sh",113 "timeout": 5114 }115 ]116 }117 ]118 }119 }120 ```121122 - If the file exists, Read and parse it. **If it fails to parse as JSON,123 STOP and report — never overwrite a file you could not parse.**124 Otherwise: ensure `hooks.Stop` exists as an array; scan every existing125 Stop entry's command strings for the substring `skdd-stop.sh` — if found,126 skip (already installed); if not found, APPEND the matcher-group object127 shown above to the `Stop` array. Never remove, reorder, or modify existing128 entries or any other settings keys. Write back with 2-space indentation.129130## Step 7 — AGENTS.md managed section1311321. Render `${CLAUDE_PLUGIN_ROOT}/templates/agents-section.md` with the same133 substitutions as Step 4.1342. If `AGENTS.md` does not exist: create it containing exactly the rendered block.1353. If it exists: append the rendered block at the end of the file, separated by136 one blank line. Never modify existing content.137138## Step 8 — CLAUDE.md import139140Claude Code does not natively read AGENTS.md; the official workaround is a141CLAUDE.md that imports it.142143- If `CLAUDE.md` does not exist: create it containing the single line `@AGENTS.md`.144- If it exists: check for a line that, trimmed, equals `@AGENTS.md` or145 `@./AGENTS.md`. If none, append `@AGENTS.md` on its own line at the end.146147## Step 9 — Report148149Tell the user:150151- Every file created or modified (full list)152- `backlog.md` is intentionally gitignored (per-developer state); everything153 else under `.claude/` plus `AGENTS.md`/`CLAUDE.md` should be committed154- If the hook was installed: it takes effect after the session restarts155 (hooks are snapshotted at startup); it can be reviewed with `/hooks`156- The chosen harvest threshold, and that `/skdd:config` changes it later157- Suggest trying a first harvest at the end of the next substantial task158159## Recovery notes160161- The `<!-- skdd:begin -->` marker is the source of truth for "already set up".162 If the marker is absent but `.claude/skills/skdd-harvest/` exists (a partial163 or broken install), proceed as a normal setup — Step 5's existence check164 protects the backlog, and everything else is safely re-copied.