implement
Implement a GitHub issue with automated PR creation
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Menu
Implement a GitHub issue with automated PR creation
Install with Codex or Claude Copy this prompt, paste it into Codex, Claude, or another assistant, and let it review the skill page and install it for you.
Based on SOC occupation classification
Automatically implement all sub-issues of an epic in dependency order
End-of-session retrospective. Captures knowledge from any working session (debug, implementation, config, deployment) as reusable scripts, CLAUDE.md procedures, or skill proposals. Run before ending a session to prevent knowledge loss.
Decompose a large GitHub issue into sub-issues and create a tracking draft PR
OWASP-guided security code review for a specific domain or issue
Project kickoff checklist based on lessons learned from previous projects. Generates a tailored checklist and optionally creates GitHub issues.
Generate a professional architecture diagram from codebase analysis
| name | implement |
| description | Implement a GitHub issue with automated PR creation |
| argument-hint | <issue-number> |
| user-invocable | true |
Implement GitHub issue with automated workflow.
The user provides an issue number: $ARGUMENTS
MUST use ~/.claude/bin/git-find-base-branch for base branch detection for the PR.
~/.claude/bin/ scripts only~/.claude/bin/venv-run.sh <cmd> or ~/.claude/bin/project-test.shpython3 -c for file operations โ use Read/Edit/Grep insteadFetch issue details: ~/.claude/bin/gh-save.sh /tmp/issue-$ARGUMENTS.json issue view $ARGUMENTS --json title,body,labels, then use the Read tool to read it
Check for linked Sentry issues in the issue body:
PAM-BACKEND-X, Sentry URLs, or "Sentry Issues" sectionsSENTRY_ISSUES=["PAM-BACKEND-G", "PAM-BACKEND-H"]Read AND verify understanding of existing code:
Parse acceptance criteria from the issue body:
- [ ] / - [x]/refine first"Create detailed implementation plan as numbered steps of max 5 minutes each:
STOP HERE and ask for confirmation before proceeding to implementation.
issue-$ARGUMENTS-<descriptive-label>grep "attribute_name" models.pypython -c "from module import Class"For each step in the plan, follow this exact sequence:
RED โ Write a failing test first
GREEN โ Write the simplest code to pass
REFACTOR โ Clean up, then commit
~/.claude/bin/git-commit.sh "descriptive message for this step"Fixes <ID> to the final commit only (the last step before PR creation), e.g.: ~/.claude/bin/git-commit.sh "final step description" "" "Fixes PAM-BACKEND-G" "Fixes PAM-BACKEND-H"Move on โ Focus shifts to the next step
When TDD doesn't apply (config files, migrations, static assets):
After every 2-3 steps, briefly check:
Fix weaknesses immediately before continuing.
DO NOT SKIP THIS PHASE. NO COMPLETION CLAIMS WITHOUT FRESH EVIDENCE.
Verification runs in a sub-agent with its own context window. Test output, validation output, review findings, and smoke test logs pollute the orchestrator's context window heavily. Delegating to a sub-agent keeps the main session lightweight for the PR creation phase and avoids context degradation mid-implementation.
The orchestrator (main session) only:
Before spawning, collect:
base_branch โ from ~/.claude/bin/git-find-base-branchacceptance_criteria โ the AC list parsed in Phase 1 (or "none" if not found)modified_files โ ~/.claude/bin/git-diff-base.sh <base-branch>has_backend_endpoints โ true if any modified file matches **/api/**, **/routes/**, **/endpoints/**has_schema_changes โ true if any modified file matches **/schemas/**, **/models/**, **/migrations/**Use the Task tool with subagent_type: "general-purpose" and the prompt below. Wait for completion (do NOT use run_in_background: true โ Phase 4 depends on the result).
## Task: Final verification for issue #$ARGUMENTS
Verify the implementation on the current branch is ready for PR creation.
Run each step below and report results in the structured format at the end.
## Context
- Issue: #$ARGUMENTS
- Base branch: <base_branch>
- Modified files: <modified_files>
- Acceptance criteria: <acceptance_criteria or "none parsed">
- Has backend endpoints: <true/false>
- Has schema changes: <true/false>
Project policies โ read these BEFORE verifying:
- ./CLAUDE.md (project root)
- ./frontend/CLAUDE.md (if frontend changes)
- ./backend/app/CLAUDE.md or ./backend/CLAUDE.md (if backend changes)
## Tool Rules
- Use Glob/Grep/Read instead of Bash equivalents (find, grep, cat, head, tail)
- Use Write/Edit for file creation and modification โ not Bash (echo, cat, sed, awk)
- Bash is for: git, gh, npm, npx, docker, python, ruff, uv, and `~/.claude/bin/` scripts only
- For venv binaries, use `~/.claude/bin/venv-run.sh <cmd>` or `~/.claude/bin/project-test.sh`
## Verification Steps
### Step A: Targeted tests
Run ONLY tests relevant to the modified files โ never the full suite:
`~/.claude/bin/project-test.sh tests/path/to/your_test.py -v`
If any test fails, fix at root cause and re-run.
### Step B: Project validation
Check for one of: `npm run validate:all`, `make validate`, `./validate.sh`.
If found, run it. If backend schemas changed, ensure OpenAPI is regenerated.
Fix any errors before proceeding.
### Step C: Integration verification (conditional)
Check the project's CLAUDE.md for an **Integration Verification** section.
If it exists AND modified files match a trigger pattern, run the defined steps.
Otherwise skip.
### Step D: Acceptance criteria verification (skip if AC = "none parsed")
For each criterion, find evidence (test name, assertion, config/UI change).
Produce a table:
| # | Criterion | Evidence | Status |
|---|-----------|----------|--------|
For UNVERIFIED items: write a test if testable, else flag for manual review.
### Step E: Self-review (max 2 fix iterations)
Run the `/review` analysis on the branch diff:
`~/.claude/bin/git-diff-base.sh --patch <base-branch>`
If findings with severity > INFO:
- Fix automatically, re-run Step A, re-run review
- Max 2 iterations โ remaining findings go into the PR body as "Known Issues"
### Step F: API smoke test (skip if has_backend_endpoints = false)
1. Restart API container: `docker restart pam_api`, then wait for it to come back up: `~/.claude/bin/wait-for-healthy.sh pam_api`
2. Seed E2E accounts if needed: `npm run db:seed:e2e`
3. Login: `./scripts/api-login.sh premium` then read `/tmp/pam-token.txt`
4. Call each new/modified endpoint, verify 2xx + correct JSON structure
5. On 500: check `docker logs pam_api --tail 30`, fix root cause, re-run
## Execute โ do not describe or delegate
You are the agent that performs this verification. There is no other agent to hand off to or wait for. Actually run each verification step below โ do not respond with a description of what you would do or a status update implying work is happening elsewhere.
## Response Format
Respond with EXACTLY this format ONLY once you have actually performed the verification steps above โ not as a status update:
VERIFICATION_COMPLETE:
TESTS: PASS/FAIL โ <passed>/<total> tests (e.g., 12/12)
VALIDATION: PASS/FAIL/SKIP โ <validate command used or reason for skip>
INTEGRATION: PASS/FAIL/SKIP โ <what was verified or reason for skip>
AC_VERIFIED: <verified count>/<total count> or SKIP โ <one-line summary>
REVIEW: PASS/WARN/FAIL โ <iterations used, findings remaining>
SMOKE_TEST: PASS/FAIL/SKIP โ <endpoints tested or reason for skip>
KNOWN_ISSUES: <list of remaining review findings, or "none">
AC_UNVERIFIED: <list of UNVERIFIED criteria needing manual review, or "none">
FAILED:
ERROR: <description of what blocked verification>
STEP: <which step failed>
LAST_OUTPUT: <relevant error output>
On VERIFICATION_COMPLETE:
KNOWN_ISSUES and AC_UNVERIFIED for inclusion in the PR body, proceed to Phase 4On FAILED:
Before proceeding to PR creation:
~/.claude/bin/git-find-base-branch/tmp/pr-body.md using the Write tool. Include:
Closes #$ARGUMENTSKNOWN_ISSUES from Phase 3 is not "none": add a ## Known Issues section listing themAC_UNVERIFIED from Phase 3 is not "none": add a ## Manual Review Needed section listing the UNVERIFIED criteria## Sentry section: Resolves: PAM-BACKEND-G, PAM-BACKEND-H~/.claude/bin/git-push-pr-merge.sh --base <base-branch> --title "<concise description>" --body-file /tmp/pr-body.md --no-merge
--no-merge means the CI gate is skipped โ the PR is left open for human review regardless of check statusAfter PR creation, check if this issue is a sub-issue of an epic and update the tracking PR accordingly.
Read the issue body (already fetched in Phase 1) and search for parent references:
Parent issue: #XXXPart of #XXXRelated to #XXXIf no parent reference found โ skip this phase entirely (not a sub-issue).
~/.claude/bin/find-tracking-pr.sh <repo> $PARENT_ISSUE
If no tracking PR exists โ skip (inform user: "Note: no tracking PR found for parent #XXX").
Read the tracking PR body and make two updates:
3a. Ensure Closes statement exists:
If Closes #$ARGUMENTS is not already in the PR body, add it after the last existing Closes line.
3b. Update tracking table row:
Find the row for this issue (#$ARGUMENTS) in the tracking table and update:
โณ Pending โ ๐ In Progress- โ PR #[new-pr-number]If no row exists for this issue, add one:
| N | #$ARGUMENTS - [Issue title] | ๐ In Progress | PR #[new-pr-number] |
3c. Write updated body and apply:
# Write updated body to /tmp/pr_body.md using the Write tool
gh pr edit [tracking-pr-number] --body-file /tmp/pr_body.md
โ
Updated tracking PR #[tracking-pr-number] for parent epic #[parent-issue]
- Status: ๐ In Progress
- Linked: PR #[new-pr-number]