Vibe Coding: Ship Fast Without The Regrets

AI-assisted development is powerful — but momentum without judgment creates unmaintainable messes. Here's the balance.

By Rais Helmy, IT consultant in Kuala Lumpur, Malaysia.

Vibe Coding. Ship fast. No regrets.

Cursor, Copilot, and Claude can write 80% of your code. But the remaining 20% — the decisions, the boundaries, the judgment — that's still yours.

principle 1 · context is everything

Expectation: best practice

  • Maintain a cursor rules / .github/copilot-instructions.md with your stack, conventions, and patterns.
  • Point the AI at multiple relevant files — not just the file you're editing.
  • Give it a working example before asking it to generate similar code.

Reality: what most teams do

  • "Generate a user auth flow" in an empty context — gets generic Express boilerplate.
  • Accepting AI output file by file without showing how they connect.
  • No persistent rules — repeating the same constraints every session.

Example (code)

// ✦ .cursorrules / copilot-instructions.md
Stack: Next.js 14 App Router, Prisma, Tailwind
Auth: NextAuth v5, role-based (admin/user/guest)
Patterns:
  - Server actions for mutations (no API routes)
  - Zod schemas co-located with server actions
  - Error: return {success, data, error} — never throw
  - Tests: Vitest + Testing Library
  - No classes, arrow functions only
  - shadcn/ui for all UI components

Before writing code: check if a similar pattern
exists in /lib or /components — follow it.

Don't just accept — understand and own.

Vibe coding creates an invisible debt: code you ship but don't understand. When it breaks at 2am, you're the one debugging it. Before accepting AI output, be able to explain every line. If you can't, ask the AI to explain it first.

Green light to accept

You can read and explain every line · It follows your established patterns · You've seen the test pass · Edge cases are handled

Ask for explanation first

Unfamiliar library APIs used · Complex async/concurrency logic · Security-relevant code (auth, payments) · DB schema changes

→ Mental model: treat AI like a pair programmer who types fast but needs your review before the code goes in.

principle 3 · steer with tests

Expectation: best practice

  • Write the test first — it defines the expected behaviour before the AI generates the implementation.
  • Use failing tests as AI prompts: "Make this test pass without changing the test."
  • Tests give the AI a concrete success criterion — output quality jumps significantly.

Reality: what most teams do

  • Generate code → it looks right → skip tests → discover edge cases in production.
  • Asking for code AND tests together — AI writes tests that describe the code, not the requirement.
  • No tests = no safety net when you ask AI to refactor next month.

Better approach (code)

// ✦ Test-first vibe coding
// 1. Write the test (your intent)
it('rejects password under 8 chars', () => {
  expect(validatePassword('abc')).toEqual({
    valid: false, error: 'Min 8 characters'
  });
});

// 2. Prompt: "Make this test pass.
//    Return {valid, error}. No throwing."

Common mistake (code)

// ✗ Generate then test
// Prompt: "Write validatePassword with tests"

// ← AI writes code, then writes tests
//   that match the code it just wrote.
//   Tests pass. But do they test
//   your requirements or its assumptions?

vibe coding decision guide

  • Boilerplate: Full auto - CRUD, form handlers, API wrappers — trust it
  • Business logic: Review carefully - Read every line, run tests, own the output
  • Auth / Payments: Human-primary - Use AI for structure only, review every token
  • DB migrations: Never auto-accept - Schema changes are irreversible in production
  • Tests: Write first - Define intent before asking AI to implement
  • Refactoring: Snapshot test first - Capture current behaviour before AI rewrites