15 Prompt Writing Techniques That Instantly Improve ChatGPT Responses
I used to think I was bad at prompting. Turns out, I was just lazy about it.
I would type something like “write me a Python function to clean data” and then wonder why the output looked generic, missed edge cases, and needed three rounds of back-and-forth to get right. After spending a ridiculous amount of time talking to ChatGPT for real work, not just experiments, I realized something: the AI is not the bottleneck. The prompt is.
The difference between a developer who gets mediocre results from ChatGPT and one who gets near-production-quality output on the first try is not intelligence. It is knowing how to talk to the model.
Here are 15 techniques I have actually used, tested, and kept in my toolkit.
1. Tell It Who It Is
This sounds almost too simple, but it works every time. Before your actual request, give ChatGPT a role.
You are a senior Python engineer with 10 years of experience building
data pipelines. Help me with the following...
When you assign a persona, the model shifts its vocabulary, depth, and assumptions. Ask the same question without a persona and with one, the difference is immediately visible.
2. Give It the “Why”
Most people tell ChatGPT what they want. Fewer people tell it why they want it. That context changes everything.
Instead of:
Write a function to remove duplicates from a list.
Try:
Write a function to remove duplicates from a list. This will run
on a dataset of 10 million rows, so performance matters more than readability.
Now the model knows to think about time complexity, not just correctness.
3. Use the “Format” Command
ChatGPT will format its output however it guesses you want it, unless you tell it otherwise. And its default guess is often wrong.
Explain the difference between lists and tuples in Python.
Format your answer as a comparison table, not paragraphs.
You can ask for bullet points, numbered lists, JSON, markdown, plain text, or even a specific column structure. The model follows format instructions reliably.
4. Provide a Bad Example (On Purpose)
This one feels counterintuitive, but it is incredibly effective. Show the model what you do not want.
Write a docstring for this function. Do NOT write something vague
like "this function processes data." Be specific about inputs, outputs,
and edge cases.
Negative examples act as a guardrail. They tell the model what to avoid, which narrows the output space and improves precision.
5. Ask for Options, Not Just One Answer
When you are not sure what you want, asking for a single answer forces the model to guess. Ask for multiple alternatives instead.
Give me three different ways to structure a config file for a Python project.
Briefly explain the trade-offs of each.
This is especially useful in design decisions, naming things, or writing copy where judgment is involved.
6. Set a Length Constraint
By default, ChatGPT tries to be thorough. Sometimes thorough is the enemy of useful.
Explain what a decorator is in Python. Keep your answer under 100 words.
Constraining length forces the model to prioritize. You get denser, more useful explanations — not padded ones.
Pro tip: You can also do the opposite. “Give me a detailed, comprehensive explanation with examples” signals the model to go deep rather than skim.
7. Use Step-by-Step Thinking for Complex Problems
For anything involving logic, math, or multi-step reasoning, explicitly ask the model to think step-by-step before giving you an answer.
Before answering, think through this step-by-step.
What is the time complexity of the following function?
This is not just a prompt trick, it actually changes how the model internally processes the problem. Outputs are noticeably more accurate.
8. Give It Real Context About Your Environment
Vague prompts produce generic answers. If you tell the model your actual setup, it will tailor the answer to your situation.
I am using Python 3.11 on Windows, working inside a virtual environment,
and I do not have admin rights. How do I install a package that requires
a C compiler?
Every constraint you provide is a constraint the model uses to filter out irrelevant suggestions.
9. Ask It to Point Out Flaws in Its Own Answer
This is underused and wildly effective. After getting an answer, follow up with:
Now critique your own answer. What are the weaknesses or edge cases
you did not address?
The model will often catch things it glossed over missing error handling, performance assumptions, or edge cases it skipped for brevity.
10. Use Delimiters to Separate Instructions from Content
If your prompt mixes instructions with actual content (like code or text to analyze), use clear separators so the model does not confuse the two.
Rewrite the following function to be more readable.
The function is enclosed in triple backticks.
```python
def f(x, y):
return x**2 + 2*x*y + y**2
Without delimiters, the model sometimes treats parts of your content as additional instructions. Delimiters eliminate that ambiguity.
---
## 11. Chain Your Prompts Instead of Cramming Everything in One
One big prompt with seven requirements usually produces a mediocre answer on all seven. Break it into a conversation.
Start with the foundation:
Write a Python class for a task manager. Just the class structure and init method for now.
Then layer in complexity:
Now add a method to mark a task as complete, with input validation.
This mirrors how a good developer actually builds software — incrementally, with feedback at each step.
---
## 12. Ask It to Explain Like You Are a Specific Person
"Explain like I'm five" is a cliche at this point. But the concept still works when you make it specific.
Explain asyncio in Python as if I am a developer who understands threading but has never written async code.
Matching the explanation to your actual knowledge level cuts through the noise of both over-simplified and over-complicated answers.
---
## 13. Use "Only" and "Nothing Else" to Kill Padding
If you are using the output programmatically — extracting JSON, getting a filename, pulling out a number — padding in the response breaks everything.
Extract all email addresses from the text below. Return only a Python list. Nothing else. No explanation.
The words "only" and "nothing else" are surprisingly powerful. They suppress the model's natural tendency to be conversational.
---
## 14. Give It a Goal, Not Just a Task
This is a subtle shift, but it moves you from getting a function to getting a *solution*.
Instead of:
Write a function to paginate API responses.
Try:
I am building a CLI tool that fetches data from a REST API. The API paginates results, and I need to collect all pages into a single list without hitting rate limits. Help me design the right approach.
When the model knows the goal, it can push back if your approach is wrong, suggest a better pattern, or catch something you have not thought of yet.
---
## 15. Save Your Best Prompts Like You Save Your Best Code
This is less of a writing technique and more of a workflow habit — but it multiplies the value of everything else on this list.
When you write a prompt that produces a genuinely great result, save it. Build a personal library of prompt templates the same way you would save reusable utility functions.
```python
# Example: Your saved prompt template
role = "You are a senior Python developer specializing in clean, testable code."
task = "Review the following function and suggest improvements."
constraints = "Focus on readability, edge cases, and Pythonic style. Keep feedback under 200 words."
code = """
# paste code here
"""
prompt = f"{role}\n\n{task}\n\n{constraints}\n\n{code}"
A library of ten well-tested prompts will do more for your daily productivity than reading another hundred tips.
The Bigger Picture
Here is something I had to learn the slow way: ChatGPT is not a search engine, and it is not a magic box. It is closer to a very capable junior developer who needs context, constraints, and clear expectations to do great work.
The prompts you write are not instructions. They are a brief. The better your brief, the better the output every single time.
Start with two or three of these techniques, not all fifteen. Pick the ones that match the type of work you do most. Notice what changes. Then layer in more.
The ceiling on what you can get out of these tools is much higher than most people realize. The bottleneck is rarely the model. It is almost always the prompt.
My Code Diary, writing about the things I had to learn the hard way so you do not have to.



