anthropic-sdk-upgrader
Skill10k starsChanged 7 months agoMITArchived repositoryView on GitHub
Use this agent when the user needs to upgrade Anthropic SDK packages. This includes: upgrading @anthropic-ai/sdk or @anthropic-ai/claude-agent-sdk to newer versions, migrating between SDK versions, resolving SDK-related dependency conflicts, updating SDK types and interfaces, or asking about SDK upgrade procedures. Examples: 'Upgrade the Anthropic SDK to the latest version', 'Help me migrate to the latest claude-agent-sdk', 'What's the process for upgrading Anthropic packages?'
- Deletes or force-pushes
- Installs packages
We split this skill into the rules it gives an agent
23 rules. About 0 are common, 15 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈15
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 18
Follow these steps exactly:
- Very specific: line 22
Before upgrading, review the current versions in package.json and check the release notes:
- Distinctive: line 29
Create a consolidated summary of changes between the current version and the target version.
- Distinctive: line 48
Identify Breaking Changes: Look for:
- Distinctive: line 84
After updating, diff the old and new type definitions to detect API changes that may not cause compilation errors but are important to know …
- Very specific: line 88
Snapshot before upgrading: Before running npm install in step 4, copy the current type definitions to a temp directory:
- Very specific: line 96
Diff the type definitions: After npm install, compare the old and new .d.ts files:
- Distinctive: line 160
After updating, check for compilation errors:
- Distinctive: line 177
After upgrading, run the Claude-related unit tests to verify nothing is broken:
- Distinctive: line 191
If needed, update documentation in the codebase:
- Very specific: line 193
Update src/extension/agents/claude/AGENTS.md if any architectural changes occurred
- Very specific: line 194
Update type definitions in common/claudeTools.ts if tools changed
- Distinctive: line 195
Document any new features or capabilities added
- Distinctive: line 196
Update the "Official Claude Agent SDK Documentation" links if URLs changed
- Distinctive: line 200
Create a commit message that documents the upgrade clearly.
- Very specific: line 238
Check if types were renamed (common: Message → ContentBlock, etc.)
- Distinctive: line 239
Look for removed type exports that need new imports
- Distinctive: line 240
Verify generic type parameters haven't changed
- Very specific: line 244
Check ClaudeCodeSessionService for compatibility issues
- Very specific: line 249
Check HookEvent type for valid event strings
- Distinctive: line 250
Verify hook callback signatures match new SDK expectations
- Distinctive: line 254
Check tool result handling for new error types
- Distinctive: line 255
Verify tool confirmation flow hasn't changed
≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
You are an expert at upgrading Anthropic SDK packages in the vscode-copilot-chat project.
Packages
| Package | Description |
@anthropic-ai/claude-agent-sdk | Official Claude Agent SDK - provides the core agent runtime, tools, hooks, sessions, and message streaming |
@anthropic-ai/sdk | Anthropic 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:
- Claude Agent SDK Releases: https://github.com/anthropics/claude-agent-sdk-typescript/releases
- Anthropic SDK Releases: https://github.com/anthropics/anthropic-sdk-typescript/releases
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 migrateHow to Create the Summary:
- Read the GitHub Release Notes: Go through each release between your versions
- Consolidate by Category: Group all features together, all bug fixes together, etc.
- Identify Breaking Changes: Look for:
- Removed or renamed exports
- Changed function signatures
- Modified type definitions
- Deprecated APIs that have been removed
- Document Migration Steps: For breaking changes, include the old and new patterns
- 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/sdk5. 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:
- Snapshot before upgrading: Before running
npm installin 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/nullImportant: This snapshot must be taken before step 4's
npm install. - Diff the type definitions: After
npm install, compare the old and new.d.tsfiles:# 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 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
@deprecatedJSDoc tags
- Cross-reference with our usage: For each change found, check whether the codebase currently uses the affected API:
Flag changes that affect APIs we actively use as higher priority.# Example: if `createSession` gained a new parameter, check our usage grep -rn "createSession" src/extension/agents/claude/ - Summarize opportunities: Identify new APIs or parameters that could improve the codebase. These become candidates for follow-up work after the upgrade is complete.
- Clean up:
rm -rf /tmp/anthropic-sdk-old
6. Fix Compilation Errors
After updating, check for compilation errors:
npm run compileAddress any type errors in the following key files:
src/extension/agents/claude/node/claudeCodeAgent.ts- Session and message handlingsrc/extension/agents/claude/node/claudeCodeSdkService.ts- SDK wrappersrc/extension/agents/claude/node/sessionParser/claudeCodeSessionService.ts- Session persistencesrc/extension/agents/claude/common/claudeTools.ts- Tool type definitionssrc/extension/agents/claude/node/hooks/*.ts- Hook implementationssrc/extension/agents/claude/vscode-node/slashCommands/*.ts- Slash command handlerssrc/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.tssrc/extension/agents/claude/node/test/claudeCodeSessionService.spec.tssrc/extension/agents/claude/node/sessionParser/test/*.spec.ts
8. Update Documentation
If needed, update documentation in the codebase:
- Update
src/extension/agents/claude/AGENTS.mdif any architectural changes occurred - Update type definitions in
common/claudeTools.tsif tools changed - Document any new features or capabilities added
- 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:
- Package version changes - Both old and new versions
- Features - Notable new capabilities added
- Bug fixes - Important fixes included
- 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.tsTroubleshooting 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
ClaudeCodeSessionServicefor compatibility issues - May need to clear old session files during major upgrades
Hook Registration Failures:
- Hook event names may have changed
- Check
HookEventtype 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
In this repository11 other files it gives its agents.
- assets/prompts/skills/agent-customization/references/agents.mdAGENTS.md
- src/extension/chatSessions/claude/AGENTS.mdAGENTS.md
- src/platform/authentication/common/AGENTS.mdAGENTS.md
- .github/copilot-instructions.mdCopilot instructions
- launchSkill
- agent-customizationSkill
- get-search-view-resultsSkill
- install-vscode-extensionSkill
- project-setup-info-context7Skill
- project-setup-info-localSkill
- troubleshootSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

