Lesson 3 of 6
Vibe coding with AI tools
Vibe coding is describing what you want in plain words and letting an AI write the code. With the Preliminaries and lessons 1 and 2 behind you, you can now follow what the AI is actually doing: which folder it's in, which files it writes, and which commands it runs.
This is the superpower
You type one sentence. It reads your whole project.
It writes the files, runs the commands, reads the errors, and fixes them itself.
What used to take a developer an afternoon happens while you watch.
Everything so far was for this moment: now you can watch an agent work and know exactly what it's doing.
Two kinds of AI coding help
| Chat in a browser | Agent in your terminal | |
|---|---|---|
| Examples | ChatGPT, Grok, Claude on the web | Claude Code, OpenAI Codex CLI, Grok Build |
| Sees your files? | Only what you paste in | Yes: everything in the folder you start it in |
| Writes files? | No. You copy its code into files yourself | Yes, directly, after asking you |
| Runs commands? | No. You run them and paste back the output | Yes: npm install, node, tests, deploys, after asking you |
| Best for | Questions, explanations, small snippets | Building and changing a real project |
Chat is a great teacher: paste an error and ask “what does this mean?”. But for building, a terminal agent is the real vibe coding tool, because it works in your files the way you've learned to.
The three terminal agents
All three install with one command, start with one word, and need you to sign in with a paid plan or an API key the first time. Check each site for current plans.
Claude Code (Anthropic)
$ curl -fsSL https://claude.ai/install.sh | bash $ claude --version
> irm https://claude.ai/install.ps1 | iex
Start it with claude. Docs: code.claude.com.
Codex CLI (OpenAI, works with your ChatGPT plan)
$ curl -fsSL https://chatgpt.com/codex/install.sh | sh
$ npm install -g @openai/codex
Start it with codex and choose Sign in with ChatGPT. Docs: github.com/openai/codex.
Grok Build (xAI)
$ curl -fsSL https://x.ai/cli/install.sh | bash
> irm https://x.ai/cli/install.ps1 | iex
Start it with grok; the first run opens your browser to sign in. Docs: docs.x.ai.
Where you start it is where it works
This is the lesson 1 idea again, and it's the one that matters most. An agent works in the folder your terminal is standing in. Start it in your home folder and it can see everything you own. Start it in a project folder and it stays in there.
$ cd ~/hello $ pwd /Users/you/hello $ claude
So: make a folder for each project, cd into it, check with pwd, then start the agent. Swap claude for codex or grok; the rule is the same.
The vibe coding loop
- Describe the outcome, not the code. “A page that shows a random cat fact when I click a button.”
- Read what it plans to do. Agents ask before writing files or running commands. Read the file names and commands: you know what they mean now.
- Run it yourself. Open the page, or run
npm start. Don't take “done!” on trust. - Paste back what you see. The exact error text, or “the button does nothing”. Specific beats long.
- Save when it works. Ask it to “commit this with git” so you have a save point to go back to.
A short real session looks like this:
$ claude > Make a one-page website in a public/ folder: a big button that shows a random cat fact. Plain HTML, CSS and JS, no frameworks. Tell me how to preview it. Create public/index.html? (y/n) y Create public/style.css? (y/n) y Create public/app.js? (y/n) y Done. Preview it with: npx serve public > commit this with git, message "first version"
Write a good request
Good requests say what you want, what it's for, what you already have, and what “done” looks like. Build one here, then paste it into whichever tool you use.
Stay safe
- Read every command it wants to run. Be suspicious of
rm,sudo, and anything piped intobash. You can always say no and ask why. - Never paste passwords or API keys into a chat. Keys go in a
.envfile that is listed in.gitignoreso it never gets uploaded. - Start agents in a project folder, not your home folder.
- AI is confidently wrong sometimes. If something it says doesn't match what your terminal shows, believe the terminal.
You start an agent and ask it to “fix the bug in index.html”. It says there's no index.html. What do you check first?
The agent can only see the folder it was started in. Quit, cd to the project, check with ls that index.html is there, and start it again.
- Chat explains; a terminal agent edits your files and runs commands.
cdinto the project,pwdto check, then startclaude,codexorgrok.- Describe the outcome, read what it wants to do, run it yourself, paste back exact errors.
- Read commands before saying yes. Keys and passwords never go in a chat.