Introduction
Choosing Tools
Windsurf Features
Language Stack
Planning
Version Control
AI Rules
Workflow
Tips
Conclusion

The Complete Guide to Vibe Coding

This guide walks you through the essentials of Vibe Coding, a method leveraging AI to assist in software development, as explained in Matthew Berman's video tutorial.

Use the navigation at the bottom or the quick menu to jump between sections.

1. Choosing Your Vibe Coding Tool

The first step is selecting the right tool. Here are the options discussed:

Windsurf & Cursor:

  • Code editors, with Windsurf being a fork of the popular VS Code.
  • The speaker primarily uses Windsurf.
  • Natural transition for existing VS Code users.
  • Considered "agentic," meaning they iterate on code more effectively than simple AI chat interfaces for coding tasks.

Cline (VS Code Extension):

  • An extension for VS Code itself.
  • Good if you prefer sticking with your existing VS Code setup.
  • The speaker has heard good things but hasn't tested it extensively.

Replit:

  • A completely online code editor.
  • Advantage: Easy deployment since everything is cloud-based.

AI Canvas Features (Claude, ChatGPT, Google):

  • Easiest way to get started.
  • Allows writing and executing code (primarily HTML/JavaScript) directly in the browser without installing anything.
  • Example: Generating and running a three.js animation in Claude's canvas.
  • Limitations: Mainly restricted to HTML/JS; less "agentic" - they generate code but don't iterate on it like dedicated tools.

Key Takeaway:

For simple browser-based tasks, AI canvases work. For more complex projects requiring iteration and more control, dedicated tools like Windsurf or Cursor are preferred.

2. Deep Dive: Windsurf Features

The speaker highlights several features of Windsurf:

Model Switching:

Easily switch between different AI models (Claude variants, GPT-4o, DeepSeek) to use the best one for the current task.

Tab Completion Enhancements:

