Agent Skills let Claude build real Excel, PowerPoint, Word and PDF files through the API. You can also upload your own Skill folder and reuse it in every request.
Skills left beta on 19 August 2026, so you no longer need the old beta header. This Python tutorial covers prebuilt Skills, custom uploads, versions, file downloads, prices and the errors you will hit.
- What it is: a Skill is a folder with a
SKILL.mdfile plus optional scripts. Claude loads it inside the code execution container when it is useful. - Required: the code execution tool in
tools, and your Skills in thecontainerparameter (up to 20 per request). - Prebuilt Skills:
xlsx,pptx,docxandpdf, withtype: "anthropic". - No beta header: Skills, the Skills API and the Files API are GA. Use
client.skillsandclient.filesin Python SDK 2.17.0. - Cost: normal token prices plus code execution time. Each organization gets 1,550 free container hours a month, then $0.05 per hour.
What Agent Skills Are in the Claude API
A Skill is a folder of instructions, scripts and resources. The only required file is SKILL.md, which starts with YAML frontmatter holding a name and a description.
Claude does not read every Skill in full on every request. Anthropic calls this progressive disclosure, and it works in three levels:
| Level | When it loads | Token cost | What it holds |
|---|---|---|---|
| 1. Metadata | Always | About 100 tokens per Skill | name and description |
| 2. Instructions | When the Skill is triggered | Under 5k tokens | The body of SKILL.md |
| 3. Resources | Only when needed | Nothing until read | Extra docs, templates and scripts |
Scripts are the clever part. When Claude runs a script, only its output enters the context window, not the code. That makes a Skill cheaper and more reliable than asking Claude to write the same code from scratch each time.
If you want the bigger picture, including Skills in claude.ai and Claude Code, read my Claude Skills guide. This post sticks to the API.
Is the Skills API Still in Beta?
No. Anthropic’s release notes for 19 August 2026 say Agent Skills and the Skills API (/v1/skills) are out of beta. The Files API left beta on the same day.
Here is what that means for your code:
- No skills header: you can drop
anthropic-beta: skills-2025-10-02. Old requests that still send it keep working and keep the old response shapes. - No code execution header: the docs say none of the three code execution tool versions needs a beta header.
- Stable namespaces: call
client.skillsandclient.files, notclient.beta.skillsandclient.beta.files. - Renamed fields:
display_titlebecamedisplay_name, andlatest_versionbecamelatest_version_id. - New delete rule: deleting a Skill now deletes all of its versions in one call.
Warning: old blog posts still show betas=["skills-2025-10-02"] and epoch-number versions like "1759178010641129". Those are beta shapes. New code should use version IDs that start with skver_.
I checked the examples below against the official docs and the anthropic Python SDK 2.17.0 on PyPI (released 3 December 2026), which needs Python 3.10 or newer.
The Code Execution Container Requirement
Skills only run inside the code execution tool’s sandbox. If you forget the tool, Claude has nowhere to read the Skill files or run its scripts.
When you list Skills in a request, the API copies their files into the container at /skills/{skill-name}/. Claude then reads SKILL.md with bash when your prompt matches the Skill’s description.
Which code execution version to use
code_execution_20250825: Bash commands and file operations. The Skills guide uses this one in every example.code_execution_20260120: adds REPL state persistence and programmatic tool calling.code_execution_20260521: same runtime as 20260120, but the tool description tells Claude about the 90-second limit per Python cell.
What is inside the container
| Item | Value |
|---|---|
| Python | 3.11 on Linux, x86_64 |
| Memory / disk / CPU | 5 GiB RAM, 5 GiB workspace, 1 CPU |
| Internet | Disabled, no outbound requests |
| Package installs | Not possible at runtime |
| Preinstalled file libraries | openpyxl, xlsxwriter, python-pptx, python-docx, pypdf, pdfplumber, reportlab and more |
| Container lifetime | 30 days after creation |
Note: because there is no network and no pip install, a custom Skill can only use the preinstalled libraries. Bundle any helper code inside the Skill folder itself.
Prebuilt Anthropic Skills: xlsx, pptx, docx, pdf
Anthropic ships four ready-made document Skills. They work for every API user with no upload step.
| skill_id | What it does | Typical prompt |
|---|---|---|
xlsx |
Creates spreadsheets, analyzes data, adds charts | “Build a monthly budget with totals” |
pptx |
Creates and edits slide decks | “Make a 6-slide deck on Q3 results” |
docx |
Creates and formats Word documents | “Draft a two-page project brief” |
pdf |
Generates formatted PDF reports | “Turn this summary into a PDF report” |
Each reference needs type, skill_id and an optional version. Anthropic Skills use date versions such as 20251013, or latest. Custom Skills use generated IDs like skill_01... and versions like skver_01....

