--- name: anthropic-skills description: Use this skill when working with the Anthropic Skills API for document creation (pptx, xlsx, docx, pdf) via code execution containers. model: us.anthropic.claude-sonnet-4-5-20250929-v1:0 --- # Anthropic Skills API ## Required Beta Headers ``` code-execution-2025-08-25 skills-2025-10-02 files-api-2025-04-14 (for file download) ``` ## Pre-built Skill IDs | Skill ID | Type | |----------|------| | `pptx` | PowerPoint | | `xlsx` | Excel | | `docx` | Word | | `pdf` | PDF | ## Usage Pattern (TypeScript) ```typescript import Anthropic from '@anthropic-ai/sdk' const client = new Anthropic() const response = await client.beta.messages.create({ model: 'claude-sonnet-4-6', max_tokens: 4096, betas: ['code-execution-2025-08-25', 'skills-2025-10-02'], container: { skills: [{ type: 'anthropic', skill_id: 'pptx', version: 'latest' }], }, messages: [{ role: 'user', content: 'Create a presentation about X' }], tools: [{ type: 'code_execution_20250825', name: 'code_execution' }], }) ``` ## Extracting and Downloading Files ```typescript // Extract file IDs from bash_code_execution_tool_result blocks for (const item of response.content) { if (item.type === 'bash_code_execution_tool_result') { const contentItem = item.content if (contentItem.type === 'bash_code_execution_result' && contentItem.content) { for (const file of contentItem.content) { if ('file_id' in file) { const metadata = await client.beta.files.retrieveMetadata(file.file_id, { betas: ['files-api-2025-04-14'], }) const dl = await client.beta.files.download(file.file_id, { betas: ['files-api-2025-04-14'], }) const buffer = Buffer.from(await dl.arrayBuffer()) await writeFile(metadata.filename, buffer) } } } } } ``` ## Handling pause_turn Long operations return `stop_reason: 'pause_turn'`. Continue by appending `response.content` as an assistant message and re-sending with `container.id` from the previous response. ## Constraints - No network access in containers - No runtime package installation - Max 8 skills per request - Container reuse via `container.id`