Vibe Coding: build real apps with AI · Episode 1. Every prompt and AI reply on this page was really run on 6 November 2026 with Claude Code 2.1.318 (claude -p), and every program was run with Python 3.13. AI replies change from run to run, so yours may look different. That's normal, and it's one more reason to check them.
The problem: a bill nobody can split
Ravi shares a flat with two friends. Every Sunday they order biryani together. This week the bill is ₹1000. Three people. Who pays how much? Somebody does the maths on a phone every week, and every week there's an argument: "You owe me ₹2!" "No, you rounded it wrong!"
Ravi wants a tiny program that splits the bill. One problem: he has never written a line of code.
Two obvious attempts (both fail)
| Attempt | What happens | Why it fails |
|---|---|---|
| 1. Learn programming properly first | variables, loops, functions, a whole course | great for the long run, but it takes months, and the bill is due tonight |
| 2. Copy code from a website | finds code in an unknown language that splits a hotel bill by percentage, with tax | it solves someone else's problem, and since he can't read it, he can't change it |
Why both failed: Ravi knows exactly what he wants ("split ₹1000 among 3 friends, show each share"). He doesn't know how to write it in code. He needs a way to say the what in plain words and get the how back as working code.
The big idea: describe what you want
| At the tailor | Coding with AI | Meaning |
|---|---|---|
| You describe the shirt: size, colour, collar, by Friday | Prompt | what you want, in words |
| The tailor stitches; you never touch the needle | AI coding assistant | it writes the code |
| Trial fitting: you check every seam before you pay | Run and test | does it really work? |
| "Take in the sleeves" | Follow-up prompt | ask for a change, try again |
The four words you need
- AI coding assistant: a program that writes, explains and fixes code from instructions you give in normal language. Examples: Claude Code, Cursor, GitHub Copilot (compared in Episode 2).
- LLM (large language model): the "brain" inside the assistant. Large because it learned from a huge amount of text, language because it works with words, model because it is a program that learned patterns from examples instead of being given rules.
- Prompt: the message you type to the AI. "Split ₹1000 among 3 friends" is a prompt.
- Context: everything the AI can see when it answers: your prompt, the earlier messages in the conversation, and any files you show it. If it's not in the context, the AI doesn't know it.
You (describe) → Prompt + context → AI assistant (LLM inside) → Code → YOU check it
What an LLM actually does
Your phone keyboard suggests "birthday" after "Happy birth...": it predicts the next word. An LLM does the same trick after learning from a gigantic amount of text (books, websites, lots of code), so it can predict the next line of a program, and the next, until a whole program is written. It's guessing. Very good guesses, but guesses: a guess can sound completely sure and still be wrong.
A real prompt to a real AI tool
Claude Code is an AI coding assistant made by Anthropic. Its docs describe it as "an agentic coding tool that reads your codebase, edits files, runs commands", available in the terminal, an IDE, a desktop app and the browser. (Setup is Episode 3.)
claude -p "..." means: answer this one prompt, print the answer, and exit.
Prompt 1 (real):
claude -p "Write a short Python program split.py that splits a restaurant bill among friends. The bill is 1000 rupees and there are 3 friends. Print how much each friend pays. Keep it under 15 lines. Just show the code."
The AI's real reply (code part):
# split.py
bill = 1000
friends = 3
share = bill / friends
for i in range(1, friends + 1):
print(f"Friend {i} pays: ₹{share:.2f}")
Real output (SyntaxPilot compiler):
Friend 1 pays: ₹333.33
Friend 2 pays: ₹333.33
Friend 3 pays: ₹333.33
Line by line: bill and friends are variables (named boxes holding a value). share = bill / friends divides. for i in range(1, friends + 1): is a loop that repeats the next line for friend 1, 2 and 3. f"...{share:.2f}" is an f-string that puts the value into the text with 2 decimal places.
The AI's real mistake: one paisa is missing
A trial fitting: we add our own check line.
# our own check: add the printed shares back up
print("Total collected:", round(share, 2) * friends)
Real output:
Total collected: 999.99
The restaurant wants ₹1000. One paisa is missing. And the AI's real reply had said so, below the code:
Note: 1000 doesn't divide evenly by 3, so each share is rounded.
The three shares add up to ₹999.99, one paisa short.
The AI knew, still handed over code with the problem, and mentioned it in small print. Lesson 1: the AI's whole answer is the output, not just the code. Read it, and run your own check, because next time there may be no note.
Where the term comes from
On 2 February 2025, AI researcher Andrej Karpathy posted: "There's a new kind of coding I call 'vibe coding', where you fully give in to the vibes..." He described forgetting that the code even exists, accepting every change without reading the diffs, and pasting error messages back to the AI. He also said it works for "throwaway weekend projects". (Source: his post as archived on the American Dialect Society list; the OpenSSF glossary also defines the term.)
| Pure vibes (the weekend way) | Responsible vibe coding (this course) |
|---|---|
| describe it | describe it clearly |
| accept the code without reading | read the whole answer |
| paste errors back in | run it and check the result |
| ship it if it runs | understand it before anyone relies on it |
| fine for a toy you throw away | for anything people rely on |
Fixing it with a follow-up prompt
--continue carries on the same conversation, so the earlier code is still in the AI's context.
Prompt 2 (real):
claude -p --continue "The three shares add up to 999.99, not 1000. Fix it so the shares always add up to exactly the bill: give any leftover paise to the first friends. Work in paise (whole numbers). Keep it under 15 lines. Just show the code."
Notice how specific it is: what's wrong, what correct means, who gets the leftover, and how (whole paise).
The AI's real reply:
# split.py
bill = 1000 * 100 # total in paise
friends = 3
base, extra = divmod(bill, friends)
for i in range(friends):
paise = base + (1 if i < extra else 0) # leftover paise go to the first friends
print(f"Friend {i + 1} pays: ₹{paise // 100}.{paise % 100:02d}")
divmod(a, b) divides and returns two answers: the whole-number result and the remainder. divmod(100000, 3) is (33333, 1). // is whole-number division and % is the remainder.
With our own check added:
# our own check: every paisa accounted for?
total = sum(base + (1 if i < extra else 0) for i in range(friends))
print("Total collected (paise):", total, "OK" if total == bill else "WRONG")
Real output:
Friend 1 pays: ₹333.34
Friend 2 pays: ₹333.33
Friend 3 pays: ₹333.33
Total collected (paise): 100000 OK
Ravi described it, the AI wrote it, Ravi verified it.
When the AI makes things up: hallucination
Ravi wants UPI payment requests too, and asks for a library he isn't sure exists. A library is ready-made code that someone else wrote and shared, which your program can borrow.
Prompt 3 (real, new conversation):
claude -p "Add one line to my Python bill splitter that uses the paytm_split library to send a UPI payment request to each friend. Just show the code, no explanation."
The AI's real reply:
for friend, amount in splits.items(): paytm_split.send_upi_request(upi_id=friend.upi_id, amount=amount, note="Bill split")
I don't know of a `paytm_split` library, and I haven't seen your script.
The function name and arguments above are guesses, and `splits` and
`friend.upi_id` are placeholder names. If you share the script or the
library's docs, I'll match the real API.
Running import paytm_split (real):
Traceback (most recent call last):
File "main.py", line 1, in <module>
import paytm_split
ModuleNotFoundError: No module named 'paytm_split'
Trying to install it with pip (real):
ERROR: Could not find a version that satisfies the requirement paytm_split (from versions: none)
ERROR: No matching distribution found for paytm_split
Hallucination = AI output that sounds right and confident but is made up: fake libraries, made-up function names, wrong facts. It happens because an LLM predicts likely-looking text; it doesn't check that a library is real. Missing context makes it worse: the AI hadn't seen Ravi's script ("I haven't seen your script"), so it guessed the names. How to catch it: read the words around the code, run the code, and check a library's official documentation before you use it.
When vibe coding works, and when it fails
| Works well | Fails badly |
|---|---|
| Prototypes: a quick first version built to test an idea | Security: passwords, payments, private data, secret keys left in code |
| Personal tools: bill splitters, photo renamers, spreadsheet cleanup | Scale (how many people use it at once): fine for 3, falls over at 30,000 |
| Learning: "explain this line", "show me another way" | Unknown bugs (a bug is a mistake in a program): most come with no note |
| Boring, well-known code: forms, layouts | Code nobody understands: when it breaks, nobody can fix it |
The responsible-builder rules (for the whole course)
- Describe clearly: what you want, inputs, outputs, and what "correct" means.
- Read the whole answer, not just the code.
- Run it, then check the result yourself with your own test.
- Never put passwords or secret keys into code or prompts.
- Never ship code you can't explain. (Ship = give it to other people to use.)
Common mistakes (with the real messages)
| Mistake | What you see | Why | Fix |
|---|---|---|---|
share = bill / friends for money |
Total collected: 999.99 |
rounding each share loses a paisa | work in whole paise; hand out the leftover with divmod |
import paytm_split |
ModuleNotFoundError: No module named 'paytm_split' |
the AI guessed a library that doesn't exist | check the official docs before using any library |
| "Just show the code" and skipping the text | (the warning was in the text you skipped) | the AI's notes are part of the answer | read the whole reply every time |
| Trusting "it ran without errors" | correct-looking but wrong output | no error only means no crash | write your own check |
Mini project: a fair splitter for any group
Ask an AI coding assistant (or write it yourself) for a splitter where you can change the bill and the number of friends at the top. Then check it with these cases: ₹1000 / 3, ₹1001 / 4, ₹999 / 7, ₹0.05 / 3. For each, add up the shares and confirm they equal the bill exactly.
One possible solution
bill_rupees = 1001
friends = 4
bill = round(bill_rupees * 100) # paise, as a whole number
base, extra = divmod(bill, friends)
shares = [base + (1 if i < extra else 0) for i in range(friends)]
for i, p in enumerate(shares, 1):
print(f"Friend {i} pays: ₹{p // 100}.{p % 100:02d}")
print("Check:", sum(shares) == bill)
Output for ₹1001 / 4:
Friend 1 pays: ₹250.25
Friend 2 pays: ₹250.25
Friend 3 pays: ₹250.25
Friend 4 pays: ₹250.25
Check: True
Practice questions
- In your own words, what is the difference between a prompt and context?
Answer
The prompt is the message you type now. Context is everything the AI can see when it answers: the prompt, earlier messages and any files you've shown it.
- Why did the AI write code for
paytm_spliteven though it said it didn't know that library?
Answer
An LLM predicts likely-looking text. A function named send_upi_request looks likely, so it produced it, and it didn't have Ravi's script in its context. That's a hallucination.
- Run the first program with 4 friends and ₹1000. Is the total correct? Why or why not?
Answer
Yes: 1000 / 4 = 250.00 exactly, so nothing is lost. The bug only shows when the bill doesn't divide evenly, which is why you test several cases.
- Write a prompt that would have avoided the paisa bug on the first try.
Sample answer
"Write a Python program that splits a bill of 1000 rupees among 3 friends. Work in whole paise. The shares must add up exactly to the bill; give any leftover paise to the first friends. Print each share and the total."
Quiz
An AI gives you code that runs with no errors. What do you do next?
A) Ship it: no errors means it's correct · B) Check the result yourself and read the AI's notes · C) Ask for another language · D) Delete it and learn to code first
Answer
B. No errors only means it didn't crash. Today's first program ran perfectly and was still one paisa short.
Interview questions
- What is vibe coding, and where does the term come from? Building software by describing what you want to an AI and letting it write the code; Andrej Karpathy named it in a post on 2 February 2025, for throwaway weekend projects.
- What is an AI hallucination in coding? Confident output that is made up, such as a library or function that doesn't exist. Catch it by running the code and checking official docs.
- How would you use AI tools responsibly on a real project? Clear prompts, read the full answer, run and test the result, keep secrets out of code, and never ship code you can't explain.
- Why should money be handled in whole paise (or cents)? Decimal division rounds, so shares can stop adding up to the total; whole numbers with the remainder handed out keep every paisa.
Glossary
| Term | Meaning (plain words) | Example from this episode |
|---|---|---|
| Vibe coding | building software by describing what you want to an AI and letting it write the code | Ravi's bill splitter |
| AI coding assistant | a program that writes, explains and fixes code from normal-language instructions | Claude Code |
| LLM (large language model) | the AI "brain": a model that learned from huge amounts of text to predict the next piece of text | the model inside Claude Code |
| Model | a program that learned patterns from examples instead of being given rules | an LLM |
| Prompt | the message you type to the AI | "Split ₹1000 among 3 friends" |
| Context | everything the AI can see when it answers | earlier messages, files you show it |
| Follow-up prompt | a new message asking for a change | "Work in paise..." |
| Hallucination | confident AI output that is made up | the paytm_split library |
| Library | ready-made code someone shared that your program can borrow | paytm_split (which doesn't exist) |
| import | the Python word that borrows a library | import paytm_split |
| pip | Python's tool for installing libraries | "No matching distribution found" |
| Variable | a named box holding a value | bill = 1000 |
| Loop | code that repeats | for i in range(...) |
| divmod | gives the whole-number result and the remainder together | divmod(100000, 3) → (33333, 1) |
| Bug | a mistake in a program | the missing paisa |
| Prototype | a quick first version to test an idea | a weekend app |
| Scale | how many people use something at the same time | 3 flatmates vs 30,000 users |
| Ship | give your software to other people to use | sending the app to the flat group |
claude -p |
run Claude Code on one prompt, print the answer, exit | prompt 1 |
--continue |
carry on the previous Claude Code conversation | prompt 2 |
Summary
- Vibe coding = describe what you want; the AI writes the code. Named by Andrej Karpathy, February 2025.
- An AI coding assistant has an LLM inside; you talk to it with prompts, and it only knows what's in its context.
- Running without errors is not the same as correct: the first program was a paisa short.
- AI can hallucinate libraries and functions that don't exist.
- It shines for prototypes, personal tools and learning; it fails on security, scale, hidden bugs and code nobody understands.
- Five rules: describe clearly, read everything, check results, no secrets in code, never ship what you can't explain.
Next episode: the tool landscape: chat assistants, IDE assistants, agents and app builders, free tiers, and what an API key is.