Use Claude as a Rubber Duck That Actually Talks Back
Rubber duck debugging works because explaining a problem forces you to think through it. Claude Code is a rubber duck that reads the code, asks smart follow-up questions, and catches the thing you were about to say.
I'm confused about why the order total is sometimes wrong. The calculation
looks right to me but customers are getting charged incorrectly.
I think it might be a rounding issue but I'm not sure where to look.
Instead of just diving into the code and presenting a fix, Claude can do something more valuable — read the relevant files, then ask you questions that narrow down the problem:
- "Is this happening for all orders or specific product combinations?"
- "Are you rounding at each line item or only at the total?"
- "This discount function returns a float — is that getting truncated when stored as an integer cents value?"
That third question might be the one that makes you go "oh, that's the bug."
This works best when you don't jump straight to "fix it" — instead, think out loud:
# Talk through your hypothesis
I think the issue is in the discount calculation. The percentage discount
gets applied after tax, but maybe it should be before? Can you read
src/billing/calculator.ts and tell me which order the operations happen in?
# Share what you've already tried
I've checked the checkout flow and the prices look right in the cart.
The total changes after the payment intent is created. Something between
the cart and the Stripe call is modifying it.
# Ask for a second opinion
Here's my theory: the race condition happens when two webhooks fire
simultaneously. Does this code handle concurrent access to the order record?
The key difference from asking Claude to "fix this bug" is that you stay in the driver's seat. Claude is the navigator — reading the map, checking the route, and asking "are you sure you want to turn here?" instead of grabbing the wheel.
Sometimes you don't need Claude to solve the problem — you need it to listen well enough that you solve it yourself.
via Claude Code
Log in to leave a comment.
When a page takes five seconds to load or an API endpoint times out under load, tell Claude which route is slow and it traces the entire code path — controller, services, queries, loops — identifying N+1 queries, redundant computations, missing indexes, and cacheable operations, then fixes each bottleneck.
Flaky tests are maddening — they pass locally, fail in CI, pass again when you retry. Tell Claude to read the test, identify the source of non-determinism — timing issues, shared state, date dependencies, or order-dependent setup — and fix the root cause so the test is reliably green or reliably red.
When your app throws an error, don't just Google the message — paste the full stack trace into Claude Code. It reads the trace, opens the referenced files in your codebase, follows the call chain, and pinpoints the actual root cause instead of just explaining the symptom.