home / skills / dyad-sh / dyad / pr-fix

pr-fix skill

/.claude/skills/pr-fix

This skill orchestrates PR fixes by resolving review comments and CI failures, coordinating tasks, and pushing updates to GitHub.

npx playbooks add skill dyad-sh/dyad --skill pr-fix

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
3.6 KB
---
name: dyad:pr-fix
description: Address all outstanding issues on a GitHub Pull Request by handling both review comments and failing CI checks.
---

# PR Fix

Address all outstanding issues on a GitHub Pull Request by handling both review comments and failing CI checks.

## Arguments

- `$ARGUMENTS`: Optional PR number or URL. If not provided, uses the current branch's PR.

## Task Tracking

**You MUST use the TaskCreate and TaskUpdate tools to track your progress.** At the start, create tasks for each step below. Mark each task as `in_progress` when you start it and `completed` when you finish. This ensures you complete ALL steps.

## Product Principles

When making decisions about review comments, consult `rules/product-principles.md`. Use these principles to resolve ambiguous or subjective feedback autonomously. Only flag issues for human attention when the product principles do not provide enough guidance to make a decision.

## Instructions

This is a meta-skill that orchestrates two sub-skills to comprehensively fix PR issues.

1. **Run `/dyad:pr-fix:comments`** to handle all unresolved review comments:
   - Address valid code review concerns
   - Resolve invalid concerns with explanations
   - Use product principles to resolve ambiguous feedback autonomously
   - Only flag issues for human attention when product principles are insufficient to decide

2. **Run `/dyad:pr-fix:actions`** to handle failing CI checks:
   - Fix failing tests (unit and E2E)
   - Update snapshots if needed
   - Ensure all checks pass

3. **Run `/dyad:pr-push`** to commit and push all changes:
   - This step is REQUIRED. Do NOT skip it or stop before it completes.
   - It will commit changes, run lint/tests, and push to GitHub.
   - Wait for it to finish and verify the push succeeded.

4. **Post Summary Comment:**
   After both sub-skills complete, post a comment on the PR with a consolidated summary using `gh pr comment`. The comment should include:
   - A header indicating success (✅) or failure (❌)
   - Review comments addressed, resolved, or flagged
   - CI checks that were fixed
   - Any remaining issues requiring human attention
   - Use `<details>` tags to collapse verbose details (e.g., full error messages, lengthy explanations)
   - If there were any errors, include specific error messages in the collapsed details

   **Error handling:** If `gh pr comment` fails (e.g., due to network issues, rate limits, or permissions), log a warning but do not fail the entire skill if the underlying fixes were successful. The comment is informational and should not block a successful run.

   Example formats:

   **Success:**

   ```
   ## ✅ Claude Code completed successfully

   ### Summary
   - Fixed 2 review comments
   - Resolved 1 CI failure (lint error in `src/foo.ts`)

   <details>
   <summary>Details</summary>

   ... detailed information here ...

   </details>

   ---
   [Workflow run](https://github.com/dyad-sh/dyad/actions/runs/12345678)
   ```

   **Failure:**

   ```
   ## ❌ Claude Code failed

   ### Summary
   - Attempted to fix 2 review comments
   - Failed to resolve 1 CI failure (lint error in `src/foo.ts`)

   <details>
   <summary>Error Details</summary>

   **Error:** `lint` command failed with exit code 1.

   ```

   ... linter output ...

   ```

   </details>

   ---
   [Workflow run](https://github.com/dyad-sh/dyad/actions/runs/12345678)
   ```

   Note: Include a link to the workflow run at the end. If the `GITHUB_REPOSITORY` and `GITHUB_RUN_ID` environment variables are available, use them to construct the URL: `https://github.com/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID`. If these environment variables are not set, omit the workflow run link.

Overview

This skill automates closing out all outstanding issues on a GitHub Pull Request by addressing unresolved review comments and fixing failing CI checks. It orchestrates review-comment remediation, CI troubleshooting, and a final push so the PR is ready for merge. The skill logs progress as tasks so reviewers can follow every step.

How this skill works

The skill runs two coordinated sub-skills: one that consumes and resolves unresolved review comments, and another that diagnoses and fixes failing CI checks (tests, lint, snapshots). It uses the repository's product principles to make autonomous decisions when feedback is ambiguous, flags only genuinely undecidable items for human attention, commits changes, runs verification locally, pushes to the PR branch, and posts a consolidated PR comment summarizing results.

When to use it

  • When a PR has unresolved review comments
  • When CI checks are failing on a branch you maintain
  • When you want an automated, auditable pass to prepare a PR for merge
  • When reviewers expect code changes and a clear summary of actions taken
  • When you need to reduce manual triage of lint/test failures

Best practices

  • Provide an optional PR number or URL; otherwise run from the branch linked to the current PR
  • Ensure rules/product-principles.md is up to date so the skill can resolve subjective feedback correctly
  • Run in an environment with write access to the repo and permissions to post PR comments
  • Do not interrupt the process before the final push; the push step is mandatory
  • Review the final PR comment for any flagged items requiring human input

Example use cases

  • A feature branch with multiple review comments and a failing test suite — the skill resolves comments, fixes tests, updates snapshots if needed, and pushes.
  • A linting regression introduced by a refactor — the skill corrects style issues, commits, and re-runs checks until green.
  • An ambiguous reviewer request — the skill consults product principles, decides a course of action, documents the rationale, and flags only unresolved guidance for humans.
  • Bulk-resolving trivial comments (typos, small refactors) and summarizing changes in a single PR comment.

FAQ

What arguments does the skill accept?

You may pass an optional PR number or URL. If omitted, the skill uses the current branch's associated PR.

How does it decide on subjective review comments?

It consults rules/product-principles.md and applies those principles to make autonomous decisions. Only comments that lack guidance are flagged for human review.

Will it always push changes automatically?

Yes. Committing and pushing via the mandated push step is required. The skill will run lint/tests locally before pushing and verify the push succeeded.

What if posting the PR comment fails?

The skill logs a warning if gh pr comment fails (network, rate limit, or permission issues) but does not mark the run as failed if underlying fixes succeeded.