anthropic-sdk-upgrader

작성자: microsoft

사용자가 Anthropic SDK 패키지를 업그레이드해야 할 때 이 에이전트를 사용하세요. 여기에는 @anthropic-ai/sdk 또는 @anthropic-ai/claude-agent-sdk를 최신 버전으로 업그레이드하는 것이 포함됩니다.

npx skills add https://github.com/microsoft/vscode-copilot-chat --skill anthropic-sdk-upgrader

You are an expert at upgrading Anthropic SDK packages in the vscode-copilot-chat project.

Packages

PackageDescription
@anthropic-ai/claude-agent-sdkOfficial Claude Agent SDK - provides the core agent runtime, tools, hooks, sessions, and message streaming
@anthropic-ai/sdkAnthropic API SDK - provides base types, API client, and message structures used by the agent SDK

Upgrade Process

Follow these steps exactly:

1. Check Current Versions and Changelog

Before upgrading, review the current versions in package.json and check the release notes:

2. Summarize All Changes

Create a consolidated summary of changes between the current version and the target version. Group changes by category, not by individual version:

Summary Format:

### `@anthropic-ai/package-name` (oldVersion → newVersion)

#### Features
- **Category:** Description of new feature or capability

#### Bug Fixes
- Description of what was fixed

#### Breaking Changes
- **Old API → New API**: Description of what changed and how to migrate

How to Create the Summary:

  1. Read the GitHub Release Notes: Go through each release between your versions
  2. Consolidate by Category: Group all features together, all bug fixes together, etc.
  3. Identify Breaking Changes: Look for:
    • Removed or renamed exports
    • Changed function signatures
    • Modified type definitions
    • Deprecated APIs that have been removed
  4. Document Migration Steps: For breaking changes, include the old and new patterns
  5. Check Peer Dependencies: Note if the new version requires different peer dependencies

3. List Important Changes

Categorize changes by impact level:

Critical (Must Address Before Merge):

  • Breaking API changes that will cause compilation errors
  • Removed types or functions currently in use
  • Changed behavior of core functionality (sessions, streaming, tools)

Important (Should Address):

  • Deprecated APIs that should be migrated
  • New recommended patterns replacing old ones
  • Performance improvements that require code changes

Nice to Have (Can Address Later):

  • New optional features
  • Additional type exports
  • Enhanced error messages

4. Update Package Versions

# Update to latest
npm install @anthropic-ai/claude-agent-sdk @anthropic-ai/sdk

5. Detect API Surface Changes

After updating, diff the old and new type definitions to detect API changes that may not cause compilation errors but are important to know about (new parameters, new functions, deprecated APIs, etc.).

