Docs
Small fixes, defects and spikes
On this page
Every code change belongs to a unit of work, and planned work arrives through the process. This page covers the rest: an ad-hoc unit for a small fix, a defect for code that does not do what was agreed, and a spike for throwaway work that answers a question.
1. Make a small fix
Section titled “1. Make a small fix”An ad-hoc unit records a small change that belongs to no planned work, such as fixing a typo. It is the only unit outside the process, in either mode, and it is never approved.
-
Ask Claude for the change. With no unit active in the working tree, Claude asks you how to go on before it changes code. If it tries the edit first, BuildKeel holds it and tells Claude:
An edit held with no unit active BuildKeel: there is no active unit in this working tree, so a change to src/footer.ts would belong to no unit of work. Before changing it, ask the user how to go on, recommending the choice that fits: capture what you discussed, which the user starts by running /bk:capture or by asking for it, turning it into the artifacts the team's process needs, to approve and then build; start the unit it belongs to with /bk:build <ID>; record it as an ad-hoc unit, with a short title you propose (create it with the BuildKeel save_draft tool, type adhoc, then start it with start_work); or go ahead without a unit, which only the user can choose, either for just these files (offer this first: call the BuildKeel manage tool with action untracked, scope files and files ["src/footer.ts"], or the folders the user names) or for the whole working tree (action untracked, scope tree). Make the change once one of these is done.Claude asks before changing code, so you usually see the question rather than the hold.
-
Choose how to go on: capture what you discussed (ask Claude, or run
/bk:capture), name the unit the change belongs to, accept the ad-hoc unit Claude proposes, or say to go ahead without a unit, for just these files or for the whole working tree. To record an ad-hoc unit directly instead, describe the change in place of an ID:/bk:build fix the footer linkClaude compares your words with the titles of the units that can start. When nothing matches, it offers Record the ad-hoc unit “Fix the footer link” and build it. When a title matches, it offers that unit first, and records an ad-hoc unit only if you pick it.
-
Read what Claude created. It creates the unit and starts it:
/bk:build fix the footer link Created ad-hoc unit AH-002 "Fix the footer link" at adhoc/AH-002/adhoc.md.- Committed alone as "new: AH-002" (5e2b7c1) in the spec repo.- Not pushed: push the spec repo to share it.Build it with /bk:build AH-002. -
Let Claude make the change, and commit it with
BuildKeel-Unit: AH-002. -
Run
/bk:doneto finish it. An ad-hoc unit has no test cases of its own: finishing needs only a clean working tree on its branch. Like any unit, it has a branch, and/bk:donewrites a completion record.
The unit’s file holds a title and a short description:
---id: AH-002title: Fix the footer link---
## Description
The footer links to the old help page./bk:status lists open ad-hoc units under Ad-hoc work.
Changes to the spec tree, to BuildKeel’s own .buildkeel/ folder and to files outside the repository are never held.
2. Record a defect
Section titled “2. Record a defect”A defect records code that does not do what was agreed: either found while building or testing the work under way, or reported later by users, customers or testers.
-
Decide whether it is a defect or a change in behavior.
- A defect: the code does not do what the spec says. The code is fixed, and the spec keeps its version.
- A change in behavior: the code does what the spec says, and the spec is wrong, no longer wanted, or silent. The spec changes and gets a new version: through a change in a Spec-driven tree; in Full SDLC, through a new version of the story, or a new item of the team’s kind for it, such as an enhancement.
When someone reports a problem,
/bk:new defectand/bk:capturecheck it against the spec in force and the code linked to it before recording anything. Claude proposes one reading, labelled as its own, with what it rests on: a defect, a change in behavior, a gap (the spec says nothing about it), or code nothing describes yet. Nothing is recorded until you confirm it or pick another. -
Run
/bk:new defect, with the unit where it was found:/bk:new defect TK-001 -
Say whether the defect was found while building or reported. Claude proposes found while building when a unit is active.
-
For a defect found while building, pick the test case that found it, when a test did. It is attached to the task or story where it was found, and Claude offers the test cases that apply there. The work is approved already, so the defect needs no approval of its own and gets its number at once:
/bk:new defect TK-001 Created defect DEF-002 "Reset link lasts 3 minutes" at defects/DEF-002/defect.md, attached to TK-001@v1, where US-001-TC2 found it.- Committed alone as "new: DEF-002" (8d41a07) in the spec repo.- Not pushed: push the spec repo to share it.- Finishing it needs a regression test with [DEF-002] in its name, passing.Build it with /bk:build DEF-002.defects/DEF-002/defect.md ---id: DEF-002title: Reset link lasts 3 minutessource: foundparent: TK-001@v1testCase: US-001-TC2---## DescriptionLinks expire after 3 minutes instead of 30.
To change a defect’s file later, such as to add steps to reproduce, ask Claude; it saves the whole file again. A defect keeps its source.
A reported defect in Full SDLC
Section titled “A reported defect in Full SDLC”A reported defect is planned work. It has the work it affects as its parent: a user story, unless your team allows other kinds in defect.parents in buildkeel.yaml, such as [story, feature]. It is drafted with a draft ID, such as DEF-draft-p2m7, reviewed like any draft, and approved with /bk:approve, which gives it its number in the defect sequence. /bk:build refuses it until it is approved. When the work it affects is not known, Claude finds it first, as Open defects and affected work shows.
There is no standalone defect in Full SDLC. When nothing describes the code yet, Claude drafts version 0 of the story the defect touches first, stating the intended behavior, and the two are approved in one set, version 0 first. A defect fixed before BuildKeel, recorded as version 0 while documenting existing code, may stand alone.
In a Spec-driven tree, defects work the same way with a few differences: see In a Spec-driven tree.
3. Fix it with a regression test
Section titled “3. Fix it with a regression test”A regression test fails without the fix and passes with it, and carries the defect’s ID in its name.
-
Run
/bk:build DEF-002. Its context gives the defect, the work it was found in, and what to test. -
Write the regression test, with the defect’s ID in its name:
it("keeps reset links for 30 minutes [DEF-002]", async () => {// ...}); -
Fix the code.
-
Run the tests, so that the regression test passes, and the test case that found the defect passes too.
-
Run
/bk:done. Without a regression test, the finish is refused and names it:/bk:done Finish of DEF-002 refused by the done gate: 1 check failed.1. DEF-002 has no regression test: no test is tagged [DEF-002].To fix: Write a test that fails without the fix and passes with it, with [DEF-002] in its name, then run the tests with a JUnit XML report and record it with the BuildKeel test_results tool.
Once a defect attached to a unit is finished, its regression test counts among that unit’s test cases. When the unit is worked on again, at a new version, the test must still pass. The unit’s coverage view lists it under Regression tests of fixed defects.
If fixing a defect means a requirement must change, the change is made as a new version of the story or task, approved as usual.
4. Close a defect without a fix
Section titled “4. Close a defect without a fix”Some defects turn out not to be defects: a duplicate of another, one nobody can reproduce, behavior that works as intended, or a failure caused by a wrong test. None of these can get a regression test, so you close it instead of finishing it.
-
Run
/bk:done DEF-002. -
Pick Close without a fix, which Claude offers beside finishing it.
-
Give the reason, and for a duplicate, the defect it duplicates.
-
Add a note if you want one.
-
Read what closing does, and confirm.
/bk:done DEF-002 Closing DEF-002 "Login redirect loops" without a fix, as a duplicate of DEF-001, will:- write its closing record, defects/DEF-002/closed.yaml: the reason, who closed it and when, never edited after- commit it on its own in the spec repoA closed defect is not open, counts as done for the work above it, and is never started or reopened: a defect that returns is a new defect.
Claude closes a defect only when you confirm it. The closing record is written once and committed alone, as close: DEF-002 (duplicate of DEF-001):
defect: DEF-002reason: duplicateduplicateOf: DEF-001note: Same root cause as the redirect loop.closedBy: Jane Doe <jane@example.com>closedAt: 2026-10-15T09:12:00ZThe reason is one of duplicate, cannot-reproduce, works-as-intended, wrong-test or changes-behavior. Use changes-behavior when the code does what the spec says and the spec is what must change; the record then names what takes it over in takenOverBy, such as CH-014 or US-007@v3. When the test was wrong, correct the test case as a new version of its test plan.
5. Try something in a spike
Section titled “5. Try something in a spike”A spike is throwaway work to find something out, such as whether a provider’s client does what you need. It runs on a branch of its own, with no unit.
-
Make sure no unit is active and the working tree has no uncommitted changes. With a unit active, Claude asks you to pause or finish it first, or to try the idea in a worktree of its own. With uncommitted changes, it asks what to do with them first.
-
Ask for a spike in words, with a name and the question it should answer, such as “spike the SMS provider: can it send a code in under five seconds?”
Starting a spike Started the spike "SMS provider" on a new branch spike/sms-provider, from main: untracked, throwaway work. BuildKeel holds no edits here meanwhile, and its commits carry no BuildKeel-Unit line. -
Try the idea with Claude. Only what was run and observed against the real thing counts as a finding. A result from a simulated or mocked call shows nothing about the real thing, and Claude says so.
-
Ask Claude to end the spike. If the spike’s branch has uncommitted changes, Claude asks whether to commit them there, with no
BuildKeel-Unitline, or leave them. It never discards them.Ending a spike Ended the spike spike/sms-provider, and switched back to main. Its branch is left as it is: BuildKeel never merges it; keep it, delete it or take from it as the user decides. -
Keep the findings you want as working notes. Claude offers what the spike showed, each with its source, for the thread or the conversation it came from.
A spike needs no tests and no review. Its commits carry no unit line, so on main they show as commits with no unit. Its code is never kept as it is: what it showed is built again in a unit, test first. /bk:status lists the spike branches still around, for you to keep, delete or take from.
Spikes are a switch, on by default. With planning.spikes: off, starting one is refused, and spike branches from before are left as they are. See Feature switches.
Open defects and affected work
Section titled “Open defects and affected work”Open defects
Section titled “Open defects”A unit’s context lists the defects attached to it or to its parent that are neither finished nor closed:
## Open defects- DEF-002 "Reset link lasts 3 minutes" in TK-001, found by US-001-TC2A story, whether it is built through tasks or on its own, and an epic above it, cannot be finished while a defect under it is open. A task is not held up by its own defects: the story above it is. A closed defect counts as done. /bk:status lists every defect with its parent and where it came from, and each closed one with its reason.
Finding the work a reported defect affects
Section titled “Finding the work a reported defect affects”Before a reported defect is saved, Claude asks BuildKeel which work the code involved belongs to. BuildKeel finds the units whose commits changed those files and the stories and tasks whose scope covers them, and names the story each belongs to, most likely first. Code documented from before BuildKeel is found by its story’s scope, even when no unit’s commits ever changed it:
A reported defect in these files would have as its parent, most likely first:- US-001 story "Request a reset link": 1 file (src/reset.ts), through TK-001 "Reset endpoint"A story found by its scope is named the same way: - US-E001 story "Password reset": 1 file (src/reset/token.ts), under its scope src/reset/.
Claude offers the first as the defect’s parent, and you pick before anything is saved. When nothing describes the code yet, BuildKeel says so, and Claude drafts version 0 of the story the defect touches first, as its parent.
In a Spec-driven tree
Section titled “In a Spec-driven tree”Defects and ad-hoc units work the same way in a Spec-driven tree, with these differences:
- Nothing is approved: every defect gets its number when it is created.
- A defect found while building is attached to the change whose work found it, such as
parent: CH-002, with the scenario whose test found it as itstestCase. It needs no proposal, and it shows in that change’s context while it is open. - A reported defect names the requirement it affects, such as
requirement: AUTH-R3, pinned to the capability version in force (AUTH-R3@v4), or stands alone. Its context shows that requirement as its version states it, with its scenarios and the tests tagged with them. While it is open, a later version that modifies or removes the requirement makes it suspect: you decide whether it still applies, and its file is saved naming the new version, or it is closed. - When a standalone defect is finished, BuildKeel looks at the files its fix changed, finds the requirements that archived changes built in them, and offers to link the defect to one. You may leave it standalone.
- When nothing describes the code of a reported defect, Claude asks whether to record it standalone (the default) or document this code first, as version 0 of a capability spec.
- Finishing a defect with no test tagged with its ID reports the missing regression test, as a reminder, and the defect is still finished. The work must be committed on its branch.
- A fix that changes a requirement is made through a change, which alters the capability spec when it is finished.
- Closing a defect without a fix works as in Full SDLC, and a closed defect drops out of its change’s open defects.
IDs and branches
Section titled “IDs and branches”IDs given offline
Section titled “IDs given offline”Defects and ad-hoc units are numbered like everything else, DEF-002 and AH-002, from the same number counter in the spec repo. An ad-hoc unit and a defect found while building get a permanent ID the moment they are created, because their commits are stamped with it straight away. A reported defect in Full SDLC is numbered when it is approved, as any draft is.
When the counter cannot be reached for one created with its number, such as with no connection, the unit still gets a permanent ID at once, with four random letters and digits in place of the number:
Created ad-hoc unit AH-k3x9 "Fix the footer link" at adhoc/AH-k3x9/adhoc.md.- The number counter could not be reached (...), so AH-k3x9 has an ID that needs no counter. It is permanent: commits are stamped with it.It is never renumbered: its commits already carry it.
When the spec tree is in your code repository
Section titled “When the spec tree is in your code repository”The file of a defect or ad-hoc unit is committed on the branch that is checked out when it is recorded, often the branch of a unit you finished a moment ago, which waits for its pull request. When you start it, its own branch is made from your main branch as usual and brings along the commit that recorded it, which changes nothing but the unit’s own file. The same file then sits on both branches, and they merge cleanly in either order.