How to Start a New App With AI: Spec, Slices, Then Prompts

Two weeks after the big first prompt, you are afraid to touch the app. Every change breaks something, and you cannot say which parts ever worked. Many engineers avoid this by not starting with a prompt. They write a one-page spec, split it into slices small enough to test on their own, and only then prompt, one slice at a time. The setup takes an evening. This post is the workflow, from spec to slices to sessions. How to write each spec line is its own post, a one-page spec your AI can follow.
Why does the big first prompt let you down?
“Build me a reading list app with accounts, sync and sharing” feels productive. What comes back is a lot of code that mostly works, with no way to tell which parts do not.
Chroma tested 18 models and found performance degrades as input length grows, even on simple tasks (Chroma, Jul 2025). And code without a spec has no definition of done, so every later prompt negotiates with whatever the AI generated first. GitHub’s spec-driven toolkit fixes that with one habit: the spec is the source of truth, and when something does not make sense you go back to the spec, not the code (GitHub, Sep 2025).
What goes in a one-page spec?
One page, five parts: who it is for, what it does (behaviors a user can see), rules for the edge cases, what is out of scope, and what “done” means. Here is the demo spec for the app this post builds. Copy it and swap in your own app:
# Reading list app (one-page spec)
Who it is for: me, tracking books I want to read.
## What it does- Add a book with a title and author.- List books still to read, oldest first.- Mark a book finished. Finished books leave the to-read list.- The list survives a restart.
## Rules- A book needs a title. Empty title is an error, no book is added.- Same title and same author is a duplicate and is refused with a clear message. Same title, different author is a different book.- Finishing a book that does not exist is an error.
## Out of scope (v1)No accounts, no cover images, no database. A plain file is fine for storage.
## Done meansEach slice ships with a test that proves its behavior from a user's view.You do not have to write the spec alone. Claude Code’s docs suggest letting the AI interview you, then building from the written file. Paste this:
I want to build a reading list app but have not thought it through yet. Interview me until you could write the spec, one question at a time, then write it to SPEC.md. Keep it to one page. Include a rules section for edge cases and an out of scope section.
Read the result and fix it. In a repo, the file lives at the project root. In Lovable, paste the spec into the project’s Instructions (the docs say this field was previously called Knowledge) so it applies on every message (Lovable docs). In Bolt, it goes in Project settings, then Knowledge, in the Project instructions field (Bolt docs).
How big should a slice be?
A slice is the smallest piece of the spec that a user could try. GitHub’s spec-driven toolkit breaks specs into tasks small enough to implement and test in isolation: not “build authentication”, but “create a registration endpoint that validates email format”. The reading list spec became four slices:
- Add and list books, with the empty-title and duplicate rules
- Mark a book finished, with the not-on-the-list rule
- Save the list to a file so it survives a restart
- A small web page on top
The first two are the vertical part: the thinnest path a reader could actually use, from adding a book to seeing it on the list. The last two are layers. Persistence goes third because it touches how every earlier test sets up its list, so you want the behavior pinned down before you change the plumbing under it. If your tool starts from a screen, start with a thin screen that only calls slice 1’s logic. Each slice names the rules it owns. If it cannot, it is a chunk of code, not a slice.
How do you prompt one slice?
Once SPEC.md exists, start a fresh session for each slice, so the build begins with clean context (a new, empty chat) and a written definition of done. In a chat tool like Lovable or Bolt, that means a new chat with the spec pasted in. A fresh session also knows nothing about your habits, so put them where it will read them on its own. Claude Code loads a CLAUDE.md at the start of every session, and Claude can read an AGENTS.md instead if that is what you have (Claude Code memory docs). A few lines are enough:
Read SPEC.md before any change. One slice per session. Never edit SPEC.md. Never change an existing test to make it pass. Do not add tests outside the current slice unless asked.The slice prompt:
Read SPEC.md. First write the tests for every rule in it, as a TDD pass. Test behaviors a user would see (a book appears in the list, a duplicate is refused), not internal details (why). Then build slice 1 only: add and list books, with the empty-title and duplicate rules. Run the tests. Do not touch slices 2 to 4, and do not edit SPEC.md or change a test to make something pass.
Writing all the tests first is deliberate: the suite is the spec in executable form, and the slices turn it green one at a time. The code is in on the site, /examples/reading-list/, runnable with Node 22 and no install. The suite ended at seven tests, after one was added late (more below). After slice 1, npm run test:before shows:
not ok 6 - a finished book leaves the to-read listnot ok 7 - finishing a book that is not on the list is an error# tests 7# pass 5# fail 2The two failures are the finish tests, which slice 2 owns. After slice 2, npm run test:after:
# tests 7# pass 7# fail 0If your tool cannot run tests, ask it for a click-through script per rule (“add the same book twice, expect the refusal message”) and click through it after each slice. The script idea is untested in Lovable and Bolt. Commit (save a snapshot) before each slice session, so a bad session costs you nothing (git for vibe coders). When a slice comes back wrong, change the spec first and regenerate, instead of patching the code into a one-off the next prompt will not know about.
The one check an engineer does by hand
Green does not mean the tests are any good. Break a rule on purpose, or feed in one odd input, and watch. In the demo, six tests were green, until someone reviewing it tried “Dune” and then “Dune ” with a trailing space. Both were accepted, because the duplicate check compared the raw title while the stored title was trimmed. No test failed, because no test asked. That became test 7, which fails against the old code and passes against the fix. The demo README has a one-line break to try too. Remove the author from the duplicate check in after/readinglist.mjs and run npm run test:after:
not ok 4 - the same title by a different author is a different book# tests 7# pass 6# fail 1Exactly one test fails, and it names the rule that broke. If breaking a rule fails nothing, the suite is decoration.
Then two quick looks. Run git diff --stat SPEC.md and check the tests folder: if the AI changed the spec or a test to get a slice green, you want to know before you merge. And make a three-column list of rule, slice, test. A rule with no slice is work the AI will invent an answer for. A slice with no rule behind it is scope creep you asked for.
Rules files and tests are the same idea as the spec: what you want, written down once where the AI has to read it. More on both in Cursor rules and habits and tests for people who do not write code.
The Get AI Native ebook goes deeper on this. It is free, and the expected launch is around Christmas. Join the waitlist on the homepage.