Skip to content

aoracle/claude-code-tutorial

Repository files navigation

Anthropic API Tutorial

A comprehensive interactive course to master the Anthropic API with Claude.

🎯 Overview

This repository contains an interactive Python course for learning the Anthropic API with 12 comprehensive chapters covering everything from basic requests to advanced prompt engineering and evaluation techniques.

The tutorial includes:

  • Step-by-step lessons with live code examples
  • Interactive quizzes to test your knowledge
  • Hands-on exercises with Claude
  • Visual learning aids and ASCII art for better retention

📚 What's Included

  • 12 Interactive Chapters: From basic API calls to advanced prompt engineering
  • Hands-on Code Examples: Live demonstrations with real API calls
  • Interactive Quizzes: Test your knowledge after each chapter
  • Quick Start Script: Automated setup with virtual environment
  • Progressive Learning: From simple requests to complex workflows

🚀 Quick Start

Option 1: Use the Launcher Script (Recommended)

  1. Get your API key from Anthropic Console
  2. Set your API key:
    export ANTHROPIC_API_KEY="your-api-key"
  3. Run the tutorial launcher:
    ./start-claude-tutorial.sh

Option 2: Manual Setup

  1. Install dependencies:
    pip install -r requirements.txt
  2. Set your API key:
    export ANTHROPIC_API_KEY="your-api-key"
  3. Run the interactive tutorial:
    python3 anthropic_api_tutorial.py
    Or run the full course with quizzes:
    python3 main.py

📖 Course Curriculum

Chapter 1: First API Request

Learn how to make your first call to Claude and understand the response structure.

Chapter 2: Conversations

Build multi-turn conversations and manage conversation history.

Chapter 3: Helper Functions

Create reusable utilities for common API operations.

Chapter 4: Chat Application

Build a simple interactive chat application.

Chapter 5: System Prompts

Master system prompts to control Claude's behavior and responses.

Chapter 6: Temperature Control

Learn how temperature affects creativity and consistency in responses.

Chapter 7: Streaming

Implement real-time streaming responses for better user experience.

Chapter 8: Model Output Control

Advanced techniques using prefilled messages and stop sequences.

Chapter 9: Structured Data Output

Get clean JSON, code, and structured data without formatting issues.

Chapter 10: Prompt Engineering vs Evaluation

Understanding the difference between writing prompts and measuring their effectiveness.

Chapter 11: Building Evaluation Workflows

Create systematic workflows for testing and improving your prompts.

Chapter 12: Grading Systems

Implement code graders, model graders, and understand when to use human evaluation.

Chapter 13: Introduction to Prompt Engineering

Learn the iterative improvement process for developing high-quality prompts.

Chapter 14: Being Clear and Direct

Master the art of crafting clear, direct opening lines for better results.

Chapter 15: Being Specific

Use guidelines and process steps to dramatically improve output quality.

Chapter 16: Structure with XML Tags

Organize complex prompts with XML tags for clarity and maintainability.

Chapter 17: Providing Examples

Harness the power of one-shot and multi-shot prompting techniques.

💡 Key Features

  • Interactive Learning: Hands-on coding with real API calls
  • Visual Elements: ASCII art and diagrams for better understanding
  • Practical Focus: Real-world examples and use cases
  • Self-Paced: Complete chapters at your own speed
  • Comprehensive Coverage: From basics to advanced techniques

🛠️ Prerequisites

  • Python 3.7+ installed
  • Basic Python programming knowledge
  • Command line familiarity
  • Anthropic API account and key

📝 Tips for Success

  1. Complete chapters in order - they build on each other
  2. Run the code examples yourself
  3. Experiment with different parameters
  4. Take the quizzes to test your understanding
  5. Apply learnings to your own projects

🏆 What You'll Learn

Complete all 8 chapters and you'll be able to:

  • Build applications that integrate with Claude
  • Handle conversations and manage context
  • Control Claude's behavior with system prompts
  • Optimize responses with temperature settings
  • Implement streaming for real-time interactions
  • Use advanced output control techniques

📄 License

MIT License

🤝 Contributing

Feel free to submit improvements or additional exercises via pull requests!


Happy learning! 🚀 May your Claude Code journey be productive and enjoyable.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published