A lot of AI coding failures are not coding failures. They happen earlier, when product behavior was never made explicit. This repo gives the agent a simple place to keep that truth before code starts.
Do not start with code. Start with a spec.
Point Codex or Claude Code at this repo, then tell it to apply the same setup to your real project. The agent can set up the spec layer, generate first-pass specs, and work from them.
This is not just for browser apps. The same model works for web, backend, API, CLI, and other software projects. Browser QA is optional.
This bootstrap did not come out of theory. It was extracted from several
months of work on four internal projects behind
playphrase.me, then cleaned up into a small public
setup.
If you want the broader context behind this workflow, the main ideas are also written up in a short article here.
Recommended path:
- Clone this repository.
- Open your real project.
- Point the agent at this bootstrap repo.
- Tell the agent whether the project is greenfield or brownfield.
- Let the agent set up the spec layer and generate first-pass specs before implementation starts.
Example:
Use this bootstrap repository as the reference:
/absolute/path/to/spec-first-bootstrap
This is a brownfield project.
Start with the brownfield discovery workflow and do not write code yet.
If you prefer, you can copy the bootstrap into your project manually.
Copy these into the target project:
Required:
AGENTS.mddocs/
Recommended:
prompts/
Optional:
qa/
After that, ask the agent to work from the copied files already inside the project.
If you copy qa/, also add the optional browser-QA routing block from:
qa/web/AGENTS.snippet.md
Without that extra block in the project's AGENTS.md, the agent may not load
the QA instructions automatically.
Typical follow-up:
Read AGENTS.md and docs/specs/README.md in this project first.
This is a brownfield project.
Use the existing bootstrap files in the repo, generate first-pass specs, and
do not write code yet.
Use this repository in either of these situations:
- you are starting a new project and want spec-first work from day one
- you already have a working project and want to migrate it to a spec-first workflow
Included:
- a minimal public
AGENTS.md - a product-spec layer under
docs/specs/ - a reusable feature spec template
- a real example spec
- prompt files for greenfield and brownfield adoption
- an optional browser-QA starter pack for web UI projects
Instead of keeping product truth scattered across code and chat history, this workflow keeps three separate layers:
docs/specs/— product truth- implementation — code that follows the contract
qa/— verification evidence when the project needs it
- context should live in specs, not only in code
- code should implement the contract
- QA should verify the contract when the project needs QA artifacts
The user does not need to write specs manually.
The practical workflow is:
- clone or place this bootstrap next to the project
- point the agent at it
- explain the goal in chat
- let the agent set up or update the spec layer
- let the agent implement against those specs
The user mainly works through chat with the agent.
You do not need to scaffold AGENTS.md or docs/specs/ manually first.
The normal flow is to ask the agent to apply this bootstrap to the project for
you.
The local path matters. In practice it is usually better to point the agent at the real local folder than to rely on a repo summary from memory.
Use this when the project is new or mostly empty.
Ask the agent to:
- read this bootstrap first
- set up the spec-first workflow in the new project
- create the initial product-spec structure
- propose the first specs that should exist before feature code
Start with:
Use this when the project already exists and you want to retrofit specs.
Ask the agent to:
- analyze the current codebase
- extract product behavior from code, routes, state, tests, UI flows, and docs
- ask the user for clarification where the product intent is still unclear
- generate first-pass specs for the most important product areas
In practice, brownfield migration usually means:
- map the product
- build a spec backlog
- generate first-pass specs
- review unknowns and conflicts
- only then start changing code
Start with:
For an existing product, do not start by writing specs one by one yourself.
Instead, ask the agent to use the existing project as evidence:
- current code
- routes and state flow
- tests and QA cases
- existing docs
- product interviews with the user or team
The job of the agent is to turn those artifacts into a short product contract.
Good brownfield output usually includes:
- a product map
- a spec backlog
- first-pass specs for risky or important areas
- unknowns that still need confirmation
Resolve those unknowns in chat and let the agent update the specs.
Use this workflow for non-trivial work:
- Clarify the product goal.
- Create or update a spec.
- Review behavior, invariants, and edge cases.
- Implement against the spec.
- Add or update verification artifacts if the project needs them.
Browser QA is optional.
Use it if your project has a browser UI and you want a lightweight structure for smoke checks, regression cases, and run reports.
The optional web QA pack assumes Playwright-style real-browser checks.
Do not treat browser QA as mandatory for every project.
Many projects are better served by:
- API verification
- CLI verification
- integration testing
- operator runbooks
- other project-specific checks
If you do have a browser UI, this repo includes a compact starter pack under:
And a matching prompt:
The easiest way to use this repo is to copy one prompt, replace
<BOOTSTRAP_PATH>, and send it to the agent.
Start here:
Included prompt files:
greenfield-bootstrap.mdbrownfield-discovery.mdbrownfield-interview.mdgenerate-first-specs.mdoptional-web-qa.mdday-to-day-spec-first.md
.
├── AGENTS.md
├── README.md
├── docs/
│ └── specs/
│ ├── README.md
│ ├── templates/
│ │ └── feature-spec.md
│ └── features/
│ └── favorites-spec.md
├── examples/
│ └── favorites-spec.md
├── prompts/
│ ├── README.md
│ └── *.md
└── qa/
├── README.md
└── web/
└── ...
AGENTS.md— minimal workflow rules for agentsdocs/specs/README.md— how the spec layer worksdocs/specs/templates/feature-spec.md— reusable templatedocs/specs/features/favorites-spec.md— example production-style specexamples/favorites-spec.md— same example in a simpler discovery pathprompts/— ready-to-send prompts for setup and migrationqa/web/— optional browser-QA starter pack for web UI projects
The simplest rule to adopt is this:
## Spec-First Rule
Before implementing any non-trivial feature:
1. Clarify the product goal.
2. Create or update a spec under `docs/specs/`.
3. Confirm user-visible behavior, invariants, and edge cases.
4. Only then begin implementation.
`AGENTS.md` is not the source of truth for detailed feature behavior.
Detailed behavior must live in specs.MIT