Start from

Full-stack: FastAPI + Next.js + PostgreSQL

Project

Names the repo, images and docs.

Used for ghcr.io/<owner>/...

Stack

Options marked “coming soon” have no pack yet, so they are not generated as broken stubs.

Mobile (Flutter, React Native, Android (native), iOS (native))coming soon
Layout

Verification loop

How “done” is proven: gates, then PRD facts against the running system, healed by an agent or you.

Closest to production; needs Docker.

You write the PRD and the checks; the agent writes the rest. ./scripts/sdlc implement FEAT-001 gives the agent your spec, installs the dependencies it adds, and loops until verified. This is only the project's default: whoever runs it can see which agents are installed and switch with ./scripts/sdlc agent.

Needs the Claude Code CLI on PATH. Bash is pre-approved so the agent can run the tests. Install: npm install -g @anthropic-ai/claude-code.

Any CLI that reads the prompt on stdin. Leave empty to use the preset's command.

CI / CD

Build once, promote the same image through environments.

Environments (deployed in order)

99 files ready
README.md
# Hello Scaffold

AI-ready full-stack project generated by Scaffolder

Generated by Scaffolder as an **AI-ready** project: every change goes
**PRD -> Code -> Test -> Deploy**, and "done" is proven by a verification loop, not by assertion.

## Quick start

```bash
./scripts/sdlc doctor     # is the toolchain installed?
./scripts/sdlc setup      # install dependencies
./scripts/sdlc verify     # gates + facts: the same thing CI runs
make up                   # run the stack: http://localhost:3000
```

Requirements: `python3` (3.9+ for the tooling, 3.12 for the backend), Node 22, Docker.

**Windows** (PowerShell or cmd): write `.\scripts\sdlc.cmd` wherever this document says `./scripts/sdlc`, and `docker compose up -d --build` instead of `make up`. macOS, Ubuntu and WSL use `./scripts/sdlc` as written.

## What you get

- **`backend/`**: FastAPI service with `/health`, `/ready` (checks PostgreSQL), `/api/v1/hello`, typed settings, structured errors, pytest + ruff + mypy preconfigured.
- **`web/`**: Next.js (App Router, TypeScript) page that renders the greeting fetched from the API at request time; Vitest + ESLint + `tsc` preconfigured.
- **`docker-compose.yml`**: the whole stack with health checks and PostgreSQL 16; also what the facts stage runs against.
- **`.ai/`**: rules, skills (agent-neutral playbooks), prompts, specs and the API contract snapshot.
- **`scripts/sdlc`**: the verification loop (see below).
- **`.github/workflows/`**: `ci.yml` and `cd.yml` (build once, deploy through `staging` `production` ).

## The loop, in one picture

```
PRD (AC-001...)  ->  acceptance.json (checks)  ->  code + tests
        \                                              |
         \--------------- ./scripts/sdlc loop ---------+
              gates: static → unit → build → contract → facts → security
              fail -> evidence + heal prompt -> agent/you fix the CODE -> verify again
              stops: green | 5 iterations | 2 identical failures | spec/gate files tampered with
```

- **Gates** (lint, types, unit tests with coverage floors, build, API-contract drift, security) run first.
- **Facts** then start the real system and check every acceptance criterion in the PRD against it. A criterion without a check fails verification: *an unverified requirement is not done*.
- Every run writes evidence (logs, `results.json`, `report.md`) to `.ai/evidence/<run>/`; `latest/` is the newest. CI uploads it as an artifact and in the job summary.
- Heal prompts go to the command in `.ai/sdlc.json` -> `agent.command` (any CLI that reads stdin), or to you if it is empty.

Details: [`AGENTS.md`](AGENTS.md) and [`.ai/README.md`](.ai/README.md).

## Add a feature

**From a requirements document** (PDF, DOCX, Markdown or text):

```bash
./scripts/sdlc spec requirements.pdf   # an agent drafts .ai/specs/FEAT-001-<feature>/{prd.md,acceptance.json}, named after the feature, not the file; the tool validates them
# you REVIEW the draft (skill: .ai/skills/review-spec): it is the contract, and the agent only drafted it
./scripts/sdlc implement FEAT-001      # then the agent writes tests, code, dependencies and config; the loop proves it
```

Large document with several features? Run `spec` once per feature with `--focus "the login flow (section 3)"` and `--name login`.

**Or write the spec yourself:**

```bash
./scripts/sdlc new user-login          # creates .ai/specs/FEAT-001-user-login/{prd.md,acceptance.json}
# you write the PRD and the checks (skills: .ai/skills/write-prd, write-fact-checks); that is the only manual part. Then:
./scripts/sdlc implement FEAT-001      # the agent writes tests, code, dependencies and config; the loop proves it
```

