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:
- Python 3.8 or higher
- Anthropic API key with access to Claude models
- Beta access to Claude Agent Skills
File Download Helper Setup
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
- Claude creates the file in the sandbox
- Returns a file ID in the tool result
- 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 List2import os3import re45def detect_file_extension(file_content: bytes) -> str:6 """7 Detect file type from magic bytes (file header).89 Args:10 file_content: First few bytes of the file1112 Returns:13 File extension including dot (e.g., '.xlsx', '.docx', '.pptx')14 """15 # Check magic bytes for common Office file formats16 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"3334def download_skill_files(35 response, client, output_dir: str = ".", default_filename: str = None36) -> List[str]:37 """38 Download files created by Claude Agent Skills from the API response.3940 Args:41 response: The Anthropic API response object OR a dict with 'file_ids' key42 client: Anthropic client instance43 output_dir: Directory to save files (default: current directory)44 default_filename: Default filename to use4546 Returns:47 List of downloaded file paths48 """49 downloaded_files = []50 seen_file_ids = set()5152 # 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 continue57 seen_file_ids.add(file_id)5859 print(f"Found file ID: {file_id}")6061 try:62 # Download the file63 file_content = client.beta.files.download(64 file_id=file_id, betas=["files-api-2025-04-14"]65 )6667 # Read file content68 file_data = file_content.read()6970 # Detect actual file type from content71 detected_ext = detect_file_extension(file_data)7273 # Use default filename or generate one74 filename = (75 default_filename76 if default_filename77 else f"skill_output_{file_id[-8:]}{detected_ext}"78 )79 filepath = os.path.join(output_dir, filename)8081 # Save to disk82 with open(filepath, "wb") as f:83 f.write(file_data)8485 downloaded_files.append(filepath)86 print(f"Downloaded: {filepath}")8788 except Exception as e:89 print(f"Failed to download file {file_id}: {e}")9091 return downloaded_files9293 # Original logic: Iterate through response content blocks94 if not hasattr(response, "content"):95 return downloaded_files9697 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_id104105 if file_id in seen_file_ids:106 continue107 seen_file_ids.add(file_id)108109 print(f"Found file ID: {file_id}")110111 try:112 file_content = client.beta.files.download(113 file_id=file_id, betas=["files-api-2025-04-14"]114 )115116 file_data = file_content.read()117 detected_ext = detect_file_extension(file_data)118119 filename = default_filename120121 if (122 not filename123 and hasattr(block.content, "stdout")124 and block.content.stdout125 ):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_filename134 )[1]135 if extracted_ext == detected_ext:136 filename = extracted_filename137 else:138 basename = os.path.splitext(139 extracted_filename140 )[0]141 filename = f"{basename}{detected_ext}"142143 if not filename:144 filename = (145 f"skill_output_{file_id[-8:]}{detected_ext}"146 )147148 filepath = os.path.join(output_dir, filename)149150 with open(filepath, "wb") as f:151 f.write(file_data)152153 downloaded_files.append(filepath)154 print(f"Downloaded: {filepath}")155156 except Exception as e:157 print(f"Failed to download file {file_id}: {e}")158159 return downloaded_filesOnce you've created this file, you can import it in your scripts:
1from file_download_helper import download_skill_filesBasic Usage
Enable skills by passing them to the Claude model configuration:
1from kern.agent import Agent2from kern.models.anthropic import Claude34agent = 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=True13)1415agent.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 os2from kern.agent import Agent3from kern.models.anthropic import Claude4from anthropic import Anthropic5from file_download_helper import download_skill_files67# Create agent with PowerPoint skills8powerpoint_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)2324# Create presentation25prompt = (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)3435response = powerpoint_agent.run(prompt)36print(response.content)3738# Download files39client = 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 breakExcel Skills
Generate spreadsheets with formulas, charts, and data analysis.
Example: Sales Dashboard
1import os2from kern.agent import Agent3from kern.models.anthropic import Claude4from anthropic import Anthropic5from file_download_helper import download_skill_files67# Create agent with Excel skills8excel_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)2324# Create sales dashboard25prompt = (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)4142response = excel_agent.run(prompt)43print(response.content)4445# Download files46client = 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 breakWord Document Skills
Create and edit documents with rich formatting.
Example: Project Proposal
1import os2from kern.agent import Agent3from kern.models.anthropic import Claude4from anthropic import Anthropic5from file_download_helper import download_skill_files67# Create agent with Word skills8document_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)2324# Create project proposal25prompt = (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)5354response = document_agent.run(prompt)55print(response.content)5657# Download files58client = 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 breakMulti-Skill Workflows
Combine multiple skills for comprehensive document packages.
Example: Multi-Document Package
1import os2from kern.agent import Agent3from kern.models.anthropic import Claude4from anthropic import Anthropic5from file_download_helper import download_skill_files67# Create agent with multiple skills8multi_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)2526# Create document package27prompt = (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)3839response = multi_skill_agent.run(prompt)40print(response.content)4142# Download files43client = 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 breakUsage
Set up your virtual environment
1uv venv --python 3.122source .venv/bin/activate1uv venv --python 3.122.venv\Scripts\activateSet your API key
1export ANTHROPIC_API_KEY=xxxInstall dependencies
1uv pip install -U anthropic kern-aiCreate 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.py1python your_script.pyConfiguration
Model Requirements
- Recommended:
claude-sonnet-4-5-20250929or 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-25skills-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]