Add Reference Repository to .knowledge/repositories
Goal
Clone a repository locally under .knowledge/repositories/<type>/... and produce
two documentation artifacts:
- A per-repo detail file (
<type>_<path-joined-by-underscores>.md) with
YAML frontmatter and a body shaped by the repo's type.
- A type-level
INDEX.md entry — a short, scannable catalog row with a
Keywords: field that links to the detail file.
Why the split: a single growing INDEX.md per type stops being read in full
once it gets long, and important context near the bottom is missed. The
detail files carry the long content; the index stays short so Claude can scan
it reliably and pick which detail file to open.
When to use
The user wants to add an external git repository as a local reference. Common
phrasings — trigger on any of these even if "submodule" isn't said:
- "add this repository as a reference"
- "add this repo to knowledge"
- "track this repo at branch X"
- "add migrated example axon4/foo and axon5/foo"
- "add reference application"
- "include this repository"
Repository types
Three types are supported. Each has its own template and INDEX shape:
repo_type |
What it is |
Where it lives |
axonframework |
A clone of an Axon Framework source tree |
.knowledge/repositories/axonframework/<RepoName>/ |
axon-examples |
A migrated example application (axon4 ↔ axon5 pair) |
.knowledge/repositories/axon-examples/{axon4,axon5}/<app>/ |
ai-bestpractices |
General reference (prompt eng, agent loops, etc.) |
.knowledge/repositories/ai-bestpractices/<repo>/ |
Inputs (gather from the user)
Always required:
url — git URL of the repository.
repo_type — one of axonframework, axon-examples, ai-bestpractices.
repo_path — relative to repo root, under .knowledge/repositories/<type>/.
purpose — 1–3 sentences. Used in the detail file and the INDEX one-liner.
keywords — 3–7 short, discriminative terms. Ask if not volunteered.
These appear in both frontmatter and INDEX.md's Keywords: line, so
they should be the kind of words a future search would actually use.
Optional, but ask when relevant:
branch — passed to git clone --branch.
commit — short hash to pin. Checked out after clone.
feature_highlights / key_paths / description — body content.
highlights — curated callouts the user wants surfaced to AI agents
(documentation URLs, files to start with, things to skip). Ask for at
least one bullet when creating a new detail file; only leave the
## Highlights section as - _none_ if the user explicitly declines.
axon-examples additionally requires:
variant — axon4 or axon5.
app_name — the application name shared across variants.
language — Kotlin or Java. Ask if missing.
build_tool — maven or gradle. Ask if missing.
architecture — optional (e.g. Vertical Slice, Hexagonal).
- For the
axon5 side: migration_notes — inline notes about choices,
alternatives, limitations. The kind of thing a migration skill should
learn from (e.g. "PaymentSaga migrated using repository-based state
instead of workflow extension"; "Deadlines not migrated — no Axon 5
equivalent without Workflow extension").
- When pairing two sides: branches/commits to compare for the Migration
Diff callout. The skill must ask for these if not provided — the
callout is meaningless without them.
Filename and path derivation
Detail filename = type-dir + _ + submodule path joined by _, with .md.
| Submodule path |
Detail filename |
.knowledge/repositories/axonframework/AxonFramework5 |
axonframework_AxonFramework5.md |
.knowledge/repositories/axon-examples/axon4/order |
axon-examples_axon4_order.md |
.knowledge/repositories/axon-examples/axon5/order |
axon-examples_axon5_order.md |
.knowledge/repositories/ai-bestpractices/cookbook |
ai-bestpractices_cookbook.md |
Both files (detail + INDEX) sit inside the type directory, alongside the
submodule(s).
The detail file MUST NOT be named CLAUDE.md or SKILL.md — those are
blocked by .claude/hooks/block-knowledge-repositories-claude-read.sh and
would become unreadable.
Workflow
Verify working directory. Run from repo root. If git status shows
unrelated unstaged changes that might get swept into the commit, warn the
user and ask whether to continue.
Clone the repository (shallow).
git clone --depth 1 --single-branch [--branch <branch>] <url> <repo_path>
Omit --branch when no branch was specified (clones the default branch).
Prefer --depth 1 to keep the local checkout small; contributors who need
full history can git -C <path> fetch --unshallow afterwards.
Lock as fetch-only. .knowledge/repositories/ is read-only by policy
(see .knowledge/README.md). Disable the push URL immediately after cloning:
git -C <repo_path> remote set-url --push origin DISABLED
Verify with git -C <repo_path> remote -v — the (push) line must
read DISABLED.
Pin to commit if requested.
git -C <repo_path> checkout <commit>
Prefer git -C <path> over cd <path> && … && cd - — it can't leak
cwd state into your next Bash call. The detached-HEAD warning is
normal — ignore it. Never use bare cd <repo_path> inside
this skill; the same rule applies to fetch/checkout in the retarget
sub-workflow below.
Write the per-repo detail file. Read the template for this repo type:
axonframework → references/templates-axonframework.md
axon-examples → references/templates-axon-examples.md
ai-bestpractices → references/templates-ai-bestpractices.md
Fill in the frontmatter and body sections. Every detail file must include
a ## Highlights section (use - _none_ only if the user explicitly
declines to add one).
Update the type-level INDEX.md. Read
references/index-entry-templates.md for the per-type entry shape. Read
the existing INDEX.md first to preserve order and the established
pattern. If the file is missing or empty, write the standard AI-agent
header (see the templates file) and append the new entry below it.
(axon-examples only) Pair with the counterpart if it exists.
- If the counterpart variant's detail file is already present, update the
counterpart's frontmatter to reflect the new pairing:
- On the axon4 source: append the new axon5 filename to
migrated_to
(promote to a list if it was scalar and a second target now exists).
- On the axon5 target: set
migrated_from to the axon4 source filename.
migrated_from is always a single scalar — a migration has exactly
one source.
migrated_to is a list — one source can have many migration
strategies. Use scalar form only when there's exactly one target.
- Update the application's INDEX entry to list the new variant bullet.
- If both sides now exist and the Migration Diff callout is missing,
write it using the branches/commits the user provided. If the user
hasn't provided them, ask before writing the callout.
Register in setup-repos.sh.
Append a clone_or_update call to .knowledge/scripts/setup-repos.sh
following the established pattern — one call per path, with the correct
branch (or none if default):
clone_or_update \
<url> \
<repo_path> \
[<branch>]
No .gitignore change needed — .knowledge/repositories/ is already
ignored as a whole.
Commit. Selective git add — never git add . or -A. Stage:
git add -f for the new/updated detail file(s) and INDEX.md —
.knowledge/repositories/ is globally gitignored, so -f is required.
git add (no -f) for .knowledge/scripts/setup-repos.sh.
Commit message focused on what was added and why, without any Claude Code
attribution (user's standing rule).
Report. Tell the user:
- Repository path and tracked ref (branch/commit).
- Detail file path created.
- INDEX.md section updated.
- For axon-examples: which counterpart side links were updated, if any.
- Commit hash.
Sub-workflow: Retarget a repository's tracked branch
The user asks to change the branch an existing repository tracks
("retarget AxonFramework5 to feat/5.1-openrewrite", "switch this
repo to branch X", "follow main now"). Don't re-run the full add
workflow — make a focused three-touch update:
- Move the local repo to the new branch.
git -C <repo_path> fetch origin <new-branch>
git -C <repo_path> checkout <new-branch>
Use git -C — see step 4 above.
- Update the detail file's frontmatter. Change
branch: to the new
branch. Keywords usually don't need to change; revisit Highlights only
if the new branch implies a different audience.
- Update the INDEX entry's branch label. The
branch \…`segment in theDetails` line must match the new frontmatter.
- Update
setup-repos.sh. Find the clone_or_update call for this
path and change its branch argument.
Commit all together (setup-repos.sh, the detail file, INDEX.md) with
a message like knowledge: retarget <RepoName> to <new-branch>. Selective
git add as in step 8. Report the new tracked branch and the current HEAD
commit hash.
Sub-workflow: Back-fill detail file for an already-cloned repository
A repository directory exists under .knowledge/repositories/ but has
no per-repo detail file (legacy state, or cloned manually outside this
skill). The main "path already exists → fail loudly" rule does NOT apply
here — only to fresh adds that would overwrite.
Procedure:
- Confirm the directory exists and has a
.git folder. If either is
missing, fall back to the main workflow (full add) instead.
- Skip the clone and pin (no
git clone, no checkout).
Still run step 3 (lock the push URL) — idempotent, and important
for repos cloned manually outside this skill that may still have a
live push URL.
- Check
setup-repos.sh. If the path is not already listed in
.knowledge/scripts/setup-repos.sh, add it (step 8 of the main
workflow).
- Resume at step 5 — write the detail file from the template,
filling
branch: from setup-repos.sh and reading the working tree
for key paths.
- Step 6 — add the INDEX entry as normal.
- Step 9 — commit the detail file, INDEX update, and any changes to
setup-repos.sh. The local repo directory is untouched.
- Report that this was a back-fill (not a clone) so the user knows
no clone operation occurred.
MUST do
- Read the existing
INDEX.md and the relevant template file before
writing — preserve established order and pattern.
- Keep
migrated_from/migrated_to cross-links bidirectional and
consistent. If A's migrated_to lists B, then B's migrated_from must
equal A.
- Surface
language and build_tool (axon-examples) on every variant
bullet in INDEX.md so readers can choose without opening detail files.
- Ask for branches/commits before writing the Migration Diff callout.
- Ask for
keywords if the user hasn't volunteered any.
- Ask for at least one
## Highlights bullet on every new detail file.
- Lock the push URL (
git -C <path> remote set-url --push origin DISABLED)
immediately after cloning. Also run this in the back-fill sub-workflow —
it's idempotent and protects manually-cloned repos.
- Append the
clone_or_update call to setup-repos.sh — required for the
repo to be reproducible on fresh checkouts.
MUST NOT do
- Do NOT add Claude Code attribution in commit messages.
- Do NOT use
git add . or git add -A.
- Do NOT silently overwrite an existing detail file or repository directory —
fail loudly and ask the user how to proceed.
- Do NOT name the detail file
CLAUDE.md or SKILL.md — blocked by hook.
- Do NOT skip the
INDEX.md update; a repo without an index entry is
incomplete work.
- Do NOT bundle unrelated changes into the commit. Exception: on the
very first use of this skill in a repo, the skill's own scaffolding
(
SKILL.md, hooks, .knowledge/README.md, empty type-level
INDEX.md files, and any repos added during the same bootstrap
pass) may legitimately be uncommitted. Bundling them into a single
"init knowledge repositories" commit is acceptable — selective git add still applies (no ./-A), but the staged set will be larger
than a steady-state add. From the second invocation onward, the rule
is strict: only files this skill touched belong in the commit.
- Do NOT
cd <repo_path> inside the skill — use git -C <path>.
The cd form leaks cwd across subsequent Bash calls in the same
session.
Edge cases
- Same upstream URL, different paths — fully supported. Common for
axon4/<app> and axon5/<app> pointing at the same upstream repository.
- Detached HEAD after
git checkout <commit> — normal. Ignore the warning.
INDEX.md does not exist or is empty — create it with the standard
AI-agent header (see references/index-entry-templates.md) and append
the new entry.
- Repository directory already present at path — fail loudly. Do not
overwrite or re-clone.
- Detail file already present — fail loudly with
diff guidance. Do
not silently overwrite.
- Clone fails (network/auth) — surface the error verbatim, do not retry
silently. Ask the user to verify URL/auth.
- Only one side of an axon-examples pair exists — that's fine. Document
the present side, mark the counterpart as
_migration pending_ in the
INDEX entry, and leave the cross-link frontmatter absent (or as an empty
list) until the counterpart is added.
- Repository present but no detail file — recovery, not an error. Use
the "Back-fill detail file for an already-cloned repository" sub-workflow
above. Do not re-clone.
- User asks to change a repository's tracked branch — use the
"Retarget a repository's tracked branch" sub-workflow above. Do not
remove and re-clone.
- Bootstrap commit (first use in repo) — see the MUST NOT
"exception" note. Bundling skill scaffolding + first repository into
one init commit is the only sanctioned exception to the
no-unrelated-changes rule.
- Tracked branch is force-pushed upstream —
git fetch will print
forced update. This is benign for an in-flight feature branch, but
the report to the user MUST mention it.
Done when
- The repository is cloned at the requested ref under
.knowledge/repositories/<type>/....
- Its
origin push URL is DISABLED (verify with
git -C <repo_path> remote -v).
.knowledge/scripts/setup-repos.sh contains a clone_or_update call
for this path with the correct branch.
- The per-repo detail file exists with full frontmatter and the type's
required body sections, including
## Highlights.
- The type-level
INDEX.md has the standard AI-agent header and a new
entry with a Keywords: line linking to the detail file.
- For axon-examples: counterpart cross-links are updated and bidirectional;
Migration Diff callout is present iff both sides exist.
- A single focused commit captures all of the above.
- The user has been told the commit hash, detail file path, and INDEX
section the entry landed in.
References (load only what the current task needs)
references/templates-axonframework.md — per-repo template for framework refs.
references/templates-axon-examples.md — per-repo template for paired
axon4/axon5 example apps, including migration-pair frontmatter rules.
references/templates-ai-bestpractices.md — per-repo template for general
AI/best-practices references.
references/index-entry-templates.md — INDEX.md entry snippets and the
standard AI-agent header for every type.
1---2name: knowledge-add-repository3description: Add a reference repository under .knowledge/repositories. Clones it locally (shallow), writes a per-repo detail markdown file with frontmatter, updates the type-level INDEX.md catalog, and registers the repo in setup-repos.sh. Use this whenever the user wants to add a reference repository, external repo, migrated application example, framework reference, or any git repository as a tracked reference - even if they don't say "submodule" explicitly. Triggers on phrases like "add this repo", "add a reference", "include this repository", "track this repo as", "add as submodule", "add migrated example", "add reference application".4---56# Add Reference Repository to `.knowledge/repositories`78## Goal910Clone a repository locally under `.knowledge/repositories/<type>/...` and produce11**two** documentation artifacts:12131. A **per-repo detail file** (`<type>_<path-joined-by-underscores>.md`) with14 YAML frontmatter and a body shaped by the repo's type.152. A **type-level `INDEX.md`** entry — a short, scannable catalog row with a16 `Keywords:` field that links to the detail file.1718Why the split: a single growing `INDEX.md` per type stops being read in full19once it gets long, and important context near the bottom is missed. The20detail files carry the long content; the index stays short so Claude can scan21it reliably and pick which detail file to open.2223## When to use2425The user wants to add an external git repository as a local reference. Common26phrasings — trigger on any of these even if "submodule" isn't said:2728- "add this repository as a reference"29- "add this repo to knowledge"30- "track this repo at branch X"31- "add migrated example axon4/foo and axon5/foo"32- "add reference application"33- "include this repository"3435## Repository types3637Three types are supported. Each has its own template and INDEX shape:3839| `repo_type` | What it is | Where it lives |40| ------------------ | --------------------------------------------------- | ------------------------------------------------------------- |41| `axonframework` | A clone of an Axon Framework source tree | `.knowledge/repositories/axonframework/<RepoName>/` |42| `axon-examples` | A migrated example application (axon4 ↔ axon5 pair) | `.knowledge/repositories/axon-examples/{axon4,axon5}/<app>/` |43| `ai-bestpractices` | General reference (prompt eng, agent loops, etc.) | `.knowledge/repositories/ai-bestpractices/<repo>/` |4445## Inputs (gather from the user)4647**Always required:**4849- `url` — git URL of the repository.50- `repo_type` — one of `axonframework`, `axon-examples`, `ai-bestpractices`.51- `repo_path` — relative to repo root, under `.knowledge/repositories/<type>/`.52- `purpose` — 1–3 sentences. Used in the detail file and the INDEX one-liner.53- `keywords` — 3–7 short, discriminative terms. Ask if not volunteered.54 These appear in both frontmatter and `INDEX.md`'s `Keywords:` line, so55 they should be the kind of words a future search would actually use.5657**Optional, but ask when relevant:**5859- `branch` — passed to `git clone --branch`.60- `commit` — short hash to pin. Checked out after clone.61- `feature_highlights` / `key_paths` / `description` — body content.62- `highlights` — curated callouts the user wants surfaced to AI agents63 (documentation URLs, files to start with, things to skip). Ask for at64 least one bullet when creating a new detail file; only leave the65 `## Highlights` section as `- _none_` if the user explicitly declines.6667**`axon-examples` additionally requires:**6869- `variant` — `axon4` or `axon5`.70- `app_name` — the application name shared across variants.71- `language` — `Kotlin` or `Java`. Ask if missing.72- `build_tool` — `maven` or `gradle`. Ask if missing.73- `architecture` — optional (e.g. `Vertical Slice`, `Hexagonal`).74- For the `axon5` side: `migration_notes` — inline notes about choices,75 alternatives, limitations. The kind of thing a migration skill should76 learn from (e.g. "PaymentSaga migrated using repository-based state77 instead of workflow extension"; "Deadlines not migrated — no Axon 578 equivalent without Workflow extension").79- When pairing two sides: branches/commits to compare for the Migration80 Diff callout. The skill **must ask** for these if not provided — the81 callout is meaningless without them.8283## Filename and path derivation8485Detail filename = type-dir + `_` + submodule path joined by `_`, with `.md`.8687| Submodule path | Detail filename |88| ------------------------------------------------------ | -------------------------------------------- |89| `.knowledge/repositories/axonframework/AxonFramework5` | `axonframework_AxonFramework5.md` |90| `.knowledge/repositories/axon-examples/axon4/order` | `axon-examples_axon4_order.md` |91| `.knowledge/repositories/axon-examples/axon5/order` | `axon-examples_axon5_order.md` |92| `.knowledge/repositories/ai-bestpractices/cookbook` | `ai-bestpractices_cookbook.md` |9394Both files (detail + INDEX) sit **inside the type directory**, alongside the95submodule(s).9697The detail file MUST NOT be named `CLAUDE.md` or `SKILL.md` — those are98blocked by `.claude/hooks/block-knowledge-repositories-claude-read.sh` and99would become unreadable.100101## Workflow1021031. **Verify working directory.** Run from repo root. If `git status` shows104 unrelated unstaged changes that might get swept into the commit, warn the105 user and ask whether to continue.1061072. **Clone the repository (shallow).**108 ```bash109 git clone --depth 1 --single-branch [--branch <branch>] <url> <repo_path>110 ```111 Omit `--branch` when no branch was specified (clones the default branch).112 Prefer `--depth 1` to keep the local checkout small; contributors who need113 full history can `git -C <path> fetch --unshallow` afterwards.1141153. **Lock as fetch-only.** `.knowledge/repositories/` is read-only by policy116 (see `.knowledge/README.md`). Disable the push URL immediately after cloning:117 ```bash118 git -C <repo_path> remote set-url --push origin DISABLED119 ```120 Verify with `git -C <repo_path> remote -v` — the `(push)` line must121 read `DISABLED`.1221234. **Pin to commit if requested.**124 ```bash125 git -C <repo_path> checkout <commit>126 ```127 Prefer `git -C <path>` over `cd <path> && … && cd -` — it can't leak128 `cwd` state into your next Bash call. The detached-HEAD warning is129 normal — ignore it. **Never use bare `cd <repo_path>`** inside130 this skill; the same rule applies to fetch/checkout in the retarget131 sub-workflow below.1321335. **Write the per-repo detail file.** Read the template for this repo type:134 - `axonframework` → `references/templates-axonframework.md`135 - `axon-examples` → `references/templates-axon-examples.md`136 - `ai-bestpractices` → `references/templates-ai-bestpractices.md`137138 Fill in the frontmatter and body sections. Every detail file must include139 a `## Highlights` section (use `- _none_` only if the user explicitly140 declines to add one).1411426. **Update the type-level `INDEX.md`.** Read143 `references/index-entry-templates.md` for the per-type entry shape. Read144 the existing `INDEX.md` first to preserve order and the established145 pattern. If the file is missing or empty, write the standard AI-agent146 header (see the templates file) and append the new entry below it.1471487. **(axon-examples only) Pair with the counterpart if it exists.**149 - If the counterpart variant's detail file is already present, update the150 counterpart's frontmatter to reflect the new pairing:151 - On the axon4 source: append the new axon5 filename to `migrated_to`152 (promote to a list if it was scalar and a second target now exists).153 - On the axon5 target: set `migrated_from` to the axon4 source filename.154 - `migrated_from` is **always a single scalar** — a migration has exactly155 one source.156 - `migrated_to` is **a list** — one source can have many migration157 strategies. Use scalar form only when there's exactly one target.158 - Update the application's INDEX entry to list the new variant bullet.159 - If both sides now exist and the Migration Diff callout is missing,160 write it using the branches/commits the user provided. **If the user161 hasn't provided them, ask before writing the callout.**1621638. **Register in `setup-repos.sh`.**164165 Append a `clone_or_update` call to `.knowledge/scripts/setup-repos.sh`166 following the established pattern — one call per path, with the correct167 branch (or none if default):168 ```bash169 clone_or_update \170 <url> \171 <repo_path> \172 [<branch>]173 ```174 No `.gitignore` change needed — `.knowledge/repositories/` is already175 ignored as a whole.1761779. **Commit.** Selective `git add` — never `git add .` or `-A`. Stage:178 - `git add -f` for the new/updated detail file(s) and `INDEX.md` —179 `.knowledge/repositories/` is globally gitignored, so `-f` is required.180 - `git add` (no `-f`) for `.knowledge/scripts/setup-repos.sh`.181 Commit message focused on what was added and why, without any Claude Code182 attribution (user's standing rule).18318410. **Report.** Tell the user:185 - Repository path and tracked ref (branch/commit).186 - Detail file path created.187 - INDEX.md section updated.188 - For axon-examples: which counterpart side links were updated, if any.189 - Commit hash.190191## Sub-workflow: Retarget a repository's tracked branch192193The user asks to change the `branch` an existing repository tracks194("retarget AxonFramework5 to feat/5.1-openrewrite", "switch this195repo to branch X", "follow main now"). Don't re-run the full add196workflow — make a focused three-touch update:1971981. **Move the local repo to the new branch.**199 ```bash200 git -C <repo_path> fetch origin <new-branch>201 git -C <repo_path> checkout <new-branch>202 ```203 Use `git -C` — see step 4 above.2042. **Update the detail file's frontmatter.** Change `branch:` to the new205 branch. Keywords usually don't need to change; revisit Highlights only206 if the new branch implies a different audience.2073. **Update the INDEX entry's branch label.** The `branch \`…\`` segment208 in the `[Details](...)` line must match the new frontmatter.2094. **Update `setup-repos.sh`.** Find the `clone_or_update` call for this210 path and change its branch argument.211212Commit all together (`setup-repos.sh`, the detail file, `INDEX.md`) with213a message like `knowledge: retarget <RepoName> to <new-branch>`. Selective214`git add` as in step 8. Report the new tracked branch and the current HEAD215commit hash.216217## Sub-workflow: Back-fill detail file for an already-cloned repository218219A repository directory exists under `.knowledge/repositories/` but has220no per-repo detail file (legacy state, or cloned manually outside this221skill). The main "path already exists → fail loudly" rule does NOT apply222here — only to fresh adds that would overwrite.223224Procedure:2252261. **Confirm** the directory exists and has a `.git` folder. If either is227 missing, fall back to the main workflow (full add) instead.2282. **Skip the clone and pin** (no `git clone`, no checkout).229 **Still run step 3 (lock the push URL)** — idempotent, and important230 for repos cloned manually outside this skill that may still have a231 live push URL.2323. **Check `setup-repos.sh`.** If the path is not already listed in233 `.knowledge/scripts/setup-repos.sh`, add it (step 8 of the main234 workflow).2354. **Resume at step 5** — write the detail file from the template,236 filling `branch:` from `setup-repos.sh` and reading the working tree237 for `key paths`.2385. **Step 6** — add the INDEX entry as normal.2396. **Step 9** — commit the detail file, INDEX update, and any changes to240 `setup-repos.sh`. The local repo directory is untouched.2417. **Report** that this was a back-fill (not a clone) so the user knows242 no clone operation occurred.243244## MUST do245246- Read the existing `INDEX.md` and the relevant template file before247 writing — preserve established order and pattern.248- Keep `migrated_from`/`migrated_to` cross-links bidirectional and249 consistent. If A's `migrated_to` lists B, then B's `migrated_from` must250 equal A.251- Surface `language` and `build_tool` (axon-examples) on every variant252 bullet in `INDEX.md` so readers can choose without opening detail files.253- Ask for branches/commits before writing the Migration Diff callout.254- Ask for `keywords` if the user hasn't volunteered any.255- Ask for at least one `## Highlights` bullet on every new detail file.256- Lock the push URL (`git -C <path> remote set-url --push origin DISABLED`)257 immediately after cloning. Also run this in the back-fill sub-workflow —258 it's idempotent and protects manually-cloned repos.259- Append the `clone_or_update` call to `setup-repos.sh` — required for the260 repo to be reproducible on fresh checkouts.261262## MUST NOT do263264- Do NOT add Claude Code attribution in commit messages.265- Do NOT use `git add .` or `git add -A`.266- Do NOT silently overwrite an existing detail file or repository directory —267 fail loudly and ask the user how to proceed.268- Do NOT name the detail file `CLAUDE.md` or `SKILL.md` — blocked by hook.269- Do NOT skip the `INDEX.md` update; a repo without an index entry is270 incomplete work.271- Do NOT bundle unrelated changes into the commit. **Exception:** on the272 very first use of this skill in a repo, the skill's own scaffolding273 (`SKILL.md`, hooks, `.knowledge/README.md`, empty type-level274 `INDEX.md` files, and any repos added during the same bootstrap275 pass) may legitimately be uncommitted. Bundling them into a single276 "init knowledge repositories" commit is acceptable — selective `git277 add` still applies (no `.`/`-A`), but the staged set will be larger278 than a steady-state add. From the second invocation onward, the rule279 is strict: only files this skill touched belong in the commit.280- Do NOT `cd <repo_path>` inside the skill — use `git -C <path>`.281 The `cd` form leaks `cwd` across subsequent Bash calls in the same282 session.283284## Edge cases285286- **Same upstream URL, different paths** — fully supported. Common for287 `axon4/<app>` and `axon5/<app>` pointing at the same upstream repository.288- **Detached HEAD after `git checkout <commit>`** — normal. Ignore the warning.289- **`INDEX.md` does not exist or is empty** — create it with the standard290 AI-agent header (see `references/index-entry-templates.md`) and append291 the new entry.292- **Repository directory already present at path** — fail loudly. Do not293 overwrite or re-clone.294- **Detail file already present** — fail loudly with `diff` guidance. Do295 not silently overwrite.296- **Clone fails (network/auth)** — surface the error verbatim, do not retry297 silently. Ask the user to verify URL/auth.298- **Only one side of an axon-examples pair exists** — that's fine. Document299 the present side, mark the counterpart as `_migration pending_` in the300 INDEX entry, and leave the cross-link frontmatter absent (or as an empty301 list) until the counterpart is added.302- **Repository present but no detail file** — recovery, not an error. Use303 the "Back-fill detail file for an already-cloned repository" sub-workflow304 above. Do not re-clone.305- **User asks to change a repository's tracked branch** — use the306 "Retarget a repository's tracked branch" sub-workflow above. Do not307 remove and re-clone.308- **Bootstrap commit (first use in repo)** — see the MUST NOT309 "exception" note. Bundling skill scaffolding + first repository into310 one init commit is the only sanctioned exception to the311 no-unrelated-changes rule.312- **Tracked branch is force-pushed upstream** — `git fetch` will print313 `forced update`. This is benign for an in-flight feature branch, but314 the report to the user MUST mention it.315316## Done when317318- The repository is cloned at the requested ref under319 `.knowledge/repositories/<type>/...`.320- Its `origin` push URL is `DISABLED` (verify with321 `git -C <repo_path> remote -v`).322- `.knowledge/scripts/setup-repos.sh` contains a `clone_or_update` call323 for this path with the correct branch.324- The per-repo detail file exists with full frontmatter and the type's325 required body sections, including `## Highlights`.326- The type-level `INDEX.md` has the standard AI-agent header and a new327 entry with a `Keywords:` line linking to the detail file.328- For axon-examples: counterpart cross-links are updated and bidirectional;329 Migration Diff callout is present iff both sides exist.330- A single focused commit captures all of the above.331- The user has been told the commit hash, detail file path, and INDEX332 section the entry landed in.333334## References (load only what the current task needs)335336- `references/templates-axonframework.md` — per-repo template for framework refs.337- `references/templates-axon-examples.md` — per-repo template for paired338 axon4/axon5 example apps, including migration-pair frontmatter rules.339- `references/templates-ai-bestpractices.md` — per-repo template for general340 AI/best-practices references.341- `references/index-entry-templates.md` — `INDEX.md` entry snippets and the342 standard AI-agent header for every type.