$npx -y skills add getsentry/sentry-for-ai --skill sentry-snapshots-cocoaFull Sentry Snapshots setup for Apple/Cocoa projects. Use when asked to "setup SnapshotPreviews", "setup Apple snapshot testing", "upload Apple snapshots to Sentry", "setup Apple snapshot GitHub Actions", or "setup Apple selective snapshot testing".
| 1 | > [All Skills](../../SKILL_TREE.md) > [Feature Setup](../sentry-feature-setup/SKILL.md) > Sentry Snapshots |
| 2 | |
| 3 | # Sentry Snapshots for Apple/Cocoa |
| 4 | |
| 5 | ## Scope |
| 6 | |
| 7 | - Goal: generate Apple snapshot images and upload them to Sentry Snapshots. |
| 8 | - Detect existing snapshot generation first, including Point-Free `swift-snapshot-testing`; preserve it when it already emits or can emit PNGs or JPEGs. |
| 9 | - Use the Sentry Wizard `appleSnapshots` flow only when setting up Sentry's first-party SnapshotPreviews solution. |
| 10 | - Use manual setup only if the wizard is unavailable, cannot resolve targets non-interactively after disambiguation, or fails after explicit disambiguation. |
| 11 | - Package-only SwiftPM: stop and ask for the host app/test target; standalone `swift test` rendering is not supported. |
| 12 | |
| 13 | ## Detect |
| 14 | |
| 15 | Do only enough detection to route before calling the wizard: |
| 16 | |
| 17 | ```bash |
| 18 | # SnapshotPreviews (Sentry first-party) -> prefer wizard / SnapshotPreviews routing |
| 19 | find . \( -name Package.swift -o -name Package.resolved -o -path '*/project.pbxproj' \) -print0 2>/dev/null | xargs -0 grep -lE "SnapshotPreviews" 2>/dev/null |
| 20 | |
| 21 | # Point-Free swift-snapshot-testing -> preserve generator, swift-snapshot-testing CI path |
| 22 | find . \( -name Package.swift -o -name Package.resolved -o -path '*/project.pbxproj' \) -print0 2>/dev/null | xargs -0 grep -lE "swift-snapshot-testing|SnapshotTesting|assertSnapshot|__Snapshots__|TEST_RUNNER_SNAPSHOT_TESTING_RECORD" 2>/dev/null |
| 23 | |
| 24 | # Required wizard input |
| 25 | find . -name '*.xcodeproj' -print 2>/dev/null | head -20 |
| 26 | |
| 27 | # Workflow shape |
| 28 | ls fastlane/Fastfile Gemfile 2>/dev/null |
| 29 | |
| 30 | # Sentry auth presence only -> never print secret values |
| 31 | [ -n "$SENTRY_AUTH_TOKEN" ] && echo "SENTRY_AUTH_TOKEN=set" || echo "SENTRY_AUTH_TOKEN=unset" |
| 32 | [ -n "$SENTRY_ORG" ] && echo "SENTRY_ORG=set" || echo "SENTRY_ORG=unset" |
| 33 | [ -n "$SENTRY_PROJECT" ] && echo "SENTRY_PROJECT=set" || echo "SENTRY_PROJECT=unset" |
| 34 | ``` |
| 35 | |
| 36 | Record: existing SnapshotPreviews setup, existing snapshot generator/library, output directory if known, Xcode project directory, CI provider, Fastlane, and Sentry auth. For each `.xcodeproj` match, record the containing directory for `--xcode-project-dir`; if `find` prints `./MyApp/MyApp.xcodeproj`, pass `./MyApp`, not the bundle path. Let the wizard detect app targets, hosted XCTest targets, and Swift previews only when no existing generator is present. |
| 37 | |
| 38 | ## Route |
| 39 | |
| 40 | Resolve routing in this order; setup is the primary path and CI is optional follow-up. |
| 41 | |
| 42 | 1. Select or create the image generator: |
| 43 | - named generator wins; |
| 44 | - multiple existing generators with no user choice -> ask; |
| 45 | - existing non-SnapshotPreviews generator -> preserve it; |
| 46 | - existing SnapshotPreviews -> use it; |
| 47 | - no existing generator -> set up SnapshotPreviews by default for Sentry Snapshots or Apple snapshot testing. |
| 48 | 2. For SnapshotPreviews, stop before setup/verification/CI if there is no `.xcodeproj` host app or no hosted XCTest target. These stops do not apply when preserving another generator. |
| 49 | 3. For setup or verification: |
| 50 | - existing non-SnapshotPreviews generator -> read `references/snapshots.md`; |
| 51 | - existing SnapshotPreviews -> read `references/snapshot-previews.md` and `references/snapshots.md`; |
| 52 | - new SnapshotPreviews setup -> read `references/wizard-setup.md`; |
| 53 | - wizard reports no Swift previews -> ask before adding previews or choosing another generator. |
| 54 | 4. For GitHub Actions/CI only after an image generator exists: |
| 55 | - Point-Free `swift-snapshot-testing` -> read `references/github-actions-swift-snapshot-testing.md` and `references/snapshots.md`; |
| 56 | - other non-SnapshotPreviews generator -> read `references/snapshots.md` and adapt existing CI/upload; |
| 57 | - SnapshotPreviews, one simulator only, no matrix/fanout/selective CI -> read `references/github-actions-simple.md`; |
| 58 | - SnapshotPreviews with multiple simulators, device families, matrix, or any selective CI -> read `references/github-actions-fanout.md` and `references/snapshot-previews.md`. |
| 59 | |
| 60 | ## Optional References |
| 61 | |
| 62 | | Need | Read | |
| 63 | |---|---| |
| 64 | | First-party SnapshotPreviews setup, disambiguation, or manual fallback | `references/wizard-setup.md` | |
| 65 | | SnapshotPreviews metadata, rendering preferences, selective rendering, or SnapshotPreviews-specific troubleshooting | `references/snapshot-previews.md` | |
| 66 | | Upload any generated snapshot images to Sentry with Fastlane, `sentry-cli`, manifests, CI notes, or upload troubleshooting | `references/snapshots.md` | |
| 67 | | One-destination GitHub Actions workflow | `references/github-actions-simple.md` | |
| 68 | | Multi-destination/fan-out GitHub Actions workflow | `references/github-actio |