5 RULES to make Vibe Coding work in Production

By Arseny Shatokhin

Share:

AI Coding Rules for Production-Ready Codebases

Key Concepts:

  • EI Coding (Exploratory/Iterative Coding): Rapid initial coding that can quickly become unmanageable.
  • VIP Coding (Velocity-Induced Problems): The tendency for fast AI-driven coding to create messy, difficult-to-maintain codebases.
  • 131 Technique: A problem-solving method for AI agents when stuck, involving presenting options and seeking confirmation.
  • DRY (Don't Repeat Yourself): A core software development principle emphasizing code reuse and avoiding duplication.
  • TDD (Test-Driven Development): A development process where tests are written before the code, guiding development and ensuring functionality.
  • Continual Learning Loop: A system for updating context and rules based on agent encounters with conflicting information or missing documentation.
  • Context: The information provided to the AI agent, crucial for consistent and accurate results.
  • Context Thrott: When an AI agent loses track of the overall goal during a prolonged task due to limited context.

The Problem with Fast AI Coding

The video addresses a common issue: while AI-powered coding (EI coding) is incredibly fast initially, it often leads to codebases that quickly become unmanageable and difficult to maintain. The speaker highlights that this isn’t a problem solved by better prompts or more powerful models, but by establishing a set of rules to guide the AI agent’s behavior, mimicking the discipline of a production engineer. The speaker’s team currently has approximately 400,000 lines of code, with 15,000 lines changed weekly, and over 90% of this code is AI-generated, yet remains consistent due to these rules. The anecdote about Salesforce regretting firing experienced staff in favor of AI underscores the potential pitfalls of unchecked AI implementation. The core argument is that speed without structure leads to chaos, and the key to sustainable AI coding is establishing “rails” for the agent.

Rule #1: The 131 Technique – Breaking the Feedback Loop

This rule addresses the issue of AI agents getting stuck and generating unproductive code. Instead of attempting to guess a solution, the agent is instructed to:

  1. Provide one clearly defined problem.
  2. Give three potential options for overcoming it.
  3. Offer one recommendation.
  4. Await confirmation before proceeding.

This forces the agent to reconsider its approach and presents the user with clear choices, shortening the feedback cycle. An example is given where an agent, unsure where to place a new feature, presents three options (existing services folder, new features module, collocation with similar classes) and recommends the first. The user simply selects a number corresponding to their choice, and the agent continues. The speaker emphasizes that if the problem definition or options are nonsensical, it indicates a fundamental issue with the agent’s understanding. The "131" command can be explicitly given to smaller models that don't automatically employ this technique.

Rule #2: DRY – Eliminating Redundancy

The DRY (Don't Repeat Yourself) principle is crucial, especially with AI. Duplicated code exponentially increases the risk of bugs, as changes need to be made in multiple locations, increasing the likelihood of errors. The example illustrates an agent adding input validation to multiple tools, potentially leading to inconsistent behavior if the validation rules are only updated in one place. The solution is to refactor the code, extracting a shared validation function into a utils directory, ensuring consistency and reducing the potential for errors. This rule directly contributes to faster shipping by reducing bugs and increasing reliability.

Rule #3: TDD – Testing First for Reliable Results

Test-Driven Development (TDD) is presented as a particularly powerful application of AI coding. AI excels at verifying code, but it needs to know what "correct" looks like. Tests provide that definition. The rule mandates that for backend development, tests must be written before any code. The agent first creates tests describing the desired functionality, then seeks user review. The speaker notes that reading a well-written test is often easier than reading the implementation code itself. While TDD doesn’t guarantee bug-free code, it ensures that the core functionality works as expected and provides a safety net for future changes. The example involves adding Discord integration, where the agent first writes tests to verify message sending and receiving.

Rule #4: Continuous Learning Loop – Architecting for Improvement

This rule focuses on the importance of context and continuous improvement. The speaker predicts that continual learning will be a major trend in 2026, but argues that it can be implemented now by architecting proper context. When the agent encounters conflicting instructions, new requirements, or inaccurate documentation, it should propose updating the relevant rules files, awaiting user confirmation. The speaker cautions against allowing the agent to update rules autonomously, as this often leads to “AI slop.” Instead, developers should manually manage the rules. The example involves migrating to Resend for email sending, where the agent proposes a rule update regarding the placement of third-party integrations. The key is to revert to the original message after updating the rules to test the improved context.

Rule #5: Start with a Plan – Maintaining Focus and Enabling Parallelism

The final rule emphasizes the importance of planning before coding. AI agents, like experienced developers, benefit from a clear plan and to-do list. The speaker highlights that these lists not only break down tasks but also serve as system reminders, preventing the agent from drifting off track during prolonged tasks (avoiding "context thrott"). This rule also unlocks the potential for running multiple agents in parallel, significantly boosting productivity. The agent is reminded of the next task every 15 or so tool calls, ensuring it stays focused.

Implementing the Rules

The video concludes with a demonstration of how to implement these rules across various AI coding agents:

  • Cloud Code: Two commands to create a folder and rules file.
  • Cursor: Settings > Rules > Paste rules under User Rules (supports team rules).
  • Vinsurf: Cascade > Customizations > Rules > Add global rules block.
  • Open Code: Two commands.
  • Codex: Two commands.

The speaker provides a link to a free school community where the rules file can be downloaded for easy copy-pasting.

Conclusion:

The video presents a compelling argument that the key to successful AI coding isn’t simply leveraging powerful models, but establishing a structured framework of rules. These five rules – 131 Technique, DRY, TDD, Continuous Learning Loop, and Start with a Plan – are designed to mitigate the risks of messy codebases and unlock the full potential of AI-assisted development. The emphasis on context, testing, and continuous improvement provides a practical and actionable approach to building production-ready applications with AI. The speaker’s team’s experience, with over 90% of their code written by AI while maintaining a consistent architecture, serves as a powerful testament to the effectiveness of these principles.

Chat with this Video

AI-Powered

Load the transcript when you're ready to chat so the initial page stays lighter.

Ready to summarize another video?

Summarize YouTube Video