Lesson 3 of 5
In Progress

Asking Better Questions, Getting Better Code?

Enle May 29, 2025

🎯 Lesson Objective:

Teach learners how to write more effective prompts that help AI return cleaner, more accurate code — and explain its decisions. This skill sets the tone for everything they’ll do in the course.


👋 Lesson Intro:

The quality of your question = the quality of your results.

Whether you’re debugging a nasty function or scaffolding a new React component, how you ask makes all the difference. In this lesson, you’ll learn how to craft prompts that make AI your most helpful collaborator — not a confusing code printer.

Prompting isn’t just about getting code — it’s about getting insight, learning patterns, and shaping how the AI thinks with you.


🧩 Key Concepts Covered:

1. What Is a “Good” Developer Prompt?

  • A prompt that:
    • Includes context (what you’re building, what tech stack you’re using)
    • Is specific about what you want (generate, fix, explain, refactor?)
    • Includes constraints (use Tailwind, keep it async, avoid jQuery, etc.)
  • Bad prompt: “Write a login page.”
    Good prompt:
    “Create a responsive login form in React with Tailwind CSS. Include email + password fields, and error validation.”

2. Prompt Formulas That Work

The Debugger Prompt

“Here’s some code that’s breaking — can you explain why this error is happening and how to fix it?”

The Rewriter Prompt

“Make this more readable but keep it efficient. Add comments so I can understand it better.”

The Generator Prompt

“Give me a boilerplate setup for a Next.js app that uses Prisma and Tailwind.”

The Comparison Prompt

“Compare this implementation to using async/await — which is cleaner and why?”

The Teach-Me Prompt

“Explain what this code does like I’m familiar with JS but not with Promises.”


🛠️ Pro Tip: Prompt Stacking

Chain your prompts instead of asking for everything at once.

🔁 Example:

  1. “Generate the base HTML/CSS for a pricing table.”
  2. “Now convert that to React components.”
  3. “Now add Tailwind and responsive layout.”

This makes your sessions modular and easier to learn from.


🤖 Practice Activity: Prompt Remix

Use ChatGPT or Cursor with this exercise:

Starter Prompt:

“Write a function that checks if a string is a palindrome.”

Now remix it:

  • Ask it to add comments line-by-line.
  • Ask it to rewrite in a different language (Python → JS or vice versa).
  • Ask: “How would this break if input is not a string?”
  • Ask: “What test cases should I write for this function?”

📌 Big Takeaway:

Prompting is a core developer skill in 2025.
The better you are at describing what you want, the faster and smarter your AI assistant becomes.


📝 Assignment: AI Prompt Playground

Choose a small function or feature you’ve built before. Then:

  1. Write 3 different prompts to either:
    • Generate it
    • Refactor it
    • Explain it
  2. Compare the outputs.
  3. Document what you learned about prompt clarity, detail, and tone.

📥 Submit:

  • The 3 prompts + AI responses
  • A 3–5 sentence reflection on which one worked best and why