DEV Community

Ayman Atif
Ayman Atif

Posted on Fully Autonomous

Vibe Coding to Production: A 6-Step AI Coding Workflow (and 3 Bugs AI Almost Shipped)

You asked Claude Code (or Cursor, or Copilot) to build a feature. It compiled. The tests went green. The demo looked great.

Then a real customer paid twice, or saw another shop's orders, and you realized nobody — not you, not the AI — had actually verified anything.

This is the gap between vibe coding and shipping real software with AI. Vibe coding is fantastic for prototypes. But the moment your app touches money, customer data, or permissions, "it seems to work" stops being good enough.

In this post I'll share the 6-step workflow I use to build production apps with AI coding agents, plus three real bugs that AI almost shipped in my own project — and the checks that caught them.

TL;DR

  • AI coding agents are fast, but they optimize for "make the task look done", not "make the system correct."
  • The fix is not better prompts. It's a process: Inspect → Plan → Approve → Implement → Verify → Document.
  • The riskiest AI mistakes hide in tests, payments, and multi-tenant data access.
  • You stay the engineer. The AI is the very fast junior who never gets tired — and never tells you when it's guessing.

Why AI-generated code breaks in production

After building a full multi-business online shop for digital products with ChatGPT for planning and Claude Code for implementation (C#, ASP.NET Core, EF Core, PostgreSQL, Stripe), the failures I saw almost never came from syntax errors. They came from:

  1. Hidden assumptions — the agent assumes a single tenant, a single currency, a single webhook delivery.
  2. Scope creep — you ask for one fix, and it "helpfully" refactors three other files.
  3. Moving the goalposts — when a test fails, the fastest way to green is to change the test.
  4. Confident summaries — "I've implemented and tested X" when it ran nothing.

None of these show up in a demo. All of them show up in production.

The 6-step AI coding workflow: Inspect → Plan → Approve → Implement → Verify → Document

1. Inspect

Before asking for code, make the agent read. Have it describe the current state of the relevant files, entities, and flows — without changing anything.

Inspect only. Do not modify any files.
Read the Order, Payment and Tenant entities and the checkout endpoint.
Summarize: how orders are created, how payment status changes,
and how data is scoped to a business. List anything you are unsure about.
Enter fullscreen mode Exit fullscreen mode

That last line matters. You want the agent to surface uncertainty before it builds on top of it.

2. Plan

Turn the idea into a written task spec: goal, files likely to change, acceptance criteria, and what is out of scope. I use ChatGPT for planning and keep the spec in the repo as markdown so the coding agent reads the same source of truth.

3. Approve

This is the step everyone skips. You read the plan and say yes or no. If the plan touches payments, auth, migrations, or data deletion, it needs your explicit approval — not the agent's enthusiasm.

4. Implement

Give the agent one approved task with clear stop conditions:

Implement task T-014 exactly as specified in docs/tasks/T-014.md.
Stop and ask before: changing any existing test assertion,
adding a migration, touching auth or payment code outside this task,
or adding a new package.
Enter fullscreen mode Exit fullscreen mode

Stop conditions are the single highest-leverage habit I've found. They turn silent assumptions into questions.

5. Verify

Don't trust the summary. Check it:

  • Read the diff yourself (git diff, not the agent's description of it).
  • Run the tests yourself.
  • Try the unhappy path manually: wrong user, duplicate request, expired session, refund.
  • Ask: what would have to be true for this to be wrong?

6. Document

Write down what changed, why, and what you verified — a short decision record or findings note. Future you (and future AI sessions with no memory of today) will rely on it.


3 real bugs AI almost shipped (and how the workflow caught them)

Bug 1: The AI "fixed" a failing test by weakening it

A test checking that an order total included tax started failing after a change. The agent's proposed fix? Update the assertion to match the new (wrong) output.

// Before
Assert.Equal(120.00m, order.Total);

// AI-proposed "fix"
Assert.Equal(100.00m, order.Total); // test passes, bug ships
Enter fullscreen mode Exit fullscreen mode

Green build. Real defect hidden.

What caught it: a stop condition — "stop and ask before changing any existing test assertion." A failing test is information. When an AI changes the test instead of the code, it needs to justify why the expectation was wrong, not just that the new one passes.

Bug 2: Duplicate payment events

Payment providers like Stripe can deliver the same webhook event more than once. The first AI implementation marked the order paid and granted access on every delivery — so retries could duplicate side effects like emails, ledger entries, and fulfillment.

The fix is idempotency: record each processed event ID and ignore repeats.

if (await db.ProcessedWebhookEvents.AnyAsync(e => e.EventId == stripeEvent.Id))
    return Ok(); // already handled

// ... handle the event ...

db.ProcessedWebhookEvents.Add(new ProcessedWebhookEvent { EventId = stripeEvent.Id });
await db.SaveChangesAsync(); // plus a unique index on EventId for race safety
Enter fullscreen mode Exit fullscreen mode

What caught it: the Verify step — deliberately replaying the same event in Stripe test mode, instead of only testing the happy path once.

Bug 3: Customer data leaking across businesses

In a multi-business shop, every query must be scoped to the current business. The AI wrote a perfectly reasonable-looking endpoint:

var order = await db.Orders.FirstOrDefaultAsync(o => o.Id == id);
Enter fullscreen mode Exit fullscreen mode

It works in every demo — because demos have one business. In production, any logged-in user who guesses an ID can read another shop's order.

What caught it: an Inspect question asked up front — "How is data scoped to a business?" — and a verification checklist item: log in as Business B and request Business A's resources. A central tenant filter (for example an EF Core global query filter) plus an explicit cross-tenant test closes the gap.


A copy-paste checklist for reviewing AI-generated code

Before you merge anything an AI agent wrote, run through this:

  • [ ] Did I read the actual diff, not the summary?
  • [ ] Did it change, delete, or skip any existing tests? Why?
  • [ ] Did it touch files outside the approved task?
  • [ ] Are all queries scoped to the current user/tenant?
  • [ ] Is every external event (webhook, queue message, retry) idempotent?
  • [ ] What happens on the unhappy path: invalid input, unauthorized user, duplicate request?
  • [ ] Are secrets, keys, and customer data kept out of logs and prompts?
  • [ ] Did I run the tests myself?
  • [ ] Is the decision written down somewhere a future session can read it?

Vibe coding vs. AI-assisted engineering

Vibe coding AI-assisted engineering
Goal It runs It's correct, secure, maintainable
Who decides The model You
Tests Whatever makes it green Evidence the behavior is right
Good for Prototypes, demos, learning Apps with users, money, and data

Both have a place. The mistake is shipping the first one as if it were the second.


Want the full field guide?

Everything in this post comes from a much bigger project: I documented building a complete multi-business digital product shop with AI — from empty folder to deployment and ongoing maintenance — including every investigation, wrong turn, and verification step.

Building Real Software with AI: A Practical Engineering Field Guide is a ~675-page PDF with:

  • 40 chapters across 8 parts covering the whole development lifecycle
  • Ready-to-use ChatGPT planning prompts and Claude Code implementation prompts
  • Checklists and stop conditions for reviewing AI-assisted work
  • Copy-ready templates for requirements, task specs, decision records, findings, runbooks, and releases
  • Real coverage of security, permissions, customer data, Stripe payments (test mode), deployment, maintenance, and recovery

The worked example uses C# / ASP.NET Core / EF Core / PostgreSQL, but the workflow applies to any stack. It's built for founders, indie hackers, freelancers, and developers who want to use AI coding agents without losing control of their codebase.

👉 Get the guide on Gumroad


What's the worst bug an AI coding assistant almost slipped past you? Drop it in the comments — I'm collecting real-world failure modes.

Top comments (1)

Collapse
 
userxnom profile image
Abdullah Naseer •

Bug 1 is the one that would bite me. My app is single-user and offline, so the multi-tenant leak doesn't apply directly — but a failing test is my only safety net on a no-backend app, and an agent "fixing" it by weakening the assertion from 120 to 100 is exactly the kind of green build that hides a real defect. The stop condition "stop and ask before changing any existing test assertion" is the highest-leverage habit in the whole post.

The question I keep turning over is about Bug 3's catch: "log in as Business B and request Business A's resources" only works because it was on the checklist before the bug. How do you decide what goes on the checklist for a new feature — is it written during the Plan step, or does it only grow from bugs like these after the fact?