Advanced tab completion with context from your codebase, terminal, and Cascade (Windsurf's AI interaction panel). Includes features like "tab to jump" and "tab to import".

Browser Preview:

Automatically offers an embedded browser preview of your web project as you build it. Allows clicking elements in the preview to give targeted feedback to the AI (@dom-element).

Contextual Knowledge:

Paste URLs (e.g., library/API documentation) into Cascade to give the AI extra context for writing code.

3. Choosing Your Language & Stack

Selecting the right programming language and technology stack is crucial:

The Rule: Choose Popularity

Opt for popular languages because the AI will have been trained on more examples, leading to potentially better code generation.

Top Choices:

  • JavaScript (JS): The world's most popular language. Great option.
  • Python: De facto language for AI; the speaker likes it.

Recommended Stack (Speaker's Preference):

  • Backend: Python
  • Frontend: HTML & JavaScript
  • Alternative: JavaScript backend (Node.js) is also viable.

Finding Popular Languages:

Use resources like GitHut 2.0 to see language popularity rankings (Python, Java, Go, JS, C++, TypeScript mentioned).

Key Takeaway:

Stick to popular languages like JavaScript or Python. The speaker prefers Python (backend) + JS/HTML (frontend).

4. Planning Your Project: The Crucial Step

Thorough planning is essential for success:

Invest Time Here:

Create a detailed, thorough plan before coding. Think through features, edge cases, and desired behavior. This prevents problems later, as future changes are harder.

Use AI for Planning:

  • Tools like Grok can help brainstorm features and identify gaps.
  • Prompt AI to ask clarifying questions.
  • Iterate with the AI until the plan is solid.

Format as PRD (Product Requirements Document):

  • Ask the AI to format the final plan as a PRD in Markdown (.md) format.
  • Copy this PRD into your project directory.

Create a To-Do List:

  • Ask the AI to generate a step-by-step to-do list for building the project, also in Markdown.
  • Refine the list as needed (e.g., remove ETAs).

Living Documents:

Your plan and to-do list aren't static. Update them as you realize changes are needed (adding/removing features, changing behavior). The AI can reference these updated documents.

Key Takeaway:

Don't skimp on planning. Use AI to help create a detailed PRD and to-do list in Markdown, and keep them updated.

5. Version Control: Your Safety Net

Version control is non-negotiable for any coding project, especially vibe coding:

What it is:

A system to save snapshots (versions) of your code at different points in time.

Why it's Critical:

  • Allows you to roll back to a previous working state if something breaks.
  • Essential because AI can sometimes make large, breaking changes.
  • Avoids frustrating loops of trying to fix broken AI-generated code; just revert and try again from a stable point.

Git: The Standard:

  • The most common version control software.
  • Allows saving points ("commits"), managing different lines of development ("branches"), and more.

Git Complexity & AI Assistance:

  • Git can be complex, but you don't need deep expertise for vibe coding.
  • Your AI agent can handle most Git commands for you (init, commit, etc.).
  • Learning basic terms (commit, revert, log) is helpful.

Setting up Git with AI:

Simply ask your AI agent (e.g., in Windsurf's Cascade) to "install git" (it checks if already present) and then "add git to this project". The AI will run commands like git init, create a .gitignore file (to exclude files from version control), set up the main branch, and make the initial commit (first save point).

GitHub: Cloud Backup:

  • Use GitHub (or similar services) to push your local Git repository to the cloud.
  • Provides secure offsite backup ("like Google Docs for code").
  • Free for basic use. Ask AI to help set up the connection.

Key Takeaway:

Use Git for version control. Let your AI assistant handle the commands. Use GitHub for cloud backup. Commit frequently!

6. Guiding the AI with Rules

Rules act like system prompts, ensuring the AI follows your desired coding style, structure, and workflow consistently.

What are Rules?:

Instructions included with every prompt sent to the AI, guiding its behavior. Supported by tools like Windsurf, Cursor, and Cline.

Accessing Rules (Windsurf Example):

  • Go to Windsurf Settings -> Memories and Rules -> Manage.
  • Rules are stored alongside "Memories" (AI-generated notes about the project).

Types of Rules:

  • Global Rules: Apply to all projects. Edited via "Edit global rules". Stored in global_rules.md.
  • Workspace Rules: Apply only to the current project.

Example Global Rules (from speaker's gist)

After making changes, ALWAYS make sure to start up a new server so I can test it.
Always look for existing code to iterate on instead of creating new code.
Do not drastically change the patterns before trying to iterate on existing patterns.
Always kill all existing related servers that may have been created in previous testing before trying to start a new server.
Always prefer simple solutions
Avoid duplication of code whenever possible, which means checking for other areas of the codebase that might already have similar code and functionality
Write code that takes into account the different environments: dev, test, and prod
You are careful to only make changes that are requested or you are confident are well understood and related to the change being requested
When fixing an issue or bug, do not introduce a new pattern or technology without first exhausting all options for the existing implementation. And if you finally do this, make sure to remove the old implementation afterwards so we don't have duplicate logic.
Keep the codebase very clean and organized
Avoid writing scripts in files if possible, especially if the script is likely only to be run once
Avoid having files over 200-300 lines of code. Refactor at that point.
Mocking data is only needed for tests, never mock data for dev or prod
Never add stubbing or fake data patterns to code that affects the dev or prod environments
Never overwrite my .env file without first asking and confirming
Focus on the areas of code relevant to the task
Do not touch code that is unrelated to the task
Write thorough tests for all major functionality
Avoid making major changes to the patterns and architecture of how a feature works, after it has shown to work well, unless explicitly instructed
Always think about what other methods and areas of code might be affected by code changes

Language-Specific Rules:

  • Find pre-made rule sets for specific languages/frameworks.
  • Example Resource: awesome-cursorrules repository on GitHub.
  • Contains Markdown files (.cursorrules) with best practices for React, Python/FastAPI, etc.
  • You don't need to understand every rule initially; they generally represent good practices.

Key Takeaway:

Use rules (global and workspace/language-specific) to guide the AI's coding style and workflow. Start with the speaker's examples and explore resources like awesome-cursorrules.

7. The Vibe Coding Workflow Cycle

Follow this iterative process for building your project:

Setup:

Create prd.md and todo.md files in your project (can ask AI to do this by pasting content).

The Workflow Loop:

  1. Reference Plan & Todo: Tell the AI to read the PRD and todo list.
  2. Build Next Feature: Instruct the AI to build one item/feature from the to-do list. (May involve initial framework setup first).
  3. Write Tests: Ask the AI to write tests for the newly added feature. Tests are separate code that verifies your main code works correctly.
  4. Run New Feature Tests: Run the tests specifically for the new feature.
    • Pass: Proceed to next step.
    • Fail: Fix the tests or the code causing the failure. Ask AI for help.
  5. Run All Tests: Run the entire test suite for the whole project.
    • Pass: Proceed to next step.
    • Fail: Fix the tests that failed. This might involve:
      • Fixing the code that broke existing functionality.
      • Updating old tests if the functionality intentionally changed and the old tests are now incorrect.
      • Ask AI to explain failures and help decide how to fix.
  6. Commit Changes: Once all tests pass, save your progress using Git. Ask the AI: "commit the code". It will handle staging files and writing a commit message.
  7. Repeat: Go back to step 1 for the next item on the to-do list.

Handling Major Issues: Rollback:

  • If the AI irrecoverably breaks the code, don't waste time trying to fix it endlessly.
  • Ask the AI to "rollback to the previous commit". This discards recent broken changes and reverts to the last known good state (your last successful commit).
  • (Mentioned: git stash can temporarily save changes instead of discarding, but rollback is the primary recovery method discussed).

Key Takeaway:

Follow a strict cycle: Build Feature -> Write Tests -> Run Tests (New & All) -> Fix -> Commit -> Repeat. Tests are crucial for stability. Use git commit often and git rollback when needed.

8. Miscellaneous Tips & Best Practices

Final tips to improve your vibe coding experience:

Chat vs. Write Mode:

  • Use Write mode when you want the AI to generate/modify code.
  • Use Chat mode to ask questions about the codebase or concepts without modifying code.

Model Selection:

Choose the best model for the task (speaker finds Claude 3.5/3.7 Thinking best for coding).

Frontend Appearance:

  • AI isn't great at creating beautiful UIs from scratch.
  • Find free/paid UI templates (e.g., Bootstrap themes) online.
  • Download the template, add it to your project, and tell the AI to use its components.

Targeting Code (@ Symbol):

  • Use the @ symbol in your prompts to reference specific files, directories, docs, or web links, giving the AI precise context for updates.
  • Requires some understanding of your codebase.

three.js for Games:

  • A popular 3D JavaScript library often used for vibe coding games.
  • Most AIs know how to use it. Just ask: "build me a game [description] using three.js".

Security Concerns:

  • Vibe-coded projects can be insecure or hard to maintain if you lack foundational knowledge.
  • Learn Best Practices: Spend time learning security fundamentals. Ask AI to explain.
  • Use Rules: Add security best practices as rules (e.g., "Rate limit all API endpoints", "Use row-level security", "Add Captcha").
  • Find Checklists: Look for security checklists online (speaker shows examples from @jackfriks and @tedx_ai / Ted Werbel on X).
  • API Keys: NEVER share API keys publicly (even in screenshots!). NEVER commit keys to Git (use .gitignore).
  • Auditing: Use tools like npm run audit (for Node.js). Ask AI to perform a security audit of your code.
  • Don't Roll Your Own Auth: Use established authentication services (e.g., Clerk).
  • Infrastructure: Implement rate limiting, DDoS protection, firewalls, monitoring.
  • Test Critical Areas: Write thorough tests for sensitive parts like payments, subscriptions, etc.

Maintainability:

  • AI code might not be "pretty" initially, but AI capabilities are improving.
  • It's okay if early projects are brittle; it's part of learning.
  • Refactoring: Ask the AI to "refactor" the code (make it cleaner, more modular, remove duplication) based on best practices (which can also be added to rules).

MCP Servers (Advanced):

  • Model Control Protocol (MCP) allows giving AI agents additional tools/capabilities.
  • Configured in Windsurf (Configure MCP -> mcp_config.json). Ask AI for help writing the config.
  • Examples:
    • Unity MCP: Control the Unity game editor via chat.
    • Firecrawl MCP: Enable deep web research capabilities for the agent.
  • Explore once comfortable with basic vibe coding.

9. Conclusion

Vibe coding is presented as a fun, relaxing way to build things, whether you're an experienced programmer or just starting. It's a great way to get exposure to coding concepts and begin a learning journey. The technology will only improve.

Made with DeepSite LogoDeepSite - 🧬 Remix