snapshot-test-setup
Set up SwiftUI visual regression testing with swift-snapshot-testing. Generates snapshot test boilerplate and CI configuration. Use for UI regression prevention.
npx skills add rshankras/claude-code-apple-skills --skill snapshot-test-setup --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# Snapshot Test Setup Generate SwiftUI snapshot/visual regression tests using Point-Free's swift-snapshot-testing library. Catches unintended UI changes by comparing rendered views against reference images. ## When This Skill Activates Use this skill when the user: - Wants "snapshot tests" or "visual regression tests" - Says "I want to catch UI regressions" - Asks about "screenshot testing" or "preview testing" - Wants to verify SwiftUI views don't change unexpectedly - Mentions "swift-snapshot-testing" or "Point-Free" ## Why Snapshot Tests ``` Without snapshots: With snapshots: Change a modifier Change a modifier → Looks fine locally → Snapshot test fails → Push to main → Shows exact visual diff → User reports UI bug → Fix before merging → Embarrassing → Confidence in UI changes ``` ## Pre-Setup Checks ### 1. Project Context ``` Glob: **/Package.swift or **/*.xcodeproj Grep: "swift-snapshot-testing" (already added?) Grep: "SnapshotTesting" in test files ``` ### 2. Configuration Questions Ask via AskUserQuestion: 1. **Package manager?** - Swift Package Manager - CocoaPods - Tuist 2. **Platform?** - iOS - macOS - Both 3. **What to test?** - Specific views (user provides names) - All
- When This Skill Activates
- Why Snapshot Tests
- Pre-Setup Checks
- 1. Project Context
- 2. Configuration Questions
- Setup Process
- Step 1: Add Dependency
- Step 2: Create Snapshot Test Base
- Step 3: Generate Snapshot Tests
- Step 4: Recording Reference Images
- Step 5: Re-record When Intentional Changes
- Gate Wiring (the deterministic UI gate)
- What to Snapshot
- High Value (Always Snapshot)
Record all snapshots (first run) xcodebuild test -scheme YourApp \ ci_scripts/ci_post_xcodebuild.sh if [ "$CI_XCODEBUILD_ACTION" = "test" ]; then if [ -d "$CI_DERIVED_DATA_PATH" ]; then find "$CI_DERIVED_DATA_PATH" -name "Failures" -type d \ fi
What does the snapshot-test-setup skill do?
Set up SwiftUI visual regression testing with swift-snapshot-testing. Generates snapshot test boilerplate and CI configuration. Use for UI regression prevention.
How do I install it?
Run `npx skills add rshankras/claude-code-apple-skills --skill snapshot-test-setup --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From rshankras/claude-code-apple-skills, a repository with 589 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
