|
| 1 | +--- |
| 2 | +name: implement |
| 3 | +description: Implement a GitHub issue end-to-end: fetch, plan, code with approval, commit incrementally, and generate a PR summary |
| 4 | +--- |
| 5 | + |
| 6 | +Implement a GitHub issue end-to-end: fetch the issue, plan, code with approval, commit incrementally, and generate a PR summary. |
| 7 | + |
| 8 | +Read `AGENTS.md` first. It is the canonical project guide for this repository. |
| 9 | + |
| 10 | +The argument is an issue number (e.g. `/implement 42`) or a full GitHub URL (e.g. `/implement https://github.com/finos/git-proxy/issues/42`). If no argument is given, ask the user. |
| 11 | + |
| 12 | +## Phase 1: Fetch issue |
| 13 | + |
| 14 | +1. Parse the argument: |
| 15 | + - If it is a full URL like `https://github.com/{owner}/{repo}/issues/{number}`, extract `{owner}/{repo}` and `{number}`. |
| 16 | + - If it is just a number, use the current repo (run `gh repo view --json nameWithOwner -q .nameWithOwner` to get it). |
| 17 | +2. Fetch issue details: |
| 18 | + ``` |
| 19 | + gh issue view <number> --repo <owner/repo> --json title,body,labels,assignees,comments |
| 20 | + ``` |
| 21 | +3. Display a summary to the programmer: |
| 22 | + - Issue number and title |
| 23 | + - Labels (if any) |
| 24 | + - Body (truncated to ~40 lines if longer) |
| 25 | + - Number of comments and any noteworthy discussion points |
| 26 | +4. Ask the programmer to confirm this is the right issue before proceeding. Use AskUserQuestion with options: "Proceed", "Show full issue body", "Cancel". |
| 27 | + |
| 28 | +## Phase 2: Branch setup |
| 29 | + |
| 30 | +1. List all configured remotes: `git remote -v` |
| 31 | +2. If there is more than one remote, ask the programmer which remote to use as upstream using AskUserQuestion (list the remote names as options). |
| 32 | + If there is only one remote, use it automatically. |
| 33 | +3. Fetch and update main from the chosen remote: |
| 34 | + ``` |
| 35 | + git fetch <remote> |
| 36 | + git checkout main |
| 37 | + git pull <remote> main |
| 38 | + ``` |
| 39 | +4. Create a new branch from main. The branch name must follow this convention: |
| 40 | + - Format: `<type>/<short-slug>` where `<type>` is a Conventional Commits type (`feat`, `fix`, `refactor`, `docs`, `chore`, etc.) and `<short-slug>` is a kebab-case summary derived from the issue title (3-5 words max). |
| 41 | + - Examples: `feat/dynamic-allocation-support`, `fix/event-watcher-reconnect`, `refactor/pod-spec-converter` |
| 42 | + - Pick the type based on the issue labels and description (e.g. a bug report maps to `fix/`, a feature request to `feat/`). |
| 43 | + ``` |
| 44 | + git checkout -b <type>/<short-slug> |
| 45 | + ``` |
| 46 | +5. Confirm to the programmer: "Created branch `<branch-name>` from `<remote>/main`." |
| 47 | + |
| 48 | +## Phase 3: Plan |
| 49 | + |
| 50 | +1. Based on the issue description, explore the codebase to understand the relevant code paths. Use subagents to search for files, classes, and patterns referenced in or implied by the issue. |
| 51 | +2. Create an implementation plan with numbered steps. Each step should be a logical, committable unit of work. The plan must include: |
| 52 | + - A 1-2 sentence summary of the issue |
| 53 | + - Numbered steps, where each step has a title, a description of what to change, and the affected file paths |
| 54 | +3. Save the plan to `plans/implement-<issue-number>.md` using this format: |
| 55 | + |
| 56 | + ``` |
| 57 | + ## Issue #<number>: <title> |
| 58 | +
|
| 59 | + <1-2 sentence summary of what the issue asks for> |
| 60 | +
|
| 61 | + ## Steps |
| 62 | +
|
| 63 | + 1. <step title> |
| 64 | + - <what to change and where> |
| 65 | + - Files: <path/to/file.ts> |
| 66 | +
|
| 67 | + 2. <step title> |
| 68 | + - <what to change and where> |
| 69 | + - Files: <path/to/file.ts, path/to/other.ts> |
| 70 | + ``` |
| 71 | + |
| 72 | +4. Show the full plan to the programmer for approval. |
| 73 | +5. Ask the programmer using AskUserQuestion with options: "Approve plan", "Modify plan", "Cancel". |
| 74 | +6. If the programmer wants modifications, iterate on the plan until approved. |
| 75 | + |
| 76 | +## Phase 4: Execute step by step |
| 77 | + |
| 78 | +For each step in the approved plan: |
| 79 | + |
| 80 | +1. Announce the step: "Step <n>/<total>: <step title>" |
| 81 | +2. Make the code changes for that step |
| 82 | +3. If the step involves logic changes, run tests (`npm run test`) and show the result |
| 83 | +4. Show the programmer a brief summary of what changed (key files and the nature of the change) |
| 84 | +5. Ask the programmer using AskUserQuestion with options: "Commit this step", "Revise changes", "Skip this step", "Stop here". |
| 85 | +6. If the programmer picks "Commit this step", run the /commit skill to commit the changes |
| 86 | +7. If the programmer picks "Revise changes", iterate until they are satisfied |
| 87 | +8. If the programmer picks "Skip this step", move to the next step without committing |
| 88 | +9. If the programmer picks "Stop here", skip all remaining steps and jump to Phase 5 |
| 89 | + |
| 90 | +After each commit, briefly confirm the commit was made and move to the next step. |
| 91 | + |
| 92 | +## Phase 5: Summary |
| 93 | + |
| 94 | +1. After all steps are complete (or the programmer stops early): |
| 95 | + - Run the /summary skill to generate a PR description based on all commits made during this session |
| 96 | + - Show the summary to the programmer |
| 97 | +2. Do NOT create a PR or push. Just present the summary for the programmer to use when they are ready. |
| 98 | +3. If no commits were made (e.g. the programmer cancelled early), skip the summary and say so. |
| 99 | + |
| 100 | +## Rules |
| 101 | + |
| 102 | +- Never make code changes without programmer approval |
| 103 | +- Always show what changed after each step before committing |
| 104 | +- The programmer can modify, skip, reorder, or stop steps at any point |
| 105 | +- Save the plan file before starting execution so the programmer has a reference |
| 106 | +- Each commit should be a logical unit (one step = one commit, unless the step is trivial) |
| 107 | +- If the issue is from a different repo (not the current one), fetch it via the full URL but make changes in the current repo |
| 108 | +- No emojis in any output |
| 109 | +- Do not create a PR or push to remote — only local commits and a summary |
| 110 | +- If a step requires running tests, run them and show results before committing |
| 111 | +- Use subagents for codebase exploration and code changes; keep the main flow focused on coordination and programmer interaction |
| 112 | + |
| 113 | +$ARGUMENTS |
0 commit comments