Steps:

  1. Snapshot before upgrading: Before running npm install in step 4, copy the current type definitions to a temp directory:

    mkdir -p /tmp/anthropic-sdk-old
    cp -r node_modules/@anthropic-ai/sdk/*.d.ts node_modules/@anthropic-ai/sdk/resources/*.d.ts /tmp/anthropic-sdk-old/ 2>/dev/null
    cp -r node_modules/@anthropic-ai/claude-agent-sdk/*.d.ts /tmp/anthropic-sdk-old/ 2>/dev/null
    

    Important: This snapshot must be taken before step 4's npm install.

  2. Diff the type definitions: After npm install, compare the old and new .d.ts files:

    # Diff the Anthropic SDK types
    for f in node_modules/@anthropic-ai/sdk/*.d.ts node_modules/@anthropic-ai/sdk/resources/*.d.ts; do
      base=$(basename "$f")
      if [ -f "/tmp/anthropic-sdk-old/$base" ]; then
        diff -u "/tmp/anthropic-sdk-old/$base" "$f"
      else
        echo "+++ NEW FILE: $f"
      fi
    done
    
    # Diff the Agent SDK types
    for f in node_modules/@anthropic-ai/claude-agent-sdk/*.d.ts; do
      base=$(basename "$f")
      if [ -f "/tmp/anthropic-sdk-old/$base" ]; then
        diff -u "/tmp/anthropic-sdk-old/$base" "$f"
      else
        echo "+++ NEW FILE: $f"
      fi
    done
    
  3. Analyze the diff and produce a report with the following categories:

    New Exports — Functions, classes, types, or constants that were added:

    • New exported functions or methods
    • New type/interface definitions
    • New enum values

    New Parameters — Optional or required parameters added to existing functions:

    • New optional fields on existing option/config types
    • New required parameters (these are breaking changes — flag them as critical)
    • New overloads of existing functions

    Changed Signatures — Modifications to existing function/method signatures:

    • Parameter type changes (e.g., string → string | string[])
    • Return type changes
    • Generic type parameter changes

    Removed or Renamed — Items that were removed or renamed:

    • Removed exports (breaking — flag as critical)
    • Renamed types/functions (breaking — flag as critical)
    • Removed fields from interfaces

    Deprecations — Items newly marked as @deprecated:

    • Functions or types with new @deprecated JSDoc tags
  4. Cross-reference with our usage: For each change found, check whether the codebase currently uses the affected API:

    # Example: if `createSession` gained a new parameter, check our usage
    grep -rn "createSession" src/extension/agents/claude/
    

    Flag changes that affect APIs we actively use as higher priority.

  5. Summarize opportunities: Identify new APIs or parameters that could improve the codebase. These become candidates for follow-up work after the upgrade is complete.

  6. Clean up:

    rm -rf /tmp/anthropic-sdk-old
    

6. Fix Compilation Errors

After updating, check for compilation errors:

npm run compile

Address any type errors in the following key files:

  • src/extension/agents/claude/node/claudeCodeAgent.ts - Session and message handling
  • src/extension/agents/claude/node/claudeCodeSdkService.ts - SDK wrapper
  • src/extension/agents/claude/node/sessionParser/claudeCodeSessionService.ts - Session persistence
  • src/extension/agents/claude/common/claudeTools.ts - Tool type definitions
  • src/extension/agents/claude/node/hooks/*.ts - Hook implementations
  • src/extension/agents/claude/vscode-node/slashCommands/*.ts - Slash command handlers
  • src/extension/agents/claude/node/toolPermissionHandlers/*.ts - Permission handlers

7. Run Tests

After upgrading, run the Claude-related unit tests to verify nothing is broken:

# Run all Claude agent tests
npm run test:unit -- --testPathPattern="agents/claude"

Fix any test failures before proceeding. Common test files to check:

  • src/extension/agents/claude/node/test/claudeCodeAgent.spec.ts
  • src/extension/agents/claude/node/test/claudeCodeSessionService.spec.ts
  • src/extension/agents/claude/node/sessionParser/test/*.spec.ts

8. Update Documentation

If needed, update documentation in the codebase:

  1. Update src/extension/agents/claude/AGENTS.md if any architectural changes occurred
  2. Update type definitions in common/claudeTools.ts if tools changed
  3. Document any new features or capabilities added
  4. Update the "Official Claude Agent SDK Documentation" links if URLs changed

9. Commit with a Detailed Message

Create a commit message that documents the upgrade clearly. Include:

  1. Package version changes - Both old and new versions
  2. Features - Notable new capabilities added
  3. Bug fixes - Important fixes included
  4. Breaking changes - What changed and how it was addressed in the code

Example commit message:

Update Anthropic SDK packages

### `@anthropic-ai/sdk` (0.71.2 → 0.72.1)

#### Features
- Structured Outputs support in Messages API
- MCP SDK helper functions

#### Breaking Changes
- `output_format` → `output_config` parameter migration

### `@anthropic-ai/claude-agent-sdk` (0.2.5 → 0.2.31)

#### Features
- **Query interface:** Added `close()` method, `reconnectMcpServer()`, `toggleMcpServer()` methods
- **Sessions:** Added `listSessions()` function for discovering resumable sessions
- **MCP:** Added `config`, `scope`, `tools` fields and `disabled` status to `McpServerStatus`

#### Bug Fixes
- Fixed `mcpServerStatus()` to include tools from SDK and dynamically-added MCP servers
- Fixed PermissionRequest hooks in SDK mode

#### Breaking Changes
- `KillShellInput` → `TaskStopInput`: Updated type mapping in claudeTools.ts

Troubleshooting Common Issues

Type Errors After Upgrade:

  • Check if types were renamed (common: Message → ContentBlock, etc.)
  • Look for removed type exports that need new imports
  • Verify generic type parameters haven't changed

Session Loading Failures:

  • Session file format may have changed between major versions
  • Check ClaudeCodeSessionService for compatibility issues
  • May need to clear old session files during major upgrades

Hook Registration Failures:

  • Hook event names may have changed
  • Check HookEvent type for valid event strings
  • Verify hook callback signatures match new SDK expectations

Tool Execution Errors:

  • Tool input schemas may have changed
  • Check tool result handling for new error types
  • Verify tool confirmation flow hasn't changed

microsoft의 다른 스킬

oss-growth
microsoft
OSS 성장 해커 페르소나
agent-framework-azure-ai-py
microsoft
Microsoft Agent Framework Python SDK(agent-framework-azure-ai)를 사용하여 Azure AI Foundry 에이전트를 구축합니다. AzureAIAgentsProvider로 지속적 에이전트를 만들 때, 호스팅 도구(코드 인터프리터, 파일 검색, 웹 검색)를 사용할 때, MCP 서버를 통합할 때, 대화 스레드를 관리할 때, 또는 스트리밍 응답을 구현할 때 사용합니다. 함수 도구, 구조화된 출력, 다중 도구 에이전트를 다룹니다.
development
airunway-aks-setup
microsoft
AKS에서 AI Runway 설정 — 빈 클러스터에서 실행 중인 모델까지. 클러스터 검증, 컨트롤러 설치, GPU 평가, 공급자 설정, 첫 배포를 다룹니다. 시기: "AI Runway 설정", "AKS 클러스터 온보딩", "AI Runway 설치", "airunway 설정", "AKS에 모델 배포", "AKS에서 GPU 추론", "AKS에서 KAITO 설정", "AKS에서 LLM 실행", "AKS에서 vLLM", "AKS에서 모델 서빙 설정", "AI Runway 컨트롤러".
devops
appinsights-instrumentation
microsoft
Azure Application Insights로 웹앱을 계측하기 위한 지침입니다. 원격 분석 패턴, SDK 설정, 구성 참조를 제공합니다. WHEN: 앱 계측 방법, App Insights SDK, 원격 분석 패턴, App Insights란 무엇인가, Application Insights 지침, 계측 예시, APM 모범 사례.
devops
applicationinsights-web-ts
microsoft
브라우저/웹 앱을 Application Insights JavaScript SDK(@microsoft/applicationinsights-web)로 계측합니다. Real User Monitoring(RUM) — 페이지 뷰, 클릭, AJAX/fetch 종속성, 예외, 사용자 지정 이벤트, 백엔드 OpenTelemetry 트레이스와 상관관계가 있는 브라우저 측 GenAI 에이전트 트레이스에 사용합니다. SDK Loader Script 및 npm 설정, 프레임워크 확장(React, React Native, Angular), Click Analytics, 텔레메트리 이니셜라이저, 브라우저에서 생성된 에이전트/도구/모델 스팬에 대한 OTel GenAI 의미론적 규칙을 다룹니다.
devops
azure-ai-anomalydetector-java
microsoft
Azure AI Anomaly Detector SDK for Java로 이상 탐지 애플리케이션을 구축하세요. 단변량/다변량 이상 탐지, 시계열 분석 또는 AI 기반 모니터링을 구현할 때 사용하세요.
development
azure-ai-language-conversations-py
microsoft
azure-ai-language-conversations Python SDK를 사용하여 대화형 언어 이해(CLU)를 구현합니다. ConversationAnalysisClient로 대화 의도와 엔터티를 분석하거나, NLP 기능을 구축하거나, 애플리케이션에 언어 이해를 통합할 때 사용합니다.
development
azure-ai-ml-py
microsoft
Azure Machine Learning SDK v2 for Python. ML 작업 영역, 작업, 모델, 데이터 세트, 컴퓨팅 및 파이프라인에 사용합니다. 트리거: "azure-ai-ml", "MLClient", "workspace", "model registry", "training jobs", "datasets".
development