К основному содержанию
скилл CX Codex

sentry-sdk-upgrade — скилл для Claude Code: суть и установка

Скилл помогает обновить Sentry JavaScript SDK между мажорными версиями, например с v7 до v8 или v9. Он находит устаревший код, обновляет импорты и проверяет сборку проекта.

Установить в Claude Code · Через Skills CLI (Vercel) Все способы и платформы ↓
npx skills add getsentry/sentry-for-ai --skill sentry-sdk-upgrade -a claude-code
Открыть на GitHub

Что делает sentry-sdk-upgrade

Скилл автоматизирует миграцию проектов на Sentry JavaScript SDK при переходе на новые мажорные релизы. Сначала он сканирует package.json и определяет фреймворк проекта: от Next.js до Remix или Node.js. Затем агент находит устаревший синтаксис. Это вызовы вроде BrowserTracing, getCurrentHub или декоратора @WithSentry.

Правки разделены по сложности на три группы. Простые замены импортов и опций конфигурации применяются сразу. Сложные участки вроде отказа от Hub или перехода к спанам агент предлагает отдельно. Официальный CLI npx @sentry/wizard -i upgrade пропускает часть паттернов, поэтому пошаговый разбор надёжнее.

В конце обновляются зависимости. Скилл определяет менеджер пакетов через lock-файлы. Все пакеты @sentry/* обязаны использовать одну мажорную версию. Это предотвращает скрытые поломки типов. Финал включает прогон npx tsc --noEmit и проверку сборки проекта.

Какие задачи решает

  • перейти с Sentry v7 или v8 на свежую мажорную версию
  • заменить устаревшие импорты и методы конфигурации в коде
  • переписать работу с транзакциями на новую модель спанов
  • устранить ошибки типизации TypeScript после поднятия версий @sentry/*

Примеры запросов агенту

  • Обнови Sentry SDK в проекте до актуальной мажорной версии
  • Помоги перейти с Sentry v7 на v8 и исправь устаревшие методы
  • После обновления пакетов @sentry ломается сборка, почини ошибки

Как установить sentry-sdk-upgrade

1Через Skills CLI (Vercel)

npx skills add getsentry/sentry-for-ai --skill sentry-sdk-upgrade -a claude-code

2Вручную: положить файлы

~/.claude/skills/sentry-sdk-upgrade/SKILL.md

Папка скилла целиком; для одного проекта — .claude/skills/sentry-sdk-upgrade/

По шагам, с командами для каждой платформы: Как установить скилл в Claude Code: пять способов

Из того же набора31

sentry-sdk-setup Определяет язык и фреймворк проекта и подключает нужный SDK Sentry: ошибки, трейсинг, session replay. CX Codex +1 3 600установок sentry-nextjs-sdk Скилл сканирует проект на Next.js и помогает настроить мониторинг Sentry для браузера, Node.js и Edge Runtime. Пригодится при подключении трейсинга, сессий или сборе ошибок с роутов и Server Actions. CX Codex +1 3 600установок sentry-cocoa-sdk Скилл проводит через полную настройку Sentry в iOS, macOS, tvOS, watchOS и visionOS: сканирует проект, предлагает набор функций и ведёт по шагам установки. CX Codex +1 3 400установок sentry-node-sdk Скилл сканирует проект и ведёт по шагам подключения Sentry к серверному JavaScript и TypeScript: ошибки, трейсинг, логи, кроны. CX Codex +1 3 300установок sentry-react-sdk Скилл проводит через полную настройку Sentry в React-проекте: сканирует зависимости, предлагает набор функций и пишет конфиг. Пригодится, когда нужно подключить мониторинг ошибок без ручного разбора документации. CX Codex +1 3 100установок sentry-setup-ai-monitoring Настраивает мониторинг LLM, вызовов агентов и расхода токенов через Sentry. Скилл проверяет зависимости в проекте и подключает нужные интеграции для Node.js, Python или Laravel. CX Codex +1 3 000установок sentry-browser-sdk Скилл проводит агента через полную настройку Sentry в браузерном JavaScript: проверяет проект на фреймворки, выбирает способ установки и подключает нужные функции. CX Codex +1 2 900установок sentry-python-sdk Скилл сканирует Python-проект и ведёт через настройку Sentry: ошибки, трейсинг, профилирование, логи, кроны и AI-мониторинг. CX Codex +1 2 600установок

Похожие

sentry-go-sdk getsentry Скилл сканирует Go-проект и ведёт по шагам настройки Sentry: ошибки, трейсинг, логи, метрики и кроны. CX Codex +1 316установок sentry-react-sdk getsentry Скилл сканирует React-приложение и проводит через полную настройку Sentry: ошибки, трейсинг, session replay, логи и профилирование. CX Codex +1 579установок fix-sentry-issues brianlovin Скилл находит сбои через Sentry MCP, сортирует их и устраняет первопричину в кодовой базе. Помогает при разборе аварийных всплесков и очистке логов от шума. CX Codex +1 2 700установок sentry brianlovin Даёт агенту правила Sentry для отслеживания ошибок и трассировки производительности в Next.js. Нужен при добавлении такой инструментализации в приложение. CX Codex +1 2 800установок Sentry Bug Fixer f Промпт превращает чат-модель в помощника по разбору ошибок из Sentry: анализ отчётов, приоритеты, правки и проверка. GP ChatGPT ★ 174 597звёзд репо sentry-triage официальный Liz Tom Показывает живые ошибки Sentry в канвасе Copilot, раскладывает их по срочности и отдаёт в работу — на трекинг или в PR с фиксом. ★ 40 418звёзд репо

Рядом в теме «Код-ревью и рефакторинг»

Всё по теме «Код-ревью и рефакторинг» →

Вопросы о sentry-sdk-upgrade

Как установить sentry-sdk-upgrade в Claude Code?

Выполните команду npx skills add getsentry/sentry-for-ai --skill sentry-sdk-upgrade -a claude-code. Скилл загрузится в каталог ~/.claude/skills/sentry-sdk-upgrade/SKILL.md.

Что делает sentry-sdk-upgrade?

Скилл сканирует файлы репозитория, выявляет текущую версию Sentry и используемый фреймворк, после чего обновляет устаревший код по шагам. Он заменяет старые импорты, перестраивает конфигурацию и тестирует сборку через tsc.

Можно ли перейти сразу с v7 на v9?

Да, скилл поддерживает составные маршруты миграции. Он поэтапно применяет изменения между версиями, а сами пакеты в package.json обновляет один раз до целевого релиза.

Исходный текст

SKILL.md · Apache-2.0
---
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](../../SKILL_TREE.md) > [Workflow](../sentry-workflow/SKILL.md) > 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

```bash
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:

| 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` |

### 1.3 Find Sentry Config Files

```bash
grep -rn "from '@sentry/\|require('@sentry/" --include="*.ts" --include="*.js" --include="*.tsx" --include="*.jsx" --include="*.mjs" --include="*.cjs" -l
```

```bash
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:

```bash
# 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:
- v7→v8: [references/v7-to-v8.md](references/v7-to-v8.md)
- v8→v9: [references/v8-to-v9.md](references/v8-to-v9.md)
- v9→v10: [references/v9-to-v10.md](references/v9-to-v10.md)

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.

```bash
# 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

```bash
# 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](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:

```js
// 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

- [Official Migration Guide (v7→v8)](https://docs.sentry.io/platforms/javascript/migration/v7-to-v8/)
- [Official Migration Guide (v8→v9)](https://docs.sentry.io/platforms/javascript/migration/v8-to-v9/)
- [Sentry JavaScript SDK Changelog](https://github.com/getsentry/sentry-javascript/blob/develop/CHANGELOG.md)

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

© getsentry · Apache-2.0 · getsentry/sentry-for-ai

Смотрите также

Спонсоры проекта

Компании, которые помогают держать аналитику открытой