E2E Snapshot Rebase

VerifiedCaution

Rebase E2E test snapshots based on failed tests from PR comments, including build, update, verification, and commit steps.

Sby Skills Guide Bot
TestingIntermediate
8/29/2026
Claude Code
#e2e-testing#playwright#snapshot-testing#pr-workflow#git

Recommended for

Automated summary

Reads failed Playwright tests from a pull request's comments, regenerates their snapshots, verifies them, then commits and pushes the updated snapshots to the PR.

Strengths

  • Automatically extracts failing test filenames from two sections of the Playwright results comment
  • Explicitly rebuilds the application binary first so tests do not run against a stale build
  • Re-runs each test without snapshot updating to catch flaky snapshots before accepting them
  • Surfaces the Git diff and prompts for a relevance review before committing

Limitations

  • Assumes npm run e2e, an e2e-tests/ directory, and a Playwright results comment in the expected format
  • Requires a working gh CLI authentication and push access to the remote
  • Commits and pushes to the PR branch without explicit confirmation, and rebasing snapshots can hide a genuine regression
When to use it

Use it when a PR fails only on Playwright snapshot diffs that are already understood and expected.

When not to use it

Avoid it when test failures stem from real application bugs or when the PR has no Playwright results comment to parse.

Security analysis

Caution
Quality score78/100

The skill is a legitimate developer workflow: it reads PR comments, builds, runs Playwright tests, updates snapshots, verifies, and pushes. No destructive commands, no credential/token handling, no obfuscation, no curl|sh or base64 payloads. The only notable risk is that it performs an irreversible-ish write action (git commit + git push to the PR branch) based on the agent's own assessment of the diffs, which warrants caution rather than a clean 'safe' rating.

Findings
  • •Step 9 commits and pushes to the PR branch automatically, gated only on the agent's own judgment that the snapshot diffs 'look reasonable' rather than explicit user confirmation.
  • •No declared allowed-tools, yet the skill requires shell access (gh, npm, git) and network access for push/pull; consumers must grant broad tool permissions.
  • •Test filenames are parsed from PR comments (potentially untrusted/semi-trusted input) and interpolated directly into shell commands (`npm run e2e e2e-tests/<testFilename>.spec.ts`), creating a command-injection surface if a crafted comment is present.
  • •Automatically runs `git add`, `git commit`, and `git push` to the PR branch without explicit user confirmation, so an unattended run can publish misleading snapshot baselines.
  • •`--update-snapshots` overwrites Playwright visual baselines with whatever the current render produces, which can silently bless visual regressions; the step-8 human review is the only safeguard and is not enforced.
How this analysis is made

Examples

Rebase PR snapshots
Look at the Playwright results comment on the current PR, find the failing E2E specs, and rebase their snapshots.
Fix failing spec snapshots
The PR is red because of snapshot diffs — update the snapshots for the failing e2e-tests specs, verify they pass, and push the changes.
Update and verify
Rebase the E2E snapshots for this PR, re-run the tests without --update-snapshots to check for flakiness, and show me the diff before committing.

name: dyad:e2e-rebase description: Rebase E2E test snapshots based on failed tests from the PR comments.

E2E Snapshot Rebase

Rebase E2E test snapshots based on failed tests from the PR comments.

Instructions

  1. Get the current PR number using gh pr view --json number --jq '.number'

  2. Fetch PR comments and look for the Playwright test results comment. Parse out the failed test filenames from either:

    • The "Failed Tests" section (lines starting with - \filename.spec.ts`)
    • The "Update Snapshot Commands" section (contains npm run e2e e2e-tests/filename.spec.ts)
  3. If no failed tests are found in the PR comments, inform the user and stop.

  4. Build the application binary:

    npm run build
    

    IMPORTANT: E2E tests run against the built binary. If any application code (anything outside of e2e-tests/) has changed, you MUST run this build step before running E2E tests, otherwise you'll be testing the old version.

  5. For each failed test file, run the e2e test with snapshot update:

    PLAYWRIGHT_HTML_OPEN=never npm run e2e e2e-tests/<testFilename>.spec.ts -- --update-snapshots
    
  6. After updating snapshots, re-run the same tests WITHOUT --update-snapshots to verify they pass consistently:

    PLAYWRIGHT_HTML_OPEN=never npm run e2e e2e-tests/<testFilename>.spec.ts
    

    If any test fails on this verification run, inform the user that the snapshots may be flaky and stop.

  7. Show the user which snapshots were updated using git diff on the snapshot files.

  8. Review the snapshot changes to ensure they look reasonable and are consistent with the PR's purpose. Consider:

    • Do the changes align with what the PR is trying to accomplish?
    • Are there any unexpected or suspicious changes?
  9. If the snapshots look reasonable, commit and push the changes:

    git add e2e-tests/snapshots/
    git commit -m "Update E2E snapshots"
    git push
    
  10. Inform the user that the snapshots have been updated and pushed to the PR.

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/e2e-snapshot-rebase-mte1lj9p/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/e2e-snapshot-rebase-mte1lj9p' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/e2e-snapshot-rebase-mte1lj9p/download' --output '.skill-downloads/e2e-snapshot-rebase-mte1lj9p/SKILL.md.part' && mv '.skill-downloads/e2e-snapshot-rebase-mte1lj9p/SKILL.md.part' '.skill-downloads/e2e-snapshot-rebase-mte1lj9p/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

This file does not provide a usable name/description header for this native procedure. It remains available to download and inspect; use the manual method below.

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/e2e-snapshot-rebase-mte1lj9p/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills