Claude Agent Skills

Create PowerPoint presentations, Excel spreadsheets, Word documents, and analyze PDFs with Claude Agent Skills

Claude Agent Skills provide capabilities beyond what can get done with prompts alone.

With Skills, Claude will gain access to filesystem-based resources. These will be loaded on demand, removing the need to provide the same guidance multiple times as it happens with prompts.

You can read more about how Skills work on Anthropic docs.

Available Skills

  • PowerPoint (pptx): Create professional presentations with slides, layouts, and formatting
  • Excel (xlsx): Generate spreadsheets with formulas, charts, and data analysis
  • Word (docx): Create and edit documents with rich formatting
  • PDF (pdf): Analyze and extract information from PDF documents

You can also create custom skills for Claude to use. You can read more about that on Anthropic docs.

Prerequisites

Before using Claude Agent Skills, ensure you have:

  1. Python 3.8 or higher
  2. Anthropic API key with access to Claude models
  3. Beta access to Claude Agent Skills

File Download Helper Setup

Warning

Important: Files created by Agent Skills are NOT automatically saved to your local filesystem. They are created in a sandboxed execution environment and must be downloaded using the Anthropic Files API.

Before running any of the examples below, you must create the file_download_helper.py file in the same directory as your script.

How File Download Works

  1. Claude creates the file in the sandbox
  2. Returns a file ID in the tool result
  3. You download the file using the helper function below

Create file_download_helper.py

Save the following code as file_download_helper.py in your project directory:

1from typing import List
2import os
3import re
4
5def detect_file_extension(file_content: bytes) -> str:
6 """
7 Detect file type from magic bytes (file header).
8
9 Args:
10 file_content: First few bytes of the file
11
12 Returns:
13 File extension including dot (e.g., '.xlsx', '.docx', '.pptx')
14 """
15 # Check magic bytes for common Office file formats
16 if file_content.startswith(b"PK\x03\x04"):
17 # ZIP-based formats (Office 2007+)
18 if b"word/" in file_content[:2000]:
19 return ".docx"
20 elif b"xl/" in file_content[:2000]:
21 return ".xlsx"
22 elif b"ppt/" in file_content[:2000]:
23 return ".pptx"
24 else:
25 return ".zip"
26 elif file_content.startswith(b"%PDF"):
27 return ".pdf"
28 elif file_content.startswith(b"\xd0\xcf\x11\xe0"):
29 # Old Office format (97-2003)
30 return ".doc"
31 else:
32 return ".bin"
33
34def download_skill_files(
35 response, client, output_dir: str = ".", default_filename: str = None
36) -> List[str]:
37 """
38 Download files created by Claude Agent Skills from the API response.
39
40 Args:
41 response: The Anthropic API response object OR a dict with 'file_ids' key
42 client: Anthropic client instance
43 output_dir: Directory to save files (default: current directory)
44 default_filename: Default filename to use
45
46 Returns:
47 List of downloaded file paths
48 """
49 downloaded_files = []
50 seen_file_ids = set()
51
52 # Check if response is a dict with file_ids (from provider_data)
53 if isinstance(response, dict) and "file_ids" in response:
54 for file_id in response["file_ids"]:
55 if file_id in seen_file_ids:
56 continue
57 seen_file_ids.add(file_id)
58
59 print(f"Found file ID: {file_id}")
60
61 try:
62 # Download the file
63 file_content = client.beta.files.download(
64 file_id=file_id, betas=["files-api-2025-04-14"]
65 )
66
67 # Read file content
68 file_data = file_content.read()
69
70 # Detect actual file type from content
71 detected_ext = detect_file_extension(file_data)
72
73 # Use default filename or generate one
74 filename = (
75 default_filename
76 if default_filename
77 else f"skill_output_{file_id[-8:]}{detected_ext}"
78 )
79 filepath = os.path.join(output_dir, filename)
80
81 # Save to disk
82 with open(filepath, "wb") as f:
83 f.write(file_data)
84
85 downloaded_files.append(filepath)
86 print(f"Downloaded: {filepath}")
87
88 except Exception as e:
89 print(f"Failed to download file {file_id}: {e}")
90
91 return downloaded_files
92
93 # Original logic: Iterate through response content blocks
94 if not hasattr(response, "content"):
95 return downloaded_files
96
97 for block in response.content:
98 if block.type == "bash_code_execution_tool_result":
99 if hasattr(block, "content") and hasattr(block.content, "content"):
100 if isinstance(block.content.content, list):
101 for output_block in block.content.content:
102 if hasattr(output_block, "file_id"):
103 file_id = output_block.file_id
104
105 if file_id in seen_file_ids:
106 continue
107 seen_file_ids.add(file_id)
108
109 print(f"Found file ID: {file_id}")
110
111 try:
112 file_content = client.beta.files.download(
113 file_id=file_id, betas=["files-api-2025-04-14"]
114 )
115
116 file_data = file_content.read()
117 detected_ext = detect_file_extension(file_data)
118
119 filename = default_filename
120
121 if (
122 not filename
123 and hasattr(block.content, "stdout")
124 and block.content.stdout
125 ):
126 match = re.search(
127 r"[\w\-]+\.(pptx|xlsx|docx|pdf)",
128 block.content.stdout,
129 )
130 if match:
131 extracted_filename = match.group(0)
132 extracted_ext = os.path.splitext(
133 extracted_filename
134 )[1]
135 if extracted_ext == detected_ext:
136 filename = extracted_filename
137 else:
138 basename = os.path.splitext(
139 extracted_filename
140 )[0]
141 filename = f"{basename}{detected_ext}"
142
143 if not filename:
144 filename = (
145 f"skill_output_{file_id[-8:]}{detected_ext}"
146 )
147
148 filepath = os.path.join(output_dir, filename)
149
150 with open(filepath, "wb") as f:
151 f.write(file_data)
152
153 downloaded_files.append(filepath)
154 print(f"Downloaded: {filepath}")
155
156 except Exception as e:
157 print(f"Failed to download file {file_id}: {e}")
158
159 return downloaded_files

