DEV Community

Learn AI Resource
Learn AI Resource

Posted on

Stop Wasting Time With Bad Prompts: A Developers Guide to Getting Results From AI

You're asking Claude to refactor your code and get back garbage. You paste the same problem into ChatGPT three times with different wording because the first two attempts missed the mark. Your teams using AI tools but nobodys actually getting faster.

The problem isnt the AI. Its your prompts.

The Real Issue: Youre Not Being a Specific Enough Human

AI tools are like really smart interns. They'll do exactly what you ask—but only if you ask clearly. Most developers write prompts the way they text their mom: vague, context-light, and hoping the AI will just get it.

Bad prompt: "Fix this code"
Better prompt: "This JavaScript function is making an API call that times out after 5s when the endpoint is slow. I need it to retry up to 3 times with exponential backoff before throwing an error. Here's the current code: [code]"

The second one works because it tells the AI what's broken, why it matters, and what success looks like. It's not longer—it's just precise.

Three Rules That Actually Work

1. Give Context Before the Task

Before you ask for help, frame the problem. What are you building? What's it for? What's already tried that didn't work?

I'm building a CLI tool for syncing config files across servers. 
Right now I'm using shell scripts, but they're fragile and hard to test.
I want to switch to Go for better error handling and cross-platform support.
I've never written Go before but I know Python and JavaScript.

I need to read a YAML config file, validate it against a schema, then apply it to 5 remote servers via SSH.
What's the simplest way to do this in Go without pulling in 15 dependencies?
Enter fullscreen mode Exit fullscreen mode

That's 6 sentences. You just saved 30 minutes of back-and-forth.

2. Specify the Format and Constraints

Don't let AI guess what "help" means to you. Tell it.

  • "Write this as a reusable function, not a script"
  • "Keep it under 100 lines"
  • "Assume Node 18+"
  • "Make it debuggable—add logging at key points"
  • "Write tests too"

Without this, you get code that might be correct but useless for your actual workflow.

3. Show Examples When It Matters

If you want a specific style or pattern, show it:

I'm writing a test for a React component. Here's an example 
of how I structure other tests in this project:

[example test]

Now write a test for this component the same way:
[component code]
Enter fullscreen mode Exit fullscreen mode

Pattern matching is something AI is really good at. Use it.

Real Example: From Garbage to Gold

Mess: "How do I make my database queries faster?"

Better:

"I have a PostgreSQL database with a users table (500k rows) and a purchases table (2M rows).
Queries to show a user's purchase history are taking 3-4 seconds.

Current query:

SELECT * FROM purchases WHERE user_id = \$1 ORDER BY created_at DESC;
Enter fullscreen mode Exit fullscreen mode

I've already indexed user_id. What else can I try? Also, I'm using TypeORM, not raw SQL."

Boom. Now the AI can actually help because it knows your constraints (PostgreSQL, TypeORM), your scale (2M rows), and what you've already tried (indexing).

Tools That Make This Easier

  • Claude (web or API) - Best for extended conversations where you build context over time
  • GitHub Copilot - Good for quick code snippets in your editor; struggles with large refactors
  • Cursor - IDE that gets your codebase context; worth it if you're doing serious work
  • Perplexity - Better for research and "what's new in X" questions

Pick one and actually learn how to use it instead of bouncing between all of them.

The Workflow That Works

  1. Write the bad prompt first - Get your question out, don't overthink it
  2. Add context - Real scenario, real numbers, what you've tried
  3. Specify what success looks like - Format, constraints, examples
  4. Follow up with specifics - "That's too complex" or "I need it to handle this edge case"

That's it. Most developers skip steps 2-3 and then blame the AI.

One More Thing

Stop saying "I'll just use AI for the easy stuff." The easy stuff doesn't need AI. Use it for the things that are actually hard: architecture decisions, refactoring, test coverage, understanding new frameworks, security review. Those are where it saves you real time.


Want to dig deeper into this? I write about practical developer tools, AI workflows, and productivity hacks in the LearnAI Weekly newsletter. It's short, it's useful, and people actually read it.

What's been your biggest prompt fail? Drop it in the comments—I'm curious what trips people up most.

Top comments (0)