Prompting Basics: Be Clear and Direct
Okay, so we’ve established that Claude is essentially your super-smart junior dev. The single biggest mistake people make with AI is being vague.
If you tell a junior developer "fix the header," they're going to stare at you blankly. Which header? What's wrong with it? Do we want it bigger, a different color, or is it broken on mobile? Claude is the same way.
Ditch the "Please" and "Thank You" (mostly)
I catch myself doing this all the time, but you don't actually need to be overly polite to Claude. It doesn't care if you say "please" or "could you kindly."
Instead of:
"Hi Claude, I hope you're having a good day. If it's not too much trouble, could you please write a regex that matches email addresses? Thank you so much!"
Just be direct:
"Write a JavaScript regex that matches standard email addresses. It should handle edge cases like plus-addressing (e.g., [email protected])."
Being direct isn't rude; it's efficient. It gives Claude less fluff to parse and gets you straight to the code.
The "What, Why, How" Framework
When I write prompts for complex tasks, I try to cover three things:
- What: What exactly do I want? (e.g., "A React component for a newsletter signup")
- Why: What is the context or business goal? (e.g., "It's for a tech blog, so it needs to look modern and minimalistic")
- How: Are there technical constraints? (e.g., "Use Tailwind CSS and don't use any external form libraries")
Put it all together:
"Write a React component for a newsletter signup. This is for a modern tech blog. Use Tailwind CSS for styling, make it fully responsive, and use native React state instead of form libraries."
Specify the Output Format
Claude loves to talk. If you just ask for code, it will often give you the code plus five paragraphs explaining how the code works. If you're in a hurry, that's annoying.
You can literally just tell it to shut up.
"Write a Python script to parse this CSV. Output only the raw code with no markdown formatting or explanations."
Or, if you need the data back in a specific way:
"Extract the names and ages from this text. Format the output as a JSON array of objects."
Being hyper-specific about how you want the answer delivered saves you a ton of copying, pasting, and manual formatting later. In the next lesson, we'll talk about the single most important concept in AI: Context.