Once you've created this file, you can import it in your scripts:

1from file_download_helper import download_skill_files

Basic Usage

Enable skills by passing them to the Claude model configuration:

1from kern.agent import Agent
2from kern.models.anthropic import Claude
3
4agent = Agent(
5 model=Claude(
6 id="claude-sonnet-4-5-20250929",
7 skills=[
8 {"type": "anthropic", "skill_id": "pptx", "version": "latest"}
9 ]
10 ),
11 instructions=["You are a presentation specialist."],
12 markdown=True
13)
14
15agent.print_response("Create a 3-slide presentation about AI trends")

The framework automatically:

  • Configures the required betas (code-execution-2025-08-25, skills-2025-10-02)
  • Adds the code execution tool
  • Uses the beta API client
  • Sets up the container with skill configurations

You can enable multiple skills at once:

1model=Claude(
2 id="claude-sonnet-4-5-20250929",
3 skills=[
4 {"type": "anthropic", "skill_id": "pptx", "version": "latest"},
5 {"type": "anthropic", "skill_id": "xlsx", "version": "latest"},
6 {"type": "anthropic", "skill_id": "docx", "version": "latest"},
7 ]
8)

PowerPoint Skills

Create professional presentations with slides, layouts, and formatting.

Example: Q4 Business Review Presentation

1import os
2from kern.agent import Agent
3from kern.models.anthropic import Claude
4from anthropic import Anthropic
5from file_download_helper import download_skill_files
6
7# Create agent with PowerPoint skills
8powerpoint_agent = Agent(
9 name="PowerPoint Creator",
10 model=Claude(
11 id="claude-sonnet-4-5-20250929",
12 skills=[
13 {"type": "anthropic", "skill_id": "pptx", "version": "latest"}
14 ],
15 ),
16 instructions=[
17 "You are a professional presentation creator with access to PowerPoint skills.",
18 "Create well-structured presentations with clear slides and professional design.",
19 "Keep text concise - no more than 6 bullet points per slide.",
20 ],
21 markdown=True,
22)
23
24# Create presentation
25prompt = (
26 "Create a Q4 business review presentation with 5 slides:\n"
27 "1. Title slide: 'Q4 2025 Business Review'\n"
28 "2. Key metrics: Revenue $2.5M (↑25% YoY), 850 customers\n"
29 "3. Major achievements: Product launch, new markets, team growth\n"
30 "4. Challenges: Market competition, customer retention\n"
31 "5. Q1 2026 goals: $3M revenue, 1000 customers, new features\n"
32 "Save as 'q4_review.pptx'"
33)
34
35response = powerpoint_agent.run(prompt)
36print(response.content)
37
38# Download files
39client = Anthropic(api_key=os.getenv("ANTHROPIC_API_KEY"))
40if response.messages:
41 for msg in response.messages:
42 if hasattr(msg, "provider_data") and msg.provider_data:
43 files = download_skill_files(
44 msg.provider_data, client, default_filename="q4_review.pptx"
45 )
46 if files:
47 print(f"Downloaded {len(files)} file(s):")
48 for file in files:
49 print(f" - {file}")
50 break