Prerequisites and Setup
You need a Claude Console account with API access and Python 3.10 or newer. If you do not have a key yet, follow how to get a Claude API key first.
- Create a project folder and virtual environment. Run
python3 -m venv .venv, then activate it withsource .venv/bin/activate(on Windows,.venv\Scripts\activate). - Install the SDK. Run
pip install -U anthropic. Check the version withpip show anthropic; it should be 2.17.0 or newer. - Set your key. Export it as
ANTHROPIC_API_KEYin your shell. The SDK reads it automatically, so you never paste it into code. - Pick a model. The examples use
claude-opus-5-5, which the Skills guide uses too.claude-sonnet-5-5is half the price if you want to save money. - Run a quick test. Save Example 1 as
budget.pyand runpython budget.py. A.xlsxfile should appear in your folder.
New to the SDK itself? My Claude API Python tutorial covers messages, streaming and basic error handling.
Example 1: Create an Excel File and Download It
This script asks the xlsx Skill for a budget spreadsheet. It then finds every generated file_id in the response and downloads it with the Files API.
import anthropic
client = anthropic.Anthropic() # reads ANTHROPIC_API_KEY
response = client.messages.create(
model="claude-opus-5-5",
max_tokens=16000,
container={
"skills": [{"type": "anthropic", "skill_id": "xlsx", "version": "latest"}]
},
tools=[{"type": "code_execution_20250825", "name": "code_execution"}],
messages=[{
"role": "user",
"content": "Create an Excel file with a simple monthly budget: "
"income, 8 expense rows, totals and a pie chart. "
"Save the final file to $OUTPUT_DIR.",
}],
)
def extract_file_ids(resp):
ids = []
for block in resp.content:
if block.type == "bash_code_execution_tool_result":
result = block.content
if result.type == "bash_code_execution_result":
for item in result.content:
ids.append(item.file_id)
return ids
for file_id in extract_file_ids(response):
meta = client.files.retrieve_metadata(file_id=file_id)
data = client.files.download(file_id=file_id)
data.write_to_file(meta.filename)
print("Saved", meta.filename, meta.size_bytes, "bytes")
print("Container:", response.container.id)
Why mention $OUTPUT_DIR in the prompt? The docs explain that each bash call gets a fresh $OUTPUT_DIR. Only files at the top level of that folder come back as file_id entries.
Tip: if a run finishes with no file IDs, the file is probably still in the container. Reuse the same container ID and ask Claude to copy the file into $OUTPUT_DIR.
For more on downloads, expiry and storage, see my Claude Files API tutorial.
Example 2: Upload a Custom Skill
Custom Skills let you package your own rules, like a brand style or a finance formula. Start with a folder like this:
invoice_checker/
SKILL.md
check_totals.py
The SKILL.md file needs frontmatter at the top. The description matters most, because Claude matches your prompt against it.
---
name: invoice-checker
description: Checks invoice spreadsheets for wrong totals and missing tax. Use when the user asks to audit, verify or check an invoice file.
---
# Invoice checker
1. Load the sheet with openpyxl.
2. Run check_totals.py on it and report every row where the total is wrong.
3. Write a short summary table at the end.
Now upload it. The Python SDK has a files_from_dir helper that sends every file in the folder:
import anthropic
from anthropic.lib import files_from_dir
client = anthropic.Anthropic()
skill = client.skills.create(files=files_from_dir("invoice_checker"))
print("Skill ID:", skill.id)
print("Version:", skill.latest_version_id)
# List only your own Skills
for s in client.skills.list(source="custom"):
print(s.id, s.display_name, s.source.type)
You can also upload a zip with files=[open("invoice_checker.zip", "rb")]. Then reference the Skill with type: "custom":
container = {
"skills": [
{"type": "custom", "skill_id": skill.id, "version": skill.latest_version_id}
]
}
Upload rules to follow
SKILL.mdlocation: at the upload root, or at the top of one enclosing folder.name: up to 64 characters, lowercase letters, numbers and hyphens only. It cannot contain “anthropic” or “claude”.description: not empty, up to 1,024 characters, no XML tags.- Size: the whole upload must be under 30 MB uncompressed.
display_name: optional, up to 255 characters. If you skip it, it comes from thename.
Warning: custom Skills are shared across your whole workspace. Any API key with access to that workspace can read, use and delete them. Keep sensitive Skills in their own workspace.
Skill Versions and Skills API Endpoints
Every upload of new files creates a new version. A version is a full snapshot, not a patch, so always upload the complete folder. The name in the new SKILL.md must match the existing Skill.
new_version = client.skills.versions.create(
skill_id="skill_01AbCdEfGhIjKlMnOpQrStUv",
files=files_from_dir("invoice_checker"),
)
print("New version:", new_version.id) # skver_...
skver_ version ID in production, and use "latest" only while you develop. With latest, anyone in the workspace who uploads a new version instantly changes what your app runs.Here are the REST endpoints behind the SDK methods:
| Action | Endpoint | Python SDK |
|---|---|---|
| Create Skill | POST /v1/skills |
client.skills.create() |
| List Skills | GET /v1/skills |
client.skills.list() |
| Get Skill | GET /v1/skills/{skill_id} |
client.skills.retrieve() |
| Delete Skill (and all versions) | DELETE /v1/skills/{skill_id} |
client.skills.delete() |
| Create version | POST /v1/skills/{skill_id}/versions |
client.skills.versions.create() |
| List versions (newest first) | GET /v1/skills/{skill_id}/versions |
client.skills.versions.list() |
| Get one version | GET /v1/skills/{skill_id}/versions/{version} |
client.skills.versions.retrieve() |
| Delete one version | DELETE /v1/skills/{skill_id}/versions/{version} |
client.skills.versions.delete() |
List calls take limit from 1 to 1,000 (default 20), a page token, and a source filter of custom or anthropic. There is also GET /v1/skills/{skill_id}/versions/latest to resolve the newest version in one call.
Example 3: Combine Skills, Reuse the Container, Handle pause_turn
Real jobs often need two Skills, like a spreadsheet plus a deck. Long runs can also stop with stop_reason: "pause_turn", which means the API paused and you should send the turn back.
import anthropic
client = anthropic.Anthropic()
SKILLS = [
{"type": "anthropic", "skill_id": "xlsx", "version": "latest"},
{"type": "anthropic", "skill_id": "pptx", "version": "latest"},
]
TOOLS = [{"type": "code_execution_20250825", "name": "code_execution"}]
messages = [{
"role": "user",
"content": "Create sample sales data for 12 months in Excel, then a "
"5-slide PowerPoint summary. Save both files to $OUTPUT_DIR.",
}]
response = client.messages.create(
model="claude-opus-5-5", max_tokens=16000,
container={"skills": SKILLS}, tools=TOOLS, messages=messages,
)
for _ in range(10): # safety cap
if response.stop_reason != "pause_turn":
break
messages.append({"role": "assistant", "content": response.content})
response = client.messages.create(
model="claude-opus-5-5", max_tokens=16000,
container={"id": response.container.id, "skills": SKILLS},
tools=TOOLS, messages=messages,
)
print("Stop reason:", response.stop_reason)
print("Reuse this container:", response.container.id)
Always send the same container ID back with a paused turn. If you do not, the request runs in a new container and the files from earlier in the turn are lost.
Keep the Skills list and its order the same on every request. Skills render into the system prompt, so changing the list breaks prompt caching.
Example 4: Give a Skill Your Own Input File
To let a Skill work on your data, upload the file with the Files API. Then reference it with a container_upload block, which places the file inside the container.
from pathlib import Path
import anthropic
client = anthropic.Anthropic()
uploaded = client.files.upload(file=Path("sales.csv"))
response = client.messages.create(
model="claude-opus-5-5",
max_tokens=16000,
container={"skills": [{"type": "anthropic", "skill_id": "docx", "version": "latest"}]},
tools=[{"type": "code_execution_20250825", "name": "code_execution"}],
messages=[{
"role": "user",
"content": [
{"type": "text", "text": "Write a one-page Word report on this data. "
"Save it to $OUTPUT_DIR."},
{"type": "container_upload", "file_id": uploaded.id},
],
}],
)
Download the report with the same extract_file_ids() loop from Example 1. Note that files you upload are not downloadable; only files made by Skills or code execution are.
The Same Request with curl
Here is the raw HTTP version of a pptx request. It uses API version 2026-10-21, the value in the current docs.
curl https://api.anthropic.com/v1/messages \
-H "x-api-key: $ANTHROPIC_API_KEY" \
-H "anthropic-version: 2026-10-21" \
-H "content-type: application/json" \
-d '{
"model": "claude-opus-5-5",
"max_tokens": 16000,
"container": {
"skills": [{"type": "anthropic", "skill_id": "pptx", "version": "latest"}]
},
"tools": [{"type": "code_execution_20250825", "name": "code_execution"}],
"messages": [{"role": "user", "content": "Create a 5-slide deck about renewable energy"}]
}'
Uploading a Skill over HTTP is a multipart POST /v1/skills with one or more files[] form fields.
Pricing with a Worked Example
There is no separate fee for Skills. You pay for two things: model tokens, and code execution time when it is not covered for free.
| Cost item | Price (checked 4 Dec 2026) |
|---|---|
| Claude Opus 5.5 tokens | $4 input / $20 output per million |
| Claude Sonnet 5.5 tokens | $2 input / $10 output per million |
| Claude Haiku 5.5 tokens | $0.10 input / $0.50 output per million (prompts up to 100K) |
| Code execution | 1,550 free hours per organization per month, then $0.05 per container hour |
| Minimum billed time | 5 minutes per execution |
| Files API calls | Free (upload, download, list, metadata, delete) |

