Lesson 1: What Vibe Coding Really Is
| Course home | Next: Lesson 2: Set up your tools |
Time: about 30 minutes. No installs yet.
Goals
By the end of this lesson you will be able to:
- Explain what an AI coding agent is and how it differs from a chatbot.
- Describe the loop an agent runs: read, think, act, check.
- Name three things agents do well and three things they get wrong.
- Explain the difference between “pure” vibe coding and AI-assisted engineering, and know which one this course teaches.
- Describe the app you will build over the next eleven lessons.
Concepts
From autocomplete to agents
AI help for programmers has arrived in three waves:
- Autocomplete. The editor suggests the rest of the line or the next few lines as you type. Useful, but you still drive every keystroke.
- Chat. You paste code into a chat window and ask questions. The AI answers, you copy the answer back. Helpful, but slow and error-prone because the AI cannot see your whole project.
- Agents. The AI works directly in your project folder. It can open files, search, edit, run commands such as tests, look at the results and try again. You give it a goal; it takes many small steps to reach it, asking your permission along the way.
This course is about the third wave. Tools like Claude Code, OpenAI Codex, GitHub Copilot’s agent mode and Google Antigravity are all agents.
How an agent works
Under the hood, an agent is a large language model (LLM) running in a loop with some tools:
+-------------------------------+
| Your goal + project context |
+---------------+---------------+
|
v
+-----------> 1. Think: what should I do next?
| |
| v
| 2. Act: read a file / edit a file / run a command
| | (asks you first for risky actions)
| v
| 3. Observe: what happened? did the test pass?
| |
+------ not done ------+------ done ------> 4. Report back to you
Key points:
- The model only “knows” what is in its context: your prompt, files it has read in this session, command output and earlier messages. If it has not read a file, it is guessing about it.
- The model predicts likely text. Most of the time that produces correct code, because correct code is common. Sometimes it produces something that looks right but is not. That is called a hallucination.
- The tools (read, edit, run) are what make it an agent. The permission prompts are what keep you in control.
Where agents shine
- Boilerplate. Page skeletons, forms, CSS layouts, config files.
- Well-known patterns. “Save this list in localStorage”, “add a delete button”, “write a test for this function”.
- Explaining code. Ask “what does this line do?” and you usually get a clear answer.
- Grinding through repetitive edits across several files.
- Getting unstuck. Reading an error message and suggesting likely causes.
Where agents stumble
- Ambiguous goals. “Make it better” leads to random changes.
- Big requests. The bigger the change, the more places for subtle mistakes.
- Long sessions. Early decisions fall out of the context and the agent starts contradicting itself.
- Your specific situation. It does not know your users, your deadline or what you agreed with a teammate unless you tell it.
- Confident wrongness. It may invent a function, a package or a setting that does not exist, and describe it fluently.
- Over-eagerness. It may “improve” things you did not ask it to touch.
Two styles of vibe coding
The phrase “vibe coding” was coined by Andrej Karpathy in February 2025 for a style where you accept whatever the AI produces and barely look at the code. That style is fun for weekend toys. Most people now use the phrase for any AI-first way of building.
| Pure vibe coding | AI-assisted engineering (this course) | |
|---|---|---|
| Who reads the code | Nobody, really | You, at least skimming every diff |
| Testing | “It seems to work” | Automated tests plus manual checks |
| Size of each step | Whatever the AI does | Small, reviewable steps |
| Version control | Optional | Commit after every working step |
| Good for | Throwaway experiments | Anything people will use or rely on |
You will still move fast. The extra habits cost minutes and save hours.
Your role changes, it does not disappear
When an agent writes the code, you become:
- The product owner: deciding what to build and what “done” means.
- The architect: keeping the project simple and organised.
- The reviewer: reading what changed and asking why.
- The tester: checking it works, including the awkward cases.
- The security guard: deciding what the agent may run and what data it may touch.
The rest of the course trains each of these roles.
Walkthrough
No installs today. You can do this in any AI chat interface you already have, or just read along.
Step 1: See the difference between vague and clear
Imagine giving each of these to an agent:
Make a habit tracker.
Build a habit tracker web page using only HTML, CSS and plain JavaScript,
no frameworks. A user can type a habit name and add it to a list, then tick
it off for today. Keep it to three files: index.html, styles.css, app.js.
Before writing code, list the files and what goes in each.
Write down three things the second prompt tells the agent that the first does not. (Suggested answer at the bottom of this lesson.)
Step 2: Read the plan for the app you will build
Over the next lessons you will build Tiny Habits:
| Lesson | What gets added |
|---|---|
| 3 | HTML page: title, form, empty list |
| 5 | Styling, mobile layout, dark mode, accessibility |
| 6 | Adding, ticking and deleting habits; streaks |
| 7 | Saving to localStorage |
| 8 | Git history and reviewed changes |
| 9 | Automated tests |
| 10 | Bugs found and fixed |
| 11 | Security hardening |
| 12 | Live on the web |
Step 3: Spot the hallucination
Here is a made-up agent reply. Read it and find the problem.
To save the habits, call
localStorage.saveArray("habits", habits). It stores the array directly, so you don’t need JSON.
The browser’s localStorage has setItem, getItem, removeItem, clear and key. There is no saveArray, and localStorage only stores strings, so you do need JSON.stringify and JSON.parse. You can check this on MDN’s localStorage page. This is exactly the kind of fluent, plausible, wrong answer you will learn to catch.
Step 4: Decide your ground rules
Write these on a sticky note or in a text file. You will turn them into an AGENTS.md file in Lesson 4.
- Plan before code.
- One small step at a time.
- I read every diff.
- I run it myself before I believe it works.
- I commit when it works.
- I read every command before I approve it.
What good output looks like
There is no code yet, so “good output” today is good understanding. You are on track if you can:
- Explain the think-act-observe loop to a friend in under a minute.
- Give an example of a request that is too big, and split it into three smaller ones.
- Explain why “the agent said the tests pass” is not the same as you seeing them pass.
Checklist
- I know the difference between autocomplete, chat and agents.
- I can draw the agent loop from memory.
- I know what “context” means and why the agent can be wrong about files it has not read.
- I have written down my six ground rules.
- I know what Tiny Habits will do by Lesson 12.
Mini-quiz
- What makes an AI coding agent different from a chat assistant?
- Why might an agent describe a function in your project incorrectly?
- Name two signs that a request is too big for one step.
- True or false: if the agent writes the code, you do not need to understand any of it.
- What does
localStoragestore: any JavaScript value, or only strings?
Answers
1. An agent can take actions in your project (read and edit files, run commands) in a loop, checking results, instead of only replying with text. 2. Because it has not read that file in the current session (it is not in its context), or because it is predicting plausible-looking text and hallucinated. 3. Any two of: you cannot describe how you would check it in a sentence; it touches many files or features at once; you could not review the result in a few minutes; it contains "and" several times ("add accounts and sync and charts"). 4. False. You need to understand it well enough to review it, test it and keep it safe. 5. Only strings. Objects and arrays must be converted with `JSON.stringify` and read back with `JSON.parse`.Assignment
Pick a small app idea of your own (not the habit tracker). Write:
- One sentence describing who it is for and what it does.
- A vague prompt for it, like “make a recipe app”.
- A clear prompt for it with: the tech (HTML, CSS, JS), the files, the one main feature, and a request for a plan first.
- Three smaller steps you would build it in.
Keep it. You will use it again in Lesson 12 when you plan your next project.