How to Write Prompts That Actually Work — Getting ChatGPT to Code What You Really Want (Part 2)

The difference between “AI magic” and “AI chaos” is how you ask.

Most people think ChatGPT gave them bad code. Truth is — they gave ChatGPT a bad prompt.

You don’t need to know how to code.
You just need to know how to ask

Think of ChatGPT like a hyper-literal assistant: fast, smart, but absolutely clueless about what’s in your head unless you say it clearly.


Why Prompting Matters More Than You Think

When you tell ChatGPT:

“Make a Python thing that does stuff with data.”

It will — but not the thing you meant.

That’s because ChatGPT doesn’t guess your intent. It completes patterns. A great prompt tells it what to do, how to do it, where to run it, and what success looks like.

Prompting is like teaching: clarity is everything.


The Anatomy of a Great Coding Prompt

ElementWhat It MeansExample
🎯 Goal  What you want to achieve“Summarize a CSV file by category.”
💻 Platform  Where code runs“Use Python 3 in Replit.”
🚫 Constraints  Limits you set“No paid libraries. Keep under 50 lines.”
🧩 Example Input/Output  Helps AI visualize“Input: sample.csv → Output: totals.csv”
🧠 Extras       Comments, validation, notes“Add comments and handle empty cells.”

A clear prompt doesn’t just say what you want — it defines where, how, and why.


Prompt Template You Can Copy

I’m a beginner. Write a [language] script that does [specific task].
It should:

  • Be runnable on [platform].

  • Include [step-by-step setup instructions].

  • Use [libraries or none].

  • Provide [example input and output].

  • Add clear comments for each part.
    Avoid [things you don’t want, e.g., external APIs, GUIs, etc.]

Use this as your personal “recipe card.” You’ll be shocked how consistent results get once you add these small details.


The “Don’ts” — What Not to Do

❌ Be vague

“Write code to clean data.”
✅ “Write a Python script that removes duplicate rows from a CSV file and saves the result as cleaned_data.csv.”

❌ Use slang or jokes

“Yo, just whip up something that counts this junk.”
✅ “Write a script that counts how many times each word appears in a text file.”

❌ Overload the request

“Make an app that logs in, fetches emails, plots charts, and sends reports.”
✅ “Start with fetching unread Gmail subjects using IMAP.”

❌ Assume context

ChatGPT doesn’t know your files or setup. Always restate the environment: “I’m on Windows,” “My data is in a CSV,” “I’m using Google Colab,” etc.

❌ Skip examples

Even one sample input/output line gives ChatGPT context it can’t guess.

The Power of Iterative Prompting

Perfect prompts are discovered, not written.

Start with something simple. Run it. See what happens. Then say:

“That’s close, but I wanted it to save results as a CSV instead of printing them. Fix that.”

Every iteration trains both you and the model. That’s how real developers work — trial, test, refine.

When Things Go Wrong (And They Will)

If the code breaks, don’t say, “It doesn’t work.”
Say this instead:

“Here’s the error message I got: [paste it]. Explain what it means and fix the code.”

That one habit separates frustrated users from fast learners.

Errors are clues, not failures.

Safety & Ethics Sidebar

  • Never share real credentials, tokens, or private data.

  • Ask before installing any new library: “What does this package do and why is it needed?”

  • Don’t copy random scripts from the web without understanding what they execute.

  • Keep dummy data handy for learning and testing.

Parting Thought

Prompting isn’t coding — it’s communicating clearly with AI.
You’re not “writing code,” you’re teaching logic.

The more specific and polite your instructions, the more useful and accurate ChatGPT becomes.

So next time you open ChatGPT, don’t type like you’re texting a friend.
Type like you’re briefing your most reliable, tireless junior developer.

Coming Next — Part 3: Don’t Fear GitHub (Even If You Can’t Code Yet)

We’ll talk about:

  • What GitHub actually is (and isn’t)

  • How to upload your first AI-generated project

  • What “commit,” “repo,” and “branch” really mean (in normal human English)

  • How to showcase your tiny wins like a pro — without touching the scary command line

Comments