Excel Skills

Generate spreadsheets with formulas, charts, and data analysis.

Example: Sales Dashboard

1import os
2from kern.agent import Agent
3from kern.models.anthropic import Claude
4from anthropic import Anthropic
5from file_download_helper import download_skill_files
6
7# Create agent with Excel skills
8excel_agent = Agent(
9 name="Excel Creator",
10 model=Claude(
11 id="claude-sonnet-4-5-20250929",
12 skills=[
13 {"type": "anthropic", "skill_id": "xlsx", "version": "latest"}
14 ],
15 ),
16 instructions=[
17 "You are a data analysis specialist with access to Excel skills.",
18 "Create professional spreadsheets with well-formatted tables and accurate formulas.",
19 "Use charts and visualizations to make data insights clear.",
20 ],
21 markdown=True,
22)
23
24# Create sales dashboard
25prompt = (
26 "Create a sales dashboard for January 2026 with:\n"
27 "Sales data for 5 reps:\n"
28 "- Alice: 24 deals, $385K revenue, 65% close rate\n"
29 "- Bob: 19 deals, $298K revenue, 58% close rate\n"
30 "- Carol: 31 deals, $467K revenue, 72% close rate\n"
31 "- David: 22 deals, $356K revenue, 61% close rate\n"
32 "- Emma: 27 deals, $412K revenue, 68% close rate\n\n"
33 "Include:\n"
34 "1. Table with all metrics\n"
35 "2. Total revenue calculation\n"
36 "3. Bar chart showing revenue by rep\n"
37 "4. Quota attainment (quota: $350K per rep)\n"
38 "5. Conditional formatting (green if above quota, red if below)\n"
39 "Save as 'sales_dashboard.xlsx'"
40)
41
42response = excel_agent.run(prompt)
43print(response.content)
44
45# Download files
46client = Anthropic(api_key=os.getenv("ANTHROPIC_API_KEY"))
47if response.messages:
48 for msg in response.messages:
49 if hasattr(msg, "provider_data") and msg.provider_data:
50 files = download_skill_files(
51 msg.provider_data, client, default_filename="sales_dashboard.xlsx"
52 )
53 if files:
54 print(f"Downloaded {len(files)} file(s):")
55 for file in files:
56 print(f" - {file}")
57 break

Word Document Skills

Create and edit documents with rich formatting.

Example: Project Proposal

1import os
2from kern.agent import Agent
3from kern.models.anthropic import Claude
4from anthropic import Anthropic
5from file_download_helper import download_skill_files
6
7# Create agent with Word skills
8document_agent = Agent(
9 name="Document Creator",
10 model=Claude(
11 id="claude-sonnet-4-5-20250929",
12 skills=[
13 {"type": "anthropic", "skill_id": "docx", "version": "latest"}
14 ],
15 ),
16 instructions=[
17 "You are a professional document writer with access to Word document skills.",
18 "Create well-structured documents with clear sections and professional formatting.",
19 "Use headings, lists, and tables where appropriate.",
20 ],
21 markdown=True,
22)
23
24# Create project proposal
25prompt = (
26 "Create a project proposal document for 'Mobile App Development':\n\n"
27 "Title: Mobile App Development Proposal\n\n"
28 "1. Executive Summary:\n"
29 " Project to build a task management mobile app\n"
30 " Timeline: 12 weeks, Budget: $120K\n\n"
31 "2. Project Overview:\n"
32 " - Native iOS and Android app\n"
33 " - Key features: Task lists, reminders, team collaboration\n"
34 " - Target users: Small business teams\n\n"
35 "3. Scope of Work:\n"
36 " - Requirements gathering (Week 1-2)\n"
37 " - Design and prototyping (Week 3-4)\n"
38 " - Development (Week 5-10)\n"
39 " - Testing and launch (Week 11-12)\n\n"
40 "4. Team:\n"
41 " - 2 developers, 1 designer, 1 project manager\n\n"
42 "5. Budget Breakdown:\n"
43 " - Development: $80K\n"
44 " - Design: $25K\n"
45 " - Testing: $10K\n"
46 " - Contingency: $5K\n\n"
47 "6. Success Metrics:\n"
48 " - 1000 users in first month\n"
49 " - 4.5+ star rating\n"
50 " - 70% user retention\n\n"
51 "Save as 'mobile_app_proposal.docx'"
52)
53
54response = document_agent.run(prompt)
55print(response.content)
56
57# Download files
58client = Anthropic(api_key=os.getenv("ANTHROPIC_API_KEY"))
59if response.messages:
60 for msg in response.messages:
61 if hasattr(msg, "provider_data") and msg.provider_data:
62 files = download_skill_files(
63 msg.provider_data, client, default_filename="mobile_app_proposal.docx"
64 )
65 if files:
66 print(f"Downloaded {len(files)} file(s):")
67 for file in files:
68 print(f" - {file}")
69 break

