Before filing
Skill
implement
What went wrong
Found with the /retro skill, reviewing four sessions of a Python project. Harness: Claude Code (VS Code extension). Model: Opus 5.5 High.
I ran /implement on a feature. The checked-out branch, had already been merged into master and deleted on the remote, but the local branch still existed. /implement ends with "Commit your work to the current branch", so it committed the whole feature there. I had to stop the agent and tell it: "you need to put it on a different branch please, this branch is already merged and deleted". The agent then cherry-picked the commit onto a new branch from origin/master and deleted the dead local branch.
Nothing in the skill could have caught this: the branch looks normal locally, and the skill gives the agent no reason to doubt it. It is easy to hit with merge-and-delete branch flows when a new session starts in the same checkout.
Proposed change
Add one step to /implement, before the first commit:
Before the first commit, check the current branch isn't already merged.
git fetch --prune
git merge-base --is-ancestor HEAD origin/<default-branch>
If it is an ancestor, its work is already in <default-branch>: create a new branch
from origin/<default-branch>, carry the uncommitted work over, and tell the user
in one line.
Detect <default-branch> with git symbolic-ref refs/remotes/origin/HEAD instead of hard-coding main or master. If the current branch is the default branch itself, keep the existing "branch first" behaviour.
Edit the line "Commit your work to the current branch." to "Commit your work to the current branch (once it has passed the merged-branch check above)."
Remove nothing.
Before filing
SCOPE.mdand checked.out-of-scope/, and this isn't covered by either.Skill
implement
What went wrong
Found with the
/retroskill, reviewing four sessions of a Python project. Harness: Claude Code (VS Code extension). Model: Opus 5.5 High.I ran
/implementon a feature. The checked-out branch, had already been merged intomasterand deleted on the remote, but the local branch still existed./implementends with "Commit your work to the current branch", so it committed the whole feature there. I had to stop the agent and tell it: "you need to put it on a different branch please, this branch is already merged and deleted". The agent then cherry-picked the commit onto a new branch fromorigin/masterand deleted the dead local branch.Nothing in the skill could have caught this: the branch looks normal locally, and the skill gives the agent no reason to doubt it. It is easy to hit with merge-and-delete branch flows when a new session starts in the same checkout.
Proposed change
Add one step to
/implement, before the first commit:Detect
<default-branch>withgit symbolic-ref refs/remotes/origin/HEADinstead of hard-codingmainormaster. If the current branch is the default branch itself, keep the existing "branch first" behaviour.Edit the line "Commit your work to the current branch." to "Commit your work to the current branch (once it has passed the merged-branch check above)."
Remove nothing.