From 812bd190ca3c2108d2663a2af3e9a2a43c97a9e4 Mon Sep 17 00:00:00 2001 From: BuildTools Date: Mon, 25 May 2026 13:00:10 -0600 Subject: [PATCH] Add update mode: re-derive existing dev-loop skills from current template Closes #16 Co-Authored-By: Claude Opus 4.7 (1M context) --- README.md | 6 +++++- RESEARCH.md | 1 + create-dev-loop.md | 24 +++++++++++++++++++++++- 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 390b922..8fb8979 100644 --- a/README.md +++ b/README.md @@ -36,7 +36,11 @@ The generated skill drives a 10-phase loop: triage → work selection → implem /create-dev-loop ``` -Run this from inside any git repository. If a skill already exists for the repo, you'll be asked whether to overwrite it. +Run this from inside any git repository. If a skill already exists for the repo, you'll be asked to choose: + +- **update** *(default)* — re-derive the skill from the current template and current repo state, then show a diff before overwriting. Use this to pull in template improvements without re-creating the GitHub repo or `my-claude-skills` entry. Aborts if the local skill directory has uncommitted changes. +- **overwrite** — full regeneration, idempotently re-asserting the repo and registry entry. +- **cancel** — exit without changes. The skill reports the command name and a summary of the choices made (build system, test runner, doc sources, reviewer, branch prefix) when it finishes. diff --git a/RESEARCH.md b/RESEARCH.md index 3f4606b..de8cc69 100644 --- a/RESEARCH.md +++ b/RESEARCH.md @@ -190,6 +190,7 @@ Last reviewed: 2026-05-25. **Implementations.** - PR #33 (Template-version header for drift detection): shipped 2026-05-25. Observed effect: pending — needs N cycles of data. Adds `` and `` HTML comments to the top of every newly generated skill, plus `{{TEMPLATE_VERSION}}` and `{{GENERATED_AT}}` rows to the Step 4 substitution table. Implements the second bullet of this finding's implications; the periodic regression-check (third bullet) is a separate future change. The drift-detection step in `cdl-dev-loop` Phase 9 is also deferred — it belongs in the cdl-dev-loop repo, not here. +- PR #35 (Update mode — re-derive existing skills from current template): shipped 2026-05-25. Observed effect: pending — needs N cycles of data. Adds an `update` mode to `/create-dev-loop` so the retrofit work that CLAUDE.md's promotion checklist currently mandates can be driven by the skill itself rather than by hand. Complements PR #33's drift detection — #33 detects drift; PR #35 is the remediation channel. --- diff --git a/create-dev-loop.md b/create-dev-loop.md index 33fc0d8..765ea15 100644 --- a/create-dev-loop.md +++ b/create-dev-loop.md @@ -23,7 +23,25 @@ ls ~/local-skills/-dev-loop/ 2>/dev/null ls ~/.claude/commands/-dev-loop.md 2>/dev/null ``` -If one exists, ask the user whether to overwrite it before continuing. +**If no skill exists**, set `MODE=fresh` and proceed to Step 2. All subsequent steps run. + +**If a skill already exists**, ask the user to choose: + +- **update** *(default)* — re-derive the skill from the current template and current repo state, producing a fresh skill file. Set `MODE=update`. Steps 2–5 run; Steps 6 (create GitHub repo) and 7 (record in `my-claude-skills`) are skipped because those artifacts already exist. +- **overwrite** — re-derive and replace as in fresh generation. Set `MODE=overwrite`. Steps 6–7 still run, idempotently re-asserting the repo and registry entry. +- **cancel** — exit without changes. + +Before proceeding in **update mode**, abort if the local skill directory has uncommitted changes: +```bash +cd ~/local-skills/-dev-loop && git status --porcelain +``` +If the output is non-empty, stop and ask the user to commit or stash their edits — the update would otherwise overwrite in-progress work. + +In **update mode**, after Step 4 completes, show the user a diff between the existing skill file and the freshly generated content *before* overwriting: +```bash +diff -u ~/local-skills/-dev-loop/-dev-loop.md /tmp/-dev-loop.new.md +``` +Get explicit confirmation before replacing the file. --- @@ -534,6 +552,8 @@ repo-specific choices made (build system, test command, doc sources, reviewer, b ### 6 — Create a private GitHub repo for the skill +**Skip this step if `MODE=update`** — the repo already exists from the initial generation. (Run only when `MODE=fresh` or `MODE=overwrite`.) + ```bash gh repo create -dev-loop --private --description "Autonomous dev loop skill for {{PROJECT_NAME}}" ``` @@ -571,6 +591,8 @@ done ### 7 — Record the skill in my-claude-skills +**Skip this step if `MODE=update`** — the entry already exists from the initial generation. (Run only when `MODE=fresh` or `MODE=overwrite`.) + Open `~/my-claude-skills/README.md` and append a new row to the skills table using the GitHub repo created in Step 6: ```