Worked example: 1,000 Excel reports a month
Say each report request uses about 20,000 input tokens across its tool loop and 8,000 output tokens on Claude Opus 5.5. These numbers are only an assumption, so measure your own with response.usage.
- Input: 20,000 x $4 / 1,000,000 = $0.08 per report.
- Output: 8,000 x $20 / 1,000,000 = $0.16 per report.
- Code execution: 1,000 runs x 5 minutes = about 83 hours, well inside the 1,550 free hours. So $0.
- Total: about $0.24 per report, or about $240 for 1,000 reports. On Sonnet 5.5 the token part halves to about $120.
Code execution is also free in any request that includes the current web search or web fetch tools. For the full price list, see my Claude API pricing guide.
Limits and Constraints
| Limit | Value |
|---|---|
| Skills per request | 20 |
| Skill upload size | Under 30 MB, all files, uncompressed |
| Skill name / description | 64 / 1,024 characters |
| Container RAM / disk | 5 GiB / 5 GiB, 1 CPU |
| Container expiry | 30 days after creation |
| Files API file size / org storage | 500 MB per file / 1 TB |
| Files API rate limit | About 500 requests per minute |
| Workspaces per organization | 1,000 by default |
Where the API Skills work
- Supported: the Claude API, Claude Platform on AWS, and Claude Models on Google Cloud (Anthropic managed).
- Partial: Microsoft Foundry deployments hosted on Anthropic, without the Skill version download endpoint.
- Not synced: Skills you upload to the API do not appear in claude.ai or Claude Code, and the reverse is also true.
- Not ZDR: Agent Skills and code execution are not covered by zero data retention. Container data is kept for up to 30 days.
Troubleshooting: Common Problems and Fixes
| Problem or error | Likely cause | Fix |
|---|---|---|
400 invalid_request_error mentioning skills or container |
Code execution tool missing, wrong type, or a bad skill_id |
Add the code execution tool and check type is anthropic or custom |
No file_id in the response |
File was saved outside $OUTPUT_DIR |
Ask Claude to copy the file into $OUTPUT_DIR in the same container |
| 400 “Not downloadable” | You tried to download a file you uploaded | Only Skill or code execution output can be downloaded |
| 404 on download | Wrong file_id, another workspace, or the file expired |
Use a key for the same workspace and check expires_at |
| Error when reusing a container | The container expired | Send the request without container.id to get a new one |
execution_time_exceeded |
A tool call ran past the time limit | Split the work into smaller steps or smaller files |
stop_reason: "pause_turn" |
A long Skill run was paused | Send response.content back with the same container ID |
| Upload rejected | No SKILL.md at the root, a reserved word in name, or over 30 MB |
Fix the frontmatter and folder layout, then upload again |
| 400 when deleting the only version | A Skill must keep at least one version | Upload a replacement version first, or delete the whole Skill |
| Old code breaks after upgrading the SDK | client.beta.skills now returns the GA shapes |
Rename display_title and latest_version, and read source.type |
| 429 rate limit errors | Too many requests for your tier | Back off and retry; see my 429 and 529 fix guide |
Code execution errors do not always raise an exception. They can come back inside a bash_code_execution_tool_result_error block with an error_code such as unavailable, too_many_requests or output_file_too_large.
FAQ
Do I still need the skills-2025-10-02 beta header?
No. Skills and the Skills API went GA on 19 August 2026, so new code needs no beta header. Old requests that still send it keep working with the old response shapes.
Can I use Skills without the code execution tool?
No. Skills run inside the code execution container, so the tool must be in your tools array. Any of the three current versions works.
How many Skills can I use in one request?
Up to 20, mixing Anthropic and custom Skills. Only include the ones you need, because each one adds metadata to the prompt.
How do I get the files a Skill creates?
Find the file_id values inside bash_code_execution_tool_result blocks. Then call client.files.download() and save the result.
Are Skills free to use?
There is no Skill fee. You pay normal token prices, plus code execution time beyond the 1,550 free hours each organization gets per month, at $0.05 per container hour.
Can my custom Skill install packages or call an API?
No. The container has no internet access and no runtime installs. Use the preinstalled libraries and bundle your own helper scripts in the Skill folder.
Do Skills I upload in claude.ai work in the API?
No. Custom Skills do not sync across surfaces. Upload them separately to the API, claude.ai and Claude Code.




