ask-matt
MAmattpocock/skills337k4,978 new stars in the last 7 days
Upgrade TRIP workflow skills to a newer version while preserving project customizations
You are now in upgrade mode — merging a newer version of the TRIP workflow into this project's existing, customized TRIP skills.
Each project's TRIP skills have two interleaved layers:
A naive copy would destroy layer 2. This skill fetches the generic template the project was installed from, computes the project's customizations as a diff against it, and replays that diff onto the new template with a git three-way merge — one command per file, exact, and verifiable. The installed version comes from the metadata.trip-version stamp every skill carries since 2.8.1; older installs are first brought to 2.8.4 (see Unstamped Installs).
Nothing to copy. The skill fetches the TRIP-workflow repository itself and upgrades to its latest release by default.
$ARGUMENTS, optional:
2.9.0 or v2.9.0) pins the target release instead of the latest;skills/ folder (a fork, an offline copy) is used as the target source instead of fetching. The base template still comes from the clone.One clone serves the whole upgrade — it provides the new skills now and the base template in Phase 2:
TRIP_SRC=$(mktemp -d)
git clone -q --no-checkout https://github.com/PiLastDigit/TRIP-workflow "$TRIP_SRC"
TARGET=$(git -C "$TRIP_SRC" tag --list 'v*' --sort=-v:refname | head -1) # or v$ARGUMENTS when a version was given
S=$(mktemp -d); git -C "$TRIP_SRC" archive "$TARGET" skills | tar -x -C "$S" --strip-components=1
$S is the target source for the rest of this skill. If a path was passed instead, S=<that path> and skip the archive. If the clone fails (offline, no access), tell the user and stop.
# Installed (one line per distinct version; more than one line = a mixed install)
grep -h "^ trip-version" .claude/skills/*/SKILL.md | sort | uniq -c
# Target
grep -h "^ trip-version" "$S"/*/SKILL.md | sort -u
installed X → target Y. If X equals Y, tell the user the project is already on the latest release and stop; remove $TRIP_SRC and $S.Compare every skill folder present on either side (diff -rq -x state .claude/skills/<skill>/ "$S"/<skill>/), and check which entries of Structural Changes apply to this install. Then show the version line and one row per skill:
TRIP 2.8.4 → 2.9.0 (installed version read from metadata.trip-version)
Skill | Status | Action
--------------------- | ----------------- | ------
TRIP-1-plan | Updated | Merge
TRIP-3-release | Updated | Merge
codex-code-review | Updated | Merge; receives checklist.md + cr-template.md from TRIP-review/
TRIP-review | Removed in 2.9.0 | Delete once its files have moved
TRIP-test | Removed in 2.9.0 | Content moves to docs/4-unit-tests/TESTING.md, then delete
TRIP-compact | Unchanged | Skip
my-own-skill | Project only | Leave in place
AskUserQuestion: "Here's the upgrade plan. Proceed?"
Options: "Yes, start upgrade" (recommended) / "Let me review the new files first" / "Abort"
The merge needs the generic skills of the installed version (the "base"). The project only holds its customized copy, so take them from the clone:
BASE=$(mktemp -d)
git -C "$TRIP_SRC" archive "v$INSTALLED_VERSION" skills | tar -x -C "$BASE" --strip-components=1
Report: "Base template v2.8.4 fetched. Upgrading v2.8.4 → v2.9.0."
For every file in $S, state folders excluded, decide by presence:
| Installed | Base | Action |
|---|---|---|
| yes | yes | git merge-file -p installed base staged → merged file |
| yes | no | file is new upstream but the project also has one: merge with an empty base |
| no | — | copy staged |
| (installed only) | — | leave in place, unless Structural Changes retires it |
A file that moved between skills is looked up under its old path on the installed and base sides — old_path below lists the moves (Structural Changes explains them).
Build everything in a scratch directory first; nothing under .claude/skills/ changes until Phase 4 passes.
MERGED=$(mktemp -d); I=.claude/skills # $S = target source from Phase 1.1
old_path() { case "$1" in
codex-code-review/checklist.md|codex-code-review/cr-template.md) echo "TRIP-review/${1#codex-code-review/}" ;;
*) echo "$1" ;; esac; }
( cd "$S" && find . -type f -not -path '*/state/*' ) | sed 's|^\./||' | while read -r f; do
mkdir -p "$MERGED/$(dirname "$f")"
i="$I/$f"; [ -f "$i" ] || i="$I/$(old_path "$f")"
b="$BASE/$f"; [ -f "$b" ] || b="$BASE/$(old_path "$f")"; [ -f "$b" ] || b=/dev/null
if [ -f "$i" ]; then
git merge-file -p -L installed -L base -L staged "$i" "$b" "$S/$f" > "$MERGED/$f" || echo "CONFLICT $f"
else
cp "$S/$f" "$MERGED/$f"
fi
done
grep -rl '^<<<<<<< ' "$MERGED" || echo "no conflicts"
Conflicts happen only where a workflow change and a customization touch the same lines. Open the marked region, keep the new workflow text and re-apply the project's intent inside it, remove the markers. Never resolve by taking one side wholesale — except where Structural Changes says a customization is retired.
Two diffs per merged file, both must be short and readable:
# what the project customized — must contain ONLY project-specific content
diff "$S/$f" "$MERGED/$f"
# what the upgrade changes — must contain ONLY workflow changes (and the new frontmatter)
diff "$I/$f" "$MERGED/$f"
Read both for every customized file (TRIP-1-plan, TRIP-2-implement, TRIP-3-release, codex-code-review/checklist.md, codex-code-review/cr-template.md) and for any other file whose first diff is not empty — a project sometimes tweaks a "pure" skill by a line, and the merge carries that over. A customization appearing in the second diff as a removal, or workflow text appearing in the first diff, means the merge went wrong for that file — fix it before continuing.
grep -rn --exclude-dir=TRIP-init --exclude-dir=TRIP-upgrade '\[ADAPT_TO_PROJECT\|\[PROJECT_NAME\]\|\[VERSION_FILE\]\|\[TEST_COMMAND\]\|\[LINT_COMMAND\]\|\[TYPECHECK_COMMAND\]\|\[MAIN_BRANCH\]' "$MERGED"/TRIP-*/ "$MERGED"/codex-code-review/*.md
TRIP-init and TRIP-upgrade mention every placeholder by name in their own instructions, so they are excluded. If any are found, fill them from context or ask the user.
codex-code-review/checklist.md section names must match the checklist section names in codex-code-review/cr-template.md.grep -rln --exclude-dir=TRIP-upgrade 'TRIP-review/\|TRIP-test' "$MERGED" returns nothing.TRIP-1-plan references codex-plan-review/scripts/start.sh and resume.sh; TRIP-2-implement and TRIP-research invoke each skill's own wrapper scripts — confirm codex-implement, codex-code-review, and codex-ask each ship scripts/{start,resume,reset,show}.sh (they pin STATE_DIR and delegate to codex-plan-review), and that codex-plan-review/scripts/key.sh exists.Show what changed:
Upgrade ready:
- New skills added: [list]
- Skills updated: [list]
- Skills unchanged: [list]
- Structural changes to apply: [list]
- Project customizations preserved: [list key ones]
Run the version-stamp check from Frontmatter and Version Stamp on $MERGED.
AskUserQuestion: "Merge verified. Apply to .claude/skills/?"
Options: "Apply" (recommended) / "Show me the diffs first" / "Abort"
If "Show me the diffs first": present the Phase 4.1 diffs. If "Abort": remove the scratch directories, nothing was changed.
# copy merged files over the install; state/ folders are never touched
rsync -a --exclude 'state/' "$MERGED"/ .claude/skills/
Then apply the post-merge steps of every Structural Changes entry that concerns this install, remove the scratch directories ($TRIP_SRC, $S unless it is a user-supplied path, $BASE, $MERGED — use trash-put where available, otherwise rm -r), and confirm the stamp once more on the live install:
grep -h "^ trip-version" .claude/skills/*/SKILL.md | sort | uniq -c
Report:
"TRIP workflow upgraded vX → vY. N files merged, M copied, 0 conflicts.
git diff .claude/skills/ docs/shows the change before you commit."
Changes a file merge cannot express on its own. Apply every entry newer than the installed version.
TRIP-review and TRIP-test removedchecklist.md and cr-template.md moved from TRIP-review/ to codex-code-review/; Phase 3 merges them from their old path. After applying, delete TRIP-review/ — its SKILL.md was the on-demand manual review, which no longer exists.TRIP-test/SKILL.md holds the project's test commands, test structure and testing priorities. Before deleting the folder, move whatever docs/4-unit-tests/TESTING.md does not already say into it, under "Running Tests", "Test Organization" and "Testing Priorities" (create the file if missing). Then delete TRIP-test/.TRIP-test". Repoint it at docs/4-unit-tests/TESTING.md (or the code review checklist for TRIP-review); the Phase 4.3 cross-reference check lists every occurrence.TRIP-3-release Step 1 no longer computes a project week; the project's week anchor date conflicts with that change. Take the new Step 1.docs/2-changelog/changelog_table.md, drop the Week column (header, separator, and the second cell of every row) so the new two-column rows fit. Leave any # Changelog Summary section below the table as it is — older hotfix entries only exist there — new releases no longer add to it.wN_vx.y.z.md changelogs and CR_wN_vx.y.z.md reviews keep their names. New ones are vx.y.z.md and CR_vx.y.z.md.Projects that had tutorials enabled get a conflict on that step of TRIP-3-release. Drop the Tutorial step and keep the new template's step numbering. Leave any existing docs/5-tuto/ folder in place — it is project content.
Merging needs the base template, and an install without a stamp cannot name it. Bring it to 2.8.4 first — the last release that rebuilds customized skills by hand — then merge from there:
git -C "$TRIP_SRC" show v2.8.4:skills/TRIP-upgrade/SKILL.md.v2.8.4 (it accepts a version argument), reusing the same clone. It rebuilds the customized skills and stamps every skill 2.8.4.The YAML frontmatter of every merged SKILL.md (name, description, argument-hint, disable-model-invocation, metadata.trip-version) is pure workflow: take it verbatim from the target file, never from the installed copy. After the merge, verify every skill reports the target version:
grep -h "^ trip-version" .claude/skills/*/SKILL.md | sort | uniq -c
Exactly one line must come back, matching the target version. Any other line means a skill was skipped, merged from the old frontmatter, or is a retired skill that was not deleted — fix it before reporting completion.
The user copied this skill's folder over .claude/skills/TRIP-upgrade/ by hand to bootstrap. That is expected: run normally. The old skill (if any) used a new-TRIP/ staging folder — if one is present, remove it in Phase 5.
These are "Project only" in the inventory — leave them in place. Never delete skills that exist only in the installed version, except those Structural Changes retires.
$MERGED before touching .claude/skills/. If something goes wrong mid-merge, the installed skills are still intact.state/ directories live inside the skill folders and hold every past review thread. Copy over; the only folders this skill deletes are those Structural Changes retires.MAmattpocock/skills337k4,978 new stars in the last 7 days
MAmattpocock/skills337k4,978 new stars in the last 7 days
MAmattpocock/skills337k4,978 new stars in the last 7 days
OBobra/superpowers331k4,772 new stars in the last 7 days
AFaffaan-m/ECC315k4,381 new stars in the last 7 days
AFaffaan-m/ECC315k4,381 new stars in the last 7 days