Set up a wiki repository
A wiki repository is a project's own git repository. It holds the knowledge
bundle in wiki/ and a copy of the tool and schema in .wiki-llm/, so people,
skills and CI check the wiki with the same rules.
This skill does four things:
- it creates a wiki repository, or brings its tool copy up to this skill's release;
- it links the workspace (the folder the user started you in) to the wiki
repository, by writing a note into the workspace's
AGENTS.mdandCLAUDE.md, so other sdlc-skills find the wiki without asking; - it adds an application to the wiki when the user asks;
- it never adds any other concept; other skills do that.
The tool
This skill carries its own copy of the tool: wiki-llm/tools/wiki_llm.py in
the folder that holds this SKILL.md. Use its absolute path for every command
below, and remember the workspace:
TOOL="python3 <folder of this SKILL.md>/wiki-llm/tools/wiki_llm.py"
RELEASE="$(cat <folder of this SKILL.md>/RELEASE)"
WORKSPACE="$(pwd)"
Every draft this skill finishes is stamped --by "sdlc-setup-wiki/$RELEASE".
Every command prints JSON. Exit 0 is success. Exit 1 is a failed check or a
refusal: read error, message or validate.errors. Exit 2 is a usage or
environment problem: show error to the user and stop, unless a step below
says otherwise.
1. Find out what to do
- Get the wiki repository's path from the user, unless they already gave it
or, when they ask to add an application, the workspace note between
<!-- sdlc-skills:start -->and<!-- sdlc-skills:end -->names it. For example../shop-wiki. A path relative to the workspace is fine. Call itWIKI. The folder may not exist yet. - Note whether the workspace is the wiki repository:
[ "$(cd "$WIKI" 2>/dev/null && pwd -P)" = "$(pwd -P)" ]. Call this case SELF. - Run
$TOOL copy check "$WIKI"and act on the result:
| Result | Do |
|---|---|
| exit 2 with "no tool copy found" | Create (section 2) |
status edited or older |
Upgrade (section 3) |
status current, and the user asked to add an application |
Add an application (section 4a) |
status current |
Link only (section 4) |
status newer |
The wiki was set up by a newer release. Tell the user to update their installed sdlc-skills, then run this skill again. Stop |
To add an application to a wiki that is not current, upgrade it first; once
the upgrade's pull request is merged, run this skill again to add it.
A draft starts from the remote's default branch, else a local main, else
master. If draft start reports "no default branch", tell the user the
repository needs one of these, and stop.
2. Create
-
Ask the user for:
- the Application key: lower-case words joined by
-, for exampleshop; - the Application title, for example
Shop Platform; - the owner team, for example
payments.
- the Application key: lower-case words joined by
-
Show what will be written, and ask for approval:
- in
WIKI:README.mdwith the checks to run by hand or in CI (kept if one exists),.gitignorelines.worktrees/and__pycache__/,.wiki-llm/(the tool copy),wiki/index.mdandwiki/<app>/overview.md; - the workspace note in each
AGENTS.mdandCLAUDE.mdof the workspace, or a newAGENTS.mdwhen neither exists.
Also say how the wiki is saved: as the first commit on
mainwhenWIKIis new, not a git repository, or has no commits; otherwise on a draft branchwiki/setupfor a pull request. - in
-
On approval, pick the case.
New folder, no git repository, or a repository with no commits.
mkdir -p "$WIKI" && cd "$WIKI" git rev-parse --git-dir >/dev/null 2>&1 || git init git symbolic-ref HEAD refs/heads/main $TOOL init . --app <key> --title "<title>" --owner-team <team>initmust reportok: true. In the SELF case, run$TOOL link . .now, so the note is part of the first commit. Then:git add -A git commit -m "Set up the <title> wiki" cd "$WORKSPACE"Report the commit, and that the user can push
mainto a new remote. Then, unless SELF, go to section 5.A repository with commits. Write the skeleton into a draft:
cd "$WIKI" $TOOL draft start setup $TOOL init .worktrees/setup --app <key> --title "<title>" --owner-team <team>In the SELF case, run
$TOOL link .worktrees/setup .worktrees/setup. Then runcd .worktrees/setupand$TOOL draft finish --by "sdlc-setup-wiki/$RELEASE", and go to section 6.
3. Upgrade
-
Show the user
copy.release_versionandsource.release_versionfromcopy check, and whether the Schema version changes (copy.schema_versionandsource.schema_version). From Schema version 1 to 2, also say that every TestSuite is removed (each Feature or ChangeRequest now has one suite, with its cases grouped by user story) and thatsdlc-design-story-testsandsdlc-design-feature-testswrite them again. Whenstatusisedited, listadded,missingandchanged: those hand edits will be replaced. Unless SELF, also say which workspace files get the note. -
Ask for approval. On approval, with
<version>the value ofsource.release_version:cd "$WIKI" $TOOL draft start setup-<version> $TOOL copy install .worktrees/setup-<version>If
draft startrefuses because the branch exists, an earlier upgrade left it. If its pull request was merged or closed, run$TOOL draft discard setup-<version> --remoteand start again. If it is still open, tell the user to finish that pull request first, and stop. -
In the SELF case, run
$TOOL link .worktrees/setup-<version> .worktrees/setup-<version>. -
Run
cd .worktrees/setup-<version>. When the Schema version changes, run$TOOL migrate. If it reports that no migration is available, tell the user the wiki cannot be upgraded with this release. Then runcd "$WIKI" && $TOOL draft discard setup-<version>and stop. Keep itsremovedsuites and itsretestkeys for the report. -
Tasks with two or more stories. The schema now allows a Task at most one story, so a wiki written before may hold Tasks with more. Run
$TOOL validateand look forrelationships.cardinalityfindings on a Task's# Stories. When there are none, go to step 6. Otherwise ask, in one round, which story each such Task keeps. Recommend the story that lists the Requirements its# Acceptancelinks, or the first story listed when that does not decide. On the answers, drop the other# Storieslinks of each Task and add an entry to thelog.mdof the Task's folder, for example* **Upgrade**: Kept STORY-checkout-pay-and-confirm on TASK-order-creation-endpoint; also served STORY-checkout-retry-safely (one story per Task since <version>).Change nothing else. A story left with no Task is not a validation error. -
Run
$TOOL draft finish --by "sdlc-setup-wiki/$RELEASE", then go to the Change-set gate (section 6). When step 5 dropped a link, the report after the commit also says: "Next: run sdlc-plan-tasks for to plan a Task for them." Whenmigrateremoved suites, it also says: "Next: run sdlc-design-story-tests for each story and sdlc-design-feature-tests for <eachretestkey> to write its TestSuite again."
4. Link only
The wiki is up to date. Tell the user, and say which workspace files get the note. On approval:
-
Not SELF. Go to section 5.
-
SELF. The note belongs in the wiki repository, so it goes through a draft:
$TOOL draft start link $TOOL link .worktrees/link .worktrees/linkIf
writtenis empty, the note is already there. Run$TOOL draft discard link, report "already linked", and stop. Otherwise runcd .worktrees/linkand$TOOL draft finish --by "sdlc-setup-wiki/$RELEASE", then go to section 6.
4a. Add an application
-
Ask the user for what they have not given:
- the Application key: lower-case words joined by
-, for examplebilling; it must not be a folder in$WIKI/wiki/already; - the Application title, for example
Billing; - the owner team, for example
finance.
If the key the user wants is already a folder in
$WIKI/wiki/, say that the application exists, offer a different key, and start nothing until they give one. - the Application key: lower-case words joined by
-
Show what will be written:
wiki/<key>/overview.mdand the indexes the tool updates, on a draft branchwiki/app-<key>for a pull request. Ask for approval. -
On approval:
cd "$WIKI" $TOOL draft start app-<key> cd .worktrees/app-<key> $TOOL app add --key <key> --title "<title>" --owner-team <team> $TOOL draft finish --by "sdlc-setup-wiki/$RELEASE"If
app addrefuses because the application exists, runcd "$WIKI" && $TOOL draft discard app-<key>, tell the user, and stop. Otherwise go to section 6, with the commit messageAdd the <title> application.
5. Link the workspace
cd "$WORKSPACE"
$TOOL link "$WORKSPACE" "$WIKI"
Report the files in written (or that the note was already there), and any
warnings. If the workspace is a git repository, tell the user the note is an
ordinary change there: they commit it if teammates should share it.
6. Change-set gate
-
If
draft finishis notok, showmissing_logsandvalidate.errors. A new tool version can report problems the old one did not. Do not fix wiki content in this skill; the one exception is the dropped story links of section 3, step 5. Tell the user what failed, run$TOOL draft discard <key>fromWIKI, and stop. -
Run
$TOOL draft diffand show the user the change set:- list the files;
- say that
.wiki-llm/files are the tool copy, written by the tool; - say that
AGENTS.mdandCLAUDE.mdhold the workspace note.
Propose a commit message such as
Set up the <title> wiki,Upgrade the wiki tool to <version>,Link the wiki to its workspaceorAdd the <title> application. -
On approval, run
$TOOL draft commit -m "<message>"; cd "$WORKSPACE"as one command:draft commitremoves the worktree you are in, so judge it by the JSON it prints, not by an error about the current directory.- Report the branch, and that the user opens the pull request; the change reaches the wiki when it is merged.
- If there is no remote, say that the branch has to be pushed first.
- Unless SELF, or this run only added an application, go to section 5.
-
On rejection, run
$TOOL draft discard <key>fromWIKI.
Rules
- Change nothing before the user approves what will be written.
- Never edit files in
.wiki-llm/by hand;copy installreplaces the whole folder. - Never write the workspace note by hand;
linkreplaces it in place. - Never open a pull request or call a hosting service; the user does that.
- Never push to
mainof a repository that already has commits.