Multi-Skill Workflows

Combine multiple skills for comprehensive document packages.

Example: Multi-Document Package

1import os
2from kern.agent import Agent
3from kern.models.anthropic import Claude
4from anthropic import Anthropic
5from file_download_helper import download_skill_files
6
7# Create agent with multiple skills
8multi_skill_agent = Agent(
9 name="Multi-Skill Document Creator",
10 model=Claude(
11 id="claude-sonnet-4-5-20250929",
12 skills=[
13 {"type": "anthropic", "skill_id": "pptx", "version": "latest"},
14 {"type": "anthropic", "skill_id": "xlsx", "version": "latest"},
15 {"type": "anthropic", "skill_id": "docx", "version": "latest"},
16 ],
17 ),
18 instructions=[
19 "You are a comprehensive business document creator.",
20 "You have access to PowerPoint, Excel, and Word document skills.",
21 "Create professional document packages with consistent information across all files.",
22 ],
23 markdown=True,
24)
25
26# Create document package
27prompt = (
28 "Create a sales report package with 2 documents:\n\n"
29 "1. EXCEL SPREADSHEET (sales_report.xlsx):\n"
30 " - Q4 sales data: Oct $450K, Nov $520K, Dec $610K\n"
31 " - Include a total formula\n"
32 " - Add a simple bar chart\n\n"
33 "2. WORD DOCUMENT (sales_summary.docx):\n"
34 " - Brief Q4 sales summary\n"
35 " - Total sales: $1.58M\n"
36 " - Growth trend: Strong December performance\n"
37)
38
39response = multi_skill_agent.run(prompt)
40print(response.content)
41
42# Download files
43client = Anthropic(api_key=os.getenv("ANTHROPIC_API_KEY"))
44if response.messages:
45 for msg in response.messages:
46 if hasattr(msg, "provider_data") and msg.provider_data:
47 files = download_skill_files(msg.provider_data, client)
48 if files:
49 print(f"Downloaded {len(files)} file(s):")
50 for file in files:
51 print(f" - {file}")
52 break

Usage

Set up your virtual environment

1uv venv --python 3.12
2source .venv/bin/activate
1uv venv --python 3.12
2.venv\Scripts\activate

Set your API key

1export ANTHROPIC_API_KEY=xxx

Install dependencies

1uv pip install -U anthropic kern-ai

Create file download helper

Create file_download_helper.py using the code provided in the File Download Helper Setup section above.

Run Example

Create a Python file with any of the examples above and run:

1python your_script.py
1python your_script.py

Configuration

Model Requirements

  • Recommended: claude-sonnet-4-5-20250929 or later
  • Minimum: claude-3-5-sonnet-20241022
  • Skills require models with code execution capability

Beta Version

Skills require the following beta flags:

  • code-execution-2025-08-25
  • skills-2025-10-02

Skill Configuration

Specify skills in the model configuration:

1skills=[
2 {"type": "anthropic", "skill_id": "pptx", "version": "latest"},
3 {"type": "anthropic", "skill_id": "xlsx", "version": "latest"},
4 {"type": "anthropic", "skill_id": "docx", "version": "latest"},
5 {"type": "anthropic", "skill_id": "pdf", "version": "latest"},
6]

Additional Resources