sentry-snapshots-cocoa

作者: sentry

完整的 Sentry Snapshots 配置,适用于 Apple/Cocoa 项目。当被要求“设置 SnapshotPreviews”、“设置 Apple 快照测试”、“上传 Apple 快照到…”时使用。

npx skills add https://github.com/getsentry/sentry-for-ai --skill sentry-snapshots-cocoa

All Skills > Feature Setup > Sentry Snapshots

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.

Detect

Do only enough detection to route before calling the wizard:

# 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

NeedRead
First-party SnapshotPreviews setup, disambiguation, or manual fallbackreferences/wizard-setup.md
SnapshotPreviews metadata, rendering preferences, selective rendering, or SnapshotPreviews-specific troubleshootingreferences/snapshot-previews.md
Upload any generated snapshot images to Sentry with Fastlane, sentry-cli, manifests, CI notes, or upload troubleshootingreferences/snapshots.md
One-destination GitHub Actions workflowreferences/github-actions-simple.md
Multi-destination/fan-out GitHub Actions workflowreferences/github-actions-fanout.md
Point-Free swift-snapshot-testing GitHub Actions workflowreferences/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.

来自 sentry 的更多技能

generate-frontend-forms
sentry
使用Sentry新表单系统创建表单的指南。在实现表单、表单字段、验证或自动保存功能时使用。
official
architecture-review
sentry
员工级代码库健康审查。发现单体模块、静默失败、类型安全漏洞、测试覆盖缺口以及LLM友好性问题。
official
linear-type-labeler
sentry
根据每个问题的标题和描述内容,对Linear问题进行分类,并从Sentry工作区的标签分类体系中应用一个类型标签。
official
sentry-flutter-sdk
sentry
完整的Sentry SDK配置,适用于Flutter和Dart。当被要求“为Flutter添加Sentry”、“安装sentry_flutter”、“在Dart中配置Sentry”或配置错误…时使用。
official
sentry-svelte-sdk
sentry
为Svelte和SvelteKit提供完整的Sentry SDK设置。当被要求“为Svelte添加Sentry”、“为SvelteKit添加Sentry”、“安装@sentry/sveltekit”或配置……时使用。
official
vercel-react-best-practices
sentry
来自 Vercel 工程团队的 React 和 Next.js 性能优化指南。在编写、审查或重构 React/Next.js… 时应使用此技能。
official
sentry-tanstack-start-sdk
sentry
为TanStack Start React提供完整的Sentry SDK设置。当被要求“向TanStack Start添加Sentry”、“安装@sentry/tanstackstart-react”或配置错误…时使用。
official
bump-size-limit
sentry
在.size-limit.js中增大尺寸限制,当size-limit CI检查失败时使用。适用于用户提到尺寸限制失败、打包体积检查失败、CI体积检查等情况。
official