PluginBench
Skill
Official
Pass
Audit score 90

sentry-sdk-upgrade

getsentry/sentry-for-ai

Upgrade the Sentry JavaScript SDK across major versions with AI-guided migration.

What is sentry-sdk-upgrade?

This skill automates upgrading the Sentry JavaScript SDK between major versions (v7→v8, v8→v9, etc.), handling deprecated APIs, breaking changes, and framework-specific configuration updates. Use it when you need to migrate Sentry, fix version-bump errors, or modernize deprecated patterns.

  • Detects current Sentry SDK version, target version, and framework from package.json
  • Identifies deprecated Sentry APIs and breaking changes across major version jumps
  • Applies auto-fixable changes like import renames and method updates directly
  • Guides AI-assisted migrations for complex patterns like hub removal and performance API changes
  • Updates all @sentry/* packages to the same target version and verifies the build succeeds
  • Provides framework-specific migration steps for Next.js, Nuxt, SvelteKit, Express, NestJS, and others

How to install sentry-sdk-upgrade

npx skills add https://github.com/getsentry/sentry-for-ai --skill sentry-sdk-upgrade
Claude Code
Cursor
Windsurf
Cline

How to use sentry-sdk-upgrade

  1. 1.Invoke the skill when asked to upgrade Sentry or migrate to a newer version
  2. 2.The skill detects your current Sentry version and framework from package.json
  3. 3.Review the recommended migration path and breaking changes summary
  4. 4.Confirm the target version and scope of changes to apply
  5. 5.The skill applies auto-fixable changes (imports, renames) and proposes AI-assisted changes (hub patterns, config restructuring)
  6. 6.Update @sentry/* packages to the target version in package.json
  7. 7.Run the build and fix any remaining type errors or build failures
  8. 8.Verify all packages are on the same major version and tests pass

Use cases

Good for
  • Upgrade from Sentry v7 to v8 or v8 to v9 with automated code refactoring
  • Fix broken code after manually bumping @sentry/* package versions
  • Migrate from deprecated APIs like startTransaction, configureScope, or Handlers.requestHandler
  • Update Sentry configuration options that changed between major versions
  • Validate that all Sentry packages are on the same major version and build succeeds
Who it's for
  • JavaScript/TypeScript developers maintaining Sentry error tracking
  • Teams upgrading Sentry across Next.js, Nuxt, React, Vue, Angular, or Node.js projects
  • DevOps engineers managing SDK version consistency across monorepos
  • Developers fixing breaking changes after a Sentry version bump

sentry-sdk-upgrade FAQ

What if I'm upgrading multiple major versions (e.g., v7 to v9)?

The skill applies changes incrementally in order (v7→v8 changes first, then v8→v9), but updates package versions once to the final target version.

Does this work with all JavaScript frameworks?

Yes. The skill detects your framework (Next.js, Nuxt, SvelteKit, Remix, React, Angular, Vue, Express, NestJS, SolidStart, Astro, Bun, Cloudflare) and applies framework-specific migration steps.

What changes are applied automatically vs. requiring review?

Auto-fixable changes (import renames, method renames, simple config swaps) are applied directly. AI-assisted changes (hub removal, performance API migration, complex config restructuring) are explained and proposed for your confirmation. Manual review is flagged for removed APIs with no equivalent.

How do I verify the upgrade succeeded?

The skill runs TypeScript compilation and your build command, then suggests adding a temporary test error to verify Sentry is working. Check that all @sentry/* packages are on the same version, imports resolve, and tests pass.

Is there a CLI alternative to this skill?

Sentry provides npx @sentry/wizard -i upgrade for v8→v9 migrations, but this skill handles more patterns and multi-hop migrations (e.g., v7→v9).

Full instructions (SKILL.md)

Source of truth, from getsentry/sentry-for-ai.


name: sentry-sdk-upgrade description: 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. license: Apache-2.0 category: workflow parent: sentry-workflow disable-model-invocation: true

All Skills > Workflow > SDK Upgrade

Sentry JavaScript SDK Upgrade

Upgrade the Sentry JavaScript SDK across major versions with AI-guided migration.

Invoke This Skill When

  • User asks to "upgrade Sentry" or "migrate Sentry SDK"
  • User mentions deprecated Sentry APIs or breaking changes after a version bump
  • User wants to move from v7 to v8, v8 to v9, or any major version jump
  • User encounters errors after updating @sentry/* package versions
  • User asks about Sentry migration guides or changelogs

Phase 1: Detect

Identify the current Sentry SDK version, target version, and framework.

1.1 Read package.json

cat package.json | grep -E '"@sentry/' | head -20

Extract:

  • All @sentry/* packages and their current versions
  • The current major version (e.g., 7.x, 8.x, 9.x)

1.2 Detect Framework

Check package.json dependencies for framework indicators:

DependencyFrameworkSentry Package
nextNext.js@sentry/nextjs
nuxt or @nuxt/kitNuxt@sentry/nuxt
@sveltejs/kitSvelteKit@sentry/sveltekit
@remix-run/nodeRemix@sentry/remix
react (no Next/Remix)React SPA@sentry/react
@angular/coreAngular@sentry/angular
vue (no Nuxt)Vue@sentry/vue
expressExpress@sentry/node
@nestjs/coreNestJS@sentry/nestjs
@solidjs/startSolidStart@sentry/solidstart
astroAstro@sentry/astro
bun types or runtimeBun@sentry/bun
@cloudflare/workers-typesCloudflare@sentry/cloudflare
None of above (Node.js)Node.js@sentry/node

1.3 Find Sentry Config Files

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

1.4 Detect Deprecated Patterns

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

1.5 Determine Target Version

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.

Phase 2: Recommend

Present a migration summary based on detected state.

2.1 Calculate Migration Path

  • Single hop: e.g., v8 to v9
  • Multi-hop: e.g., v7 to v9 (apply v7→v8 changes first, then v8→v9)

For multi-hop migrations, apply code changes incrementally but update package versions once to the final target.

2.2 Present Breaking Changes Summary

Load the appropriate version-specific reference:

Present a concrete summary of changes needed, categorized by complexity:

Auto-fixable (apply directly):

  • Package import renames (e.g., @sentry/utils to @sentry/core)
  • Simple method renames (e.g., @WithSentry to @SentryExceptionCaptured)
  • Config option swaps (e.g., enableTracing to tracesSampleRate)

AI-assisted (explain and propose):

  • Hub removal with variable storage patterns
  • Performance API migration (transactions to spans)
  • Complex config restructuring (Vue tracing options, Next.js config merging)
  • Sampler transactionContext flattening

Manual review (flag for user):

  • Removed APIs with no equivalent
  • Behavioral changes (sampling, source maps defaults)
  • Custom transport modifications

2.3 Confirm Scope

Ask the user:

  • Confirm the migration path (e.g., "v8 to v9")
  • Confirm whether to proceed with all changes or specific categories
  • Note: npx @sentry/wizard -i upgrade exists as a CLI alternative for v8→v9 but may not handle all patterns

Phase 3: Guide

Step through changes file by file.

3.1 Process Each File with Sentry Imports

For each file identified in Phase 1.3:

  1. Read the file to understand current Sentry usage
  2. Apply auto-fixable changes directly:
    • Package import renames
    • Method/function renames
    • Simple config option swaps
  3. For AI-assisted changes, explain what needs to change and why, then propose the specific edit
  4. For uncertain changes, show the code and ask the user to confirm

3.2 Apply Changes by Category

Work through changes in this order:

Step 1: Package Import Updates

Replace removed/renamed package imports. Reference the version-specific migration file for the complete mapping.

Step 2: API Renames

Apply mechanical method and function renames.

Step 3: Config Changes

Update Sentry.init() options and build configuration.

Step 4: Complex Pattern Migration

Handle patterns requiring understanding of context:

  • Hub usage stored in variables
  • Transaction-based performance code
  • Custom integration classes
  • Framework-specific wrappers

Step 5: Update package.json Versions

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.

Step 6: Verify Build

# 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.

3.3 Framework-Specific Steps

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.

Phase 4: Cross-Link

4.1 Verify

  • All @sentry/* packages on same version
  • No import errors from removed packages
  • TypeScript compilation passes
  • Build succeeds
  • Tests pass (if they exist)

Suggest adding a test error:

// Add temporarily to verify Sentry is working after upgrade
setTimeout(() => {
  throw new Error('Sentry upgrade verification - safe to delete');
}, 3000);

4.2 New Features in Target Version

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

4.3 Related Resources

If the user has other Sentry SDKs (Python, Ruby, Go, etc.) that also need upgrading, note that this skill covers JavaScript SDK only.