implement
Implement a GitHub issue with automated PR creation
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Implement a GitHub issue with automated PR creation
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
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]