Build one epic from its Beads tickets in this session, in one pass - the tests and the code of all its tickets together, then the spec's acceptance - and close it all with one commit. Starts with the ready bugs and any epic left open, then the epic you name or the next ready one. With "all", it goes on to the next ready epic until nothing is ready.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Build?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/lukaskellerstein-build)
---
name: build
description: Build one epic from its Beads tickets in this session, in one pass - the tests and the code of all its tickets together, then the spec's acceptance - and close it all with one commit. Starts with the ready bugs and any epic left open, then the epic you name or the next ready one. With "all", it goes on to the next ready epic until nothing is ready.
disable-model-invocation: true
argument-hint: [epic id, specs/NNN-name.md, or all]
allowed-tools: Bash(bd *), Bash(git *), Bash(npm test*), Bash(npm run *), Bash(npx tsc*), Bash(node --test*), Bash(pnpm test*), Bash(pnpm run *), Bash(yarn test*), Bash(go test *), Bash(go vet *), Bash(pytest*), Bash(uv run *), Bash(cargo test*), Bash(make test*), Read, Write, Edit, Glob, Grep
---
# spex build
Argument: $ARGUMENTS
Build in this session, with no subagents. The person typed this command, and this command
commits once for each epic and once for the bugs: that is their request to commit. It never
pushes without their ok.
## 1. Pick the work
1. `bd where` finds no Beads database: stop, `NEXT /spex:init`.
2. **Bugs first.** `bd ready --type bug --json` lists the ready bugs. Read the spec file of
each `spec_id`. Fix all of them in one pass with part 2, then close them and commit in
one call as in part 3, step 5, with no epic and the message `fix: <ids>`.
3. **Epics left open.** `bd epic close-eligible --dry-run --json` lists the epics whose
tasks are all closed but which are still open (a build that stopped before part 3).
Run part 3 on each of them now: it has no tickets left to close, and it commits only if
a file changed. An open epic blocks every epic that needs it.
4. **The epic.**
- An epic id in the argument, or the `Epic:` line of the spec file in the argument:
that epic.
- No argument, or `all`: the first task of `bd ready --exclude-type epic --json`. Its
`parent` is the epic, and its `spec_id` is the spec file.
- That task has no `parent`: it belongs to no epic. Read the file of its `spec_id`, if
it has one. Build the task alone with part 2, then close and commit it as in part 3,
step 5. Then pick again from step 2.
5. Read the spec file once. Read only the code that the work needs.
6. Note where you start: `git rev-parse HEAD`. Changes in `git status` that no commit
holds come from a build that stopped. They belong to the tickets that are still
`in_progress`, so keep them.
## 2. The tickets, in one pass
Build all the open tickets of the epic together, not one after the other. Write each file
once where you can, not once for each ticket.
1. `bd list --parent <epic> --status open,in_progress --json` gives every ticket with its
description, its acceptance, its `Covers:` line and its needs (`dependencies` of type
`blocks`).
2. Put the tickets in need order: a ticket comes after the tickets it needs. A ticket that
needs an open ticket outside the epic: leave it out, and say at the end what it waits
for.
3. Claim them all in one call: `bd update <id> <id> … --claim`.
4. Read the code that the tickets touch, once.
5. Write the tests: at least one for each acceptance item of each ticket, so that every
Acceptance line of the spec has a test. A test name says what it checks.
6. Write the code for all the tickets: one `Write` for a new file, one round of `Edit`s for
a file that exists. Keep to the tickets.
7. Run the whole test suite, and the type check and the lint if the project has them, in
one command. Fix until all are green.
A ticket that you file under the epic during the pass joins the pass.
While you work:
- **Work that is in no ticket.** Do not widen a ticket. Look at the spec's Acceptance, and
file the work in one of three ways. `<id>` is the ticket where you found it. Each one
gets a description: what you saw, and where (`file:line`), written now, while you still
know it. The board shows it as Markdown, so write the acceptance as a list.
- The spec's Acceptance needs it: file it under the epic, and build it in this pass.
`bd create "<title>" -t task -p <n> --parent <epic> --spec-id <path> --deps discovered-from:<id> --description $'<what and where>\n\nCovers: A4' --acceptance $'- <check>\n- <check>'`
- Something works wrong against a spec: a bug, with `-t bug` and the `spec_id` of that
spec. Its description has what happens and the steps to see it. The next build fixes
it first.
- Anything else (a new feature, polish, legal text, a nicer flow): file it for later and
do not build it. `bd create "<title>" -t task -p <n> -l later --spec-id <path> --deps discovered-from:<id> --description $'<what and where>\n\nFound while building <id>.' --acceptance $'- <check>'`,
then `bd defer <new id> --reason "found while building <id>; waits for the person"`.
It comes back only when the person asks for it with `/spex:new`.
- **A detail the spec does not say.** Take the simplest choice that fits the spec. Write it
under Decisions in the spec file. It goes into the commit of the epic.
- **Defaults follow the spec.** Defaults in the code, the config and the seed data (country,
currency, prices, limits) are the values in the spec's Decisions, never other values.
- **Outside services.** Tests and runs never use a real key or a real account. Before the
first run, list the names (never the values) of the variables for the services the spec
uses: `env | cut -d= -f1`. Run the tests and the app with them removed
(`env -u NAME …`), or with test values set in the test. Never send a request to a real
payment, mail or other outside service.
- **Tests that wait.** A test that starts a server, sends a request or waits for a process
has a time limit (for example `node --test --test-timeout=10000`, `go test -timeout 60s`,
`pytest-timeout`), so wrong code makes the test fail instead of hang.
- **The spec cannot be built as it is written, or a choice goes against "Your words".**
Stop. Explain it on one screen, with your pick, and wait.
- **A test of earlier work fails.** Fix it in this pass.
## 3. Check, close, commit
1. For each Acceptance line of the spec, name the test that checks it. The `Covers:` line
of each ticket tells you where to look.
2. If the project runs (a web app, a CLI, an API), go through the main path of the spec
once. For a server, do it in one shell command: start it in the background on a free
port, keep its PID, wait until it answers, run the path with `curl` or the CLI, then stop
it by that PID. Never stop a process that you did not start.
3. A line that is not met becomes a ticket under the epic, with `Covers: <line>` in its
description. Build it now, with part 2.
4. If the spec changes what the people who run or use the app do (start it, set it up,
daily work), update that part of `README.md` in plain words.
5. Close and commit in one call. Close the tickets in need order, with one `--reason` for
each, in the same order. bd closes them in the order given, and it refuses a ticket
whose needed ticket comes later in the list. Then close the epic, then commit:
`bd close <id> <id> … --reason "<what was done; the tests that check it>" --reason "<…>" && bd close <epic> --reason "acceptance met" && git add <the files of the epic> && git commit -m "<epic id>: <epic title> (<ticket ids>)"`
With `all`: go back to part 1, step 2, and build the next ready epic in this session.
Stop when nothing is ready, or at a stop that waits for the person.
## 4. Reply
- First line: `BUILD · <epic id> <name> · done`, or `BUILD · <epic id> · stopped: <why>`.
With `all`: `BUILD · <n> epics · done`, and one line for each epic.
- A table: ticket, what was done, tests.
- Acceptance: one line for each: `A1 · met · <test name>`.
- Tickets filed during the build: id and title. Put the ones filed for later in their own
list: they wait for the person (`bd list --status deferred -l later`).
- Commits: the hash of each, one for each epic and one for the bugs.
- The next ready epic, from `bd ready --type epic`, or "nothing is ready".
- Last line, with a remote: `ok pushes the commits and the tickets · then /clear and /spex:build`.
With no remote: `NEXT /clear, then /spex:build`.
After the ok: `git push`, then `bd dolt push`. If a push fails, show the error and the command.