How to prompt engineer

Good morning everyone. I am at Google Cloud Dev day event. While listening Richard Seroter’s speech about developers and developing with AI, he underlined the words, Prompt Engineering. İt made me think that i could write another article about this. I know there exist tons of articles already but why the hell not. And here it is!

What is Prompt Engineering?

Prompt engineering is the art and science of crafting inputs to AI systems (particularly large language models like GPT-4, Claude, or Gemini) to get the most effective outputs. Think of it as learning how to communicate with AI—a skill that’s becoming as essential as learning programming languages was a decade ago.

Why Should You Care?

You might be thinking, “I can just ask an AI a question, what’s the big deal?” Well, here’s why it matters:

  • Efficiency – Good prompts can save you hours of back-and-forth refinement
  • Quality – The difference between a mediocre and excellent prompt can be dramatic
  • Consistency – Well-engineered prompts produce more reliable results
  • Cost – If you’re using paid API calls, better prompts mean fewer tokens used

The Fundamentals of Prompt Engineering

1. Be Clear and Specific

The most basic principle is clarity. AI models aren’t mind readers (yet!).

Bad: “Write code”
Good: “Write a JavaScript function that takes an array of numbers and returns the sum of all even numbers”

2. Provide Context

AI models don’t know about your specific situation unless you tell them.

I'm building a React application for a small e-commerce store. 
I need a component that handles product filtering. The filters include:
- Price range
- Category selection
- Brand selection
- Rating threshold

3. Specify Format

Tell the AI exactly how you want information presented.

Please format your response as a markdown table with the following columns:
1. Framework name
2. GitHub stars
3. Main features
4. Learning curve (Easy/Medium/Hard)

4. Use Role Prompting

One of my favorite techniques! Ask the AI to adopt a specific perspective or expertise.

As an experienced cybersecurity expert, explain the potential vulnerabilities 
in this authentication system and suggest improvements.

Advanced Techniques

1. Chain-of-Thought Prompting

This technique encourages the AI to work through a problem step-by-step, which often leads to more accurate results.

Please solve this algorithmic problem. First, explain your understanding 
of the problem. Next, outline possible approaches. Then, implement the solution 
in Python with comments. Finally, analyze the time and space complexity.

2. Few-Shot Learning

Provide examples of what you want before asking for a new instance.

Here are examples of converting technical concepts to simple explanations:
Technical: "HTTP is a protocol for transferring hypertext documents"
Simple: "HTTP is like a postal service for the internet, delivering web pages from servers to your device"
Technical: "Public key cryptography uses paired keys for encryption"
Simple: "Public key encryption is like having a padlock where anyone can lock it, but only you have the key to unlock it"
Now, please explain "containerization" in simple terms.

3. Refining Through Iteration

The most powerful prompts often come through refinement. Start with something basic, then iterate based on results.

My workflow typically looks like:

  1. Start with a basic prompt
  2. Evaluate the response
  3. Identify what’s missing or incorrect
  4. Refine the prompt with more specific instructions
  5. Repeat until satisfied

Real-World Examples from My Projects

Example 1: Generating Code Documentation

When I needed to document my WordFlow project, I would have used this approach:

I need comprehensive documentation for my Python library called WordFlow.
It's a static site generator that converts docx and md files.
Please create:
1. A README.md with installation instructions, basic usage, and examples
2. API documentation for the core functions
3. A tutorial on creating a custom theme
Base your documentation on this code structure:
[I pasted my project structure and key files here]

Example 2: Debugging Complex Issues

I'm getting this error in my Go application:
[error message]

Here’s the relevant code:

“`
[Code snippet]

“`

As an experienced Go developer, please: 1. Identify potential causes of this error 2. Suggest debugging approaches 3. Propose solutions 4. Explain why this might be happening

Tools to Enhance Your Prompt Engineering

  • Prompt libraries – Collections like Prompt Engineering Guide
  • Templates – Create reusable templates for common tasks
  • Version control – Track prompt iterations (I use a simple Markdown file in my projects)
  • LLM playgrounds – Test environments like OpenAI’s playground or Claude’s console

Common Mistakes to Avoid

  • Being too vague – “Make this better” gives the AI nothing to work with
  • Overwhelming with information – There’s a sweet spot between too little and too much context
  • Not iterating – Your first prompt is rarely your best
  • Forgetting your audience – The best prompts for code generation differ from those for creative writing

Final Thoughts

Prompt engineering isn’t just about talking to machines—it’s about clearly expressing your intent, which is a universally valuable skill. As AI becomes more integrated into development workflows, the ability to effectively communicate with these systems will be as fundamental as knowing how to use version control or write documentation.

I’ve found that investing time in learning prompt engineering has exponentially increased my productivity across projects. Whether I’m prototyping a new app, debugging, or exploring ideas, a well-crafted prompt can save hours of work.

What are your experiences with prompt engineering? Let me know in the comments, and if you have any specific prompt techniques that have worked well for you, I’d love to hear them!

Until next time,
Metin (devsimsek)


Subscribe to my newsletter

Leave a Reply

Your email address will not be published. Required fields are marked *


ABOUT ME

Hey there! I’m Metin, also known as devsimsek—a young, self-taught developer from Turkey. I’ve been coding since 2009, which means I’ve had plenty of time to make mistakes (and learn from them…mostly).

I love tinkering with web development and DevOps, and I’ve dipped my toes in numerous programming languages—some of them even willingly! When I’m not debugging my latest projects, you can find me dreaming up new ideas or wondering why my code just won’t work (it’s clearly a conspiracy).

Join me on this wild ride of coding, creativity, and maybe a few bad jokes along the way!