Need medical care? I'm Dr. César Méndez, surgeonI'm a patient →
The tools

Module 01 · 20 min

How to Structure Prompts That Actually Work

If I had to pick ONE single skill from this entire course, this would be it. The exact same AI model, with the same power, can give you a useless answer or one that saves you hours—and the only difference is you and how you ask. This is called 'prompting,' and it's not magic or secret phrases you find on Twitter: it's clear, structured communication. Let's dive in, because mastering this multiplies everything else.

Think of it this way: AI is like the world's best intern—it knows a ton and works lightning fast, but it's literal and doesn't know you. If you give it a vague instruction, it fills in the blanks by guessing (and it guesses wrong). If you give it a clear, complete instruction, it hands you something brilliant. Your job isn't 'knowing how to code': it's knowing how to ASK properly.

The Formula I Use in Every Prompt

After building with thousands of prompts, it all comes down to four pieces. You don't always have to use all of them, but when something goes wrong, it's almost always because one of these was missing:

  • CONTEXT—who you are, what you're building, with what stack, and what data/files are relevant. It's the full picture the AI can't see.
  • TASK—what exactly you want, in a single clear direction. Not five things at once.
  • FORMAT—how you want the response: just the code? A list? Steps? A JSON? If you don't specify, the AI picks for you (and sometimes poorly).
  • CONSTRAINTS—what to avoid, the limits, the tone, what you DO NOT want.

Worked Example: The Same Task, Two Worlds

Let's say you want a login form. Look at the real difference between a poor prompt and a good one.

❌ Poor prompt:

hazme un login

The AI doesn't know your stack, your design, or what should happen on submit. It will give you a generic form that probably won't fit your project and you'll have to redo. You just wasted time.

✅ Good prompt:

Estoy construyendo una app web en Next.js (App Router)
con Firebase Auth y estilos con Tailwind.

Créame un componente de formulario de login con:
- campos de email y contraseña
- botón de 'Iniciar sesión' con estado de carga
- manejo y muestra de errores (ej: contraseña incorrecta)
- que use Firebase Auth para el login real

Devuélveme SOLO el componente, comentado, sin explicación
adicional. Que se vea limpio y moderno.

Same AI, 10x better result: code that fits right into your project, does what you need, and barely requires tweaking. Notice how all 4 pieces show up—context (Next.js + Firebase + Tailwind), task (login form), format (only the component, commented), constraints (clean look, no extra explanations).

Prompt lab: build a good one piece by piece

Interactivo

Your prompt

Build me a login form component with email and password fields.

Likely quality of the result25%

Generic result

The AI guessed your stack and your design. It probably won't fit and you'll redo it.

A good prompt = Context + Task + Format + Constraints. Turn on the pieces and watch the same model go from handing you garbage to handing you gold.

💡 Error #1 (and Its Cure)

The most common mistake is giving TOO LITTLE context. The AI can't read your mind or see your project (unless it's an agent inside it). When in doubt, give MORE context, not less. An extra 30 seconds describing the full picture saves you 30 minutes fixing an answer that didn't fit.

Techniques That Level You Up

1. Divide and Conquer

Don't ask it to 'build the whole app.' The AI gets lost, and so do you. Ask piece by piece: first the screen, then the logic, then connecting the data. Every piece that works becomes the foundation for the next. That's how I build EVERYTHING: in verifiable steps.

2. Ask It to Think Before Acting

For complex tasks, add: 'before writing code, explain your plan in steps.' This forces the AI to reason first (so you can spot if it's heading down the wrong track BEFORE it generates 200 wrong lines). A bad plan is fixed in one sentence; bad code takes half an hour.

3. Give It Examples (Few-Shot)

AI is an incredible imitator. If you want a specific style or format, show it: 'I want it to look like this [example]' or 'follow this format [example]'. One example is worth a thousand adjectives.

4. Iterate—The First Answer Is a Draft

The first response is almost never the final one, and that's okay. Refine it: 'almost, but make it simpler,' 'add handling for this edge case,' 'this failed with this error, fix it.' Prompting is a conversation, not a single shot. The best results come from back-and-forth.

⚠️ Watch Out for These Habits

Don't assume the AI remembers everything from way earlier messages (the context window has limits). Don't accept code you don't understand without asking it to explain. And don't get frustrated if it doesn't work by the 3rd iteration: rephrase the problem from scratch—sometimes a new angle unlocks it.

🚀 Build Your Project

Take your project idea (the one you defined in the Tech Radar). Write ONE good prompt, using all 4 pieces, asking the AI to describe the first screen you need to build. Save it. That's the very first real brick of your product—in Module 5, we'll turn it into running code.

Key Takeaways

  • A good prompt = Context + Task + Format + Constraints.
  • Give more context, not less: the AI can't see what you see.
  • Break big tasks down into verifiable pieces.
  • Ask for a plan before code, give examples, and iterate without fear.
  • Prompting is a conversation, and it is THE skill that multiplies everything else.
You don't need perfect prompts. You need clear prompts and a willingness to iterate. Master this, and AI becomes your superpower.

Comentarios

Inicia sesión (arriba) para leer y participar en la conversación de la comunidad.