Agent DailyAgent Daily
tutorialbeginner

Introduction to Claude Skills Create documents, analyze data, automate workflows with Claude's Excel, PowerPoint, PDF skills.

cookbook
View original on cookbook

This guide introduces Claude Skills, specialized capability packages that enable document creation, data analysis, and workflow automation through Excel, PowerPoint, and PDF generation. Skills use a three-tier progressive loading model (metadata → full instructions → linked files) to optimize token usage and efficiency. The tutorial covers environment setup, API configuration, skill discovery, and practical quick-start examples for Excel, PowerPoint, and PDF workflows.

Key Points

  • Skills are organized expertise packages combining instructions, code, and resources—higher-level than individual tools with proven, tested helper scripts
  • Progressive disclosure architecture loads only necessary components: metadata first (64 chars name, 1024 chars description), then full instructions (<5k tokens), then linked files on-demand
  • Setup requires Python 3.8+, Anthropic API key, virtual environment, and anthropic SDK v0.71.0+ with dependencies installed via pip
  • Use client.beta.messages.create() with container parameter and three required betas: code-execution-2025-08-25, files-api-2025-04-14, skills-2025-10-02
  • Code execution tool must be enabled in requests when using Skills; responses include file_ids for downloading created documents
  • Skills are composable—multiple skills work together seamlessly in single requests for complex workflows
  • Two skill types: Anthropic-managed (xlsx, pptx, pdf, docx) and custom user-defined skills for company-specific workflows
  • Token usage is dramatically reduced compared to providing instructions in prompts due to progressive loading and efficient skill architecture
  • API configuration requires .env file with ANTHROPIC_API_KEY; verify connection with test request before proceeding
  • Output directory automatically created; skill metadata visible initially, full instructions loaded only when skill becomes relevant to request

Found this useful? Add it to a playbook for a step-by-step implementation guide.

Workflow Diagram

Start Process
Step A
Step B
Step C
Complete
Quality

Concepts

Artifacts (5)

Environment Setup Scriptbashscript
#!/bin/bash
# Navigate to skills directory
cd /path/to/claude-cookbooks/skills

# Create virtual environment
python -m venv venv

# Activate it (macOS/Linux)
source venv/bin/activate
# OR on Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Copy and configure .env file
cp .env.example .env
# Edit .env and add: ANTHROPIC_API_KEY=sk-ant-api03-...
API Configuration and Initializationpythonscript
import os
import sys
from pathlib import Path
from anthropic import Anthropic
from dotenv import load_dotenv
from file_utils import download_all_files, extract_file_ids, get_file_info, print_download_summary

# Load environment variables
load_dotenv(Path.cwd().parent / ".env")

API_KEY = os.getenv("ANTHROPIC_API_KEY")
MODEL = os.getenv("ANTHROPIC_MODEL", "claude-sonnet-4-6")

if not API_KEY:
    raise ValueError("ANTHROPIC_API_KEY not found. Copy ../.env.example to ../.env and add your API key.")

# Initialize client
client = Anthropic(api_key=API_KEY)

# Create outputs directory
OUTPUT_DIR = Path.cwd().parent / "outputs"
OUTPUT_DIR.mkdir(exist_ok=True)

print("✓ API key loaded")
print(f"✓ Using model: {MODEL}")
print(f"✓ Output directory: {OUTPUT_DIR}")
print("\n📝 Note: Beta headers will be added per-request when using Skills")
API Connection Testpythonscript
# Test API connection
test_response = client.messages.create(
    model=MODEL,
    max_tokens=100,
    messages=[
        {
            "role": "user",
            "content": "Say 'Connection successful!' if you can read this.",
        }
    ],
)

print("API Test Response:")
print(test_response.content[0].text)
print(f"\n✓ Token usage: {test_response.usage.input_tokens} in, {test_response.usage.output_tokens} out")
Skills API Request Templatepythontemplate
response = client.beta.messages.create(
    model="claude-sonnet-4-6",
    max_tokens=4096,
    container={
        "skills": [
            {
                "type": "anthropic",
                "skill_id": "xlsx",  # or 'pptx', 'pdf', 'docx'
                "version": "latest"
            }
        ]
    },
    tools=[{
        "type": "code_execution_20250825",
        "name": "code_execution"
    }],
    messages=[{
        "role": "user",
        "content": "Create an Excel file..."
    }],
    betas=[
        "code-execution-2025-08-25",
        "files-api-2025-04-14",
        "skills-2025-10-02"
    ]
)
.env Configuration Templateenvconfig
# Anthropic API Configuration
ANTHROPIC_API_KEY=sk-ant-api03-YOUR_API_KEY_HERE
ANTHROPIC_MODEL=claude-sonnet-4-6

# Optional: Custom output directory
# OUTPUT_DIR=/path/to/outputs
Introduction to Claude Skills Create documents, analyze data, automate workflows with Claude&#x27;s Excel, PowerPoint, PDF skills. | Agent Daily