When Not to Use AI: Knowing the Limits

Hướng dẫn chi tiết về When Not to Use AI: Knowing the Limits trong Vibe Coding dành cho None.

When Not to Use AI: Knowing the Limits

The euphoria of “Vibe Coding” is addictive. You describe a feature, hit a button, and watch as hundreds of lines of functional, styled, and documented code materialize before your eyes. In this high-abstraction flow state, the distance between intent and implementation shrinks to near zero. You feel like a digital sorcerer, conjuring complex systems from nothing but natural language.

However, every experienced Vibe Coder eventually hits “The Wall.” It usually happens late at night: you’ve spent two hours in a circular prompt loop with your AI agent. You ask it to fix a bug; it introduces another. You ask it to revert; it breaks the CSS. You provide the error log; it apologizes and gives you the exact same code you just rejected.

This is the “Prompt Loop of Death,” and it’s the first sign that you’ve crossed the boundary of what AI can currently handle. To master Vibe Coding, you must not only know how to use the tools but, more importantly, when to put them down. This article explores the cognitive and technical limits of AI in software development and provides a framework for knowing when to switch from “Vibe” back to “Manual.”


The Core Concept: The Vibe Coding Boundary

AI agents are stochastic parrots with incredible pattern-matching capabilities. They are trained on the “average” of human knowledge. They excel at boilerplate, common patterns, and standard integrations. They struggle with novelty, deep logical nesting, and high-stakes precision.

In Vibe Coding, we solve problems by defining intent. This works as long as the path from intent to execution follows a well-trodden road. When you ask for a “responsive navbar,” the AI has millions of examples to draw from. But when you ask for a “highly optimized custom memory allocator for a specific edge-case hardware device,” the “vibe” breaks down because the statistical probability of the AI getting it right is lower than the probability of it hallucinating a plausible-looking failure.

1. The Hallucination Threshold

AI doesn’t tell you “I don’t know.” It predicts the next most likely token. When a library is too new (post-training cutoff) or a problem is too specific, the AI will confidently suggest functions that don’t exist or logic that is syntactically correct but semantically nonsensical. If you find yourself correcting the same hallucination more than twice, you have crossed the threshold.

2. Context Window Saturation

As your project grows, the AI’s “memory” (context window) fills up. While modern models have massive windows, their “attention” degrades. It might forget a crucial security constraint you mentioned in the first prompt or start ignoring the project’s established naming conventions. When the AI starts “forgetting” your rules, it’s time to stop prompting and start auditing.

3. The Novelty Gap

AI cannot invent truly new paradigms. It can recombine existing ones brilliantly, but it cannot reason from first principles to solve a problem that has never been solved before. If your startup’s “secret sauce” is a brand-new architectural pattern, the AI will constantly try to pull you back toward the “standard” (and often incorrect) way of doing things.


When to Step Away: Specific Scenarios

Knowing the limits isn’t just a feeling; it’s a tactical decision. Here are the specific scenarios where you should stop Vibe Coding and pick up the keyboard.

1. Security-Critical Logic (The “Zero-Vibe” Zone)

Encryption, authentication flows, and authorization logic should never be left entirely to an AI. A stochastic model might suggest a “pretty good” regex for password validation that actually has a ReDoS vulnerability, or it might implement a JWT check that skips the signature verification in certain edge cases.

  • The Rule: Use AI to boilerplate the structure, but manually review every line of code that handles user identity, data encryption, or financial transactions.

2. Deep Debugging and Performance Bottlenecks

When your app is slow, AI will often suggest “generic” optimizations: “Add a cache,” “Use a CDN,” or “Optimize your images.” But if your bottleneck is a specific N+1 query nested inside a complex reducer logic, the AI likely won’t see the systemic connection.

  • The Problem: The AI sees the code, but it doesn’t “run” the code in its head with the same fidelity as a human using a profiler.
  • The Fix: Use Chrome DevTools, React Profiler, or EXPLAIN ANALYZE in SQL. Find the bottleneck yourself, then use the AI to help you rewrite the specific function once you’ve identified the culprit.

3. Novel or Niche Library Integration

If you are using a library that was released last month, or a niche SDK for an IoT device, the AI is effectively guessing. It will use the syntax of similar libraries, leading to hours of frustration.

  • The Rule: If the documentation isn’t in the AI’s training data, you are the lead architect. Read the docs yourself, write a small “adapter” or “wrapper,” and then feed that wrapper to the AI so it knows how to interface with the library.

