Start working on a GitHub issue - shows ready items, handles assignment and branch creation
Start working on a GitHub issue by assigning yourself, moving it to In Progress, and creating a feature branch. Use this when you're ready to begin coding on a new task or sub-task.
/plugin marketplace add jwilger/claude-code-setup/plugin install sdlc@jwilger-claude-pluginsStart or continue working on a GitHub issue. This command:
$ARGUMENTS - Optional issue number to work on directly (e.g., /sdlc:work 123)
Read .claude/sdlc.yaml to get:
If config doesn't exist, inform user to run /sdlc:setup first.
git status --porcelain
If there are uncommitted changes, ERROR:
Cannot start new work with uncommitted changes.
Options:
1. Commit your changes: git add . && git commit
2. Stash your changes: git stash
3. Discard changes: git checkout .
Then run /sdlc:work again.
Fetch and pull the latest changes:
git fetch origin
git pull --ff-only
If pull fails due to diverged history, inform user and suggest resolution.
Before showing issues, search memento for relevant project context:
mcp__memento__semantic_search: "current work in progress [project-name]"
This helps identify if there's already work in progress that should be the default.
If using GitHub Projects:
gh project-ext ready # Shows Ready items sorted by priority
Also get In Progress items:
gh project item-list <project-number> --owner <owner> --format json | \
jq '.items[] | select(.status == "In Progress")'
If not using projects, fall back to:
gh issue list --state open --json number,title,labels,assignees
IMPORTANT: Sub-issues should ONLY be listed when their parent issue is In Progress. Do NOT fetch or display sub-issues for Ready items or any other status.
For each In Progress issue (and ONLY In Progress issues), check if it has sub-issues that are not Done:
gh issue-ext sub list <issue-number> --json
This returns JSON with sub-issue details including state. Filter to include sub-issues where:
Collect these sub-issues with their parent issue context for presentation in Step 6.
Check the current branch for linked issues:
git branch --show-current
If branch name contains an issue number (e.g., feature/123-add-login), that issue should be the default selection.
Also check:
gh issue list --assignee @me --state open
Use AskUserQuestion to show available work:
Format issues as options:
Sub-issue Priority: Sub-issues of In Progress items should be shown prominently (after any "Currently working on" item but before general Ready items) since they represent work that's already been scoped and is blocking completion of the parent.
Include context from memento search if relevant.
Let user select an issue or enter a custom issue number.
gh issue edit <number> --add-assignee @me
gh project-ext move <number> "In Progress"
Generate slug from issue title (lowercase, hyphens, max 50 chars).
If using git-spice:
First, determine current branch and default branch:
git branch --show-current
git symbolic-ref refs/remotes/origin/HEAD | sed 's@^refs/remotes/origin/@@'
If on default branch (main/master):
Simply create the new branch (use --no-commit to avoid empty commit issues when working directory is clean):
gs branch create <issue-number>-<slug> --no-commit
If NOT on default branch:
Check if there's a PR for the current branch:
gh pr view --json state,url,mergedAt 2>/dev/null
Scenario 1: No PR exists for current branch
Use AskUserQuestion:
No PR for current branch
Branch
<current-branch>doesn't have a PR yet. For proper stacking with git-spice, the base branch should have a PR.Options:
- Create PR first — Run
/sdlc:prto create a PR for<current-branch>, then run/sdlc:workagain- Start new stack from main — Switch to main and start fresh (parallel work, no stacking)
- Stack anyway (advanced) — Create stacked branch without base PR (you'll need to create PRs in order later)
If "Create PR first": Stop and inform user to run /sdlc:pr
If "Start new stack from main":
git checkout <default-branch>
git pull --ff-only
gs branch create <issue-number>-<slug> --no-commit
If "Stack anyway":
gs branch create <issue-number>-<slug> --no-commit
Scenario 2: PR exists but is merged
Use AskUserQuestion:
PR already merged
The PR for
<current-branch>has been merged. You should switch to main and pull the updates before starting new work.Options:
- Switch to main and pull — Recommended: checkout main, pull updates, then create branch
- Stay here — Keep working from this branch (not recommended)
If "Switch to main and pull":
git checkout <default-branch>
git pull --ff-only
gs branch create <issue-number>-<slug> --no-commit
Scenario 3: PR exists and is open
Use AskUserQuestion:
Stack on current branch?
You're on
<current-branch>which has an open PR. When using git-spice, you can:
- Stack on current branch — Creates new branch as a child of
<current-branch>(stacked PR workflow)- Start new stack from main — Switches to main first, then creates branch (parallel work)
If "Stack on current branch":
gs branch create <issue-number>-<slug> --no-commit
If "Start new stack from main":
git checkout <default-branch>
git pull --ff-only
gs branch create <issue-number>-<slug> --no-commit
If using standard git:
git checkout -b feature/<issue-number>-<slug>
Create a memory noting the current work:
mcp__memento__create_entities:
name: "Current Work Session [date]"
entityType: "work_session"
observations:
- "Working on issue #<number>: <title>"
- "Project: <project-name> | Path: <repo-path>"
- "Branch: <branch-name>"
Show the issue details and acceptance criteria:
gh issue view <number>
If the issue has sub-issues:
gh issue-ext sub list <number>
Display:
Ready to work on #<number>: <title>
Branch: <branch-name>
Status: In Progress
Acceptance Criteria:
<from issue body>
Sub-issues:
<if any>
The SDLC will guide your TDD workflow. Just describe what you want to implement.
/sdlc:setupgit pull --rebase or manual resolution