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

pr-fix-actions skill

/.claude/skills/pr-fix-actions

This skill helps fix failing CI checks and GitHub Actions on a PR by automating lint, type, test, and build repairs.

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

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

Files (1)
SKILL.md
3.2 KB
---
name: dyad:pr-fix:actions
description: Fix failing CI checks and GitHub Actions on a Pull Request.
---

# PR Fix: Actions

Fix failing CI checks and GitHub Actions on a Pull Request.

## 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.

## Instructions

1. **Determine the PR to work on:**
   - If `$ARGUMENTS` contains a PR number or URL, use that
   - Otherwise, get the current branch's PR using `gh pr view --json number,url,title,body --jq '.'`
   - If no PR is found, inform the user and stop

2. **Check for failing CI checks:**

   ```
   gh pr checks <PR_NUMBER>
   ```

   Identify which checks are failing:
   - Lint/formatting checks
   - Type checks
   - Unit tests
   - E2E/Playwright tests
   - Build checks

3. **For failing lint/formatting checks:**
   - Run `npm run lint:fix` to auto-fix lint issues
   - Run `npm run fmt` to fix formatting
   - Review the changes made

4. **For failing type checks:**
   - Run `npm run ts` to identify type errors
   - Read the relevant files and fix the type issues
   - Re-run type checks to verify fixes

5. **For failing unit tests:**
   - Run the failing tests locally to reproduce:
     ```
     npm run test -- <test-file-pattern>
     ```
   - Investigate the test failures
   - Fix the underlying code issues or update tests if the behavior change is intentional

6. **For failing Playwright/E2E tests:**
   - Check if the failures are snapshot-related by examining the CI logs or PR comments
   - If snapshots need updating, run the `/dyad:e2e-rebase` skill to fix them
   - If the failures are not snapshot-related:
     - **IMPORTANT:** First build the application before running E2E tests:
       ```
       npm run build
       ```
       E2E tests run against the built binary. If you make any changes to application code (anything outside of `e2e-tests/`), you MUST re-run `npm run build` before running E2E tests again.
     - Run the failing tests locally with debug output:
       ```
       DEBUG=pw:browser PLAYWRIGHT_HTML_OPEN=never npm run e2e -- <test-file>
       ```
     - Investigate and fix the underlying issues

7. **For failing build checks:**
   - Run the build locally:
     ```
     npm run build
     ```
   - Fix any build errors that appear

8. **After making all fixes, verify:**
   - Run the full lint check: `npm run lint`
   - Run type checks: `npm run ts`
   - Run relevant unit tests
   - Optionally run E2E tests locally if they were failing

9. **Commit and push the changes:**

   If any changes were made:

   ```
   git add -A
   git commit -m "Fix failing CI checks

   - <summary of fix 1>
   - <summary of fix 2>
   ...

   Co-Authored-By: Claude Opus 4.5 <[email protected]>"
   ```

   Then run `/dyad:pr-push` to push the changes.

10. **Provide a summary to the user:**
    - List which checks were failing
    - Describe what was fixed for each
    - Note any checks that could not be fixed and require human attention

Overview

This skill fixes failing CI checks and GitHub Actions on a Pull Request. It inspects the PR, identifies failing checks (lint, types, unit tests, E2E, build), applies targeted fixes, and prepares a clean commit ready to push. It produces a concise summary of what was fixed and any remaining issues that need human attention.

How this skill works

The skill locates the target PR (explicit PR number/URL or the current branch's PR) and runs GitHub CLI checks to list failing jobs. It runs local commands to reproduce and resolve failures: lint/format auto-fixes, TypeScript fixes, unit test debugging, build fixes, and E2E troubleshooting with rebuilds and snapshot handling. All progress is tracked via task creation and updates, and changes are committed for push.

When to use it

  • A pull request shows failing CI checks in GitHub Actions
  • You need to reproduce CI failures locally to investigate root causes
  • Lint or formatting checks are blocking merge
  • TypeScript errors or build failures prevent the PR from passing
  • Playwright/E2E tests are failing or snapshots need rebase

Best practices

  • Start by creating tasks for each step and update their status as you work
  • Always build the app before running E2E tests and rebuild after code changes
  • Auto-fix lint and formatting first, then re-run checks to narrow failures
  • Reproduce failing unit tests locally with the exact test pattern to debug
  • Use clear commit messages summarizing each fix and include co-author when required

Example use cases

  • A PR fails only on lint and formatting: run lint:fix and fmt, review changes, commit
  • Type errors introduced by a refactor: run ts, fix types in files, re-run type checks
  • A flaky unit test fails in CI: reproduce locally, fix race condition or update test
  • Playwright snapshots changed after UI updates: rebase snapshots using the e2e rebase flow and rebuild
  • Build errors after dependency updates: run npm run build, fix imports or configuration, and re-run CI

FAQ

What if no PR is found for the current branch?

The skill will inform you that no PR exists and stop; create a PR first or pass a PR number/URL as an argument.

Do I need to rebuild before every E2E test run?

Yes. E2E tests run against the built app. Rebuild whenever you change application code outside e2e-tests.