`implement` checks the spec is complete, installs the toolchain if needed, runs a baseline, gives the agent your PRD and checks as its prompt,
installs any dependency the agent adds, then verifies and heals until green. It never commits or pushes: you review `git diff`.
The agent is `claude` (`claude -p --permission-mode acceptEdits --allowedTools "Read" "Edit" "Write" "Glob" "Grep" "Bash"`); that is the project's default. See which AI agents are installed on your machine (and how to install the others) and pick one with `./scripts/sdlc agent`; for one run add `--agent <name>`.
Prefer a desktop app to a command-line tool? `./scripts/sdlc agent claude-desktop` runs the Claude desktop app's own Claude Code unattended, and `handoff-claude`, `handoff-cursor` or `handoff-vscode` open that app on this project, copy the instruction and wait for you (press Enter when its agent is done: the checks and the verify loop then run as usual).
FEAT-000 (hello world) is the worked example and is already built, so `implement` has nothing to write for it; `./scripts/sdlc verify` proves it, and `implement` is for your own features (FEAT-001 onward).
Add `--dry-run` to see the exact prompt and command without running anything. `./scripts/sdlc feature FEAT-001` does the same and also ships (`--deploy <env>`).

## Use it from an AI desktop app (Claude Code, Codex, ...)

You can open this folder in a desktop coding app instead of letting `./scripts/sdlc` start an agent CLI. What changes is **who is in charge**.
`implement` is in charge of its agent: it refuses a dirty tree, installs the toolchain, runs a baseline, gives the agent a fixed prompt with fixed permissions, stops if the agent touches the spec or the gate config, then verifies and heals within a budget.
In a desktop app the agent is interactive and nothing enforces any of that. So keep the tool as the **judge** and use the app as the **agent**.

**Identical to the CLI, nothing to set up:** open the folder in the app, open the terminal built into the app, and run the commands above there (`./scripts/sdlc implement FEAT-001`). The tool starts the agent itself, so the behaviour is the CLI's by construction. It needs that agent's CLI installed and signed in (`./scripts/sdlc agent` shows which are).