4. Large-Scale Refactoring

Asking an AI to “Refactor this entire 50-file project to use X instead of Y” is a recipe for disaster. It will likely miss edge cases, break imports, and introduce subtle regressions that your test suite (if you have one) might not catch.

  • The Strategy: Refactor one module manually. Establish the pattern. Then, use the AI to replicate that pattern in the other 49 files one by one, validating each step.

Practical Example: The Pricing Engine Trap

Imagine you are building a SaaS platform with a complex pricing model: tiered discounts, regional taxes, promotional codes, and legacy subscription credits.

The Vibe Coding Failure

You prompt: “Implement a function that calculates the final price for a user based on their tier, their country, and any active promos.”

The AI generates a 100-line switch statement. It looks great. You “vibe” with it and move on. Two weeks later, a customer in Germany with a “WINTER20” code is charged -$5.00 because the AI didn’t account for the order of operations between regional VAT and flat-rate discounts.

The Manual-First Approach

  1. Stop the Vibe: Realize this logic is high-stakes (money) and high-complexity (nested rules).
  2. Define the Logic Manually: Write down the business rules in a plain text file or comments.
    • Step 1: Calculate base price.
    • Step 2: Apply percentage discounts.
    • Step 3: Apply flat-rate promos.
    • Step 4: Ensure price is not below zero.
    • Step 5: Apply regional tax on the final subtotal.
  3. Use AI for the “Heavy Lifting”: Give the AI these specific steps and ask it to write unit tests for every edge case before writing the function.
  4. Verification: Manually check the logic flow.
// DON'T VIBE THIS: The logic is too sensitive for stochastic guessing.
// DO THIS: Use TDD (Test Driven Development) to define the human boundary.

describe('Pricing Engine', () => {
  it('should never return a negative price even with aggressive promos', () => {
    const result = calculatePrice({ base: 100, promo: 150 });
    expect(result).toBeGreaterThanOrEqual(0);
  });
  
  it('should apply VAT AFTER all discounts', () => {
    // Manually verify the sequence here
  });
});

Best Practices: The Human-in-the-Loop Rhythm

To avoid the pitfalls of AI over-reliance, adopt a “Pulse” rhythm in your development workflow.

1. The “Trust but Verify” Audit

For every block of code an AI generates, perform a “mental execution.” If you can’t explain exactly what every line is doing, you shouldn’t commit it. If the code is too complex to understand at a glance, ask the AI to simplify it or break it into smaller functions.

2. TDD as a Safety Net

The best way to know if an AI has hit its limit is to have a failing test. Before you ask an AI to fix a bug, write a test that reproduces the bug. If the AI “fixes” the code but the test still fails, you know the AI doesn’t truly understand the problem. This is your signal to take over manually.

3. Small Commits, High Frequency

In Vibe Coding, it’s easy to generate 500 lines of code in one go. Don’t. Generate a small, testable piece, verify it, commit it, and then move to the next. This prevents the “Context Rot” where a small mistake in the first minute of prompting becomes a structural foundation that is impossible to fix an hour later.

4. The 10-Minute Rule

If you have been fighting with a prompt for more than 10 minutes without progress, stop. Delete the last generated block of code. Write the core logic yourself (even if it’s ugly). Once the core logic is working, you can ask the AI to “Clean this up,” “Make it more idiomatic,” or “Add error handling.”


Conclusion: Becoming the Pilot, Not the Passenger

Vibe Coding is not about replacing the developer; it’s about upgrading the developer to a System Architect. In this new world, your most valuable skill isn’t your ability to remember the syntax for a map function; it’s your ability to recognize the boundaries of the system you are building.

AI is an incredible co-pilot, but it doesn’t have “skin in the game.” It doesn’t care if your database leaks or if your CSS is 4MB too large. You are the Pilot. You are responsible for the structural integrity, the security, and the long-term maintainability of the code.

By knowing when to step back and take the controls, you transform AI from a source of frustration and technical debt into a powerful multiplier. Vibe with the boilerplate, dance with the UI components, but when it comes to the heart of your application—the logic, the security, and the novelty—be the human in the loop. That is the secret to true Vibe Coding mastery.