Vibe coding capstone: build the feature and fix a bug
Build the feature in small reviewed changes, record prompt iterations including one failure that changed the next prompt, fix one real bug and review the diff.
By Invicly Tech, , in Prompt Engineering and Vibe Coding. About 8 minutes to read.
In short
Now you build the feature in small reviewed steps. You keep every prompt that mattered, record one failure that made you write a better prompt, fix one real bug with a test and write notes on the diff.
Think of it like this: Think of a lab notebook: you do not only record what worked, you record what you tried, what went wrong and what you changed.
Explained simply
This is where you build. The golden rule is small steps. You ask the assistant for one small change, read what it wrote, run the checks and make a commit. Then you do the next step. Small steps are easy to understand and easy to undo.
While you work, you keep a record. When you improve a prompt, you save the old and the new version and say why. This is the most useful thing you will take away, because next time you will start from better prompts.
You will also meet a failure. The assistant may write something that looks right and is wrong. Do not hide it. Write down what it did, how you found out and what you changed in your next prompt. That is the evidence that you are in charge.
Finally, you fix one real bug. First write a test that fails because of the bug. Then fix it and watch the test pass. At the end, read the whole diff once more and write short review notes.
Press Play on a diagram to walk through it one step at a time.
- 1Prompt
Ask for one small change from the pack.
- 2Review
Read the diff line by line.
- 3Test
Run the checks tied to the matrix row.
- 4Commit
One change, one message.
- 5Log
Note the prompt and decision.
- Back to step 1
- You to Assistant: Prompt v1: add note editing1Prompt v1: add note editing
- Assistant to You: Diff that lets any user edit any note2Diff that lets any user edit any note
- You to Tests: Run the ownership test3Run the ownership test
- Tests to You: Test fails4Test fails
- You to Assistant: Prompt v2: only the owner may edit, add test first5Prompt v2: only the owner may edit, add test first
- 1Reproduce
Make the bug happen on purpose.
- 2Write failing test
Capture it in code.
- 3Fix
Smallest change that works.
- 4Rerun suite
Check nothing else broke.
- Back to step 1
In depth
Build in small reviewed commits
Follow the plan step by step: model and validation, create endpoint, list endpoint, edit and delete, then the user interface. For each step, run the implement prompt, read the diff in your editor, run the relevant tests, and commit with a message that says what changed. Use git diff to check exactly what is staged. If the assistant touched files you did not expect, ask why, or discard those changes. One commit should mean one idea.
- One step per prompt.
- Read the diff before staging.
- Run the matrix checks for that step.
- Commit with a clear message.
Record prompts and one failure
Keep a prompt log with version, text, result and decision. Choose one failure that taught you something. Maybe the assistant allowed any user to edit any note, or it invented a library function. Write the symptom, the cause, and the exact change in your prompt, for example adding an ownership rule and a request for a failing test first. This single entry shows how prompts improve through evidence.
- Add note editing
- No ownership rule
- No test requested
- Result: any user can edit
- Only the owner may edit
- Return 404 to others
- Write the failing test first
- Result: test passes, accepted
Fix one real bug with a test
Pick a bug you actually hit, for example a note with only spaces is saved. Reproduce it, then write a test that fails. Ask the assistant for a minimal fix, or write it yourself. Run the test again and the full suite. The commit should hold the test and the fix together. A bug without a test tends to return.
Diff review notes
Before you open a pull request, review the full diff against the base branch with git diff main...HEAD, or your own base name. Write notes in a fixed shape: file, concern, evidence, action. Typical checks: ownership on every route, input limits, error handling, logs without personal data, accessible labels, and no unrelated changes. Even if all is well, record that you checked these things.
- 1Scope
Only expected files changed.
- 2Security
Ownership and input limits.
- 3Behaviour
Tests match matrix rows.
- 4Operations
Errors and logs.
- 5Notes
File, concern, evidence, action.
Learn it in 5 short steps
About 1h 35m each. Track them with a timer in your plan.
- 1Build in small reviewed commits~1h 35m
- 2Record before-and-after prompts~1h 35m
- 3Log a failure that changed a prompt~1h 35m
- 4Fix one real bug with a test~1h 35m
- 5Write diff review notes~1h 35m
Key points
- Keep each change small enough to review in a few minutes, and commit after each one.
- Store before-and-after versions of any prompt that you changed, with the reason.
- Log at least one real failure: what the assistant produced, how you saw it was wrong, and how the next prompt changed.
- Fix a real bug by writing a failing test first, then the fix, then rerunning the test.
- Write diff review notes that name the file, the concern and the evidence.
Key terms
Tap a card to flip it. 0/5 known
Examples
Prompt v1: Add an edit endpoint for notes.
Result: any signed-in user could edit any note.
Prompt v2: Add PATCH /api/notes/:id. Only the note owner may edit.
Return 404 for other users. Write the failing test first.
Result: test written, then passing. Accepted after review.A prompt change recorded in the log.
A regression test for a spaces-only note
A note of only spaces was saved. First you add this failing test, then you trim the body in validation until it passes.
import { test, expect } from "vitest";
import { validateNote } from "./validateNote";
test("rejects a note with only spaces", () => {
const result = validateNote({ body: " " });
expect(result.ok).toBe(false);
});A diff review note
Notes are short and checkable. This one found an unrelated change and one good practice.
File: src/app/api/notes/route.ts
Concern: list query had no owner filter.
Evidence: api test list-notes returned another user's note.
Action: added where ownerId = session.user.id, test passes.
File: package.json
Concern: unrelated dependency added.
Action: removed, not needed.Quick reference
- One prompt, one small step, one commit.
- Run git diff and read every changed line before committing.
- Keep before and after prompt versions with the reason.
- Log one real failure: symptom, cause, prompt change.
- Bug fix order: failing test, fix, full suite.
- Review full branch diff with git diff against your base branch.
- Review notes: file, concern, evidence, action.
Common mistakes
- Accepting a large generated change in one go, which makes review shallow.
- Only keeping the final prompt, so nobody can see what you learned.
- Fixing a bug without a test, so it can come back unseen.
Quick quiz
Pick an answer to see if you're right and why.
Practice exercises
Try each one yourself first. Use the hint if you get stuck, then compare with the solution.
- Exercise 1easy
Make three small commits for model, validation and create endpoint, each with a clear message.
- Exercise 2medium
Write a prompt log entry for one prompt you improved, with before, after and reason.
- Exercise 3hard
Find one real bug, fix it with a regression test, and write diff review notes for the whole branch.
Check yourself
Answer in your head, reveal, then be honest with yourself.
Feel confident about this topic?
Frequently asked questions
- What if the assistant writes a big change anyway?
- Ask it to split the work into steps, or revert and prompt for one step at a time.
- Does the failure have to be dramatic?
- No. Any real mistake that changed your next prompt counts, as long as you can show the evidence.
- Can I write the bug fix myself?
- Yes. What matters is the failing test, the fix and the result.