Ever had this experience: you talk to ChatGPT or Claude for ages, but the response is completely off from what you wanted? I’ve seen so many friends complain about this—“help me write some code,” it writes, but miles off from your requirements; “summarize this article,” it summarizes, but it’s all fluff, missing all the key points; “analyze this data,” it analyzes, but analyzes nothing.

Don’t worry, AI isn’t too stupid, you two just have a “language barrier.”

It’s like going to a foreign restaurant and ordering, you say “bring me something delicious,” the server is confused—what is delicious? Sweet or savory? Hot or cold? Main course or dessert? AI is the same, it’s powerful, but it needs you to speak clearly. This is what this series is about: Prompt Engineering.


Honestly, “prompt engineering” sounds mysterious, but simply put, it’s the technique of learning how to talk to AI. You can think of it as “AI translation”—translating the vague ideas in your head into instructions AI can accurately understand. Or more directly: prompt engineering is the methodology that turns AI from a “good enough guy” into a “precision executor.” This isn’t magic, but a set of trackable techniques. Master it, and your AI collaboration efficiency can multiply.

Why did I write this series specifically? Because many people can use AI now, but few can use it well. Most people are still at the “open ChatGPT → enter question → copy answer” stage. This is like buying a sports car but only knowing how to step on the gas, not even knowing how to shift gears. And those who really use AI well can get satisfactory results with one question that would take you three tries—that’s the gap.


In this series, I’ll take you through the official Anthropic prompt engineering tutorial—yes, from the company that developed Claude. The entire series has 9 core chapters plus 3 advanced appendices, and I’ve organized the content into a learning path:

We’ll start with the most basic Claude API structure, understanding what message formats are and how to write system prompts; then we’ll talk about how to express requirements clearly—like ordering specific dishes at a restaurant, not “something delicious”; followed by role-playing, letting AI enter specific roles; separating data and instructions, making AI output in your format, teaching AI step-by-step reasoning, using examples to teach AI, preventing AI from making things up, and finally building complex prompts from scratch. The advanced section covers chaining, tool use, and search & retrieval. After learning these, you can advance from “AI novice” to “AI trainer.”


But enough theory, let’s get our hands dirty with a simple example. First, you need to be able to call Claude. Two paths: one, register yourself at Anthropic Console and pay by token; two, use our packaged AI programming tool, 180 RMB per day for 25 USD credit, 300 RMB per day for 50 USD credit, supporting Codex, Claude Code, Gemini—three major tools, saving you the hassle of account management and top-ups. Once you have access, install the Python SDK:

pip install anthropic

Then write the simplest call:

import anthropic

client = anthropic.Anthropic(api_key="your_API_KEY")

def get_completion(prompt: str):
    message = client.messages.create(
        model="claude-haiku-4-2025-01-23",
        max_tokens=2000,
        temperature=0,
        messages=[{"role": "user", "content": prompt}]
    )
    return message.content[0].text

response = get_completion("Hello, Claude!")
print(response)

Got it running? Congrats, you’ve taken your first step. There are two parameters you’ll often encounter: temperature controls response “randomity”—set to 0 for stable responses, set to 1 for more creativity but less predictability; max_tokens limits maximum response length, 2000 is usually enough. For learning, set temperature to 0 so you can clearly see the prompt’s effect.


Before we officially start learning, let me give you a few precaution shots. First, never commit your API Key to GitHub! Use environment variables: client = anthropic.Anthropic(api_key=os.environ.get("ANTHROPIC_API_KEY")). Second, Claude model names have a specific format, get one character wrong and it errors—remember to use the latest model ID, like claude-haiku-4-2025-01-23. Third, Messages API requires messages to alternate between user and assistant, and the first must be user—we’ll cover this in detail later.

That’s it for today. There are 11 more articles in this series. Next time, we’ll dive deep into Claude API message formats and system prompts—know why some people can make Claude perform like a professional lawyer or senior programmer? The secret is in “system prompts.”


What’s your biggest headache with AI right now? Inaccurate responses, messy formatting, or something else? Share in the comments, and I’ll address it in future articles.

Found this article helpful? Like it to help more people see this series, share it with friends learning AI, and follow MengShou Programming so you don’t miss updates. Your support is my motivation to keep creating—see you next time.