| name | gh-weld-next |
| description | Pick an open GitHub issue to work on, then create a branch and hand off to the user. Lists open issues, lets you select one, reads the full issue details, optionally adds context notes posted as an issue comment, creates a branch, and confirms you're ready to implement. Pair with /gh-weld-ship when work is done. Use when: starting a new piece of work, picking the next issue from the backlog, adding notes or context to an issue before branching, or annotating an issue with decisions before starting work. |
gh-weld-next
Find something to work on. Read it. Branch. Go.
NEVER
- NEVER pick a blocked issue (one whose blocker issues are still open) without warning the user — starting blocked work wastes the sprint and may require a branch rename when the blocker resolves
- NEVER create a branch from main if main has uncommitted changes — uncommitted changes contaminate the new branch and pollute the issue diff. Instead: commit or stash first.
Workflow
1 — Check working tree
Run git status --porcelain. If the tree is dirty: output "Working tree has uncommitted changes — commit or stash before starting new work." and stop. This loop always branches from a clean main (see the NEVER rule above), so any uncommitted change — on main or a feature branch — would be carried onto the new branch and pollute the issue diff.
Run git branch --show-current. If not on main or master: warn "You're on branch <branch> — switch to main before starting new work? (y/n)". On yes, run git checkout main.
Run git pull to get the latest. If the pull fails (diverged history or merge conflict): output "git pull failed — main has diverged. Resolve the conflict or reconcile manually before starting new work." and stop. Do not branch from an unmerged main.
2 — List open issues
gh issue list --state open --json number,title,labels,updatedAt
Display as a numbered menu. For each issue show: N. #<number> — <title> [<labels>]. Sort by issue number ascending.
If no open issues: output "No open issues. Run /gh-weld-issue to create one." and stop.
3 — Pick
Ask: "Which issue? Enter a number from the list, or describe what you want to work on."
If the user is undecided, suggest the next issue by judgment, not just list order: prefer the highest-priority unblocked issue, break ties toward the one that unblocks the most other open issues, then toward the smallest well-scoped change that can ship this session. Surface the reason ("#N is unblocked and unblocks #X, #Y") rather than just naming it.
If the user describes something: match against titles and confirm before proceeding. If no match, offer to run /gh-weld-issue first.
Read the full issue:
gh issue view <N> --json number,title,body,labels
Display the full title and body so the user can read the acceptance criteria.
Check for blockers: look for Depends on # or Blocked by # in the body. If found, fetch each referenced issue:
gh issue view <blocker-N> --json number,title,state
If any blocker is still open: warn "Issue #N is blocked by open issue # — . Work on it anyway? (y/n)". If no, return to step 3.
Ask: "(a)ccept, (r)evise, or (s)kip?"
4 — Create branch
Infer a branch name from the issue title: lowercase, hyphens, max 50 chars. Prefix with fix/ for bugs, feat/ for features, chore/ for chores — inferred from labels. If type is ambiguous, use no prefix.
Show the proposed name and ask: "(a)ccept or enter a different name?"
git checkout -b <branch-name>
If the branch already exists (fatal: a branch named '<branch-name>' already exists): ask "Branch <branch-name> already exists — enter a different name, or (c)heck out the existing one?" Do not overwrite it.
5 — Hand off
Output:
Ready. You're on branch `<branch-name>` — issue #<N> is waiting.
When you're done: /gh-weld-ship
Stop. The user implements. /gh-weld-ship picks it up from here.