/software-engineering:feature-flow-w [context | #issue-number] [--skip-branch] [--skip-issue] [--skip-mr] [--squash] [--msg "text"] [--dry-run] [--force] [--worktree-path <path>]from software-engineering
Orchestrates a complete git worktree workflow for feature development. Creates parallel working directories for multiple simultaneous features without switching branches. Supports staged changes mode and issue-driven mode with GitHub/GitLab/Forgejo integration.
Ships in software-engineering. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Orchestrate a complete git workflow using worktrees for feature development. Creates a parallel working directory instead of switching branches, keeping your current branch untouched. Two modes:
#<number>): Retrieve issue → validate relevance → worktree + branch → implement → lint → test → verify → commit → merge (all in worktree)Use feature-flow-w instead of feature-flow when you want to work on multiple features simultaneously without leaving your current branch.
Route based on $argument: first positional argument matching #<number> or bare <number> → Issue Mode; otherwise → Staged Changes Mode.
Issue Mode examples: /feature-flow-w #42, /feature-flow-w 42 --squash
Staged Mode examples: /feature-flow-w, /feature-flow-w add user auth, /feature-flow-w --skip-issue
Before creating any worktree, compute the target path:
--worktree-path <path> (or -w <path>) provided → use that path (resolve to absolute if relative)<repo-parent>/<repo-name>-<sanitized-branch> where / in branch name becomes -
/home/user/my-project, branch feat/add-auth → /home/user/my-project-feat-add-authStore <worktree-path> and <original-path> (result of pwd) for use throughout all phases.
Execute parallel git commands: git status and git diff --staged
Detect Repository Host: Use the detect-repo-host skill to identify the hosting service (GitHub, GitLab, or Forgejo) and extract owner/repo details.
Analysis steps:
Analyze staged changes:
feat, test+fixes → fix, docs only → docs, structural → refactor, build/config → choresrc/api/ → api, internal/auth/ → auth)Generate proposed branch name:
<type>/<scope>-<description> (kebab-case, 2-4 words)feat/api-user-profile, fix/auth-jwt-validation, docs/readme-updateError handling:
detect-repo-host skill provides detailed error messagesParse flags: --skip-branch or -b → skip this phase (no worktree created, behaves like original feature-flow).
If not skipped:
git rev-parse --abbrev-ref HEAD<path> with branch <name>?" with options: "Yes, create worktree", "Use different name", "Skip worktree creation"Worktree creation sequence (staged changes transfer):
git diff --staged > /tmp/feature-flow-w-staged-$(date +%s).patchgit reset HEADgit worktree add <path> -b <branch-name>cd <path> && git apply <patch-file> && git add .git apply in step 4 exited 0 and cd <path> && git status --porcelain shows the expected staged files). Only after this confirmation, discard the transferred changes from the source working tree by reverse-applying the same patch: cd <original-path> && git apply -R <patch-file>. Reverse-applying (instead of git checkout -- .) removes only the moved changes and leaves any unrelated uncommitted work in the source untouched, so the changes never live in two places. If the apply did not verify, do NOT touch the source — fall through to the patch-apply error path below (which restores the original).rm <patch-file>git worktree listError handling:
<path>-v2 or ask for alternativegit worktree remove <path>), re-stage original changes (git stash pop or re-apply patch), display error, suggest manual resolution<name>-v2 or ask for alternative.gitmodules detected → Run git submodule update --init --recursive in new worktreeParse flags: --skip-issue or -i → skip this phase.
If not skipped:
List available labels (same pattern as /create-issue skill):
gh label list --repo <owner>/<repo>glab label listfgj label list -R <owner>/<repo>Generate issue content following /create-issue conventions:
feat→enhancement, fix→bug, docs→documentation, etc.), validate against available labelsDisplay preview, ask confirmation: "Create issue with this content?" → "Yes, create issue" / "Skip issue creation"
Create issue if approved:
gh issue create --repo <owner>/<repo> --title "<title>" --body "<body>" --label "<label1>" --label "<label2>" --assignee @meglab issue create --title "<title>" --description "<body>" --label "<label1>" --label "<label2>" --assignee "$(glab api user | jq -r '.username')"fgj issue create -R <owner>/<repo> -t "<title>" -b "<body>" -l <label1> -l <label2> (no assignee flag — fgj does not yet support issue assignment, so omit self-assign)Error handling:
gh/glab/fgj CLI not installed → Skip issue creation, warn, continue to commitAll git commands execute in worktree directory (if created): prefix with cd <worktree-path> &&.
Generate conventional commit message following /commit skill format (see commit.md for full spec):
Closes #<issue-number> (always use Closes, not Refs, when an issue was created in Phase 3)commit skill's no-attribution policy)Display preview, ask confirmation: "Commit with this message?" → "Yes, commit now" / "Edit message" / "Cancel workflow"
Execute: cd <worktree-path> && git commit -m "<message>", verify with cd <worktree-path> && git log -1 --oneline.
Error handling:
Display workflow summary showing:
<worktree-path>cd <worktree-path>cd <original-path>git worktree remove <worktree-path> && git branch -d <branch-name>Detect Repository Host: Use the detect-repo-host skill.
Get current branch: git rev-parse --abbrev-ref HEAD
Fetch issue details:
gh issue view <number> --repo <owner>/<repo> --json title,body,labelsglab issue view <number>fgj issue view <number> -R <owner>/<repo> --jsonExtract: Title (→ branch name, commit, MR title), Body (→ implementation spec), Labels (→ type detection)
Validate the issue is still relevant (ESSENTIAL — never skip):
The codebase may have changed since the issue was opened, so the issue may already be resolved or no longer applicable. Before doing any work, confirm it still holds:
file:line), then ask via AskUserQuestion: "Proceed anyway" / "Adjust scope to remaining work" / "Abort" (optionally comment on or close the issue).This check is read-only and always runs, including under --dry-run and --force. In --force mode, run the check and auto-proceed when the issue is still valid; if it is clearly already resolved, abort with the evidence instead of implementing redundant changes.
Error handling:
gh/glab/fgj CLI not installed → Abort: "Cannot retrieve issue. Install gh (GitHub), glab (GitLab), or fgj (Forgejo) CLI first."Parse flags: --skip-branch or -b → skip this phase.
If not skipped:
Derive branch type from labels:
| Label contains | Type |
|---|---|
| bug, bugfix, fix | fix |
| enhancement, feature | feat |
| documentation, docs | docs |
| refactor | refactor |
| test | test |
| ci, ci-cd | ci |
| performance | perf |
| (no match) | feat |
Generate branch name: <type>/<scope>-issue-<N> (scope from issue title, kebab-case)
Compute worktree path (see Worktree Path Computation above)
Ask confirmation via AskUserQuestion: "Create worktree at <path> with branch <name>?" → handle response same as Phase 2.
Create worktree: git worktree add <path> -b <branch-name>
If .gitmodules detected: cd <path> && git submodule update --init --recursive
Verify: git worktree list
Error handling:
<path>-v2 or ask for alternative<name>-v2 or ask for alternativeAll file operations target the worktree directory.
Use the run-lint skill with working_directory set to <worktree-path>. If lint fails, ask user whether to continue.
Use the run-tests skill with working_directory set to <worktree-path>. If tests fail, ask user whether to continue.
All commands run in worktree directory.
cd <worktree-path> && git diff --stat summaryAll git commands run in worktree directory.
cd <worktree-path> && git add <files from Phase I-3> (only created/modified files)Closes #<N>cd <worktree-path> && git commit -m "<message>", verify with cd <worktree-path> && git log -1 --onelineError handling: Pre-commit hook fails → abort with recovery steps; commit fails → abort.
On successful commit: Immediately proceed to Phase I-8.
Parse flags: --skip-mr → skip this phase.
Build command: cd <worktree-path> && auto-mr [--msg "<message>"]
auto-mr squashes by default; there is no --squash flag to forward. --squash/-s is a no-op kept for backward compatibility.--msg: default <type>(<scope>): <issue-title> (Closes #<N>), override with user's --msgPre-flight (run before asking):
auto-mr --version — if auto-mr is not installed, skip this phase entirely and
show git push -u origin <branch-name> instead.cd <worktree-path> && git rev-parse --abbrev-ref HEAD — if this is the default branch
(main/master), stop. auto-mr will not refuse on its own, and merging a
default branch into itself then deleting it is not recoverable from here.cd <worktree-path> && git status --porcelain — if the tree is dirty, list the uncommitted files
and let the user decide before proceeding.Confirmation (required — never skip, never infer): ask via AskUserQuestion:
Run
auto-mron<branch-name>? This pushes the branch, opens the MR/PR, waits for CI, and then merges it and deletes the branch automatically if CI passes.
Options: "Yes — push, merge and delete" / "Cancel — leave the commit local"
Do not treat the Phase I-7 commit approval as covering this. Committing and merging are different decisions with very different blast radius, and this is the only irreversible step in the workflow.
Execute: Run auto-mr from worktree → on success display MR/PR URL → on failure warn and show manual push instructions. If the failure looks like a pipeline timeout, verify the MR/PR is still open and unmerged (gh pr view / glab mr view / fgj pr view) before reporting the outcome.
Display summary showing:
<worktree-path>cd <worktree-path>cd <original-path>git worktree remove <worktree-path> && git branch -d <branch-name>Both modes:
| Flag | Short | Effect |
|---|---|---|
--skip-branch | -b | Skip worktree/branch creation, stay on current branch |
--worktree-path <path> | -w <path> | Override default worktree directory location |
--dry-run | -n | Preview mode: show what would be done without executing |
--force | -f | Skip all confirmation prompts, auto-approve all phases |
Staged changes mode only:
| Flag | Short | Effect |
|---|---|---|
--skip-issue | -i | Skip issue creation |
Issue mode only:
| Flag | Short | Effect |
|---|---|---|
--squash | -s | No-op — auto-mr squashes by default already |
--msg "text" | -m "text" | Custom MR message for auto-mr |
--skip-mr | none | Skip auto-mr phase (I-8) |
Flag parsing: Split $argument by spaces. Tokens starting with -- or - are flags. #<number> or bare <number> as first positional → Issue Mode. Remaining non-flag text → context for branch/commit description. --worktree-path / -w consumes the next token as its value.
Dry run (--dry-run): Executes discovery/retrieval phases, displays all proposed actions (worktree path, branch, issue, commit, implementation plan, lint/test commands), but does NOT execute any mutations. Ends with "Dry run complete. No changes made."
Force mode (--force): Skips all AskUserQuestion calls, auto-approves all phases. Still displays progress and aborts on errors.
feature-flow-w vs feature-flow| Use case | Command |
|---|---|
| Work on multiple features in parallel | feature-flow-w |
| Keep current branch untouched | feature-flow-w |
| Simple single-feature workflow | feature-flow |
| Branch switching is acceptable | feature-flow |
| CI running on current branch, need to start new work | feature-flow-w |
Works with /create-issue (same CLI logic), /commit (same conventional format), and /analyze-pr (compatible output).
# Stage files, create worktree → branch + issue + commit
git add api/user.go api/user_test.go
/feature-flow-w
# Custom worktree location
git add api/user.go
/feature-flow-w --worktree-path ~/worktrees/user-feature
# Skip issue creation for trivial changes
git add docs/README.md
/feature-flow-w --skip-issue
# Preview without executing
git add database/schema.sql
/feature-flow-w --dry-run
# Minimal workflow: commit only (no worktree, no issue)
git add config.yml
/feature-flow-w --skip-branch --skip-issue
# Full workflow from issue (creates worktree)
/feature-flow-w #42
# With squash merge
/feature-flow-w #42 --squash
# Custom worktree path
/feature-flow-w #42 --worktree-path ../my-project-issue-42
# Implement and commit only, no MR
/feature-flow-w #42 --skip-mr
# Auto-approve everything
/feature-flow-w #42 --force --squash
| # | Error | Message / Action |
|---|---|---|
| 1 | No staged changes | "No staged changes found. Stage files with 'git add ' first." |
| 2 | Not a git repository | "Not a git repository. Initialize with 'git init' first." |
| 3 | Branch already exists | Suggest <name>-v2 or ask for alternative |
| 4 | Worktree directory already exists | Suggest <path>-v2 or ask for alternative |
| 5 | Branch checked out in another worktree | Display the other worktree path, ask for different branch name |
| 6 | Patch apply fails | Remove worktree, display error, suggest manual resolution |
| 7 | Pre-commit hook fails | Display hook output, abort, suggest fixing and retrying |
| 8 | gh/glab/fgj CLI not found (issue) | Skip issue creation, warn, continue to commit |
| 9 | Invalid labels | Remove invalid labels silently, warn user |
| 10 | Issue creation fails | Log error, continue to commit without issue reference |
| 11 | Commit fails | Display git error, abort |
| 12 | .gitmodules detected | Run git submodule update --init --recursive in new worktree |
| # | Error | Message / Action |
|---|---|---|
| 13 | Issue not found | "Issue #N not found in <owner/repo>." Abort. |
| 14 | gh/glab/fgj CLI not found (retrieval) | "Cannot retrieve issue. Install gh, glab, or fgj CLI first." Abort. |
| 14b | Issue already resolved / no longer relevant | Report evidence (file:line); ask to proceed / adjust scope / abort |
| 15 | Worktree directory already exists | Suggest <path>-v2 or ask for alternative |
| 16 | Branch checked out in another worktree | Display the other worktree path, ask for different branch name |
| 17 | Lint failure | Display errors, attempt auto-fix, ask user to continue or abort |
| 18 | Test failure | Display output, attempt fix (max 2 retries), ask user |
| 19 | auto-mr not installed | Warn, show manual push: git push -u origin <branch-name> |
| 20 | auto-mr fails | Show error, provide manual push command and MR URL |
| 21 | .gitmodules detected | Run git submodule update --init --recursive in new worktree |
--dry-run first to preview either mode--skip-issue for trivial changes (staged mode)/feature-flow-w add OAuth2 integration--worktree-path when the default path is too long or you prefer a specific location--skip-mr to commit without creating a merge request (issue mode)git worktree remove <path> && git branch -d <branch>git worktree list/feature-flow-w → work in worktree → /commit → /analyze-prWhat SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub sgaunet/claude-plugins --plugin software-engineering18 skills in this plugin
/analyze-and-create-issueAnalyze codebase and create GitHub/GitLab/Forgejo issues per finding/analyze-prReview PR for quality, security, and coverage (GitHub/GitLab/Forgejo)/audit-codebaseAudit security, performance, and best practices holistically/auto-mrPush current branch, create MR/PR on GitHub, GitLab, or Forgejo, wait for CI pipeline, merge, and clean up branch using auto-mr CLI/check-claude-md-tokensMonitor and optimize CLAUDE.md token count to stay under 2500 token limit/commitCreate conventional commit from staged changes with approvalOther plugins' skills for the same job