skills/sentry-sdk-upgrade/SKILL.md
Upgrade the Sentry JavaScript SDK across major versions. Use when asked to upgrade Sentry, migrate to a newer version, fix deprecated Sentry APIs, or resolve breaking changes after a Sentry version bump.
npx skillsauth add getsentry/sentry-for-claude sentry-sdk-upgradeInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
All Skills > Workflow > SDK Upgrade
Upgrade the Sentry JavaScript SDK across major versions with AI-guided migration.
@sentry/* package versionsIdentify the current Sentry SDK version, target version, and framework.
cat package.json | grep -E '"@sentry/' | head -20
Extract:
@sentry/* packages and their current versions7.x, 8.x, 9.x)Check package.json dependencies for framework indicators:
| Dependency | Framework | Sentry Package |
|---|---|---|
| next | Next.js | @sentry/nextjs |
| nuxt or @nuxt/kit | Nuxt | @sentry/nuxt |
| @sveltejs/kit | SvelteKit | @sentry/sveltekit |
| @remix-run/node | Remix | @sentry/remix |
| react (no Next/Remix) | React SPA | @sentry/react |
| @angular/core | Angular | @sentry/angular |
| vue (no Nuxt) | Vue | @sentry/vue |
| express | Express | @sentry/node |
| @nestjs/core | NestJS | @sentry/nestjs |
| @solidjs/start | SolidStart | @sentry/solidstart |
| astro | Astro | @sentry/astro |
| bun types or runtime | Bun | @sentry/bun |
| @cloudflare/workers-types | Cloudflare | @sentry/cloudflare |
| None of above (Node.js) | Node.js | @sentry/node |
grep -rn "from '@sentry/\|require('@sentry/" --include="*.ts" --include="*.js" --include="*.tsx" --include="*.jsx" --include="*.mjs" --include="*.cjs" -l
find . -name "sentry.*" -o -name "*.sentry.*" -o -name "instrumentation.*" | grep -v node_modules | grep -v .next | grep -v .nuxt
Scan for patterns that indicate which migration steps are needed:
# v7 patterns (need v7→v8 migration)
grep -rn "from '@sentry/hub'\|from '@sentry/tracing'\|from '@sentry/integrations'\|from '@sentry/serverless'\|from '@sentry/replay'" --include="*.ts" --include="*.js" --include="*.tsx" --include="*.jsx" -l
grep -rn "new BrowserTracing\|new Replay\|startTransaction\|configureScope\|Handlers\.requestHandler\|Handlers\.errorHandler" --include="*.ts" --include="*.js" --include="*.tsx" --include="*.jsx" -l
# v8 patterns (need v8→v9 migration)
grep -rn "from '@sentry/utils'\|from '@sentry/types'" --include="*.ts" --include="*.js" --include="*.tsx" --include="*.jsx" -l
grep -rn "getCurrentHub\|enableTracing\|captureUserFeedback\|@WithSentry\|autoSessionTracking" --include="*.ts" --include="*.js" --include="*.tsx" --include="*.jsx" -l
If the user didn't specify a target version, recommend the latest major version (v9 as of this writing). If the user has already bumped package versions but has broken code, detect the target from package.json.
Present a migration summary based on detected state.
For multi-hop migrations, apply code changes incrementally but update package versions once to the final target.
Load the appropriate version-specific reference:
Present a concrete summary of changes needed, categorized by complexity:
Auto-fixable (apply directly):
@sentry/utils to @sentry/core)@WithSentry to @SentryExceptionCaptured)enableTracing to tracesSampleRate)AI-assisted (explain and propose):
transactionContext flatteningManual review (flag for user):
Ask the user:
npx @sentry/wizard -i upgrade exists as a CLI alternative for v8→v9 but may not handle all patternsStep through changes file by file.
For each file identified in Phase 1.3:
Work through changes in this order:
Replace removed/renamed package imports. Reference the version-specific migration file for the complete mapping.
Apply mechanical method and function renames.
Update Sentry.init() options and build configuration.
Handle patterns requiring understanding of context:
Update all @sentry/* packages to the target version. All packages must be on the same major version.
# Detect package manager
if [ -f "yarn.lock" ]; then
echo "yarn"
elif [ -f "pnpm-lock.yaml" ]; then
echo "pnpm"
else
echo "npm"
fi
Install updated dependencies using the detected package manager.
# Check for type errors
npx tsc --noEmit 2>&1 | head -50
# Run build
npm run build 2>&1 | tail -20
Fix any remaining type errors or build failures.
Consult references/upgrade-patterns.md for framework-specific config file locations and validation steps.
Next.js: Check instrumentation.ts, next.config.ts wrapper, both client and server configs.
Nuxt: Check Nuxt module config and both plugin files.
SvelteKit: Check hooks files and Vite config.
Express/Node: Verify early initialization order.
NestJS: Check for decorator and filter renames.
@sentry/* packages on same versionSuggest adding a test error:
// Add temporarily to verify Sentry is working after upgrade
setTimeout(() => {
throw new Error('Sentry upgrade verification - safe to delete');
}, 3000);
Mention features available in the new version that the user might want to enable:
v8 new features: OpenTelemetry-based Node tracing, automatic database/HTTP instrumentation, functional integrations, new span APIs
v9 new features: Structured logging (Sentry.logger.*), improved source maps handling, simplified configuration
If the user has other Sentry SDKs (Python, Ruby, Go, etc.) that also need upgrading, note that this skill covers JavaScript SDK only.
development
Decide which Sentry signal to reach for when instrumenting code — error, span, span attribute, log, or metric. Use when adding instrumentation and unsure whether something should be a log vs a span vs a metric, when deciding "what to instrument where", when reviewing instrumentation for gaps, or when a coding agent needs a rule for choosing between errors, traces, logs, and metrics. This skill decides WHAT to emit; the sentry-*-sdk skills handle HOW to set each pillar up.
development
Full Sentry SDK setup for React Native and Expo. Use when asked to "add Sentry to React Native", "install @sentry/react-native", "setup Sentry in Expo", or configure error monitoring, tracing, profiling, session replay, or logging for React Native applications. Supports Expo managed, Expo bare, and vanilla React Native.
development
Full Sentry SDK setup for Python. Use when asked to "add Sentry to Python", "install sentry-sdk", "setup Sentry in Python", or configure error monitoring, tracing, profiling, logging, metrics, crons, or AI monitoring for Python applications. Supports Django, Flask, FastAPI, Celery, Starlette, AIOHTTP, Tornado, and more.
development
Configure specific Sentry features beyond basic SDK setup. Use when asked to monitor AI/LLM calls, set up OpenTelemetry pipelines, or create alerts and notifications.