sentry-snapshots-cocoa — Claude Code skill: Apple snapshots to Sentry
Sets up snapshot image generation for Apple projects and uploads them to Sentry Snapshots. Useful when you need visual preview testing or want it running in CI.
npx skills add getsentry/sentry-for-ai --skill sentry-snapshots-cocoa -a claude-codeWhat sentry-snapshots-cocoa does
The skill first looks at what the project already has: it searches Package.swift, Package.resolved and project.pbxproj, and checks for Point-Free swift-snapshot-testing. An existing generator gets preserved. With nothing in place, it installs Sentry's own SnapshotPreviews through the appleSnapshots wizard. Manual setup only kicks in when the wizard is unavailable or cannot resolve targets non-interactively.
From there it picks a route from a reference table: references/wizard-setup.md, references/snapshot-previews.md, references/snapshots.md, plus three GitHub Actions variants — a simple one-destination workflow, a fan-out workflow for multiple simulators, and one for swift-snapshot-testing. Uploads go through Fastlane or sentry-cli, and manifests and metadata travel alongside the images.
One hard stop: for a SwiftPM package with no host app or hosted XCTest target, the skill asks you to supply them — standalone swift test rendering is not supported. Before uploading it checks SENTRY_AUTH_TOKEN, SENTRY_ORG and SENTRY_PROJECT, and asks you to confirm the organization, project and export directory. That is a good moment to check whether the screenshots carry customer data, because they leave for Sentry as they are.
What it helps with
- generate PNG snapshots of Swift previews for an Apple project
- upload snapshots to Sentry with their metadata
- keep an existing
swift-snapshot-testinggenerator intact - build a GitHub Actions workflow that fans out across simulators
- run snapshots selectively for changed screens only
Example prompts for the agent
- set up SnapshotPreviews for my Apple project and upload the snapshots to Sentry
- check which snapshot generator the project already uses and don't break it
- create a GitHub Actions workflow with multiple simulators for snapshot tests
How to install sentry-snapshots-cocoa
1Skills CLI (Vercel)
npx skills add getsentry/sentry-for-ai --skill sentry-snapshots-cocoa -a claude-code2Manually: put the files in place
~/.claude/skills/sentry-snapshots-cocoa/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/sentry-snapshots-cocoa/
1Skills CLI (Vercel)
npx skills add getsentry/sentry-for-ai --skill sentry-snapshots-cocoa -a codex2Manually: put the files in place
.agents/skills/sentry-snapshots-cocoa/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add getsentry/sentry-for-ai --skill sentry-snapshots-cocoa -a cursor2Manually: put the files in place
.cursor/skills/sentry-snapshots-cocoa/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install getsentry/sentry-for-ai sentry-snapshots-cocoa2Manually: put the files in place
.github/skills/sentry-snapshots-cocoa/SKILL.md1Skills CLI (Vercel)
npx skills add getsentry/sentry-for-ai --skill sentry-snapshots-cocoa -a gemini-cli2Platform CLI
gemini skills install https://github.com/getsentry/sentry-for-ai --path src/skills/sentry-snapshots-cocoaManually: put the files in place
.devin/skills/sentry-snapshots-cocoa/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add getsentry/sentry-for-ai --skill sentry-snapshots-cocoa -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about sentry-snapshots-cocoa
How do I install sentry-snapshots-cocoa in Claude?
Run npx skills add getsentry/sentry-for-ai --skill sentry-snapshots-cocoa -a claude-code. The skill file then lands at ~/.claude/skills/sentry-snapshots-cocoa/SKILL.md.
What does sentry-snapshots-cocoa do?
It sets up snapshot image generation for Apple projects and uploads the results to Sentry Snapshots. It can also wire up a GitHub Actions workflow once a generator exists.
What do I need before uploading snapshots?
SENTRY_AUTH_TOKEN, SENTRY_ORG and SENTRY_PROJECT, plus confirmation of the organization, project and export directory. The skill checks whether they are set but never prints their values.
Source text
SKILL.md · Apache-2.0
---
name: sentry-snapshots-cocoa
description: Full 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".
license: Apache-2.0
---
# Sentry Snapshots for Apple/Cocoa
## Scope
- Goal: generate Apple snapshot images and upload them to Sentry Snapshots.
- Detect existing snapshot generation first, including Point-Free
`swift-snapshot-testing`; preserve it when it already emits or can emit PNGs or JPEGs.
- Use the Sentry Wizard `appleSnapshots` flow only when setting up Sentry’s first-party
SnapshotPreviews solution.
- Use manual setup only if the wizard is unavailable, cannot resolve targets
non-interactively after disambiguation, or fails after explicit disambiguation.
- Package-only SwiftPM: stop and ask for the host app/test target; standalone
`swift test` rendering is not supported.
Snapshot uploads send generated images and metadata to Sentry.
Confirm the target organization/project and export directory, and check whether the
images contain customer data or other sensitive content before uploading.
Upload only the selected snapshot output within the user’s requested scope.
## Detect
Do only enough detection to route before calling the wizard:
```bash
# SnapshotPreviews (Sentry first-party) -> prefer wizard / SnapshotPreviews routing
find . \( -name Package.swift -o -name Package.resolved -o -path '*/project.pbxproj' \) -print0 2>/dev/null | xargs -0 grep -lE "SnapshotPreviews" 2>/dev/null
# Point-Free swift-snapshot-testing -> preserve generator, swift-snapshot-testing CI path
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
# Required wizard input
find . -name '*.xcodeproj' -print 2>/dev/null | head -20
# Workflow shape
ls fastlane/Fastfile Gemfile 2>/dev/null
# Sentry auth presence only -> never print secret values
[ -n "$SENTRY_AUTH_TOKEN" ] && echo "SENTRY_AUTH_TOKEN=set" || echo "SENTRY_AUTH_TOKEN=unset"
[ -n "$SENTRY_ORG" ] && echo "SENTRY_ORG=set" || echo "SENTRY_ORG=unset"
[ -n "$SENTRY_PROJECT" ] && echo "SENTRY_PROJECT=set" || echo "SENTRY_PROJECT=unset"
```
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.
## Route
Resolve routing in this order; setup is the primary path and CI is optional follow-up.
1. Select or create the image generator:
- named generator wins;
- multiple existing generators with no user choice -> ask;
- existing non-SnapshotPreviews generator -> preserve it;
- existing SnapshotPreviews -> use it;
- no existing generator -> set up SnapshotPreviews by default for Sentry Snapshots or
Apple snapshot testing.
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.
3. For setup or verification:
- existing non-SnapshotPreviews generator -> read `references/snapshots.md`;
- existing SnapshotPreviews -> read `references/snapshot-previews.md` and
`references/snapshots.md`;
- new SnapshotPreviews setup -> read `references/wizard-setup.md`;
- wizard reports no Swift previews -> ask before adding previews or choosing another
generator.
4. For GitHub Actions/CI only after an image generator exists:
- Point-Free `swift-snapshot-testing` -> read
`references/github-actions-swift-snapshot-testing.md` and
`references/snapshots.md`;
- other non-SnapshotPreviews generator -> read `references/snapshots.md` and adapt
existing CI/upload;
- SnapshotPreviews, one simulator only, no matrix/fanout/selective CI -> read
`references/github-actions-simple.md`;
- SnapshotPreviews with multiple simulators, device families, matrix, or any
selective CI -> read `references/github-actions-fanout.md` and
`references/snapshot-previews.md`.
## Optional References
| Need | Read |
| --- | --- |
| First-party SnapshotPreviews setup, disambiguation, or manual fallback | `references/wizard-setup.md` |
| SnapshotPreviews metadata, rendering preferences, selective rendering, or SnapshotPreviews-specific troubleshooting | `references/snapshot-previews.md` |
| Upload any generated snapshot images to Sentry with Fastlane, `sentry-cli`, manifests, CI notes, or upload troubleshooting | `references/snapshots.md` |
| One-destination GitHub Actions workflow | `references/github-actions-simple.md` |
| Multi-destination/fan-out GitHub Actions workflow | `references/github-actions-fanout.md` |
| Point-Free `swift-snapshot-testing` GitHub Actions workflow | `references/github-actions-swift-snapshot-testing.md` |
## Completion Checks
- The selected snapshot image generator is documented and preserved or configured
according to the route above.
- Snapshot generation appears in the relevant local or CI test logs.
- Export directory contains `.png` files and any generated `.json` sidecars.
- Upload succeeds and prints a Sentry URL or snapshot id.
- Base branch upload is full; selective PR upload includes the full image-name manifest.
© getsentry · Apache-2.0 · getsentry/sentry-for-ai