Add comprehensive Skills API support#53
Merged
jamesrochabrun merged 4 commits intomainfrom Oct 26, 2025
Merged
Conversation
This PR adds full support for Anthropic's Skills API, enabling users to create, manage, and use skills in their applications.
## Features Added
### Core Skills Support
- Add Container parameter to MessageParameter for specifying skills
- Add Container response to MessageResponse for reusing containers
- Add SkillReference for referencing Anthropic and custom skills
- Support for skill versioning (latest or specific versions)
### Skills Management API
- Create skills with file uploads (multipart/form-data)
- List skills with filtering and pagination
- Retrieve individual skill details
- Delete skills
- Create, list, retrieve, and delete skill versions
### Implementation Details
- Add 8 new service methods to AnthropicService protocol
- Implement all methods in DefaultAnthropicService
- Implement all methods in AIProxyService for proxy compatibility
- Add multipart/form-data support for file uploads
- Add new endpoint paths: /v1/skills, /v1/skills/{id}, /v1/skills/{id}/versions
- Proper error handling for DELETE operations
- Query parameter support for pagination and filtering
### New Types
- SkillCreateParameter: Parameters for creating skills
- SkillVersionCreateParameter: Parameters for creating skill versions
- SkillFile: Represents files to upload
- ListSkillsParameter: Filtering and pagination options
- SkillResponse: Individual skill metadata
- ListSkillsResponse: Paginated skill list
- SkillVersionResponse: Version-specific metadata
- ListSkillVersionsResponse: Paginated version list
### Example Application
- Add SkillsDemoView with interactive UI
- Add SkillsDemoObservable with example implementations
- Demonstrate listing skills
- Demonstrate using skills in messages (XLSX example)
- Demonstrate container reuse across multi-turn conversations
- Demonstrate streaming with skills
- Update ApiKeyIntroView to include Skills beta headers
## Technical Notes
- Follows existing codebase patterns and conventions
- Full AIProxy compatibility
- Type-safe with proper Swift enums and structs
- Comprehensive documentation with API links
- Platform support: iOS 15+, macOS 12+, Linux
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
The JSONDecoder already uses .convertFromSnakeCase strategy which automatically handles snake_case to camelCase conversion. Explicit CodingKeys are redundant and inconsistent with other response models in the codebase (e.g. TextCompletionResponse). Changes: - Remove CodingKeys from SkillResponse - Remove CodingKeys from ListSkillsResponse - Remove CodingKeys from SkillVersionResponse - Remove CodingKeys from ListSkillVersionsResponse This follows the existing pattern where displayTitle, latestVersion, createdAt, updatedAt, hasMore, and nextPage are automatically mapped from their JSON snake_case equivalents.
When using Skills with code execution, the API returns new content types: - text_editor_code_execution_tool_result - bash_code_execution_tool_result These were not handled in MessageResponse.Content enum, causing decoding errors. Changes: - Add CodeExecutionToolResult struct to handle these results - Add codeExecutionToolResult case to Content enum - Update decoder to handle any *_tool_result types dynamically - Update encoder to properly encode code execution results This fixes the dataCorrupted error when decoding Skills API responses.
- Add Skills API to table of contents - Add detailed Skills API section with: - Introduction and beta access instructions - Basic usage examples with container management - Container reuse pattern for multi-turn conversations - Skills management examples (create, list, retrieve, delete) - Skill versions management examples - Complete parameter and response model documentation - Update Xcode project to include Skills demo files - Add code execution tool result handling in MessageFunctionCallingObservable 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
This PR adds full support for Anthropic's Skills API, enabling users to create, manage, and use skills in their SwiftAnthropic applications.
What's New
🎯 Core Features
Container Support
Containerparameter toMessageParameterfor specifying skills to loadContainerresponse field toMessageResponsefor reusing containers across conversationsSkillReferencetype for referencing both Anthropic-managed and custom skillsSkills Management
📦 New API Types
Parameters:
SkillCreateParameter- Create new skills with filesSkillVersionCreateParameter- Create new skill versionsSkillFile- File data with metadata for uploadsListSkillsParameter- Filter and paginate skill listsListSkillVersionsParameter- Paginate version listsResponses:
SkillResponse- Individual skill metadataListSkillsResponse- Paginated skill resultsSkillVersionResponse- Version-specific detailsListSkillVersionsResponse- Paginated version results🔧 Implementation
Service Methods (8 new):
Infrastructure:
/v1/skills,/v1/skills/{id},/v1/skills/{id}/versions📱 Example Application Updates
New Skills Demo:
SkillsDemoViewwith UI for testingSkillsDemoObservablewith example implementationsUpdated Files:
ApiKeyIntroView- Added Skills beta headersOptionsListView- Added "Skills API" optionUsage Example
Testing
Automated
Manual Testing
Run the example app and:
Technical Notes
Files Changed
Checklist