iterate-pr
Fix CI failures and address review feedback on the current branch's PR. Use when CI is failing, review comments need addressing, or you need to push fixes for an open PR. Supports --dry-run to preview without changes.
What this skill does
# Iterate on PR
One-shot workflow: gather review feedback, fix CI failures, verify locally, commit, push, and reply to all threads.
**Requires**: GitHub CLI (`gh`) authenticated.
**Important**: All scripts must be run from the repository root directory (where `.git` is located), not from the skill directory. Use the full path to the script via `${CLAUDE_SKILL_ROOT}`.
If `--dry-run` is in $ARGUMENTS, print the plan but make no changes (no commits, no pushes, no replies).
## Bundled Scripts
### `scripts/fetch_pr_checks.py`
Fetches CI check status and extracts failure snippets from logs.
```bash
uv run ${CLAUDE_SKILL_ROOT}/scripts/fetch_pr_checks.py [--pr NUMBER]
```
Returns JSON:
```json
{
"pr": {"number": 123, "branch": "feat/foo"},
"summary": {"total": 5, "passed": 3, "failed": 2, "pending": 0},
"checks": [
{"name": "tests", "status": "fail", "log_snippet": "...", "run_id": 123},
{"name": "lint", "status": "pass"}
]
}
```
### `scripts/fetch_pr_feedback.py`
Fetches and categorizes PR review feedback using the LOGAF scale.
```bash
uv run ${CLAUDE_SKILL_ROOT}/scripts/fetch_pr_feedback.py [--pr NUMBER]
```
Returns JSON with feedback categorized as:
- `high` - Must address before merge (h:, blocker, changes requested)
- `medium` - Should address (m:, standard feedback)
- `low` - Optional (l:, nit, style, suggestion)
- `bot` - Informational automated comments (Codecov, Dependabot, etc.)
- `resolved` - Already resolved threads
Review bot feedback (from Copilot, Claude, CodeQL, etc.) appears in `high`/`medium`/`low` with `review_bot: true` — it is NOT placed in the `bot` bucket.
Each feedback item may include:
- `thread_id` - GraphQL node ID for inline review comments (used for replies)
### `scripts/reply_to_thread.py`
Replies to PR review threads. Batches multiple replies into a single GraphQL call.
```bash
uv run ${CLAUDE_SKILL_ROOT}/scripts/reply_to_thread.py THREAD_ID "body" [THREAD_ID "body" ...]
```
## Workflow
### 1. Identify PR
```bash
gh pr view --json number,url,headRefName
gh repo view --json owner,name -q '"\\(.owner.login)/\\(.name)"'
```
Store PR number and `{owner}/{repo}` for use in later steps. Stop if no PR exists for the current branch.
### 2. Gather and Address Review Feedback
Run `uv run ${CLAUDE_SKILL_ROOT}/scripts/fetch_pr_feedback.py` to get categorized feedback.
**Auto-fix (no prompt):**
- `high` - must address (blockers, security, changes requested)
- `medium` - should address (standard feedback)
When fixing feedback:
- Understand the root cause, not just the surface symptom
- Check for similar issues in nearby code or related files
- Fix all instances, not just the one mentioned
This includes review bot feedback (items with `review_bot: true`). Treat it the same as human feedback:
- Real issue found → fix it
- False positive → skip, but note why (will be included in reply)
- Never silently ignore review bot feedback — always verify the finding
**Prompt user for selection (using `AskUserQuestion` tool):**
- `low` - use the `AskUserQuestion` tool to present options. Build the question text with a numbered list of all low-priority items, then offer these options:
- "All" — address every low-priority item
- "None" — decline all
- "Pick…" — let the user specify which numbers in the "Other" text field (e.g., "1,3")
Example question text:
```
Found 3 low-priority suggestions:
1. [l] "Consider renaming this variable" - @reviewer in api.py:42
2. [nit] "Could use a list comprehension" - @reviewer in utils.py:18
3. [style] "Add a docstring" - @reviewer in models.py:55
Which would you like to address?
```
**Skip silently:**
- `resolved` threads
- `bot` comments (informational only)
Track every thread's disposition (fixed, declined, false-positive, skipped) for the reply step.
If `--dry-run`: print the classification table (including the low-priority numbered list for preview, but do NOT prompt the user for selection). Skip to the Summary step.
### 3. Check CI and Fix Failures
Run `uv run ${CLAUDE_SKILL_ROOT}/scripts/fetch_pr_checks.py` to get structured failure data.
For each failure:
1. Read the `log_snippet` and trace backwards from the error to understand WHY it failed
2. **Run the failing test(s) locally first.** Derive test names from the failure output. If they pass locally, do NOT attempt to fix the code — the failure is likely environmental. Investigate: cache not cleared between tests, `transaction.on_commit()` callbacks in rolled-back test transactions, test ordering dependencies, or shared mutable state. Report findings to the user.
3. If tests fail locally too, read the relevant code and check for related issues
4. Fix the root cause with minimal, targeted changes
Do NOT assume what failed based on check name alone — always read the logs.
### 4. Verify Locally
Before committing, verify fixes locally:
- If you fixed a test failure: re-run that specific test
- If you fixed a lint/type error: re-run the linter or type checker on affected files
- For any code fix: run existing tests covering the changed code
Detect the test runner from manifest files (`pyproject.toml`/`setup.py` → Python, `package.json` → Node/TS). Check `.github/workflows/` for CI commands first.
If local verification fails, fix before proceeding — do not push known-broken code.
### 5. Commit and Push
```bash
git add <changed files>
git commit -m "fix: address PR feedback and CI failures
- <bullet per change: what was changed and why>"
git push
```
Store the resulting commit SHA for replies.
### 6. Reply to All Threads
**Inline review threads** (items with `thread_id`): reply using the batch script.
**Issue-level comments** (items without `thread_id`): reply via REST API:
```bash
gh api -X POST repos/{owner}/{repo}/issues/{pr_number}/comments -f body="$REPLY_BODY"
```
Use `${CLAUDE_SKILL_ROOT}/scripts/reply_to_thread.py` for inline threads. Batch all replies into a single call:
```bash
uv run ${CLAUDE_SKILL_ROOT}/scripts/reply_to_thread.py \
PRRT_abc $'Fixed — description of change.\n\n*— Claude Code*' \
PRRT_def $'Not applicable — reason.\n\n*— Claude Code*'
```
**Reply format by disposition:**
- **Fixed**: `"Fixed in <SHA>. <description of change>.\n\n*— Claude Code*"`
- **Declined (low)**: `"Noted — declined by author. <brief reason if given>.\n\n*— Claude Code*"`
- **False positive**: `"Not applicable — <reason>.\n\n*— Claude Code*"`
**Guards:**
- Before replying, check if the thread already has a reply ending with `*— Claude Code*` to avoid duplicates
- End every reply with `\n\n*— Claude Code*`
- If the script fails, log and continue — do not block the workflow
### 7. Summary
Print a final table:
| # | File | Comment (truncated) | Action | Commit / Note |
|---|------|---------------------|--------|---------------|
| 1 | src/foo.py:42 | "Use `Optional` instead..." | Fixed | abc1234 |
| 2 | README.md | "Typo in heading" | Fixed | abc1234 |
| 3 | src/bar.py:10 | "Consider splitting..." | Declined | Low priority, user chose "none" |
| 4 | CI: tests | pytest failure in test_api | Fixed | abc1234 |
## Fallback
If scripts fail, use `gh` CLI directly:
- `gh pr checks --json name,state,bucket,link`
- `gh run view <run-id> --log-failed`
- `gh api repos/{owner}/{repo}/pulls/{number}/comments`
Related in Cloud & DevOps
appbuilder-action-scaffolder
IncludedCreate, implement, deploy, and debug Adobe Runtime actions with consistent layout, validation, and error handling. Use this skill whenever the user needs to add actions to an App Builder project, understand action structure (params, response format, web/raw actions), configure actions in the manifest, use App Builder SDKs (State, Files, Events, database), deploy and invoke actions via CLI, debug action issues, or implement patterns such as webhook receivers, custom event providers, journaling consumers, large payload redirects, action sequence pipelines, and Asset Compute workers. Also trigger when users mention serverless functions in Adobe context, action logging, IMS authentication for actions, or cron-style scheduled actions.
orchestrating-datacloud
IncludedSalesforce Data Cloud product orchestrator for connect→prepare→harmonize→segment→act workflows. Use this skill when the user needs a multi-step Data Cloud pipeline, cross-phase troubleshooting, or data space and data kit management. TRIGGER when: user needs a multi-step Data Cloud pipeline, asks to set up or troubleshoot Data Cloud across phases, manages data spaces or data kits, or wants a cross-phase sf data360 workflow. DO NOT TRIGGER when: work is isolated to a single phase (use the matching phase-specific skill), the task is STDM/session tracing/parquet telemetry (use observing-agentforce), standard CRM SOQL (use querying-soql), or Apex implementation (use generating-apex).
github-project-automation
IncludedAutomate GitHub repository setup with CI/CD workflows, issue templates, Dependabot, and CodeQL security scanning. Includes 12 production-tested workflows and prevents 18 errors: YAML syntax, action pinning, and configuration. Use when: setting up GitHub Actions CI/CD, creating issue/PR templates, enabling Dependabot or CodeQL scanning, deploying to Cloudflare Workers, implementing matrix testing, or troubleshooting YAML indentation, action version pinning, secrets syntax, runner versions, or CodeQL configuration. Keywords: github actions, github workflow, ci/cd, issue templates, pull request templates, dependabot, codeql, security scanning, yaml syntax, github automation, repository setup, workflow templates, github actions matrix, secrets management, branch protection, codeowners, github projects, continuous integration, continuous deployment, workflow syntax error, action version pinning, runner version, github context, yaml indentation error
sf-datacloud
IncludedSalesforce Data Cloud product orchestrator for connect→prepare→harmonize→segment→act workflows. TRIGGER when: user needs a multi-step Data Cloud pipeline, asks to set up or troubleshoot Data Cloud across phases, manages data spaces or data kits, or wants a cross-phase `sf data360` workflow. DO NOT TRIGGER when: work is isolated to a single phase (use the matching sf-datacloud-* skill), the task is STDM/session tracing/parquet telemetry (use sf-ai-agentforce-observability), standard CRM SOQL (use sf-soql), or Apex implementation (use sf-apex).
fabric-cli
IncludedUse this skill for Fabric.so CLI workflows with the `fabric` terminal command: diagnose/install/login, search or browse a Fabric library, save notes/links/files, create folders, ask the Fabric AI assistant, manage tasks/workspaces, generate shell completion, check subscription usage, produce JSON output, and use Fabric as persistent agent memory. Do not use for Microsoft Fabric/Azure/Power BI `fab`, Daniel Miessler's Fabric framework, Python Fabric SSH, Fabric.js, or textile/fashion fabric.
lark
IncludedLark/Feishu CLI skills: lark-cli operations for docs, markdown, sheets, base, calendar, im, mail, task, okr, drive, wiki, slides, whiteboard, apps, approval, attendance, contact, vc, minutes, event. Use when the user needs to operate Lark/Feishu resources via lark-cli, send messages, manage documents, spreadsheets, calendars, tasks, OKRs, deploy web pages, or any Feishu/Lark workspace operations.