java/src/main/resources/targets/claude/skills/core/pr/x-pr-fix/SKILL.md
Reads PR review comments and fixes actionable ones automatically. Detects PR from argument or branch, classifies comments (actionable/suggestion/question/praise), implements fixes, and commits with proper conventional commit messages.
npx skillsauth add edercnj/claude-environment x-pr-fixInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Automates the process of addressing PR review comments for {{PROJECT_NAME}}. Reads all review comments from a pull request, classifies them by type, and implements fixes for actionable feedback.
/x-pr-fix — fix comments on current branch's PR/x-pr-fix 123 — fix comments on PR #123| Parameter | Required | Description |
|-----------|----------|-------------|
| PR-number | No | PR number to process. If omitted, detect from current branch. |
1. DETECT -> Identify PR (argument or branch)
2. FETCH -> Get all review comments via GitHub CLI
3. CLASSIFY -> Categorize each comment (actionable/suggestion/question/praise/resolved)
4. FIX -> Implement fixes for actionable comments
5. VERIFY -> Compile and test after each fix
6. REPLY -> Reply to each comment thread in PT-BR (fix summary or rejection reason)
7. COMMIT -> Commit with conventional commit message
8. REPORT -> Summarize actions taken
Determine which PR to process:
# If argument is a number, use it directly
PR_NUMBER=$1
# If no argument, detect from current branch
if [ -z "$PR_NUMBER" ]; then
gh pr view --json number --jq '.number'
fi
If no PR found, abort: No PR found for current branch. Provide a PR number as argument.
# Get all review comments (not issue comments)
gh api repos/{owner}/{repo}/pulls/{PR_NUMBER}/comments \
--jq '.[] | {id: .id, path: .path, line: .line, body: .body, user: .user.login, created_at: .created_at}'
# Also get PR review threads for context
gh api repos/{owner}/{repo}/pulls/{PR_NUMBER}/reviews \
--jq '.[] | {id: .id, state: .state, body: .body, user: .user.login}'
For each comment, classify into one of:
| Type | Description | Action | |------|-------------|--------| | Actionable | Clear request to change code (fix bug, rename, refactor) | Implement the fix | | Suggestion | Optional improvement with rationale | Implement if aligns with project standards | | Question | Reviewer asking for clarification | Skip (requires human response) | | Praise | Positive feedback | Skip | | Resolved | Already addressed or outdated | Skip |
Classification rules:
For each actionable/suggestion comment:
Read the file at the specified path and line:
# Comment metadata provides path and line
cat -n {path} | sed -n '{line-5},{line+5}p'
Understand the reviewer's request
Implement the fix using Edit tool
If the fix requires understanding broader context, read surrounding code first
Ordering: Process comments file-by-file to minimize context switching. Within a file, process top-to-bottom to avoid line number shifts.
After each fix (or batch of fixes per file):
{{COMPILE_COMMAND}}
{{TEST_COMMAND}}
If compilation fails, revert the last change and try an alternative approach. If tests fail, analyze the failure and adjust the fix.
After each comment is processed (fixed, skipped, or rejected), reply to the review comment thread in Portuguese (pt-BR) explaining the action taken.
Reply command:
# Reply to an inline review comment thread
gh api repos/{owner}/{repo}/pulls/{PR_NUMBER}/comments/{comment_id}/replies \
-f body="{message_in_portuguese}"
Reply templates by classification:
| Classification | Reply Template (PT-BR) |
|---------------|----------------------|
| Actionable (fixed) | Corrigido. {descricao da alteracao feita}. Commit: {short_hash} |
| Suggestion (accepted) | Sugestao aceita. {descricao da alteracao feita}. Commit: {short_hash} |
| Suggestion (rejected) | Sugestao analisada, mas nao aplicada. Motivo: {razao tecnica pela qual nao faz sentido no contexto atual} |
| Actionable (rejected) | Observacao analisada, mas nao faz sentido neste contexto. Motivo: {explicacao tecnica detalhada} |
| Actionable (failed) | Tentei corrigir, mas a alteracao causou falha na compilacao/testes. Necessita intervencao manual. |
| Question | (no reply — requires human response) |
| Praise | (no reply) |
| Resolved | (no reply — already resolved) |
Rules:
Examples:
Fix applied:
Corrigido. Renomeei a variavel `d` para `elapsedTimeInMs` conforme padrao de naming do projeto. Commit: abc1234
Suggestion rejected:
Sugestao analisada, mas nao aplicada. Motivo: o metodo precisa ser publico porque implementa a interface Assembler, que define o contrato do pipeline. Tornar package-private quebraria o polimorfismo.
Comment doesn't make sense:
Observacao analisada, mas nao faz sentido neste contexto. Motivo: o null check sugerido e desnecessario aqui — o parametro vem de um Optional.orElseThrow() na linha 42, garantindo que nunca sera null neste ponto.
After all fixes for a logical group are verified:
git add {modified-files}
git commit -m "fix({scope}): address PR review comments
- {summary of change 1}
- {summary of change 2}
Addresses review comments on PR #{PR_NUMBER}"
Scope should match the module/layer affected (e.g., domain, api, config).
Output a summary table:
## PR Review Comments — Fix Report
**PR:** #{PR_NUMBER}
**Total comments:** N
**Processed:** M
| # | File | Line | Type | Action | Status | Reply |
|---|------|------|------|--------|--------|-------|
| 1 | src/main/Foo.java | 42 | Actionable | Renamed variable | Fixed | Replied |
| 2 | src/main/Bar.java | 15 | Suggestion | Added null check | Fixed | Replied |
| 3 | src/main/Baz.java | 20 | Actionable | — | Rejected | Replied |
| 4 | src/main/Baz.java | 88 | Question | — | Skipped | — |
| 5 | src/main/Qux.java | 3 | Praise | — | Skipped | — |
### Questions Requiring Human Response
- **src/main/Baz.java:88** (@reviewer): "Why is this method public?"
| Scenario | Action | |----------|--------| | PR not found | Abort with message | | No comments on PR | Report "No review comments found" | | Comment references deleted file | Skip with warning | | Fix causes compilation failure | Revert and report as "Unable to fix automatically" | | Fix causes test failure | Revert and report as "Fix caused regression" | | API rate limit | Wait and retry (max 3 attempts) |
| Skill | Relationship | Context |
|-------|-------------|---------|
| x-story-implement | called-by | Invoked during Phase 4 (fix review comments) |
| x-pr-fix-epic | called-by | Batch mode processes multiple PRs from an epic |
| x-git-push | calls | Uses Conventional Commits format for fix commits |
| x-review | reads | Processes comments produced by specialist reviews |
tools
Documentation automation v2: stack-aware generation from documentation.targets.
development
Generates or updates CI/CD pipelines per project stack with actionlint validation.
tools
Generates ADRs from architecture-plan mini-ADRs with sequential numbering and index update.
development
Formats source code; first step of the pre-commit chain (format -> lint -> compile).