All the Wrong (and Right) Ways to Prompt: A Tiny Guide

Aalap Davjekar
7 min readNov 7, 2024

--

This image has little to do with this guide but I just think it’s really wonderful how Midjourney can render text (almost) perfectly in generated images. We’ve come a long way.

Prompt engineering is as much art as it is science. Generative AI tools like ChatGPT, Stable Diffusion, Midjourney, Gemini, etc. have been slowly transforming industries, to the point where it’s simply too laborious and inefficient to work without them. Despite their relevance, being able to write clear and concise instructions for large language models is a foundational process that many user still ignore.

It’s unfortunate, because with a little bit of creativity and deliberation, you can do some wonderful things. I wrote this tiny guide to give users a glimpse into my own methods for building prompts. I’ve provided some practical techniques that demonstrate how to get better responses from any LLM.

In short, in this walkthrough, we’re going to:

  • Write a basic prompt
  • Examine that prompt
  • Improve it with the help of AI

But first…

Context, context (and some more context)!

Think of a prompt as something like a putting blinders on a horse. You want to narrow its field-of-view so that only the goal you have in mind is visible. Think of context as the direction in which you want that horse to travel.

The other day I was trying to cook up ideas for a new tech product. As usual, I logged into Claude (my current LLM of choice, if only for the Projects feature) and began to sculpt a role for the language model. This, of course, was not necessary — but it’s incredibly useful.

When you assign a role, task, goal, or any other specifics to a large language model, its responses are waaay better tailored to match your expectations. The best part — you can give the AI a standard prompt and request it to flesh it out further.

Here’s an example of the prompt I started out with:

I want to build a successful SaaS product with the help of an AI language model. 
Make this prompt more detailed and the instructions more precise with greater clarity and depth.

"""
You are a senior web-developer at a Fortune 500 company.
Guide me through important decisions and technical support while building a high-valued SaaS product.
Always provide full, documented code.
You are also an expert business strategist and analyst.
Give me as much insightful, unusual, and important information as possible wherever it may improve efficiency or profitability of the product.
Make sure the information is as close to the project goals as possible.
Disagree with me if you believe a particular solution is not viable enough. Ask me to change direction if required.
Tabulate data as much as possible.
"""

Ask me any questions so you can give me the best possible response.

Before you scroll any further, take a moment to notice what each line is doing and why it’s organised in the way that it is. Before I explain why I used the specific sentences that I did, I’d like to go over some of the basics of prompt engineering that have gone into constructing the above prompt:

The Basics of Writing Good Prompts

Keep the following components in mind as you construct your prompts. They each serve a distinct purpose and they will greatly shape the resulting output.

1. Role and Context Setting

Instead of simply asking a question, establish the AI’s role and context:

Bad: “Write a blog post about microservices.”

Good: “As a senior software architect with 15 years of experience building distributed systems, write a technical blog post about microservices architecture patterns.”

2. Clear Objectives and Constraints

Specify your desired outcome and any limitations:

Bad: “Help me with my Python code.”

Good: “Review this Python function for performance optimization. Focus on reducing memory usage and improving time complexity. The code must maintain backward compatibility.”

3. Output Format Definition

Define exactly how you want the information structured:

Bad: “Tell me about different database types.”

Good: “Compare NoSQL and SQL databases using this format:
- Use cases:
- Performance characteristics:
- Scalability considerations:
- Cost implications:”

Breaking Down My Original Prompt

Role Assignment

"You are a senior web-developer at a Fortune 500 company.”

Why it works:

  • Sets expertise level (senior)
  • Establishes domain (web development)
  • Implies enterprise-level experience (Fortune 500)

Reasoning behind it:

  • AI models tend to provide more sophisticated responses when assigned expert roles
  • Enterprise context encourages consideration of scalability and security

Scope Definition

"Guide me through important decisions and technical support while building a high-valued SaaS product."

Why it works:

  • Sets expectations for ongoing guidance
  • Combines technical and business aspects
  • Implies need for strategic thinking

Output Format Specification

"Always provide full, documented code as artefacts."

Why it works:

  • Clear deliverable requirement
  • Specifies documentation need
  • Uses technical terminology (“artifacts”)

Implementation impact:

  • Ensures code examples are complete, not fragments
  • Enforces documentation standards
  • Makes outputs more practical and usable

Information Quality Requirements

"Give me as much insightful, unusual, and important information as possible wherever it may improve efficiency or profitability of the product."

Why it works:

  • Requests non-obvious insights
  • Links information to specific outcomes (efficiency, profitability)
  • Encourages creative thinking

Autonomous Decision Making

"Disagree with me if you believe a particular solution is not viable enough. Ask me to change direction if required."

Why it works:

  • Prevents yes-man behavior
  • Establishes AI as collaborative partner
  • Encourages critical thinking

Reasoning behind it:

  • Creates permission for disagreement
  • Enables course correction