**Claude Code (the Claude desktop app's Code tab, or the CLI): slash commands.** Open this folder and type `/sdlc` in the chat to pick one. The project ships one command per step (`.claude/skills/`): Claude does the work as the agent, and `./scripts/sdlc` stays the judge. Only you can start them (Claude never runs one on its own), and nothing is ever committed.

| Type | What it does |
|---|---|
| `/sdlc-doctor` | checks that the tools this project needs are installed |
| `/sdlc-setup` | installs the dependencies |
| `/sdlc-gates` | the fast checks: lint, types, unit tests, build, contract, security |
| `/sdlc-verify` | every gate, then each acceptance criterion against the running system; it only reports |
| `/sdlc-new user-login` | creates a feature's spec and writes the PRD and checks with you in chat |
| `/sdlc-spec requirements.pdf` | drafts a spec from a requirements document |
| `/sdlc-implement FEAT-001` | builds the feature and proves it, healing until green |

The names start with `sdlc-` on purpose: Claude Code has built-in commands such as `/doctor`, and a project command with the same name would replace them.
Step 1 below is not needed for these commands. The steps 1 to 5 are what `/sdlc-implement` does for you: follow them by hand in other apps.

**For other apps, or to see what `/sdlc-implement` does,** follow these steps. Each one stands in for something `implement` does for you.

1. **Let the app read this project's rules (once).** Codex reads `AGENTS.md` by itself. Claude Code reads `CLAUDE.md`, so make that file import `AGENTS.md`, and commit it (`implement` wants a clean tree):
   ```bash
   echo '@AGENTS.md' > CLAUDE.md && git add CLAUDE.md && git commit -m "chore: let Claude Code read AGENTS.md"
   ```
   Optional, macOS / Linux / WSL: list the playbooks in `.ai/skills/` as skills of each tool. The prompt and `AGENTS.md` already name every rule and playbook by path, so an agent reads them either way. Keep these links local (second line), because a clean tree is required:
   ```bash
   for dir in .claude/skills .agents/skills; do mkdir -p "$dir"; for s in .ai/skills/*/; do ln -s "../../.ai/skills/$(basename "$s")" "$dir/$(basename "$s")"; done; done
   printf '.claude/\n.agents/\n' >> .git/info/exclude
   ```
   Check that the app really loaded the rules: start a chat and ask it *"which instructions from this repository did you load?"*. It should name `AGENTS.md` and its rules.

2. **Give it the permissions the CLI gives its agent: edit this project and run its commands, nothing more.**
   - *Claude Code:* mode **Accept edits** (called *Auto accept edits* in older versions), and let it run the tool without asking, by answering "always allow" the first time or by putting this in `.claude/settings.local.json`:
     ```json
     { "permissions": { "allow": ["Bash(./scripts/sdlc *)"] } }
     ```
   - *Codex:* **Ask for approval** or **Approve for me**. Both use the `workspace-write` sandbox, which is what `codex exec --sandbox workspace-write` gives the CLI agent.
   - Do not pick **Bypass permissions** or **Full access**: the CLI's agent never has them, and the integrity guard below is manual.
   - Installing dependencies needs the network: run `./scripts/sdlc setup` and `./scripts/sdlc sync` yourself in the app's terminal rather than widening what the agent may do.
   - Work in the project folder itself, not in a git worktree. A worktree is a fresh checkout: no `node_modules` or `.venv`, no `.ai/evidence`, and no uncommitted spec. If you use one, commit the spec first and run `./scripts/sdlc setup` inside it.

3. **Start from the same state the CLI requires:** a clean tree, the toolchain installed, and a green baseline.
   ```bash
   git add .ai/specs && git commit -m "spec: FEAT-001"   # from here the spec is frozen: any later change shows in git
   ./scripts/sdlc setup
   ./scripts/sdlc gates                                   # green BEFORE the agent starts, so its failures are its own
   ```

4. **Hand the agent the exact prompt the CLI would send.**
   ```bash
   ./scripts/sdlc implement FEAT-001 --dry-run --agent claude   # nothing runs; the name only has to be a preset, installed or not
   ```
   It prints `prompt: .ai/evidence/<run>/implement.prompt.md`: your PRD and checks inside the same instructions `implement` uses. In the app, open a chat on this folder and send:
   `Read .ai/evidence/<run>/implement.prompt.md and do exactly what it says.` (the Copilot and Cursor presets use this very sentence). If the agent stops with questions, they are in `QUESTIONS.md` next to that prompt: answer them in `prd.md`, commit, and start again.

5. **Let the tool judge, and heal from the app.** First the check the CLI does when the agent finishes, then the loop with *you and the app* as the agent for this one run (`--agent ""`; nothing is saved):
   ```bash
   git status --short -- .ai/specs .ai/sdlc.json scripts .github/workflows   # must print nothing: the spec and the gates are not the agent's to change
   git log --oneline -3                                                       # the agent must not have committed; you review and commit
   ./scripts/sdlc sync                                                        # installs any dependency the agent added
   ./scripts/sdlc loop --agent ""
   ```
   `loop` runs the gates and the facts. When something fails it writes `.ai/evidence/<run>/heal-1.prompt.md`, prints the path and waits. Send the app `Read .ai/evidence/<run>/heal-1.prompt.md and do exactly what it says.`, and when it is done press **Enter** in the terminal to verify again. Run it in the terminal yourself: a shell started by an agent cannot wait for Enter.
   It stops exactly as the CLI does: green (exit 0), 5 rounds, 2 identical failures in a row, or the spec or gate files changed while healing (exit 4). **"Done" is that exit code and `.ai/evidence/latest/report.md`, never the agent's own message.**

**Drafting a spec from a document works the same way:** `./scripts/sdlc spec requirements.pdf --dry-run --agent claude` writes the prompt (it contains the document's text); send it to the app; then `./scripts/sdlc facts --feature FEAT-001 --runtime none` (use the id the dry run prints after "would create") has the tool check that every criterion has a check. Review the draft before you implement it (`.ai/skills/review-spec`).

**What stays different.** The agent's permissions, model and effort are the app's settings, not the CLI preset's. The prompt is the same, but the agent is not headless: it may ask you things mid-run. And only step 5's two `git` lines stand in for the CLI's integrity guard and commit check, so run them every time.


## CI/CD

- `ci.yml` runs the same gates per component, then the facts job against the Docker stack, and uploads the evidence.
- `cd.yml` (push to `main` / tags) calls CI first, builds each image **once** (tag `sha-<12 chars>`), pushes to `ghcr.io/your-org/`, then deploys:
  - `staging` (push-default-branch) -> https://staging.example.com
  - `production` (tag) -> https://example.com
- Add required reviewers to a GitHub Environment (Settings -> Environments) to gate promotion. Deploy target: `none` (`scripts/deploy.sh`, `deploy/targets/`). Roll back by re-deploying an earlier `sha-` tag.
- After every deploy the live URL is checked with the same facts (`--no-runtime --base-url ...`).

## Configuration

Everything this project was generated from is in [`scaffolder.config.yaml`](scaffolder.config.yaml); runtime behaviour of the loop is in [`.ai/sdlc.json`](.ai/sdlc.json).
Environment variables: see [`.env.example`](.env.example).

License: MIT