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
根據每個問題的標題與描述內容,從 Sentry 工作區的標籤分類法中分類 Linear 問題,並套用對應的類型標籤。
official
sentry-flutter-sdk
sentry
完整的 Sentry SDK 設定,適用於 Flutter 和 Dart。當被要求「為 Flutter 加入 Sentry」、「安裝 sentry_flutter」、「在 Dart 中設定 Sentry」或設定錯誤…時使用。
official
sentry-svelte-sdk
sentry
完整的 Sentry SDK 設定,適用於 Svelte 和 SvelteKit。當被要求「將 Sentry 加入 Svelte」、「將 Sentry 加入 SvelteKit」、「安裝 @sentry/sveltekit」或進行設定時使用…
official
vercel-react-best-practices
sentry
來自 Vercel Engineering 的 React 與 Next.js 效能優化指南。此技能應在撰寫、審查或重構 React/Next.js… 時使用。
official
sentry-tanstack-start-sdk
sentry
完整的 Sentry SDK 設定,適用於 TanStack Start React。當被要求「將 Sentry 加入 TanStack Start」、「安裝 @sentry/tanstackstart-react」或設定錯誤…時使用。
official
bump-size-limit
sentry
在 .size-limit.js 中提高大小限制,當 size-limit CI 檢查失敗時使用。適用於使用者提到大小限制失敗、套件大小檢查失敗、CI 大小…等情況。
official