|
| 1 | +--- |
| 2 | +name: gh-issue |
| 3 | +description: Hand off a GitHub issue to an OpenCode agent for implementation. Fetches the issue, creates a worktree, then either starts implementation (type::task) or prepares design docs first (type::story). |
| 4 | +--- |
| 5 | + |
| 6 | +You are being asked to take ownership of a GitHub issue and drive it to completion. |
| 7 | + |
| 8 | +The user will invoke this skill with an issue number, for example `/gh-issue 42`. |
| 9 | + |
| 10 | +## Step 1 - Fetch the issue |
| 11 | + |
| 12 | +Run: |
| 13 | + |
| 14 | +```bash |
| 15 | +gh issue view <number> --json number,title,body,labels,assignees,milestone |
| 16 | +``` |
| 17 | + |
| 18 | +Read the issue carefully: |
| 19 | + |
| 20 | +- **Title and body**: understand the requirement |
| 21 | +- **Labels**: determine the workflow (see Step 3) |
| 22 | + |
| 23 | +## Step 2 - Create a worktree |
| 24 | + |
| 25 | +Create an isolated Git worktree for this issue. |
| 26 | + |
| 27 | +1. Build a short slug from the issue title: |
| 28 | + - lowercase |
| 29 | + - spaces replaced with `-` |
| 30 | + - remove non-alphanumeric characters except `-` |
| 31 | + - truncate to 50 characters |
| 32 | +2. Create branch `<user>/<slug>`. |
| 33 | +3. Create worktree under `.opencode/worktrees/<slug>`. |
| 34 | + |
| 35 | +Example: |
| 36 | + |
| 37 | +```bash |
| 38 | +git worktree add -b <user>/<slug> .opencode/worktrees/<slug> HEAD |
| 39 | +``` |
| 40 | + |
| 41 | +Report the worktree path and branch to the user. |
| 42 | + |
| 43 | +## Step 3 - Route based on label |
| 44 | + |
| 45 | +Inspect issue labels and choose the workflow. |
| 46 | + |
| 47 | +All projects using these conventions follow the same labeling pattern. |
| 48 | + |
| 49 | +### If labeled `type::task` (or `type::bug`) |
| 50 | + |
| 51 | +Proceed directly to implementation: |
| 52 | + |
| 53 | +1. Read `AGENTS.md` to orient yourself in the project. |
| 54 | +2. Understand the codebase relevant to the issue. |
| 55 | +3. Implement changes following project conventions. |
| 56 | +4. Run the project's formatting command (see `AGENTS.md`). |
| 57 | +5. Run the project's build command (see `AGENTS.md`). |
| 58 | +6. Commit with a conventional commit message referencing the issue: `feat: <summary> (#<number>)` (or `fix:` for bugs). |
| 59 | +7. Push the branch and create a PR: |
| 60 | + |
| 61 | +```bash |
| 62 | +gh pr create --title "<title>" --body "$(cat <<'EOF' |
| 63 | +Closes #<number> |
| 64 | +
|
| 65 | +## Summary |
| 66 | +<bullet points> |
| 67 | +
|
| 68 | +## Test plan |
| 69 | +<checklist> |
| 70 | +
|
| 71 | +Generated with OpenCode. |
| 72 | +EOF |
| 73 | +)" |
| 74 | +``` |
| 75 | + |
| 76 | +8. Show the user the PR URL. |
| 77 | + |
| 78 | +### If labeled `type::story` |
| 79 | + |
| 80 | +A design spec and implementation plan are required before coding. |
| 81 | + |
| 82 | +1. Load and run the `superpowers/brainstorming` skill via OpenCode's native `skill` tool. |
| 83 | +2. The brainstorming workflow should produce a design spec under `_docs/specs/` and an implementation plan under `_docs/plans/`. |
| 84 | +3. Ask the user to review and approve both documents. |
| 85 | + |
| 86 | +Do not start implementation until approval is explicit. |
| 87 | + |
| 88 | +### If labeled `type::chore` |
| 89 | + |
| 90 | +Follow the same flow as `type::task` but use a `chore:` commit prefix. |
| 91 | + |
| 92 | +### If no matching `type::` label |
| 93 | + |
| 94 | +Ask the user whether to treat it as: |
| 95 | + |
| 96 | +- task (implement now), or |
| 97 | +- story (design first) |
| 98 | + |
| 99 | +## Conventions reminder |
| 100 | + |
| 101 | +- Commit messages: Conventional Commits (`feat:`, `fix:`, `chore:`, `refactor:`, `test:`, `docs:`) |
| 102 | +- Always run the project's formatting command before committing (see `AGENTS.md`) |
| 103 | +- Always run the project's build command before opening a PR (see `AGENTS.md`) |
0 commit comments