skills/branch-worktree/SKILL.md
Create a named branch and git worktree, then open it in a color-coded VSCode window. Use when: 'branch worktree', 'new worktree', 'worktree for', 'start a worktree', 'create worktree'.
npx skillsauth add ryan-mahoney/ryan-llm-skills branch-worktreeInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Create a git worktree with a structured branch name derived from a loose description, configure the environment, color-code the VSCode window, and open it.
$ARGUMENTS — free-text description of the work. If it starts with a number, that number is used as the issue/ticket prefix in the branch name.
1087 redesign dashboard onboarding → branch 1087-redesign-dashboard-onboardingfix candidate stage seed data → branch fix-candidate-stage-seed-datarefactor/jobs list controller → branch refactor-jobs-list-controller$ARGUMENTS is not empty. If empty, ask the user to describe the work.git rev-parse --git-dir.code CLI is available: which code.Parse $ARGUMENTS into a valid branch name:
/, spaces, underscores, and consecutive special characters with a single -.<slug>.Examples:
| Input | Slug |
|---|---|
| 1087 redesign dashboard onboarding | 1087-redesign-dashboard-onboarding |
| fix candidate stage seed data | fix-candidate-stage-seed-data |
| refactor/jobs list controller | refactor-jobs-list-controller |
repo_name=$(basename "$(git remote get-url origin)" .git)
Critical rule: The worktree must be on branch <slug>, never on main. The branch must not track any remote branch.
git fetch origin
Case A — Worktree path already exists (~/.worktrees/<repo-name>/<slug>):
Verify the worktree is on the correct branch:
actual_branch=$(git -C ~/.worktrees/<repo-name>/<slug> rev-parse --abbrev-ref HEAD)
actual_branch equals <slug> → reuse it, skip to Step 3b.actual_branch is anything else (e.g. main) → remove and recreate:
git worktree remove --force ~/.worktrees/<repo-name>/<slug>
Then fall through to Case C.Case B — Branch <slug> exists locally but no worktree:
mkdir -p ~/.worktrees/<repo-name>
git worktree add ~/.worktrees/<repo-name>/<slug> <slug>
Case C — Neither exists (most common):
mkdir -p ~/.worktrees/<repo-name>
git worktree add --no-track -b <slug> ~/.worktrees/<repo-name>/<slug> origin/main
--no-track prevents the new branch from tracking origin/main.
After the worktree is ready (all cases), run these checks inside the worktree:
cd ~/.worktrees/<repo-name>/<slug>
# Confirm we are on <slug>, not main or anything else
actual_branch=$(git rev-parse --abbrev-ref HEAD)
if [ "$actual_branch" != "<slug>" ]; then
echo "ERROR: Worktree is on branch '$actual_branch', expected '<slug>'. Aborting."
exit 1
fi
# Remove any upstream tracking — the branch must be independent for PRs
git branch --unset-upstream <slug> 2>/dev/null || true
Record the absolute worktree path for all subsequent steps.
cp .env ~/.worktrees/<repo-name>/<slug>/.env 2>/dev/null || true
Compute a deterministic color index from the slug. Use a simple hash:
hash_val=$(printf '%s' "<slug>" | cksum | awk '{print $1}')
color_index=$((hash_val % 8))
Select the hex value from this palette:
| Index | Color | Hex |
|-------|--------|-----------|
| 0 | Teal | #0d7377 |
| 1 | Purple | #6a1b9a |
| 2 | Orange | #e65100 |
| 3 | Blue | #1565c0 |
| 4 | Green | #2e7d32 |
| 5 | Red | #b71c1c |
| 6 | Indigo | #283593 |
| 7 | Brown | #4e342e |
Write .vscode/settings.json in the worktree:
{
"workbench.colorCustomizations": {
"titleBar.activeBackground": "<hex>",
"titleBar.activeForeground": "#ffffff",
"statusBar.background": "<hex>",
"statusBar.foreground": "#ffffff"
}
}
jq:
jq --arg bg "<hex>" \
'.["workbench.colorCustomizations"] = {
"titleBar.activeBackground": $bg,
"titleBar.activeForeground": "#ffffff",
"statusBar.background": $bg,
"statusBar.foreground": "#ffffff"
}' \
.vscode/settings.json > /tmp/vscode-settings-tmp.json \
&& mv /tmp/vscode-settings-tmp.json .vscode/settings.json
jq is not available, overwrite with color settings only.Run dependency installation in the worktree so it's ready to work:
cd ~/.worktrees/<repo-name>/<slug> && bun install --frozen-lockfile
If bun is not on PATH, try:
export PATH="$HOME/.bun/bin:$PATH"
bun install --frozen-lockfile
code --new-window ~/.worktrees/<repo-name>/<slug>
Print a summary to the user:
Worktree ready:
Branch: <slug>
Tracks: nothing (independent — push with `git push -u origin <slug>`)
Path: ~/.worktrees/<repo-name>/<slug>
Color: <color-name> (<hex>)
STOP. Do not proceed with any implementation work. The user will continue in the new VSCode window.
NNNN-kebab-description when an issue number is present, kebab-description otherwise.~/.worktrees/<repo-name>/ to keep them out of the source repo..vscode/settings.json is gitignored in the repo, so color settings won't leak into commits.main. Every worktree must be on its own named branch.--no-track on creation and --unset-upstream as a safety net. This ensures git push -u origin <slug> sets tracking correctly when the user is ready to open a PR.testing
This skill should be used when the user asks to "run the spec", "implement the spec", or "execute the spec". Implements every step in a SpecOps implementation spec by delegating each step (or logical group of adjacent steps) to a sequential subagent, conventional-committing each one independently, and — when `roborev` is on the path — running `roborev check` on every commit and `roborev fix` (with spec context, so the fix cannot silently drift the implementation away from the spec) on any commit that fails.
development
Exhaustively audit a top-level UI implementation component against an HTML prototype and produce a grouped markdown checklist of corrections. Use when a user asks for UI parity review, visual QA, design implementation audit, pixel-level drift detection, or behavior/style mismatch analysis between prototype HTML and shipped component code.
development
Audit a SpecOps implementation spec against its source analysis spec to find requirements, policies, contracts, edge cases, error modes, invariants, defaults, side effects, or implementation steps that the implementation has dropped, weakened, contradicted, or silently changed — then patch the implementation spec to restore them. Use this skill whenever the user mentions auditing, comparing, conforming, reconciling, or checking an implementation spec against an analysis spec, finding gaps between two specs, ensuring an implementation spec preserves analysis behavior, or verifying spec derivation or traceability. Also trigger when the user describes "did the implementation spec lose anything from the analysis," "does the implementation match the analysis," "verify the implementation spec covers everything," or asks to confirm one spec is faithful to another. Run this before generating code from an implementation spec and after either spec is edited.
development
Audit a set of SpecOps analysis specs for cross-spec coherence — establish a dependency-ordered implementation sequence, then verify pairwise integration contracts at module boundaries plus three cross-cutting consistency dimensions (shared data models, side-effect ownership, terminology) — and patch the affected specs to resolve gaps. Use this skill whenever the user mentions cross-spec consistency, integration gaps between specs, conflicts between specs, duplicate work across specs, implementation order, dependency order for migration, building an implementation-order checklist, ensuring specs interoperate, terminology drift across specs, or shared data model conflicts. Also trigger when the user describes "do my specs agree with each other," "what order should I implement these in," "find inconsistencies across all my specs," or asks to audit a folder of analysis specs as a set rather than individually. Run this once after generating a full set of analysis specs, before deriving implementation specs.