Skip to main content
Breathbase
AI Development

Prompt engineering for developers: getting better code from AI

How to get better results from AI coding tools with smart prompts. Techniques and examples.

April 18, 20258 minMiquel van Dongen
AI Summary

 

Prompt engineering as a core skill

The quality of AI-generated code stands or falls with the quality of your prompts. Two developers using the same AI tool for the same task can get radically different results, purely based on how they formulate their instructions. Prompt engineering — the art of effectively communicating with AI — is therefore the most important new skill for every developer working with AI development tools.

The good news is that prompt engineering is not rocket science. It follows logical principles that you can learn and practice. In this article, we share the techniques we use daily at Breathbase to consistently get high-quality code from AI tools.

The basics: clear instructions

Be specific, not vague

The biggest mistake is vagueness. "Build a login page" produces generic code. "Build a login page with email and password fields, client-side validation, a 'forgot password' link, and error handling that shows specific error messages for incorrect email format, unknown account, and wrong password" produces usable code. The more specific your instruction, the better the result.

Define the technical context

Always mention your technology stack, coding conventions, and architecture patterns. "Use TypeScript with strict mode, functional React components with hooks, and Tailwind CSS for styling. Follow the file structure already present in the project." This prevents the AI from making choices that do not fit your project.

Provide examples

One-shot or few-shot prompting — providing examples — is particularly effective. Show an existing component from your project and ask the AI to build a new component in the same style. The AI recognizes patterns and applies them consistently.

The best prompts do not describe what the code looks like, but what the code should achieve. Focus on the desired behavior and edge cases, and let the AI determine the implementation details.

Advanced techniques for better code

Chain-of-thought prompting

Ask the AI to think first before generating code. "First analyze which components are needed, which data flows exist, and which edge cases we need to handle. Then generate the code." This leads to better thought-out solutions.

Negative instructions

Also tell the AI what it should not do. "Do not use class components, no any-types, and no inline styles." Negative instructions are often just as valuable as positive ones because they prevent common AI patterns that do not fit your project.

Iterative refinement

Do not generate code all at once, but in steps. Start with the structure, then add logic, then error handling, then tests. Each step builds on the previous one and gives you the opportunity to adjust. This works excellently with tools like Cursor and Claude Code.

Context management for large projects

In large projects, context management is crucial. AI models have a limited context window, so you need to be strategic about what information you provide. Use .cursorrules or CLAUDE.md files to capture project-wide instructions. Reference specific files instead of entire folders. Give the AI only the context relevant to the current task.

An effective technique is creating an architecture document that summarizes the key decisions and patterns of your project. Reference this document with every new task so the AI stays consistent with your existing architecture.

Improving your prompting skills

Prompt engineering is a skill you develop through practice. Experiment with different formulations for the same task and compare the results. Keep a log of prompts that worked well and reuse them as templates. And invest in an AI development training to learn in a structured way from experts who work with these tools daily. The investment in better prompting skills pays for itself directly in higher code quality and faster development.

Tags

Prompt EngineeringAIDevelopment
Miquel van Dongen

Miquel van Dongen

Founder & Consultant @ Breathbase

Specialist in Microsoft Dynamics 365, Power Platform and AI-driven software development. Helps organizations get the most out of their digital transformation.

More about Miquel

Get in touch

Have a question or want to explore possibilities? Feel free to reach out to us.