"Fix pull requests based on review feedback and CI failures. Use when: (1) Addressing PR review comments, (2) Fixing CI/test failures, (3) Resolving merge conflicts, (4) Implementing requested changes."
Recursos
1Instal·la
npx skillscat add holon-run/holon/github-pr-fix Instal·la des del registre de SkillsCat.
GitHub PR Fix Skill
Automation skill for fixing pull requests based on review feedback, CI failures, and other issues.
Purpose
This skill helps you:
- Analyze PR review comments and CI failures
- Fix code issues in priority order (build → test → lint)
- Push fixes to the PR branch
- Reply to review comments with fix status
Prerequisites
This skill can use:
ghx(default): Preferred for context + publish because it reduces API-shape mistakes and retry loopsghCLI (selective fallback): Use for simple read/one-off write operations, or whenghxis unavailable
Environment & Paths
GITHUB_OUTPUT_DIR: Where this skill writes artifacts- Default: system-recommended output directory if provided by caller; otherwise a temp dir
/tmp/holon-ghprfix-*
- Default: system-recommended output directory if provided by caller; otherwise a temp dir
GITHUB_CONTEXT_DIR: Whereghxwrites collected data- Default:
${GITHUB_OUTPUT_DIR}/github-context
- Default:
GITHUB_TOKEN/GH_TOKEN: Token for GitHub operations (scopes:repoorpublic_repo)
Inputs & Outputs
- Inputs:
${GITHUB_CONTEXT_DIR}/github/pr.json,review_threads.json,check_runs.json,pr.diff, etc. (fromghxwhen available, else collected withghAPIs) - Outputs (agent writes under
${GITHUB_OUTPUT_DIR}):summary.mdmanifest.jsonpublish-results.json
Definition of Done (Strict)
The run is successful only if all of the following are true:
- Required code fixes are committed and pushed to the existing PR branch.
- Publish step is executed via ghx batch publish mechanism and
${GITHUB_OUTPUT_DIR}/publish-results.jsonis produced. publish-results.jsoncontains no failed reply action.
If replies are planned but not published, the run is not successful.
Publishing Strategy (Token + Accuracy)
Optimize for expected total token cost across the full run (including retries/rework), not shortest immediate command count.
- Use
ghxby default for multi-step/high-risk publish operations (reply_review, review posting, batch comment updates). ghis acceptable for low-risk/simple operations (single read query, single top-level comment).- If not using
ghxfor publish, recordfallback_reasonin outputs and verify publish result explicitly. - Avoid ad-hoc API shapes for review replies. If direct REST fallback is required, use
POST /repos/{owner}/{repo}/pulls/{pull_number}/commentswithin_reply_to.
1. Context Collection
If context is not pre-populated, collect PR context with:
- preferred:
ghx(with diff/checks/threads/files enabled) - fallback:
gh pr view,gh pr diff,gh apito produce equivalent files under${GITHUB_CONTEXT_DIR}/github/.
2. Analyze PR Feedback
Read the collected context:
${GITHUB_CONTEXT_DIR}/github/pr.json: PR metadata and reviews${GITHUB_CONTEXT_DIR}/github/review_threads.json: Review comments with line numbers${GITHUB_CONTEXT_DIR}/github/check_runs.json: CI check results${GITHUB_CONTEXT_DIR}/github/test-failure-logs.txt: Failed test logs${GITHUB_CONTEXT_DIR}/github/pr.diff: Code changes
Identify issues in priority order:
- Build errors - Blocking, must fix first
- Test failures - High priority
- Import/type errors - Medium priority
- Lint issues - Lower priority
- Refactor requests - Non-blocking, can defer
3. Fix Issues
Check out the PR branch and fix issues:
# Checkout PR branch
git checkout <pr-branch>
# Make fixes
# ... fix code issues ...
# Commit changes
git add .
git commit -m "Fix: <description>"
# Push to PR branch
git pushIMPORTANT: Commit your code fixes BEFORE replying to reviews. This ensures reviewers can see your actual fixes when reading your replies.
4. Generate Artifacts
Create the required output files:
${GITHUB_OUTPUT_DIR}/summary.md
Human-readable summary:
- PR reference
- Issues identified
- Fixes applied
- Review responses
${GITHUB_OUTPUT_DIR}/manifest.json
Execution metadata:
{
"provider": "github-pr-fix",
"pr_ref": "holon-run/holon#123",
"status": "completed|partial|failed",
"fixes_applied": 5,
"reviews_replied": 3,
"fallback_reason": ""
}5. Reply to Reviews
Publish review replies via ghx batch publish mechanism. github-pr-fix should describe reply requirements in natural-language/structured planning, then follow ghx documentation to build the publish request and execute batch publish.
Implementation guidance:
- default: use
ghx.sh intent run --intent=...as documented by ghx - fallback: use
gh apionly when needed, and synthesize${GITHUB_OUTPUT_DIR}/publish-results.jsonwith equivalent per-action status
After publish, ensure ${GITHUB_OUTPUT_DIR}/publish-results.json exists and check for failed reply actions.
Output Contract
Required Outputs
${GITHUB_OUTPUT_DIR}/summary.md: Human-readable summary- PR reference and description
- Issues identified
- Fixes applied
- Review responses
${GITHUB_OUTPUT_DIR}/manifest.json: Execution metadata${GITHUB_OUTPUT_DIR}/publish-results.json: Publishing execution result
Git Operations
You are responsible for all git operations:
# Checkout PR branch
git checkout <pr-branch>
# Stage changes
git add .
# Commit with descriptive message
git commit -m "Fix: <description>"
# Push to PR branch (NOT a new branch)
git pushNote: Push changes to the existing PR branch, do NOT create a new PR.
Important Notes
- You are running HEADLESSLY - do not wait for user input or confirmation
- Fix issues in priority order: build → test → import → lint
- Commit fixes BEFORE replying to reviews
- Prefer
ghxfor publish when available; useghfallback selectively and documentfallback_reason - Verify publish-results and fail when any reply action fails
- For non-blocking refactor requests, consider deferring to follow-up issues
Reference Documentation
pr-fix-workflow.md: Complete workflow guide
- Error triage and priority order
- Environment setup and verification
- Test failure diagnosis
- Handling refactor requests
- Posting review replies
diagnostics.md: Diagnostic confidence levels
- Confidence levels for CI failure diagnosis
- Common contract rules