DEV Community

Cover image for Stop asking 'what's wrong with this function
xiaodong Zhang
xiaodong Zhang

Posted on

Stop asking 'what's wrong with this function

For a long time my most-used prompt was some variant of "take a look at this and tell me what's wrong."

It's the worst prompt I had, and it took me months to notice because the failure is slow rather than obvious.

Why open-ended costs more

"Optimize this" can mean performance, readability, memory, or line count. Those pull in different directions. The model doesn't know which you want, so it picks — or worse, addresses all of them.

You get a rewrite touching a dozen things you didn't care about, while the one thing you did care about is untouched or buried.

Then you correct. Then it corrects. Two or three rounds.

Each round drags the entire conversation with it. Usage is metered on context, so round three costs more than round one. And as the window fills, the model starts losing the original intent — you're paying more for worse output.

The vague prompt felt cheap because it was fast to type. The cost showed up downstream.

What I write now

This function gets slow above ~10k records. I think it's the nested loop. Rewrite as a single pass, behavior must not change, run the tests after.

Longer to type. Usually lands first try.

The components that matter:

  • Symptom — slow above 10k, not "slow"
  • Hypothesis — the nested loop (and it's fine to be wrong; it gives a starting point)
  • Constraint — behavior must not change
  • Verification — run the tests

That last one is doing the heaviest lifting. With a runnable check the agent closes its own loop instead of handing back something that looks done.

Two cases where vague is right

I don't want to overcorrect, because I did that too for a while.

Deliberate exploration. Once in a while I ask an open question specifically to surface blind spots:

Read this file. What would you improve?

Last time I did this it flagged a cache invalidation path that breaks under concurrency — I hadn't considered concurrency because current volume doesn't require it. It also caught two functions in different files with near-duplicate logic, which I'd missed for months because they were never open at the same time.

That's a real category of value, and precise prompts structurally can't produce it: you can only ask about problems you've already imagined.

I do this periodically, expecting a signal-to-noise ratio around one in three. Route it through a subagent so the file reads don't accumulate in the main thread.

Genuine uncertainty. When I don't know what I want, saying so beats faking precision:

I'm not sure where the bottleneck is. Analyze first, propose options, don't change anything yet.

Pretending to know produces confident work on the wrong problem.

The heuristic

If I can describe what the diff will look like in one sentence, I state it precisely and skip analysis. If I can't, I ask for analysis first.

That's held up for months. It also encodes something true: the cases where you can't describe the diff are exactly the cases where you don't yet understand the problem.

The review-prompt corollary

Same principle applies when asking for a review, with an extra clause:

Only report issues affecting correctness or the stated requirements. Skip style preferences.

An agent asked to find problems will find problems — that's the request. Without scoping you get a wall of "this could be more elegant," and following it produces over-engineering: extra abstraction, defensive code, tests for cases that can't occur.

The economics underneath

Rework is the main cost driver in AI-assisted work, and precision is the main lever on rework.

That said, precise prompting doesn't make careful work cheap — it makes it less wasteful. Runnable checks still mean iteration rounds. Analysis passes still cost a read of the codebase. Review agents still need their own context window.

For the months where that adds up past my baseline, I top up through Asale rather than sizing a tier for peak weeks — a market where unused subscription capacity gets routed to people who need it, priced per million tokens.

Standard caveat: requests relay through another user's client, so the payload is visible at that hop. No end-to-end encryption, stated on their front page. Personal projects and open source, fine. NDA'd work, no.


Does anyone else run periodic open-ended audits? Curious whether others find the one-in-three hit rate worth it, or whether that's just me being generous with my own idea.

Top comments (0)