stack-branch
Skill9 starsChanged 4 months agoMITView on GitHub
Create a new branch stacked on another PR. Use when you want to start work that depends on an existing PR that hasn't been merged yet.
- Commits and pushes
In this repository74 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- architectSkill
- artifact-hygieneSkill
- backlog-groomSkill
- beads-check-dolt-migrationSkill
- beads-migrate-to-doltSkill
- beads-setupSkill
- beadsSkill
- breakdownSkill
- browser-screenshotSkill
- circleci-statusSkill
- clean-codeSkill
- complete-taskSkill
- confluenceSkill
- contract-checkSkill
- contract-testSkill
- create-prSkill
- delegate-workSkill
- developSkill
- diagnose-bugSkill
- do-i-need-thisSkill
- eas-build-errorSkill
- handoffsSkill
- handoffs-tidySkill
- image-studioSkill
- implement-solutionSkill
- jira-commentSkill
- jira-ticketSkill
- landscapeSkill
- model-update-checkSkill
- name-sessionSkill
- nextSkill
- outstanding-workSkill
- pedantic-reviewSkill
- peer-sessionSkill
- pickupSkill
- pi-spendSkill
- plan-daySkill
- plan-to-backlogSkill
- project-briefSkill
- pr-statusSkill
- ready-to-mergeSkill
- ready-to-releaseSkill
- rebaseSkill
- release-maintenanceSkill
- release-managerSkill
- release-statusSkill
- reply-commentsSkill
- review-commentsSkill
- review-prSkill
- sanity-checkSkill
- second-opinionSkill
- setup-multirepo-gitSkill
- skills-reviewSkill
- start-ticketSkill
- thoughtboxSkill
- tidy-settingsSkill
- todaySkill
- token-dashboardSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
10 rules. About 0 are common, 5 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈5
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 14
Create a new branch based on an existing PR branch (not main) for dependent work.
- Distinctive: line 29
Use jira-ticket for the key, summary and issue type.
- Distinctive: line 36
If parent branch not specified:
- Distinctive: line 43
If attached to a non-default branch, offer to use it as the parent.
- Distinctive: line 79
Run the shared read-only branch preflight before changing checkout state:
- Very specific: line 87
If tracked_changes=true or untracked_changes=true, stop before switching or creating a branch.
- Very specific: line 88
Use AskUserQuestion to offer Commit first, Stash and continue, or Abort.
- Very specific: line 112
After creating or resuming the branch, record the parent using GitHub CLI's supported per-branch merge-base configuration so /create-pr can …
- Very specific: line 140
When {parent-branch} is merged, use /rebase merged {parent-branch} to rebase onto main
- Very specific: line 144
Only offer this when the branch exists on origin.
≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Create Stacked Branch
Create a new branch based on an existing PR branch (not main) for dependent work.
Usage
/stack-branch AB-456
/stack-branch AB-456 feature/parent-branch # Explicit parentInstructions
1. Get the Jira Ticket
The first argument is the Jira ticket number for the new work.
Use jira-ticket for the key, summary and issue type. It owns tool availability, deferred discovery and unavailable-context handoffs. If skill invocation is absent, read that installed skill and follow it; do not reconstruct the lookup. Stop branch creation if required context remains unavailable rather than guessing the branch prefix.
2. Identify Parent Branch
If parent branch not specified:
# Check if currently on a feature branch
git branch --show-currentIf attached to a non-default branch, offer to use it as the parent. If detached or on the repository default branch, ask which PR branch to stack on.
3. Resolve the parent ref
Fetch the parent branch read-only and require its remote-tracking ref to exist. The parent is an
existing PR branch, so origin/{parent-branch} is the authoritative base. Do not check out or pull
the parent branch:
git fetch origin {parent-branch}
git rev-parse --verify origin/{parent-branch}4. Create Branch Name
Map the Jira issue type to conventional commit prefix:
| Issue Type | Prefix |
| Story | feat |
| Task | feat |
| Bug | fix |
| Improvement | feat |
| Spike | chore |
| Sub-task | inherit from parent |
Create branch name:
{prefix}/{TICKET}-{summary-in-kebab-case}Example: feat/AB-456-add-caching-layer
5. Preflight the new branch
Run the shared read-only branch preflight before changing checkout state:
~/.agents/skills/start-ticket/scripts/git-branch-preflight.sh {new-branch-name}Working tree gate
If tracked_changes=true or untracked_changes=true, stop before switching or creating a branch.
Use AskUserQuestion to offer Commit first, Stash and continue, or Abort. Never stash,
discard, or carry changes to another branch without that choice. If HEAD is detached, stop and ask
the user to preserve it on a branch before switching away.
Existing branch gate
- A non-empty
worktree_paththat differs fromcurrent_worktreemeans another worktree owns the target: do not switch or create; report the path and offer to continue there. Compare canonical worktree roots, not the invocation directory (which may be a subdirectory). local_branch_exists=true: offer Resume existing branch or Abort. Resume withgit switch {new-branch-name}and skip creation.- Remote-only (
remote_branch_exists=true): offer Track remote branch or Abort. If chosen, fetch it and rungit switch --track -c {new-branch-name} origin/{new-branch-name}. - With no local branch and
remote_branch_exists=unknown, stop before creating or pushing because collision safety is unresolved.
6. Create the branch
For a genuinely new branch, branch directly from the fetched parent ref:
git switch --no-track -c {new-branch-name} origin/{parent-branch}After creating or resuming the branch, record the parent using GitHub CLI's supported per-branch
merge-base configuration so /create-pr can target it later:
git config branch.{new-branch-name}.gh-merge-base {parent-branch}7. Confirm branch push
Rerun the preflight for {new-branch-name} after creating or resuming it. Skip this phase only when
target_published=true: HEAD matches the exact origin/{new-branch-name} destination, not a parent
upstream. On unknown or a preflight error, stop; on false, offer to publish the branch.
Show the exact branch and remote, then use AskUserQuestion
immediately before the command. If approved, the command must be the next tool call, standalone
and unchained:
git push -u origin {new-branch-name}Approval applies only to that one command. A retry or any later remote mutation requires fresh confirmation. If declined, keep the branch local and do not attempt PR creation.
8. Inform user
Tell the user:
- Created or resumed branch
{new-branch-name}based on{parent-branch} /create-prwill read the recorded parent and target{parent-branch}, notmain- When
{parent-branch}is merged, use/rebase merged {parent-branch}to rebase onto main
9. Offer draft PR handoff
Only offer this when the branch exists on origin. Ask whether to continue with:
/create-pr --draft {parent-branch}This choice authorizes only the handoff. /create-pr owns the complete draft, the immediate PR
creation confirmation, the remote command, and closing the associated bead. Approval of the earlier
branch push never carries into PR creation.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

