git clone https://github.com/anthropics/claude-cookbooks.git# Claude Skills Cookbook π A comprehensive guide to using Claude's Skills feature for document generation, data analysis, and business automation. This cookbook demonstrates how to leverage Claude's built-in skills for Excel, PowerPoint, and PDF creation, as well as how to build custom skills for specialized workflows. > **π― See Skills in Action:** Check out **[Claude Creates Files](https://www.anthropic.com/news/create-files)** to see how these Skills power Claude's ability to create and edit documents directly in Claude.ai and the desktop app! ## What are Skills? Skills are organized packages of instructions, executable code, and resources that give Claude specialized capabilities for specific tasks. Think of them as "expertise packages" that Claude can discover and load dynamically to: - Create professional documents (Excel, PowerPoint, PDF, Word) - Perform complex data analysis and visualization - Apply company-specific workflows and branding - Automate business processes with domain expertise π Read our engineering blog post on [Equipping agents for the real world with Skills](https://www.anthropic.com/engineering/equipping-agents-for-the-real-world-with-agent-skills) ## Key Features - β¨ **Progressive Disclosure Architecture** - Skills load only when needed, optimizing token usage - π **Financial Focus** - Real-world examples for finance and business analytics - π§ **Custom Skills Development** - Learn to build and deploy your own skills - π― **Production-Ready Examples** - Code you can adapt for immediate use ## Cookbook Structure ### π [Notebook 1: Introduction to Skills](notebooks/01_skills_introduction.ipynb) Learn the fundamentals of Claude's Skills feature with quick-start examples. - Understanding Skills architecture - Setting up the API with beta headers - Creating your first Excel spreadsheet - Generating PowerPoint presentations - Exporting to PDF format ### πΌ [Notebook 2: Financial Applications](notebooks/02_skills_financial_applications.ipynb) Explore powerful business use cases with real financial data. - Building financial dashboards with charts and pivot tables - Portfolio analysis and investment reporting - Cross-format workflows: CSV β Excel β PowerPoint β PDF - Token optimization strategies ### π§ [Notebook 3: Custom Skills Development](notebooks/03_skills_custom_development.ipynb) Master the art of creating your own specialized skills. - Building a financial ratio calculator - Creating company brand guidelines skill - Advanced: Financial modeling suite - [Best practices](https://docs.claude.com/en/docs/agents-and-tools/agent-skills/best-practices) and security considerations ## Quick Start ### Prerequisites - Python 3.8 or higher - Anthropic API key ([get one here](https://console.anthropic.com/)) - Jupyter Notebook or JupyterLab ### Installation 1. **Clone the repository** ```bash git clone https://github.com/anthropics/claude-cookbooks.git cd claude-cookbooks/skills ``` 2. **Create virtual environment** (recommended) ```bash python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate ``` 3. **Install dependencies** ```bash pip install -r requirements.txt ``` 4. **Configure API key** ```bash cp .env.example .env # Edit .env and add your ANTHROPIC_API_KEY ``` 5. **Launch Jupyter** ```bash jupyter notebook ``` 6. **Start with Notebook 1** Open `notebooks/01_skills_introduction.ipynb` and follow along! ## Sample Data The cookbook includes realistic financial datasets in `sample_data/`: - π **financial_statements.csv** - Quarterly P&L, balance sheet, and cash flow data - π° **portfolio_holdings.json** - Investment portfolio with performance metrics - π **budget_template.csv** - Department budget with variance analysis - π **quarterly_metrics.json** - KPIs and operational metrics ## Project Structure ``` skills/ βββ notebooks/ # Jupyter notebooks β βββ 01_skills_introduction.ipynb β βββ 02_skills_financial_applications.ipynb β βββ 03_skills_custom_development.ipynb βββ sample_data/ # Financial datasets β βββ financial_statements.csv β βββ portfolio_holdings.json β βββ budget_template.csv β βββ quarterly_metrics.json βββ custom_skills/ # Your custom skills β βββ financial_analyzer/ β βββ brand_guidelines/ β βββ report_generator/ βββ outputs/ # Generated files βββ docs/ # Documentation βββ requirements.txt # Python dependencies βββ .env.example # Environment template βββ README.md # This file ``` ## API Configuration Skills require specific beta headers. The notebooks handle this automatically, but here's what's happening behind the scenes: ```python from anthropic import Anthropic client = Anthropic( api_key="your-api-key", default_headers={ "anthropic-beta": "code-execution-2025-08-25,files-api-2025-04-14,skills-2025-10-02" } ) ``` **Required Beta Headers:** - `code-execution-2025-08-25` - Enables code execution for Skills - `files-api-2025-04-14` - Required for downloading generated files - `skills-2025-10-02` - Enables Skills feature ## Working with Generated Files When Skills create documents (Excel, PowerPoint, PDF, etc.), they return `file_id` attributes in the response. You must use the **Files API** to download these files. ### How It Works 1. **Skills create files** during code execution 2. **Response includes file_ids** for each created file 3. **Use Files API** to download the actual file content 4. **Save locally** or process as needed ### Example: Creating and Downloading an Excel File ```python from anthropic import Anthropic client = Anthropic(api_key="your-api-key") # Step 1: Use a skill to create a file response = client.messages.create( model="claude-sonnet-4-6", max_tokens=4096, 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 budget spreadsheet" }] ) # Step 2: Extract file_id from the response file_id = None for block in response.content: if block.type == "tool_result" and hasattr(block, 'output'): # Look for file_id in the tool output if 'file_id' in str(block.output): file_id = extract_file_id(block.output) # Parse the file_id break # Step 3: Download the file using Files API if file_id: file_content = client.beta.files.download(file_id=file_id) # Step 4: Save to disk with open("outputs/budget.xlsx", "wb") as f: f.write(file_content.read()) print(f"β File downloaded: budget.xlsx") ``` ### Files API Methods ```python # Download file content (binary) content = client.beta.files.download(file_id="file_abc123...") with open("output.xlsx", "wb") as f: f.write(content.read()) # Use .read() not .content # Get file metadata info = client.beta.files.retrieve_metadata(file_id="file_abc123...") print(f"Filename: {info.filename}, Size: {info.size_bytes} bytes") # Use size_bytes not size # List all files files = client.beta.files.list() for file in files.data: print(f"{file.filename} - {file.created_at}") # Delete a file client.beta.files.delete(file_id="file_abc123...") ``` **Important Notes:** - Files are stored temporarily on Anthropic's servers - Downloaded files should be saved to your local `outputs/` directory - The Files API uses the same API key as the Messages API - All notebooks include helper functions for file download - **Files are overwritten by default** - rerunning cells will replace existing files (you'll see `[overwritten]` in the output) See the [Files API documentation](https://docs.claude.com/en/api/files-content) for complete details. ## Built-in Skills Reference Claude comes with these pre-built skills: | Skill | ID | Description | | ---------- | ------ | --------------------------------------------------------------------------- | | Excel | `xlsx` | Create and manipulate Excel workbooks with formulas, charts, and formatting | | PowerPoint | `pptx` | Generate professional presentations with slides, charts, and transitions | | PDF | `pdf` | Create formatted PDF documents with text, tables, and images | | Word | `docx` | Generate Word documents with rich formatting and structure | ## Creating Custom Skills Custom skills follow this structure: ``` my_skill/ βββ SKILL.md # Required: Instructions for Claude βββ scripts/ # Optional: Python/JS code β βββ processor.py βββ resources/ # Optional: Templates, data βββ template.xlsx ``` Learn more in [Notebook 3](notebooks/03_skills_custom_development.ipynb). ## Common Use Cases ### Financial Reporting - Automated quarterly reports - Budget variance analysis - Investment performance dashboards ### Data Analysis - Excel-based analytics with complex formulas - Pivot table generation - Statistical analysis and visualization ### Document Automation - Branded presentation generation - Report compilation from multiple sources - Cross-format document conversion ## Performance Tips 1. **Use Progressive Disclosure**: Skills load in stages to minimize token usage 2. **Batch Operations**: Process multiple files in a single conversation 3. **Skill Composition**: Combine multiple skills for complex workflows 4. **Cache Reuse**: Use container IDs to reuse loaded skills ## Troubleshooting ### Common Issues **API Key Not Found** ``` ValueError: ANTHROPIC_API_KEY not found ``` β Make sure you've copied `.env.example` to `.env` and added your key **Skills Beta Header Missing** ``` Error: Skills feature requires beta header ``` β Ensure you're using the correct beta headers as shown in the notebooks **Token Limit Exceeded** ``` Error: Request exceeds token limit ``` β Break large operations into smaller chunks or use progressive disclosure ## Resources ### Documentation - π [Claude API Documentation](https://docs.anthropic.com/en/api/messages) - π§ [Skills Documentation](https://docs.claude.com/en/docs/agents-and-tools/agent-skills/overview) ### Support Articles - π [Teach Claude your way of working using Skills](https://support.claude.com/en/articles/12580051-teach-claude-your-way-of-working-using-skills) - User guide for working with Skills - π οΈ [How to create a skill with Claude through conversation](https://support.claude.com/en/articles/12599426-how-to-create-a-skill-with-claude-through-conversation) - Interactive skill creation guide ### Community & Support - π¬ [Claude Support](https://support.claude.com) - π [GitHub Issues](https://github.com/anthropics/claude-cookbooks/issues) ## Contributing We welcome contributions! Please see [CONTRIBUTING.md](../CONTRIBUTING.md) for guidelines. ## License This cookbook is provided under the MIT License. See [LICENSE](../LICENSE) for details. ## Acknowledgments Special thanks to the Anthropic team for developing the Skills feature and providing the SDK. --- **Questions?** Check the [FAQ](docs/FAQ.md) or open an issue. **Ready to start?** Open [Notebook 1](notebooks/01_skills_introduction.ipynb) and let's build something amazing! π
[{"step":"Prepare your project details","action":"Gather the [PROJECT_NAME], [PROJECT_DESCRIPTION], and any specific installation steps or dependencies for your repository. Have a clear vision of what sections you want included in the README.","tip":"Use bullet points to list key features, dependencies, and usage examples before generating the README to ensure nothing important is missed."},{"step":"Generate the README structure","action":"Copy the prompt template into your AI assistant and replace all [PLACEHOLDERS] with your specific project details. For example, replace [PROJECT_NAME] with 'Climate Impact Tracker' and [PROJECT_DESCRIPTION] with 'A tool for analyzing carbon footprint data from organizations.'","tip":"If your project has unique requirements (like Docker setup or special build steps), add those to the Installation section as custom [INSTALLATION_STEPS]."},{"step":"Customize and refine","action":"Review the generated README for accuracy. Add any project-specific badges (e.g., CI status, Python version), screenshots, or additional sections like 'Roadmap' or 'Acknowledgements' if needed.","tip":"Use emojis sparingly but consistently to improve readability. Ensure all code blocks are properly formatted and tested."},{"step":"Save and integrate","action":"Save the README.md file to the root of your project repository. Commit the changes and push to your remote repository. Update your project's GitHub/GitLab page with the new README.","tip":"After generating the README, manually verify that all links (e.g., to the License file or API documentation) are correct and functional."}]
No install command available. Check the GitHub repository for manual installation instructions.
git clone https://github.com/anthropics/claude-cookbooks/blob/main/skills/README.mdCopy the install command above and run it in your terminal.
Launch Claude Code, Cursor, or your preferred AI coding agent.
Use the prompt template or examples below to test the skill.
Adapt the skill to your specific use case and workflow.
Generate a professional README.md file for a [PROJECT_NAME] repository. Include sections for: Project Description, Features, Installation, Usage, Dependencies, Contributing, License, and Contact. Use [PROJECT_DESCRIPTION] as the project's purpose and [INSTALLATION_STEPS] for any custom setup requirements. Format the README with GitHub-flavored Markdown, including code blocks for commands and examples.
```markdown
# π Ocean Data Analyzer
A Python library for processing and visualizing oceanographic sensor data from NOAA buoys.
## π Features
- Real-time data ingestion from NOAA API
- Automated quality control for sensor outliers
- Interactive visualization with Plotly Dash
- Support for CSV, JSON, and NetCDF formats
- REST API for programmatic access
## π Installation
### Prerequisites
- Python 3.9+
- pip
### Steps
```bash
# Clone the repository
git clone https://github.com/yourusername/ocean-data-analyzer.git
cd ocean-data-analyzer
# Create and activate virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Install in development mode
pip install -e .
```
## π‘ Usage
### Basic Analysis
```python
from ocean_analyzer import BuoyDataProcessor
processor = BuoyDataProcessor('44007')
data = processor.fetch_recent_data(days=7)
processor.plot_temperature_trend(data)
```
### API Server
```bash
# Start the Flask API
python -m ocean_analyzer.api.server --port 5000
# Make a request
curl http://localhost:5000/api/data?buoy_id=44007&days=30
```
## π οΈ Dependencies
- requests==2.31.0
- pandas==2.0.3
- plotly==5.15.0
- flask==2.3.2
- netCDF4==1.6.2
## π€ Contributing
1. Fork the repository
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request
## π License
Distributed under the MIT License. See `LICENSE` for more information.
## π§ Contact
- Maintainer: Jane Doe
- Email: [email protected]
- Project Link: https://github.com/yourusername/ocean-data-analyzer
```skills-collection
Take a free 3-minute scan and get personalized AI skill recommendations.
Take free scan