DEV Community

Shreyas Hupare
Shreyas Hupare

Posted on

Prompt Engineering

Garbage In, Garbage Out!
"The quality of your question decides the quality of ai's answer."

What is Prompt Engineering? Why it matters ?

A prompt means giving instructions to an AI model, right? 
Well, not exactly. You can call it a prompt, but that alone doesn't make it prompt engineering. The real magic lies in how you ask the question. The output depends entirely on that.
So, why call it engineering? Because it's not just asking questions - it's learning how the model responds, testing different instructions, refining your approach, and building better results over time. That's an iterative, structured process - just like engineering.
So basically, prompt engineering is all about tweaking and refining your input to get the most accurate and useful output from an AI model.

Golden Rule #Don't Trust the Model Blindly

Let's get one thing straight: AI is a tool, not a truth machine.

  • It can hallucinate facts.
  • It can make assumptions.
  • It might sound confident and still be wrong.

So never expect it to do your job. Use it as a helpful assistant - but always verify what it gives you. It never supposed to give right answers. 

Simple Checklist to improve your prompt

🧑‍🎓 1. Set the Persona
Tell the model who to become.

"You are a senior nodeJS developer working on NestJs Framework."
"You are a product manager writing a user story."
Why? Because it helps the model adopt the right tone, terminology, and context.

🙋‍♂️ 2. Say Who You Are & What you are trying to achieve
Let the model know your role too.

"I'm a beginner learning nodeJs and building simple to-do list application."
"I run a small business and want to automate emails."
This builds alignment and helps it tailor answers to your level.

📦 3. Give Clear Context
Don't leave it guessing. Do half job for AI.

❌ "Fix this code."
✅ "This is a React component giving a 'TypeError' on button click. Can you help debug it?"
Details matter. The more the model knows, the better it performs.

🧩 4. Break It Into Steps
Avoid asking everything in one go. Go modular.

❌ "Build me a chatbot with memory and emotion."
✅ "Step 1: Help me create a basic chatbot in Node.js. Step 2: How can I add memory support?"
Think of it as a conversation, not a monologue.

🔁 5. Use Examples
Give inputs and desired outputs.

Input: "I like apples and bananas"
Expected Output: ["apples", "bananas"]
It makes your expectation crystal clear.

❓ 6. Ask for Clarifications (Yes, Really)
Ask the model to review your prompt before answering.
"Before you answer, tell me if any part of this prompt is unclear or could be improved."
This practice helps catch weak spots early.

What If You're Not Getting the Results You Want?

That's part of the process. Prompt engineering is iterative - like coding.
Here's what to do:

  • Read your prompt again. Is it vague or missing info?
  • Read the response and ask: "What did it miss?"
  • Tweak one thing at a time and retry.
  • You can even ask the model: "Why might this answer not be what I expected?"

Over time, you'll build a sense for what works and what doesn't.

Learning References: 
OpenAI Prompt Engineering Guide

Prompt Engineering Guide

Top comments (1)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.