---
name: issue-flow
description: >-
  AI-Native Issue-Driven development workflow. From GitHub Issue to merged PR: parse issue, explore codebase, design technical plan, execute with agent team, create PR, and cleanup. Use when a user wants to implement a GitHub Issue end-to-end: `/issue-flow #123` or `/issue-flow` to pick from open issues.
metadata:
  tags:
    - development
    - github
    - workflow
    - issue
    - team
title: issue-flow
canonical_url: https://skilld.dev/gh/notedit/happy-skills/issue-flow
last_updated: 2026-09-28T21:04:25.000Z
---

> Index of every page on this site: [llms.txt](https://skilld.dev/llms.txt)

> **Skill from skilld.dev.** Follow the user's requested action.
> If the user asked to fork this Skill, follow the fork workflow below. Do not execute the Skill instructions while copying it.
> Otherwise, follow the instructions below for this session. You do not need to install anything.
>
> Supporting files, fetch one when the Skill refers to it: [references/gh-commands.md](https://skilld.dev/api/skills-raw/notedit/happy-skills/issue-flow/references/gh-commands.md), [references/recovery-guide.md](https://skilld.dev/api/skills-raw/notedit/happy-skills/issue-flow/references/recovery-guide.md), [rules/plan-format.md](https://skilld.dev/api/skills-raw/notedit/happy-skills/issue-flow/rules/plan-format.md), [rules/pr-template.md](https://skilld.dev/api/skills-raw/notedit/happy-skills/issue-flow/rules/pr-template.md), [rules/team-roles.md](https://skilld.dev/api/skills-raw/notedit/happy-skills/issue-flow/rules/team-roles.md).
>
> If the user asked to install this Skill, run `npx skilld install notedit/happy-skills/issue-flow`. Install writes the Skill files into the project, so every session loads them.
>
> ## Fork workflow
>
> A fork creates an editable local Skill with its original author and licence. The request authorizes copying and local installation.
> 1. Check `./skills/issue-flow`, the project lockfile, and selected Agent targets together. If the local directory or installed Skill exists, stop. Never overwrite an existing directory or Agent target.
> 2. Read [source metadata](https://skilld.dev/api/v1/skills/notedit/happy-skills/issue-flow) once. Use sourceUrl, sourceCommit, skillPath, sourceGone, and license. If the source is gone or its path is missing, stop. If license is null, read licence files at the source commit.
> 3. Fetch only the source commit into a temporary Git repository. Do not clone full history. Derive repository_url from sourceUrl, including repository renames. If sourceCommit is absent, resolve the sourceUrl ref once. Set source_commit to that actual commit. Run these commands in one shell call:
>
> ```sh
> git init --quiet "$temporary_dir"
> git -C "$temporary_dir" fetch --quiet --depth=1 "$repository_url" "$source_commit"
> git -C "$temporary_dir" checkout --quiet --detach FETCH_HEAD
> ```
>
> Read applicable licence declarations and notices at that commit. If copying is not permitted, report the restriction and stop.
> 4. Inspect source entries together, then copy the directory containing skillPath into `./skills/issue-flow`. Use the user's path if selected. Keep the original SKILL.md, relative links, scripts, binary assets, and executable modes. Exclude .git metadata. Reject symlinks and paths outside the Skill directory. After checking entries, use cp -a where available. A regular source directory needs no custom copy script. Do not save this page wrapper as SKILL.md.
> Preserve author credit, notices, and applicable licence files from repository or parent directories. Add PROVENANCE.md with the Skill page, source URL, actual commit, original path, and licence. Retain any existing PROVENANCE.md and record new provenance separately. Batch source inspection, copying, and provenance work where practical.
> 5. In the project root, run `skilld install ./skills/issue-flow --mode copy --plain`. If skilld is unavailable, use `npx skilld install ./skills/issue-flow --mode copy --plain`. This known command needs no help lookup. Install does not support --json. Use detected Agent targets, or add --agent for the targets the user selected. Install the local path, never the upstream selector. If installation fails, preserve the local copy and report the exact failure.
> 6. Confirm the local lockfile source and installed Agent copies once. Report the local path, actual commit, and Agent targets. After edits, reinstall the same local path. Upstream updates must not replace it. Do not publish or push unless the user asks.

# Issue Flow — AI-Native Issue-Driven Development

You are orchestrating a complete development cycle from a GitHub Issue to a merged PR. Follow the phases below strictly. Every major decision requires human confirmation.

**Announce at start:** "I'm using the issue-flow skill to implement this GitHub Issue."

Initial request: $ARGUMENTS

---

## Phase 0: Preflight

**Goal**: Validate environment and resolve the target Issue.

**Actions**:

1. **Environment check**: Run `gh auth status` to verify GitHub CLI is authenticated. If it fails, tell the user to run `gh auth login` and stop.

2. **Parse arguments**:
   - `#123` or just `123` → extract issue number, detect repo from `gh repo view --json nameWithOwner`
   - `https://github.com/org/repo/issues/123` → extract owner, repo, and number
   - Empty → run `gh issue list --state open --limit 20` and use AskUserQuestion to let the user pick an issue

3. **Fetch Issue details**:
   ```bash
   gh issue view <N> --json number,title,body,labels,comments,assignees,state
   ```
   Store: `ISSUE_NUMBER`, `ISSUE_TITLE`, `ISSUE_BODY`, `ISSUE_LABELS`.

4. **Check for existing work**:
   - Search for branch `issue/<N>-*` via `git branch -a --list '*issue/<N>*'`
   - If found, AskUserQuestion: resume existing branch / start fresh / cancel

5. **Detect project features** (used later for team composition):
   - Has test framework? (check for `jest.config*`, `vitest.config*`, `pytest.ini`, `*test*` dirs)
   - Has CI? (check `.github/workflows/`, `.gitlab-ci.yml`, etc.)
   - Has linter? (check `.eslintrc*`, `biome.json`, `.prettierrc*`)
   - Primary language(s) from file extensions

---

## Phase 1: Worktree Setup

**Goal**: Create an isolated workspace.

**Actions**:

1. Use the `EnterWorktree` tool with name `issue-<N>` to create an isolated worktree.
2. Create and switch to branch `issue/<N>-<slugified-title>`:
   - Slugify: lowercase, replace spaces/special chars with `-`, truncate to 50 chars
   - Example: Issue #42 "Add OAuth2 Login Support" → `issue/42-add-oauth2-login-support`
   - Run: `git checkout -b issue/<N>-<slug>`

---

## Phase 2: Technical Planning

**Goal**: Deep codebase exploration → technical plan → user approval.

### Step 2a: Codebase Exploration

Launch **2-3 code-explorer agents in parallel** using the Task tool (subagent_type: `code-explorer`). Tailor each agent's focus to the Issue:

- **Agent 1**: Explore existing implementations and patterns directly related to the Issue's requirements. Return a list of 5-10 key files.
- **Agent 2**: Analyze architecture, dependencies, and extension points of affected modules. Return a list of 5-10 key files.
- **Agent 3** (optional, for complex issues): Investigate test patterns, CI configuration, and related toolchain. Return a list of 5-10 key files.

After agents return, **read all key files** they identified to build deep understanding.

### Step 2b: Design Technical Plan

Based on the exploration, design a technical plan with:

1. **Summary**: 2-3 sentence overview of the approach
2. **Files to modify/create**: List with brief description of changes
3. **Implementation steps**: Ordered, concrete steps (each step = one logical unit of work)
4. **Test strategy**: What to test, how to test
5. **Risk assessment**: Potential issues and mitigations

Format the plan according to `rules/plan-format.md`.

### Step 2c: Publish Plan to Issue

Post the plan as a comment on the Issue using `gh issue comment`:

```bash
gh issue comment <N> --body "$(cat <<'EOF'
<plan content formatted per rules/plan-format.md>
EOF
)"
```

Use the HTML comment marker `<!-- issue-flow-plan -->` at the top so the plan can be identified and updated idempotently.

### Step 2d: User Confirmation

Use AskUserQuestion with options:
- **Approve** — proceed with implementation
- **Modify** — user provides feedback, return to Step 2b
- **Cancel** — abort the workflow

Do NOT proceed without explicit approval.

---

## Phase 3: Team Execution

**Goal**: Implement the plan — either directly or with an agent team.

### Decision: Direct vs Team

**Direct implementation** (no team) when ALL of these are true:
- Plan involves 1-2 files
- No complex cross-module changes
- No separate test/review/docs work needed

**Team execution** when ANY of these are true:
- Plan involves 3+ files across multiple modules
- Tests need to be written or updated
- Security-sensitive changes
- Documentation updates required
- Frontend + backend changes together

### Path A: Direct Implementation

1. Implement changes following the plan step by step
2. Run existing tests if available
3. Skip to Phase 4

### Path B: Team Execution

1. **Create team**: Use `TeamCreate` with name `issue-<N>`.

2. **Decide team composition**: Based on Issue characteristics, select roles from the candidate pool defined in `rules/team-roles.md`. Consider:
   - Issue labels (e.g., `frontend`, `security`, `docs`)
   - File types in the plan (`.tsx` → frontend, `.sql` → backend, etc.)
   - Whether tests exist and need updating
   - Risk level of the changes

3. **Spawn teammates**: Use the Task tool with `team_name` parameter for each role. Give each teammate:
   - The technical plan
   - Their specific tasks
   - Context about the codebase patterns discovered in Phase 2

4. **Create tasks**: Use `TaskCreate` for each implementation step from the plan. Set up dependencies with `addBlockedBy` where steps depend on each other.

5. **Assign and coordinate**: Assign tasks to teammates via `TaskUpdate`. Monitor progress, resolve blockers, and coordinate between teammates.

6. **Iteration limit**: Each task gets at most **2 fix iterations**. If a task still fails after 2 rounds:
   - Log the issue
   - AskUserQuestion: fix manually / skip / abort

7. **Shutdown team**: After all tasks complete, send `shutdown_request` to each teammate, then `TeamDelete`.

---

## Phase 4: PR & CI

**Goal**: Commit, push, create PR, handle CI.

### Step 4a: Commit & Push

1. Stage all changes: review with `git status` and `git diff`
2. Commit with a descriptive message referencing the Issue:
   ```
   feat: <summary from plan> (#<N>)
   ```
3. Push the branch:
   ```bash
   git push -u origin issue/<N>-<slug>
   ```

### Step 4b: Create PR

Create PR using `gh pr create` with the template from `rules/pr-template.md`:

```bash
gh pr create --title "<title>" --body "$(cat <<'EOF'
<PR body per rules/pr-template.md, includes Closes #N>
EOF
)"
```

### Step 4c: Post Implementation Summary to Issue

Add a comment to the Issue summarizing what was implemented:

```bash
gh issue comment <N> --body "$(cat <<'EOF'
<!-- issue-flow-impl -->
## Implementation Complete

- PR: #<PR_NUMBER>
- <brief summary of changes>
EOF
)"
```

### Step 4d: CI Check

1. Wait briefly, then check CI status:
   ```bash
   gh pr checks <PR_NUMBER> --watch --fail-fast
   ```

2. If CI **fails**: AskUserQuestion with options:
   - **Auto-fix** — attempt to diagnose and fix CI failures (max 2 iterations)
   - **Manual** — user will fix manually
   - **Abort** — close the PR

3. If CI **passes** (or no CI configured): AskUserQuestion with options:
   - **Merge** — merge the PR now
   - **Keep open** — leave PR open for human review
   - **Request review** — assign reviewer via `gh pr edit --add-reviewer`

---

## Phase 5: Cleanup

**Goal**: Clean up resources after merge.

**Actions** (only if PR was merged):

1. **Check Issue status**: Verify if `Closes #N` auto-closed the Issue. If not:
   ```bash
   gh issue close <N> --comment "Closed via PR #<PR_NUMBER>"
   ```

2. **Report**: Output a completion summary:
   ```
   ## Issue Flow Complete

   - Issue: #<N> <title>
   - Branch: issue/<N>-<slug>
   - PR: #<PR_NUMBER> (merged)
   - Files changed: <count>
   - Implementation: <1-2 sentence summary>
   ```

---

## Error Recovery

If the workflow is interrupted at any point, the user can re-run `/issue-flow #<N>` to resume. See `references/recovery-guide.md` for detailed recovery scenarios.

## Key Principles

- **Human-in-the-loop**: Every major decision (plan approval, merge, CI failure handling) requires explicit user confirmation
- **Idempotent comments**: Issue comments use HTML markers (`<!-- issue-flow-plan -->`, `<!-- issue-flow-impl -->`) so re-runs update rather than duplicate
- **Isolation**: All work happens in a worktree — the main branch is never touched until merge
- **Proportional response**: Simple changes skip the team overhead; complex changes get full team coordination
