Vibe Coding Methodology · Lesson 1

Why You Need to Set Rules for AI

Vibe Coding is a development approach where you use natural language to have AI directly generate code. Its problem lies in quality: AI without rules will rework, miss edits, silently delete code, and leave permanent technical debt. This lesson first looks at what failures look like, then examines how to inject constraints most reliably.

Four Typical Failure Types

The following four failure types recur repeatedly in AI collaboration, all rooted in the same cause: constraints never made it into the context.

01

Misunderstanding Rework

AI starts writing the moment it gets requirements, producing 200 lines before realizing it misunderstood. Worse, it modifies 7 files before discovering the approach was wrong — reverting each one is extremely costly.

02

Tech Stack Drift

AI picks different frameworks in different conversations: Express today, Fastify tomorrow. Databases oscillate between MongoDB and PostgreSQL. Without a locked tech stack, the project drifts and loses consistency.

03

Well-Intentioned Destruction

AI cleans up code it considers redundant during refactoring, and you only discover that code was useful after the fact. Well-intentioned cleanup becomes a destructive operation.

04

Permanent Technical Debt

You ask for a complete auth system; AI suggests "start with a simple login and add OAuth later." That "later" never arrives, and the simple code becomes permanent technical debt.

Interactive Demo 1 · Same Request, Two Timelines

The same request — "Build me a login" — leads to completely different outcomes with and without rules. Click "Next Step" to advance both timelines simultaneously.

No Rules
With Rules
Interactive Demo 2 · Survival Test of Three Injection Methods

There are three common ways to communicate constraints to AI. Click to switch and see whether the same constraint ("use PostgreSQL for the database") remains in effect at three different points.

What a Rule File Looks Like

frontmatter controls when it applies

---
alwaysApply: true   # auto-applies to all conversations
---
# Development Constraints & Config Standards
The following are important user constraints. Please follow them strictly.

true for global coding standards; false for on-demand files like writing style guides, to avoid polluting the coding conversation context.

Three files in xs_vibe_rules

  • rule-opensource.mdc: Main development standards, 14 chapters covering the full workflow
  • writing-style.mdc: Writing style guide, manually referenced on demand
  • secrets.mdc: API key and credentials template in placeholder form

To use, simply place them in your project's .cursor/rules/ directory.

Take These Rules

itshen/xs_vibe_rules · Open-source repo for this series

The complete rule set is fully open source (MIT License). Fork it, place it in your project's .cursor/rules/ directory, then trim and adjust it to your own tech stack — and you've got your first version of an AI collaboration standard.

Fork on GitHub
Key Takeaways

The value of rules lies not in quantity but in each one solving a real problem. Every time AI makes the same mistake again, turn it into a rule — that's the foundational method of this entire series. Whether constraints hold is determined by the injection mechanism: writing "you must" ten times still loses to a Rule file that auto-loads every turn.

Source material: This series is based on the author's open-source repository itshen/xs_vibe_rules, containing Cursor Rules and design thinking distilled from multiple real projects.