Snapshot Test Refactorer
Quickly generates test snapshots, identifies refactoring opportunities, and applies changes to backend code for faster iteration.
Install on your platform
We auto-selected Claude Code based on this skill’s supported platforms.
Run in terminal (recommended)
claude mcp add snapshot-test-refactorer npx -- -y @trustedskills/snapshot-test-refactorer
Or manually add to ~/.claude/settings.json
{
"mcpServers": {
"snapshot-test-refactorer": {
"command": "npx",
"args": [
"-y",
"@trustedskills/snapshot-test-refactorer"
]
}
}
}Requires Claude Code (claude CLI). Run claude --version to verify your install.
About This Skill
The snapshot-test-refactorer skill automates the maintenance of visual regression tests by detecting and fixing broken snapshots caused by non-functional UI changes. It streamlines the workflow for developers who need to update test baselines without manually inspecting every pixel difference in the DOM.
When to use it
- Automatically updating baseline snapshots after legitimate frontend refactors, such as CSS class renames or layout shifts that do not alter visual output.
- Resolving flaky tests triggered by minor DOM structure changes where the rendered appearance remains identical to previous versions.
- Reducing manual overhead when integrating new components that require initial snapshot generation but lack specific styling logic.
Key capabilities
- Identifies discrepancies between current application renders and stored snapshot files.
- Refactors test assertions to align with updated DOM structures while preserving visual expectations.
- Generates updated baseline snapshots for approved changes to ensure future test runs pass correctly.
Example prompts
- "Update the snapshot tests for the new dashboard layout after I changed the grid CSS classes."
- "Fix the failing visual regression tests caused by adding a new header component without altering the main content area."
- "Refactor the snapshot assertions to match the updated DOM structure following a recent framework migration."
Tips & gotchas
Ensure your testing environment is stable before running this skill, as it relies on consistent rendering outputs. While effective for structural changes, verify that visual differences are not being masked if the refactor inadvertently altered styling properties like colors or fonts.
Tags
TrustedSkills Verification
Unlike other registries that point to live repositories, TrustedSkills pins every skill to a verified commit hash. This protects you from malicious updates — what you install today is exactly what was reviewed and verified.
Security Audits
| Gen Agent Trust Hub | Pass |
| Socket | Pass |
| Snyk | Pass |
🌐 Community
Passed automated security scans.