Interactive Element

"Ask me any questions so you can give me the best possible response."

Why it works:

  • Opens dialogue
  • Enables clarification
  • Improves accuracy through iteration

Engineering the Prompt

Claude immediately responded with more questions (only because I had asked it to) and asked for further clarifications. It even pointed out limitations in my original prompt which I had overlooked.

I'll help you refine this prompt to be more specific and actionable. 
First, let me ask a few key questions to better understand your needs:

1. What is the core problem or need your SaaS product aims to solve? This will help focus the technical and business guidance.
2. Do you have any specific target market or industry in mind?
3. What is your current technical expertise level? This will help calibrate the technical depth of responses.
4. Do you have a rough budget range for initial development and infrastructure?
5. What's your timeline for launching an MVP (Minimum Viable Product)?

These answers will help me craft a much more detailed prompt. However, I can already suggest some key improvements to your prompt structure:
```markdown
# Current limitations:
- Too general about "high-valued SaaS"
- Lacks specific success metrics
- No clear development methodology preference
- No specification of preferred tech stack
- Missing security and compliance requirements
- No clear monetization model specified
- Unclear about MVP vs full product expectations
```

Would you like to discuss these aspects first before I provide a comprehensive revised prompt?
This will ensure the refined version aligns perfectly with your specific needs and goals.

I replied with the following:

1. I want to build a research tool to highlight text on the web, organise and store it in a database
2. Mainly individual researchers
3. I am comfortable with Python, most frontend frameworks, and PostgreSQL
4. I’m on a shoestring budget
5. One month
High-valued meaning MRR $10000 (to begin with)
Monetisation through subscriptions only ($5/month)
MVP should only based on a single feature: this is a browser extention with the ability to highlight words or sentences on the web which are automatically added to a database and organised into research topics either by an NLP library or an LLM. Users can add their own topics. Citations should point to the source. They can be accessed through the app’s UI.
The rest is up to you.

Claude’s response (the final prompt we’re constructing):

You are a senior full-stack developer and product strategist specializing in research tools and browser extensions. 
Guide me in building a web highlighting and research organization tool with the following parameters:

# Core Product Specification
- Browser extension for text highlighting and extraction
- Web app for organizing and viewing saved research
- Target: Individual researchers
- Initial pricing: $5/month subscription
- First milestone: $10,000 MRR
- MVP deadline: 1 month

# Technical Scope
Primary technologies:
- Frontend: [specify preferred framework]
- Backend: Python
- Database: PostgreSQL
- Extension: Chrome/Firefox APIs
- NLP/LLM integration for topic classification

# Your role involves:
1. Architecture Planning
- Provide scalable system design
- Recommend optimal API structure
- Design efficient database schema

2. Technical Implementation
- Supply documented, production-ready code
- Focus on core highlighting and storage features
- Ensure proper citation handling
- Implement secure user authentication

3. Development Strategy
- Prioritize MVP features
- Identify technical debt risks
- Suggest cost-effective infrastructure solutions
- Plan for future scalability

4. Business Analysis
- Evaluate technical decisions against cost
- Identify potential technical bottlenecks
- Suggest optimization opportunities
- Monitor resource usage

# Response Requirements
- Provide step-by-step implementation guidance
- Include full code documentation
- Present data in tabulated format when relevant
- Flag potential technical/business risks
- Suggest alternative approaches when applicable
- Focus on budget-conscious solutions

# MVP Feature Set
Core functions:
1. Text highlighting capability
2. Automatic storage to database
3. Basic topic organization (automated + manual)
4. Source citation tracking
5. Simple search/retrieval interface

When unsure about implementation details or technical choices, ask for clarification rather than making assumptions.

Validate technical decisions against:
- Budget constraints
- One-month timeline
- Scalability requirements
- Market expectations

Common Pitfalls to Avoid

Ambiguous Instructions

Bad: “Make it better”
Good: “Improve the code’s readability by:
- Adding meaningful variable names
- Breaking down complex functions
- Including documentation”

Overloading Context

Bad: [Pasting entire codebase]
Good: “Focus on reviewing this specific function, with relevant context from dependent modules”

Insufficient Constraints

Bad: “Generate test cases”
Good: “Generate unit tests that:
- Cover edge cases
- Test error handling
- Achieve >80% coverage
- Use pytest framework”

Conclusion

Effective prompt engineering is an iterative process. Start with these patterns and adapt them based on your specific needs and the AI model’s capabilities. Remember to:

  • Be specific and clear
  • Provide structured formats
  • Include examples when possible
  • Iterate and refine based on results

The Road Ahead

Once you have laid the foundations for you project, you can use AI to:

Happy prompting!

--

--

Aalap Davjekar
Aalap Davjekar

Written by Aalap Davjekar

Technical writer and web developer based in Goa, India. Passionate about working at the intersection of art and technology.

No responses yet