Most engineers blame the AI when they get bad results. The real issue? The prompt.
Here's what actually works:
1. Be specific upfront
Vague prompts = vague answers.
❌ "Write a function to handle errors."
✅ "Write a Python FastAPI middleware that catches async errors and returns a structured JSON response with status code and message."
2. Use constraints
Tell the AI what not to do.
"No comments. No print statements. Use async/await with httpx, not requests."
Constraints cut bloat before it's even generated.
3. Give an example
Point it to your existing code and say "match this style." Whether you're using Claude Code, Cursor, or GitHub Copilot, letting AI read your codebase directly means it aligns with your naming conventions, patterns, and architecture, no lengthy explanation needed. If you're on a browser-based AI, just paste a snippet, same idea, same result.
4. Assign a role
"You are a senior backend engineer reviewing this API design for scalability issues."
It steers the reasoning frame and gets you a sharper, more focused review.
5. Break complex tasks apart
Don't ask AI to "build a full auth system" in one prompt.
Instead: models → routes → decorators/dependencies → pytest tests. Each step builds on the last and errors are easier to catch.
6. Refine, don't regenerate
Something's off? Don't restart. Say:
"This Python function is returning None instead of the parsed JSON, debug just this function, don't touch the rest."
Targeted edits save tokens and preserve what's already working.
7. Control output length
"Give me 3 approaches to this caching problem, one paragraph each."
Longer output ≠ better output. It just takes more time to read and review.
8. Know when AI can mislead you
Designing system architecture, making security-critical decisions, or estimating performance at scale, AI can sound very confident and still be completely wrong. Always validate its output with your own judgment and domain knowledge.
The core principle?
AI won't fix a bad brief. The quality of your output is directly proportional to the clarity of your input.
Top comments (0)