GitHub Issue Workflow
Context
Read both the issue body and every comment as requirements input. Maintainer follow-ups frequently add scope, edge cases, or override the original description; when a later comment conflicts with the body, prefer the comment.
!gh issue view ${ARGUMENTS#\#} --json number,url,title,body,labels,assignees,state,comments 2>/dev/null || echo "Provide an issue number"
Instructions
Phase 1: Setup
Parse the issue number from $ARGUMENTS (strip # if present)
Assign yourself if unassigned:
gh issue edit <number> --add-assignee @me
Create a branch from main based on the issue type:
Determine the branch prefix from labels:
bug → fix/
enhancement → feat/
documentation → docs/
- No label →
feat/ (default)
Branch name format: <prefix><issue-number>-<slug>
git checkout main && git pull
git checkout -b <branch-name>
Phase 2: Plan
Enter Plan Mode to design the implementation:
- Explore the codebase to understand affected areas
- Identify files that need changes
- Consider the module architecture (Gacela facades, module boundaries)
- Plan the TDD approach (what tests to write first)
Create implementation plan with:
- Summary of what the issue requires
- List of files to create/modify
- Test strategy (unit, integration)
- Step-by-step implementation order
Phase 3: Implement
After plan approval, implement following TDD:
- Write failing tests first
- Implement minimum code to pass
- Refactor while keeping tests green
Run full test suite:
composer test
Fix ALL errors before proceeding.
Phase 4: Ship
Update CHANGELOG.md — add entry under ## Unreleased
Commit changes:
git add <specific-files>
git commit -m "<type>(<scope>): <description>
Related to #<issue-number>"
Final refactor commit (mandatory, last commit before PR):
Re-review every file touched by this change. Look for:
- duplication introduced by the new code (extract or reuse)
- dead branches, unused params, leftover debug
- naming drift vs. surrounding module conventions
- violations of
.claude/rules/php.md, modules.md, compiler.md
- over-engineering: speculative abstractions, premature interfaces
Apply fixes. Re-run composer test. Commit as a separate ref(...) commit — must be the final commit on the branch before PR:
git commit -m "ref(<scope>): polish <area> after #<issue-number>
Related to #<issue-number>"
If review surfaces zero changes, record that fact in the PR body instead of skipping silently.
Create PR using /pr #<issue-number>
Phase 5: Verify & Merge
Wait for CI green on the PR:
gh pr checks <pr-number-or-branch> --watch
Fix red checks on the branch (push fixes; re-watch). Do not proceed while any required check is failing.
Merge with mandatory approval bypass when possible:
Once every required check is green, merge via admin bypass to satisfy the mandatory-approval rule:
gh pr merge <pr-number> --squash --admin --delete-branch
If --admin is rejected (token lacks admin, branch protection blocks bypass), fall back to --auto --squash --delete-branch and surface that the PR is awaiting human approval. Never --no-verify past a failing required check.
Sync local main after merge:
git checkout main && git fetch origin main && git reset --hard origin/main
Checklist
1---2name: gh-issue3description: Fetch a GitHub issue, create a branch, implement with TDD, and open a PR4---56# GitHub Issue Workflow78## Context910Read both the issue body **and every comment** as requirements input. Maintainer follow-ups frequently add scope, edge cases, or override the original description; when a later comment conflicts with the body, prefer the comment.1112!`gh issue view ${ARGUMENTS#\#} --json number,url,title,body,labels,assignees,state,comments 2>/dev/null || echo "Provide an issue number"`1314## Instructions1516### Phase 1: Setup17181. **Parse the issue number** from `$ARGUMENTS` (strip `#` if present)19202. **Assign yourself if unassigned**:21 ```bash22 gh issue edit <number> --add-assignee @me23 ```24253. **Create a branch** from `main` based on the issue type:2627 Determine the branch prefix from labels:28 - `bug` → `fix/`29 - `enhancement` → `feat/`30 - `documentation` → `docs/`31 - No label → `feat/` (default)3233 Branch name format: `<prefix><issue-number>-<slug>`3435 ```bash36 git checkout main && git pull37 git checkout -b <branch-name>38 ```3940### Phase 2: Plan41424. **Enter Plan Mode** to design the implementation:43 - Explore the codebase to understand affected areas44 - Identify files that need changes45 - Consider the module architecture (Gacela facades, module boundaries)46 - Plan the TDD approach (what tests to write first)47485. **Create implementation plan** with:49 - Summary of what the issue requires50 - List of files to create/modify51 - Test strategy (unit, integration)52 - Step-by-step implementation order5354### Phase 3: Implement55566. **After plan approval**, implement following TDD:57 - Write failing tests first58 - Implement minimum code to pass59 - Refactor while keeping tests green60617. **Run full test suite**:62 ```bash63 composer test64 ```65 Fix ALL errors before proceeding.6667### Phase 4: Ship68698. **Update CHANGELOG.md** — add entry under `## Unreleased`70719. **Commit changes**:72 ```bash73 git add <specific-files>74 git commit -m "<type>(<scope>): <description>7576 Related to #<issue-number>"77 ```787910. **Final refactor commit (mandatory, last commit before PR)**:80 Re-review every file touched by this change. Look for:81 - duplication introduced by the new code (extract or reuse)82 - dead branches, unused params, leftover debug83 - naming drift vs. surrounding module conventions84 - violations of `.claude/rules/php.md`, `modules.md`, `compiler.md`85 - over-engineering: speculative abstractions, premature interfaces8687 Apply fixes. Re-run `composer test`. Commit as a separate `ref(...)` commit — must be the final commit on the branch before PR:88 ```bash89 git commit -m "ref(<scope>): polish <area> after #<issue-number>9091 Related to #<issue-number>"92 ```93 If review surfaces zero changes, record that fact in the PR body instead of skipping silently.949511. **Create PR** using `/pr #<issue-number>`9697### Phase 5: Verify & Merge989912. **Wait for CI green** on the PR:100 ```bash101 gh pr checks <pr-number-or-branch> --watch102 ```103 Fix red checks on the branch (push fixes; re-watch). Do not proceed while any required check is failing.10410513. **Merge with mandatory approval bypass when possible**:106 Once every required check is green, merge via admin bypass to satisfy the mandatory-approval rule:107 ```bash108 gh pr merge <pr-number> --squash --admin --delete-branch109 ```110 If `--admin` is rejected (token lacks admin, branch protection blocks bypass), fall back to `--auto --squash --delete-branch` and surface that the PR is awaiting human approval. Never `--no-verify` past a failing required check.11111214. **Sync local main** after merge:113 ```bash114 git checkout main && git fetch origin main && git reset --hard origin/main115 ```116117## Checklist118- [ ] Issue fetched and understood119- [ ] Self-assigned120- [ ] Branch created from fresh `origin/main`121- [ ] Plan created and approved122- [ ] Tests written first (TDD)123- [ ] Implementation complete124- [ ] `composer test` passes125- [ ] Changelog updated126- [ ] Feature commit with issue reference127- [ ] Final refactor commit (last commit on branch, separate `ref(...)`)128- [ ] PR created via `/pr`129- [ ] CI green (`gh pr checks --watch`)130- [ ] PR merged via `--admin --squash` (or `--auto` fallback if admin blocked)131- [ ] Local `main` synced to `origin/main`