Write AI test specifications before implementation, or hide the function body from a fresh test-writing chat
A small-SaaS developer reports a double-refund bug despite passing AI-generated tests. Their revised Claude Code routine separates test specifications from implementation and uses a fresh chat for diff review.
Evidence: The author reports this. We have not checked it beyond reading the source.
The business problem
Tests generated alongside AI-written code can repeat its mistaken assumptions.
What was tried
The commenter now either writes the test specification first or opens a fresh chat with only the function signature and docstring, withholding the implementation body. For code review, they open another chat on the diff without the original session's context. They also reduced CLAUDE.md from roughly 400 lines to 80, keeping rules and project gotchas.
What was reported (mixed)
u/FarExperience1359 says an earlier AI-written refund flow passed tests but refunded one order twice. They provide no measured defect rate after changing the routine.
Limitations
One developer's account; no code, tests or incident report. Independent context is a review technique, not proof of correctness. No exact prompt supplied.
What you need
A function signature/docstring or test specification and a code diff.
Sources
- u/FarExperience1359, comment on r/ClaudeAI (not the original poster) ↗ Community discussion, publication date unknown
Source published: unknown. Last reviewed here: October 26, 2026. Spot a mistake? Tell us.
Tools in this workflow
- Claude Code: Author's coding, test-writing and review assistantTry Claude Code
Get new workflows like this by email
A short selection of the most useful new workflows, including the ones that did not work. Free, and you can unsubscribe at any time.
Related workflows
A Claude-built support inbox that drafts replies, pulls orders and learns from the owner's edits
A small online seller had Claude build Relay, an internal web app that turns email, Facebook and Instagram messages into tickets every 10 minutes, drafts replies with order data, and handles cancellations and returns after his approval.
A third AI model audits the code before launch: 100 bugs found in a no-code founder's SaaS
A founder with no coding skills builds with two AI models and points a third at the codebase only to audit, before taking payments. It found about 100 bugs, including broken payment credits, then became a standing check.
Localize an iOS app with code-aware CLI agents, .xcstrings and separate App Store copy files
An iOS developer describes using Claude Code to find missing strings and Codex CLI to translate .xcstrings, store metadata and screenshot text. App Store entry and screenshot layout remain manual.
Automate monthly refreshes of data-driven articles with an agent that fetches, filters, rebuilds and drafts for human review
An Ahrefs marketer describes a monthly pipeline that pulls fresh keyword data, filters it with written rules and examples, rebuilds tables, updates WordPress drafts and notifies the editor, who approves every change before it goes live.