explaingit

anthropics/prompt-eng-interactive-tutorial

35,749Jupyter NotebookAudience · developerComplexity · 2/5MaintainedSetup · moderate

TLDR

Anthropic's interactive tutorial for learning prompt engineering, how to write clear, effective instructions for AI models to get better results.

Mindmap

mindmap
  root((repo))
    What it does
      Interactive tutorial
      Nine chapters
      Hands-on experiments
    Topics covered
      Prompt basics
      Role assignment
      Step-by-step thinking
      Reducing hallucinations
    Use cases
      Building chatbots
      Legal services
      Financial analysis
    Tech stack
      Jupyter Notebook
      Python
      Anthropic API
    Audience
      Beginners
      Experienced developers
      AI product builders

Things people build with this

USE CASE 1

Learn how to structure prompts to get clearer, more useful responses from Claude.

USE CASE 2

Build AI-powered chatbots by understanding how to assign roles and control output format.

USE CASE 3

Reduce hallucinations and false information in AI responses using proven techniques.

USE CASE 4

Develop industry applications like legal document analysis or financial report generation.

Tech stack

Jupyter NotebookPythonAnthropic APIClaude 3 Haiku

Getting it running

Difficulty · moderate Time to first run · 30min

Requires Anthropic API key and Claude 3 Haiku access to run notebook cells.

License could not be detected automatically. Check the repository's LICENSE file before use.

In plain English

This repository is Anthropic's official interactive tutorial for learning prompt engineering, the skill of writing clear, effective instructions for AI language models like Claude. Prompt engineering matters because the way you phrase a question or task to an AI has a dramatic effect on the quality of the response; understanding how to structure prompts separates people who get frustrating or generic outputs from those who get precise, useful results. The tutorial is structured as a series of Jupyter Notebooks (interactive documents that mix explanatory text with runnable code) organized into nine chapters. The chapters progress from beginner to advanced topics: the basics of prompt structure, how to be clear and direct, how to assign the AI a specific role, how to separate data from instructions, how to control formatting, how to prompt the AI to think step by step before answering, how to provide examples, how to reduce hallucinations (when an AI confidently states false information), and finally how to build complex prompts for real industry use cases like chatbots, legal services, and financial analysis. An appendix covers more advanced patterns like prompt chaining and tool use. Each chapter includes an "Example Playground" section where you actively experiment by running prompts yourself and observing how small changes to the wording change Claude's output. This hands-on approach is central to the design, you learn by doing rather than just reading. You would use this tutorial if you are new to working with Claude or AI models and want a structured foundation for writing better prompts, or if you are an experienced developer building AI-powered products and want to understand Anthropic's recommended techniques more deeply. The tech stack is Jupyter Notebook, running Python to call the Anthropic API (using Claude 3 Haiku as the model by default). An alternative Google Sheets version is also available for users who prefer a spreadsheet interface.

Copy-paste prompts

Prompt 1
I'm new to Claude. Walk me through the first chapter of Anthropic's prompt engineering tutorial to understand the basics of prompt structure.
Prompt 2
Show me how to use the Example Playground in chapter 3 to experiment with role assignment and see how it changes Claude's responses.
Prompt 3
Help me implement the step-by-step thinking technique from chapter 6 to improve accuracy on a complex analysis task.
Prompt 4
I'm building a chatbot. Which chapters in this tutorial should I focus on, and how do I apply the techniques to my use case?
Prompt 5
Explain the hallucination reduction strategies from chapter 8 and give me a concrete example of how to apply them.
Open on GitHub → Explain another repo

Generated 2026-05-18 · Model: sonnet-4-6 · Verify against the repo before relying on details.