Skip to content

mimonimo/claude-cookbook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 

Repository files navigation

🧑‍🍳 claude-cookbook

Practical Claude API recipes — copy, run, and build upon

Python 3.10+ License: MIT Powered by Claude Stars PRs Welcome

RecipesGetting StartedContributing


claude-cookbook is a collection of practical, runnable recipes for the Claude API. Each recipe is a self-contained Python file you can copy and adapt for your project.

Think of it as Stack Overflow for Claude API patterns — except the code actually works.


🍳 Recipes

Agents

Recipe Description Difficulty
web_research_agent.py Agentic web research loop with DuckDuckGo ⭐⭐

Structured Output

Recipe Description Difficulty
extract_data.py Extract typed data (contacts, invoices) with Pydantic

RAG

Recipe Description Difficulty
simple_rag.py RAG with TF-IDF retrieval — no vector DB required ⭐⭐

Tools

Recipe Description Difficulty
calculator_agent.py Tool use pattern: define, call, collect, repeat

Streaming

Recipe Description Difficulty
streaming_chat.py Streaming chat with history and token tracking

Vision

Recipe Description Difficulty
image_analyzer.py Analyze images from URLs or local files

Difficulty: ⭐ Beginner · ⭐⭐ Intermediate · ⭐⭐⭐ Advanced


🚀 Getting Started

1. Clone the repo

git clone https://github.com/mimonimo/claude-cookbook
cd claude-cookbook

2. Install dependencies

pip install anthropic rich httpx pydantic scikit-learn

3. Set your API key

export ANTHROPIC_API_KEY="your-key-here"
# Get yours at: https://console.anthropic.com/

4. Run a recipe

python recipes/streaming/streaming_chat.py
python recipes/agents/web_research_agent.py
python recipes/structured_output/extract_data.py

📖 Recipe Format

Each recipe follows a consistent structure:

"""
Recipe: Name
=============
What this recipe demonstrates.
When to use it.

Requirements:
    pip install anthropic <other-deps>

Usage:
    ANTHROPIC_API_KEY=your-key python recipe_name.py
"""

# ... imports ...

# ── Tool/Function Definitions ───────
# ... the interesting code ...

# ── Demo ───────────────────────────
def main():
    # Runnable example

if __name__ == "__main__":
    main()

Philosophy:

  • Each recipe fits in a single file
  • Minimal dependencies
  • Runnable as-is with just an API key
  • Clear comments explaining the why, not just the what

🗺️ Roadmap

Coming soon:

  • Batch processing with concurrency
  • Prompt caching patterns
  • Multi-agent coordination
  • Code execution agent
  • PDF/document analysis
  • CSV data analyst
  • Automated testing with Claude
  • Slack bot integration
  • Voice transcription + Claude

🤝 Contributing

Have a useful Claude API pattern? Add it as a recipe!

Guidelines:

  1. One recipe = one .py file in the right category folder
  2. Follow the recipe format (docstring header + main())
  3. Minimize dependencies — prefer stdlib when possible
  4. Add your recipe to the README table
  5. Open a PR!
# Fork, clone, add recipe, push, PR
git clone https://github.com/mimonimo/claude-cookbook
cd claude-cookbook
# Create your recipe in the right folder
# Add it to the README
git add . && git commit -m "Add recipe: your-recipe-name"
git push origin main

New recipe ideas (open issues):

  • Semantic search with embeddings
  • Code review bot
  • Meeting summarizer
  • Email draft generator

📚 Resources


📝 License

MIT © mimonimo


Found a useful recipe? Give it a ⭐ to help others find it!

Built by mimonimo

About

Practical Claude API recipes — copy, run, and build upon. Agents, RAG, tools, streaming, vision, structured output.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages