github-issues
Resolve GitHub issues using TDD: read, analyse, branch, test, fix, lint, type-check, rebase
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
メニュー
Resolve GitHub issues using TDD: read, analyse, branch, test, fix, lint, type-check, rebase
Codex または Claude でインストール この Prompt をコピーして Codex、Claude、または他のアシスタントに貼り付けると、Skill ページを確認してインストールできます。
SOC 職業分類に基づく
Write, edit, and refactor code with full tool access - Use when you need to actually write or modify code, create files, run commands, or implement features.
Create a new branch for pending changes
Create commit message
Commit changes
Create GitHub pull request
Lint and test code to complete the PR
| name | github-issues |
| description | Resolve GitHub issues using TDD: read, analyse, branch, test, fix, lint, type-check, rebase |
| license | MIT |
| compatibility | opencode |
Walk through a complete GitHub issue resolution: read the ticket, analyse it, branch, write a failing test, fix the code, lint, type-check, rebase, and push the branch.
Use this when you are asked to fix a bug, implement a feature, or handle a chore tracked as a GitHub issue. An issue number is required as the starting point. If you also have a PR number/URL, the agent can additionally monitor PR review comments.
Before reading the issue, load the project's conventions and domain model:
AGENTS.md — it lists every .ai/ instruction file..ai/ files referenced there. These are the single source of truth for standards, architecture, testing, safety, dispatchers, and the domain model..ai/standards.md — multi-tenancy isolation, relative imports, British English.ai/architecture.md — src layout, module structure.ai/domain.md — model hierarchy, owner cascading, access control patternsDo not skip this step. The .ai/ files contain mandatory rules the agent must follow.
gh issue view <N>
gh issue view <N> --comments
Read the full thread including all comments.
Read the full thread and produce a structured analysis. You must explicitly list each of the following before proceeding:
What is clear: Facts, requirements, and expected behavior that are unambiguous from the report. Assumptions: Anything you must assume to proceed (environment, edge cases, unstated behavior, implied requirements). Open questions / Ambiguities: Anything unclear, contradictory, vague, or missing.
First run: Present this analysis to the user, then explicitly ask about each open question or assumption:
"I found a few things I need your input on: - — e.g. what should happen when X is missing? - — e.g. should this apply to all environments or just production? - — I assumed Y, is that right?"
Wait for the user to answer each question. Incorporate their answers, update the analysis, then re-present for final confirmation:
"Here's the updated analysis with your clarifications. Is this correct?"
Do not proceed past this point without explicit user confirmation. Do not skip the questioning step — a passive list that the user can gloss over is not sufficient.
Re-run after feedback: Evaluate the latest comments. If they are positive/approval, report to the user and stop. If they request changes, clarify any ambiguity with the user before proceeding.
Before creating a branch or writing any code, present a concrete plan:
tests/...)Ask the user about each uncertainty or trade-off explicitly:
"- <trade-off 1> — I see two ways to fix this. Option A is simpler but narrower. Option B is more general but touches more files. Which do you prefer?" "- <trade-off 2> — I'm not sure where the test should live. Under tests/integration/ or tests/unit/?"
After the user's input, update the plan and ask:
"Here's my plan. Shall I proceed?"
Do not create a branch or write any code until the user confirms.
Follow .ai/branch-conventions.md to name the branch. Fetch the latest develop and branch from it:
# origin/develop is assumed up-to-date with upstream
git fetch origin develop
git checkout -b <branch-name> origin/develop
Write a test that reproduces the bug or validates the feature. Follow project conventions:
tests/, mirroring the source path under src/bitcaster/.ai/testing-patterns.md for detailstox -e tests -- pytest <path-to-test> -x --no-cov
The test MUST fail against the unpatched codebase. Follow the mandatory TDD RED-phase discipline defined in .ai/workflow.md.
Find and fix the relevant code in src/bitcaster/.
When creating or modifying models (Organization, Project, Application, Event, etc.):
owner with fallback: Application.save() auto-cascades from project.owner; Project.save() auto-cascades from organization.owner.local() queryset method to exclude the system OS4D org where appropriateScopedManager to auto-resolve the org/project/application hierarchy from kwargs.ai/domain.md for the complete referenceRepeat until the test passes:
tox -e tests -- pytest <path-to-test> -x --no-cov
If you need to run the full test suite:
Note: The full suite can take several minutes. When invoking the bash tool for this command, pass
timeout=600000(10 minutes) to prevent premature timeout.
tox -e tests
tox -e lint
If lint fails, fix the errors. If any source code changed during fixing, re-run the tests (step 8). Repeat until both lint and tests are clean.
tox -e mypy
If mypy fails, fix the errors. If any source code changed during fixing, re-run the tests (step 8). Repeat until both mypy and tests are clean.
gh issue view <N> --comments
Try to derive a PR number from the issue:
PR_NUM=$(gh issue view <N> --json closedByPullRequestsReferences \
--jq 'if length > 0 then .[0].number else "" end' 2>/dev/null)
If gh succeeded and a PR is found (non-empty $PR_NUM):
Present to the user: "I found PR #$PR_NUM linked to this issue. Shall I also check PR review comments? [y/n]"
gh pr view $PR_NUM --commentsIf gh succeeded but no PR is found ($PR_NUM empty):
Ask: "Do you have a PR number? (leave blank for no)"
gh pr view <PR_NUM>. If the command fails (non-zero exit), warn the user and skip. Otherwise, fetch review comments.If gh failed (unauthenticated or not installed):
Ask: "I could not reach GitHub CLI. Do you have a PR number? (leave blank for no)"
git remote get-url origin and build the PR URL (https://github.com/OWNER/REPO/pull/<PR_NUM>). Use webfetch to retrieve the page. If it returns an error (e.g. 404), warn the user and skip. Otherwise, advise the user that review comments could not be fetched and suggest they paste relevant feedback.Combine issue comments and PR review comments (if any). Decide:
Present the changes to the user and ask for approval before committing:
git diff --stat
fix/, feat/, chore/) as the Conventional Commits type:
<type>: <issue title>
Closes #<N>
git commit -m "<message>"Do not proceed past this point without explicit approval.
Detect the correct upstream remote. If upstream exists, rebase against the canonical repo (fork workflow). Otherwise fall back to origin (direct contributor):
DEFAULT_BRANCH="develop"
if git remote get-url upstream > /dev/null 2>&1; then
TARGET_REMOTE="upstream"
else
TARGET_REMOTE="origin"
fi
git fetch "$TARGET_REMOTE" "$DEFAULT_BRANCH"
git rebase "$TARGET_REMOTE/$DEFAULT_BRANCH"
If there are conflicts, stop and alert the user. Do not attempt to resolve conflicts automatically. If the user resolves them manually, re-enter at step 8 (iterate until tests pass) to re-verify the full pipeline.
Ask the user for approval before pushing:
<branch-name> is rebased and ready. Shall I push to origin?
[y/n]"git push origin <branch-name>
Notify the user the branch is pushed and ready for them to open a PR:
"Branch <branch-name> is pushed. Once a PR is created from it, it will be auto-linked to issue #. You can ask me to handle PR feedback later — I will try to detect the PR automatically."
If new feedback arrives later and the user asks you to handle it, re-enter at step 1 with the same issue number. The agent will attempt to find a linked PR (step 11b) and check both issue comments and PR review comments.