afc-pr-comment
Post structured review comments to GitHub PR
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Menu
Post structured review comments to GitHub PR
Instalar com Codex ou Claude Copie este prompt, cole no Codex, Claude ou outro assistente e deixe que ele revise a página da skill e instale para você.
Baseado na classificação ocupacional SOC
Code and component analysis — analyze code, trace flows, audit consistency, inspect components
Architecture analysis and design review
Full auto pipeline — run spec-to-clean cycle automatically for new features
Save session state for later resumption
Resolve spec ambiguities with clarifying questions
Pipeline artifact cleanup and codebase hygiene
| name | afc:pr-comment |
| description | Post structured review comments to GitHub PR |
| argument-hint | <PR number> [--severity critical,warning,info] |
| allowed-tools | ["Read","Bash","Glob","Grep","Task"] |
| model | sonnet |
Analyzes a PR and posts a structured review comment to GitHub. Reuses existing triage reports when available. Asks for user confirmation before posting.
!gh pr view $0 --json number,title,headRefName,author,body,additions,deletions,changedFiles,labels,reviewDecision,state,url 2>/dev/null || echo "PR_FETCH_FAILED"
$ARGUMENTS — PR number (required), with optional severity filter
42 — Analyze and post review for PR #4242 --severity critical,warning — Only include Critical and Warning findings42 --severity critical — Only include Critical findingsParse:
--severity filter if present (comma-separated: critical, warning, info)Use the pre-fetched PR metadata. If the pre-fetch returned PR_FETCH_FAILED, output [afc:pr-comment] Error: PR not found or gh not available. and abort.
Fetch the diff:
gh pr diff {number}
Verify the PR is open. If closed/merged, inform the user and ask whether to proceed anyway.
ls -t .claude/afc/memory/triage/*.md 2>/dev/null | head -5
If a report from today contains PR #{number} analysis, reuse it as the review basis instead of re-analyzing from scratch.
Review the diff using perspectives A–E from review/perspectives.md:
Classify each finding:
If --severity was specified, filter findings to only the listed levels. Default: include all.
## AFC Code Review — PR #{number}
### Summary
| Severity | Count |
|----------|-------|
| Critical | {N} |
| Warning | {N} |
| Info | {N} |
### Findings
#### C-{N}: {title}
- **File**: `{path}:{line}`
- **Issue**: {description}
- **Suggested fix**: {suggestion}
#### W-{N}: {title}
{same format}
#### I-{N}: {title}
{same format}
### Positives
- {1-2 things done well}
---
*Reviewed by [all-for-claudecode](https://github.com/anthropics/claude-code)*
If zero findings after filtering:
## AFC Code Review — PR #{number}
No issues found. Code looks good!
---
*Reviewed by [all-for-claudecode](https://github.com/anthropics/claude-code)*
Display the full review comment to the user.
Determine the review event:
| Event | When to use |
|---|---|
| REQUEST_CHANGES | Critical findings in production code that pose genuine risk to users: bugs affecting functionality, security vulnerabilities, or architectural violations costly to fix post-merge. A Critical finding limited to test/docs/config alone does NOT qualify. |
| COMMENT | Findings are improvements the author should consider but don't block merging. Also when Critical findings are in non-production code, or the author has already acknowledged the concern in PR discussion. |
| APPROVE | No findings, or all findings are informational and code is ready to merge. |
Tell the user:
Review event: {APPROVE|COMMENT|REQUEST_CHANGES}
Findings: Critical {N} / Warning {N} / Info {N}
Ask for confirmation (AskUserQuestion):
tmp_file=$(mktemp)
cat > "$tmp_file" << 'REVIEW_EOF'
{review comment content}
REVIEW_EOF
gh pr review {number} --body-file "$tmp_file" --event {COMMENT|REQUEST_CHANGES|APPROVE}
rm -f "$tmp_file"
PR review posted
├─ PR: #{number} ({title})
├─ Event: {APPROVE|COMMENT|REQUEST_CHANGES}
├─ Findings: Critical {N} / Warning {N} / Info {N}
└─ URL: {PR URL}
gh pr review completes, confirm success by checking the exit code. If it fails, report the error and suggest manual posting.