Prompt Order in Vibe Coding: Foundation First, One Moving Part per Prompt, a Commit After Each
The same prompts in a different order give a clean app or a mess. The six-step order used for the local LLM chat app (starter kit, basic UI, fake model round trip, Gemma, hardware awareness, small features), with a commit after each, and why a bug after step four is easy to find.
What you will learn
- Explain why one giant prompt for a multi-part app turns debugging into a loop
- Sequence an app build so each prompt adds one moving part to a working base
- Use a fake model before the real one so the wiring is tested on its own
- Follow the build, test, secure, commit rhythm and roll back to the last good commit
Before you start
- Using a coding agent such as Claude Code
- Basic git commit and branch
This lesson has no new code. It's about how you ask for the code, and that habit carries into every app you build with an agent. The same prompts, in a different order, can give you a clean app or a mess. We'll see why using the local LLM chat app from this section and the order we followed.
The trap: everything in one shot
It's tempting to open the agent and ask for everything at once: the back end, the React front end, GPU support, chat history and a delete button, in one prompt. For a small script that can work. This app has a lot of moving parts, so a big pile of code arrives at once and you haven't read any of it. When something breaks, you can't tell which part broke, and there's no commit to go back to. Then one fix breaks two other things, and debugging turns into a loop that doesn't end.
Build it like a house
A builder lays the foundation first, and nobody brings in furniture before that. Then the walls, then the roof, and each layer is checked before the next goes on top. With an agent, the foundation is a starter kit that runs, and then you add one moving part at a time. The agent stays focused too: each prompt has a small job, so the code it writes is easier to check.
The safety net is git. At every step that works, make a commit. Think of it as a save point in a game: if you lose, you start again from the last save, not from the beginning. If the next change goes wrong and the app stops working, roll back to the last good commit and you lose only that one step. You can also try a risky change on a branch so the working version stays safe.
The six steps for the chat app
Steps 1 and 2: a skeleton
The starter kit is a FastAPI back end and a React front end, joined together, and it starts with no errors. Commit that before you touch anything else. Then the basic UI: a list of messages and a box to type in. There's no model behind it yet. You only check that the screen shows up and that the front end and back end talk. Two clean commits, and a foundation you know is right.
Steps 3 and 4: make it talk
In step 3 the goal isn't a smart answer. It's the round trip. A message leaves the React screen, goes to the FastAPI endpoint, reaches a fake model, and a fixed reply comes back. Even an error message is fine here, because it shows the wiring works.
In step 4, swap the fake model for Gemma 3 1B. The pipe already works, so if a new bug shows up now, you know it's in the model part. That's why fake first helps: you never debug the screen and the model at the same time. (The real app keeps this switch as USE_FAKE_ENGINE; see the Gemma chatbot.)
A prompt for one step can look like this:
Role: You're a full stack Python developer.
Context: We have a FastAPI and React starter kit that runs, and it's committed.
Task: Wire the chat screen to one endpoint, with a fake model that returns a fixed reply. Don't add the language model yet.
Format: List the files you change, and keep the change small.
One step, one moving part, and a clear line around what not to touch.
Steps 5 and 6: once the chat replies every time
A local model depends on the hardware, so step 5 makes the app check where it runs, GPU or CPU (the setup is in GPU for Docker containers). Step 6 adds small features like deleting the chat history. These are low risk, so they come last, when every layer below works and is committed.
The rhythm for every step
- Build with one small prompt and one moving part.
- Test it. Even an error tells you something.
- Secure it: read the change and check it for security holes.
- Commit it, so you've got a known good state.
Then repeat with the next prompt. Never stack a new layer on one you haven't tested.
Side by side
| Everything at once | One step at a time | |
|---|---|---|
| What arrives | GPU code, history and the model before the chat even works | One part per prompt |
| A bug shows up | Could be in any part | Right after step 4, so it's in what you just added |
| Way back | Nothing safe to return to | The last commit still works |
Same app, same prompts. Only the order changed, and that's what made the bug easy to fix. The same idea for everyday tasks, outside code, is in breaking big tasks into steps.
Common mistakes
- Accepting a big change you haven't read. You can't debug code you don't know.
- Skipping the commit because "it's a small step". The small steps are the ones you want to roll back.
- Plugging in the real model before the wiring works. Now two things can be broken at once.
- Adding features to a layer that fails sometimes. Fix it first.
Try it yourself
Before your next app, write your prompts as a numbered list, foundation first, and commit after each one.
Related course on Udemy
The Python Architect Masterclass: Full Stack to AI Engineer
Python, Django, FastAPI, React, Docker, AWS, LLMs, RAG, agents and MCP, from first steps to AI engineer.View on Udemy ↗: The Python Architect Masterclass: Full Stack to AI Engineer (paid course, opens in a new tab)Related posts
CLAUDE.md, settings.json and Plugins: Which Claude Code File Advises, Which Enforces, Which Packages
Three needs in one repo: a test command, a rule that Claude must never read .env, and a shared deploy skill. See which file each belongs in, how the settings layers merge, and what a plugin manifest carries.
Authoring a Claude Skill: SKILL.md, Frontmatter, Progressive Disclosure and the Description That Triggers It
Pack a support team's ticket-triage routine into one skill folder, then watch three requests load one, two or all three levels: the catalog, the SKILL.md body, and a script whose code never enters the context.
One Change, Four Environments: Where a Claude Config Edit Lands in Dev, Staging, Prod and CI
Change one line in a repo and ask where it lands. A small resolver for bookshop-bot shows that a new model id in settings.json reaches only CI, a prompt bump reaches dev and CI, and a prod block edit reaches only prod.
Claude in the SDLC: Prompts in Git, a Change Gate by Path, a Claude Review That Advises and a Person Who Merges
Follow one prompt edit from a branch to a merge: version prompts and the model pin like code, keep the API key in GitHub Secrets, gate changes by path, let Claude review the diff, and leave the merge to a person.
