Anthropic's Prompt Engineering Tutorial
Written by Nikos Vaggalis   
Wednesday, 19 November 2025

The more elaborate the prompt the better the outcome. But how do I construct a really great prompt? The answer to that question is given by this free, official Anthropic step-by-step guide which shows how to construct prompts that get optimal answers out of the Claude LLM.

Despite the title, which sound broad and all encompassing, this is a course for developers and not users trying to instruct Claude through its web or desktop interfaces since it presents prompting techniques blended with Python code. However, anyone can absorb the theoretical part which tells of the concept behind the prompting.

The guide is hosted on Github and consists of 9 chapters:

Chapter 1: Basic Prompt Structure
Chapter 2: Being Clear and Direct
Chapter 3: Assigning Roles
Chapter 4: Separating Data from Instructions
Chapter 5: Formatting Output & Speaking for Claude
Chapter 6: Precognition (Thinking Step by Step)
Chapter 7: Using Examples
Chapter 8: Avoiding Hallucinations
Chapter 9: Building Complex Prompts (Industry Use Cases)

and an Appendix which goes beyond standard prompting by covering:

Chain Prompts
Tools Use
Search & Retrieve

Each chapter is presented as a Jupyter notebook, theory and code including. Of course, you need a Claude API key for doing the exercises, but no worries as the very first tutorial takes you through everything that you must do to get started:

1. Clone this repository to your local machine.

2. Install the required dependencies by running the following command: pip install anthropic

3. Set up your API key and model name. Replace "your_api_key_here" with your actual Anthropic API key

API_KEY = "your_api_key_here"
MODEL_NAME = "claude-3-haiku-20240307"

which stores the API_KEY & MODEL_NAME variables
for use across notebooks within the IPython store

%store API_KEY
%store MODEL_NAME

Then you can run the notebook cells in order of each chapter, following the instructions provided.

Each chapter shows how you can call the API passing to it the appropriate payload. For instance Chapter 2 tells you to be 'Clear and Direct':

Think of Claude like any other human that is new to the job. Claude has no context on what to do aside from what you literally tell it. Just as when you instruct a human for the first time on a task, the more you explain exactly what you want in a straightforward manner to Claude, the better and more accurate Claude's response will be.

For instance on telling Claude to write a Haiku but specifically skip the "Here is a haiku" preamble, we ask:

# Prompt
PROMPT = "Write a haiku about robots. Skip the preamble; go straight into the poem."

# Print Claude's response
print(get_completion(PROMPT))

Then, on asking for the best basktetball player, we hand Claude some pointers :

PROMPT = "Who is the best basketball player of all time? Yes, there are differing opinions, but if you absolutely had to pick one player, who would it be?"

All the chapters contain tiny gems like these, especially the more advanced ones.

All fine except for one thing; that while the guide is touted as "interactive" and that there's an "Example Playground" area at the bottom of each chapter where you can experiment with the examples in the lesson to see for yourself how changing prompts can change Claude's responses, this isn't true. You just have access to the Jupyter Notebooks. That said, the tutorial is also available as a Google Sheet using Anthropic's Claude for Sheets extension, as a much friendlier alternative.

To conclude, if you're a Claude user then this repository will make you construct much more efficient prompts, squeezing maximum performance out of it.

 

More Information

Anthropic's Prompt Engineering Interactive Tutorial

Related Articles

Prompt Engineering Techniques To Make You An Expert

 

To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on Twitter, Facebook or Linkedin.

Banner


Chrome DevTools To Benefit From MCP
28/10/2025

Google brings the power of Chrome DevTools to AI coding assistants with its Chrome DevTools Model Context Protocol server, now in public preview. 



The Fuss About Fil-C...
12/11/2025

...is entirely justified. While we all go mad for Rust and its steep learning curve, we may have missed the most important thing to happen to C/C++ since they were invented - Fil-C.


More News

pico book

 

Comments




or email your comment to: comments@i-programmer.info

Last Updated ( Wednesday, 19 November 2025 )