Claude Code Workflow tool gotcha: a pipeline() stage that returns parallel([...]) resolves to a BARE ARRAY, but a sibling stage that returns {dimension, verified: []} resolves to an OBJECT — so a collector written as per.flatMap(p => Array.isArray(p?.verified) ? p.verified : []) SILENTLY DROPS every item from the…
Before writing code for a GitHub issue when another session might take the same one, claim it with BOTH an assignee and a wip label so a sibling sees it and skips. Trigger on "pick up issue #N", "work through the open issues", "is anyone on this?". Not for filing or reviewing.
Diagnose and prevent gh pr create opening a PR against the WRONG head branch when invoked from a parallel-orchestration setup with multiple worktrees. Use when: (1) you've dispatched subagents to work in sub-worktrees but you're finalizing PRs from a separate orchestration worktree, (2) gh pr create succeeds but gh pr…
Use when gh pr merge --squash prints an alarming diffstat — far more files than your PR touched, with create mode 100644 lines for files you never added (e.g. handoff docs, sibling-PR artifacts) and an inflated insertion count. This looks like your PR smuggled unrelated content onto the base branch, but it usually has…
Diagnose and recover from two adjacent gh pr merge failure modes that masquerade as merge conflicts. Use when: (1) gh pr merge --squash (or --merge) errors with "To have the pull request merged after all the requirements have been met, add the --auto flag" AND "Run the following to resolve the merge conflicts locally"…
Diagnose and bypass gh pr merge --squash --delete-branch failing with "failed to run git: fatal: 'main' is already used by worktree at ..." when another git worktree has main checked out. Use when: (1) you run gh pr merge and see this exact error, (2) you have multiple worktrees in the repo (e.g. .claude/worktrees/)…
Finish somebody else's open draft pull request when your session must push to a different, designated branch name — base it on the PR head and supersede.
GitHub auto-close on squash-merge only catches ONE issue per PR even when the PR title/body says "Closes #447, #448, #449, #450". The first issue closes; the rest stay OPEN. Use when: (1) you opened a PR with a title or body listing multiple "Closes #X, #Y, #Z" references, (2) the PR squash-merged successfully (gh pr…
Diagnose "my CI failed on a file I didn't change — the test passes locally but CI insists there's a duplicate / conflict / lint violation that isn't in my branch." Caused by GitHub Actions checking out refs/pull/N/merge (the auto-computed merge of PR head + base) on pullrequest events. Use when: (1) CI fails on a…
Prevent (and recover from) git add -u + git commit --amend + git push --force-with-lease catastrophically rolling thousands of unrelated tracked-file deletions into an amended commit when the project has an async post-commit hook that mutates tracked files (e.g. regenerates docs/site/.html, docs/site/index.html…
Use when a git commit --amend silently rewrites the WRONG commit in a repo that has an async/background post-commit hook. Trigger: after a normal commit, git log shows an unexpected extra commit on top that a background hook created ([auto-docs] ..., a docs/site regen, a changelog/checkbox tick) — and a later --amend…
Fix a RECURRING fatal: Unable to create '.../worktrees/ /index.lock': File exists that comes back after you rm it — in a busy/multi-worktree repo where your OWN git commands keep spawning git maintenance run --auto (→ git gc --auto / git repack / git pack-objects). Use when: (1) a git checkout/add/commit fails with…
Two-dot git diff origin/main..branch reports files main gained after you branched as your deletions; three-dot uses the merge base and shows only real ones.
Fix "untracked working tree files would be overwritten by merge" errors when pulling after a squash merge. Use when: (1) git pull fails listing files that should already be on main, (2) you just squash-merged a PR and can't pull on another branch, (3) files from a merged branch appear as "untracked" blocking checkout…
Fix git rebase origin/main (or any multi-commit rebase) silently stalling mid-replay with hint: pick ... It has been rescheduled; To edit the command before continuing, please edit the todo list first output, leaving a stuck .git/worktrees/ /rebase-merge/ directory that git rebase --abort does NOT clear. Use when: (1)…
Diagnose and avoid git stash pop pulling in a stale stash from a different branch when the preceding git stash was a no-op. Use when: (1) git stash reports "No local changes to save" but you git stash pop anyway as a reflex; (2) git stash pop surfaces files you don't recognize, often with "both modified" merge…
Create, list, switch and clean up git worktrees — a second isolated checkout for parallel work or a pull request review. Runs the bundled skills/git-worktree/scripts/worktree-manager.sh, which also copies .env in, gitignores the dir and trusts mise or direnv. Not a bare git worktree add.
Gate execution of a structured runbook/handoff/plan prompt behind an AskUserQuestion when the user explicitly hints that newer state (issues filed, PRs merged, probes shipped) has landed since the prompt was authored. Use when: (1) the user invokes "execute docs/handoffs/sessionNNN.md" or "run this plan" or "implement…
In a git-worktree session, your OWN Read/Write/Edit tool calls that use a BASE-repo absolute path (one MISSING the .claude/worktrees/ / segment) silently operate on the base repo's working tree — a DIFFERENT, often month-stale branch sharing the same .git. Use when: (1) a Read's line numbers / function locations don't…
A scope or plan doc from a prior session references dataset paths, table and column names that may not exist. Verify every project.dataset.table and column name exists, with a fast schema probe, before a multi hour dispatch of parallel subagents or batch jobs. NOT enum VALUES.
A verification / gate-running subagent you dispatched into YOUR OWN worktree silently measures the branch PLUS your uncommitted edits, and reports the mixture as the branch's result. Nothing is clobbered and nothing errors — the suite really ran, the counts are real, they are just counts of a tree nobody will ever…
Before a large redesign, restructure or migration that will rewrite shared files — templates, the base layout, central views, shared CSS — audit every unmerged branch for commits on those same files. Use when the repo keeps long lived parallel branches (client variant, release, staging, whitelabel) and the plan…
Prevent and diagnose nested git worktrees created at the wrong filesystem path when orchestrating parallel work from the main Claude Code agent. Use when (1) you ran git worktree add .claude/worktrees/ ... from the main agent's Bash tool, (2) git worktree list shows the new worktree at an unexpected nested path like…
The conflicting files are derived output from a generator: resolve their source, re-run it and stage the fresh result rather than hand merging the output.