Skip to content

Commit 376c387

Browse files
authored
Merge pull request #325 from raifdmueller/docs/workflow-content-rework
docs: rework spec-driven workflow content
2 parents 867fee5 + a24e1ca commit 376c387

File tree

2 files changed

+116
-114
lines changed

2 files changed

+116
-114
lines changed

docs/spec-driven-workflow.adoc

Lines changed: 58 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ This document describes how to build production-quality software with AI agents,
1010

1111
Semantic Anchors are compact terms that reliably activate rich knowledge domains in LLMs.
1212
Instead of writing pages of instructions, you reference a concept the model already understands deeply.
13-
"Use TDD" is shorter than explaining test-driven development.
14-
"Follow arc42" is shorter than describing 12 architecture sections.
13+
"Use link:#/anchor/tdd-london-school[TDD, London School]" is shorter than explaining test-driven development with mocks and outside-in design.
14+
"Follow link:#/anchor/arc42[arc42]" is shorter than describing 12 architecture sections.
1515
The prompts stay short, precise, and maintainable.
1616

1717
This workflow was used to build three open source projects, all 100% AI-generated.
18-
The golden rule: I only prompt, I never touch the code myself.
18+
*The golden rule: I only prompt, I never touch the code myself.*
1919
Every line of code, every test, every documentation file was written by the AI under my guidance.
2020

2121
* https://github.com/docToolchain/dacli[*dacli*]: A full CLI tool with spec, architecture docs, tests, and user manual. Built by one AI, cross-reviewed by 5 different LLMs.
@@ -41,20 +41,40 @@ That is like asking a junior developer to build an entire application from a one
4141
The result will be unpredictable at best.
4242

4343
This workflow takes the opposite approach: break the work into small, well-defined steps and let the AI handle each one autonomously.
44-
Each step produces a concrete artifact that you can review before moving on.
44+
Each step produces a concrete artifact that you can review if you see the need for it.
4545

4646
The paradox: the smaller you make each task, the more autonomy you can give the agent.
4747
A vague "build me X" needs constant supervision.
48-
A precise "implement issue #42 using TDD, respecting the spec in src/docs/specs/" can run on its own.
48+
A precise "implement issue #42 using TDD, respecting the spec and architecture in src/docs/" can run on its own.
4949
The phases described in this document are designed to produce exactly that kind of precise, self-contained task.
5050

51-
This connects directly to Shannon's theorem.
52-
Each small step is a short transmission over the noisy channel.
53-
Short transmissions with error correction (tests, linting, review) are far more reliable than one long, unchecked transmission.
54-
LLM output is inherently non-deterministic -- the same prompt can produce different code each time.
55-
TDD and reviews are the error correction that makes this noisy channel usable.
56-
The agent works in a tight loop: implement, test, commit, check docs.
57-
You review at the boundaries between phases, not after every line of code.
51+
This connects directly to *Eichhorst's Principle*, which applies Shannon's noisy channel theorem to LLM coding.
52+
An LLM is not a deterministic tool.
53+
It is a noisy, non-deterministic channel.
54+
It hallucinates, loses context, and is sometimes plain wrong.
55+
But an agent in a loop corrects itself: the compiler reports an error, the agent reads it, fixes the code, runs the tests, reads the failure, fixes the logic, and repeats until green.
56+
That is not magic -- that is error correction, exactly as Shannon described.
57+
58+
When you prompt an LLM and paste the result into your project, you run an *open loop*.
59+
No compiler check, no test suite, no review.
60+
The LLM guesses once and you hope it guessed right.
61+
When an agent writes code, runs the compiler, runs the tests, and iterates until everything passes, that is a *closed loop*.
62+
The same principle that makes a thermostat work.
63+
64+
Different tests correct different error classes.
65+
The compiler catches syntax errors.
66+
Unit tests catch logic errors.
67+
BDD tests catch domain errors.
68+
Each layer increases the reliability of the channel.
69+
Untested code is an uncorrected channel -- the noise passes straight through.
70+
71+
The consequence: *better tests beat better prompts*.
72+
A comprehensive test suite turns a mediocre model into a reliable coding partner.
73+
And if the complexity of a specification exceeds the capacity of the LLM, more tokens will not help.
74+
The answer is smaller specifications, clearer boundaries, and better tests.
75+
76+
Each small step in this workflow is a short transmission over the noisy channel.
77+
Short transmissions with error correction are far more reliable than one long, unchecked transmission.
5878

5979
== Workflow Overview
6080

@@ -68,7 +88,7 @@ These principles apply to all phases:
6888
⚓ link:#/anchor/conventional-commits[*Conventional Commits*]:: All commits follow a standardized format for a clean, parseable git history.
6989
⚓ link:#/anchor/docs-as-code[*Docs-as-Code according to Ralf D. Müller*]:: Documentation lives in the repository as AsciiDoc, built by https://doctoolchain.org[docToolchain].
7090
Docs-as-Code treats documentation like source code: version-controlled, peer-reviewed, and built automatically.
71-
*Definition of Done*:: Code passes all tests, feature branch is merged or PR is created, documentation is updated, architecture decisions are recorded.
91+
⚓ link:#/anchor/definition-of-done[*Definition of Done*]:: Code passes all tests, feature branch is merged or PR is created, documentation is updated, architecture decisions are recorded.
7292

7393
== Prerequisites
7494

@@ -77,6 +97,8 @@ Before starting, set up your project infrastructure:
7797
. Initialize a git repository
7898
. Install https://doctoolchain.org[docToolchain] and download the ⚓ link:#/anchor/arc42[*arc42*] template
7999
. Configure your AI coding environment with an `AGENTS.md` (or tool-specific equivalent like `CLAUDE.md`)
100+
. Give the AI agent access to GitHub or GitLab via the CLI (`gh` or `glab`). The agent will need this later to create issues, pull requests, and ADR discussions. Consider using a dedicated account for audit traceability.
101+
. Following Eichhorst's Principle, set up error correction layers for your project: linters, pre-commit hooks, CI pipelines, and static analysis. Each layer catches a different class of error and makes the LLM channel more reliable. The https://github.com/LLM-Coding/vibe-coding-risk-radar[Vibe Coding Risk Radar] can help determine which checks are appropriate for your project's risk profile. These checks unfold their full effect once the first lines of runnable code exist -- set them up early, but revisit as the project grows.
80102

81103
.Installing docToolchain (Linux/macOS)
82104
[source,bash]
@@ -112,20 +134,20 @@ A minimal `AGENTS.md` for this workflow:
112134
## Conventions
113135
- Documentation: Plain English according to Strunk & White
114136
- Testing: TDD (London or Chicago School as appropriate)
137+
- Code: DRY, SOLID, KISS, Ubiquitous Language (DDD)
115138
- Commits: Conventional Commits, reference issue number
116139
- Branches: feature/<issue-description>
117140
118-
## Current State
119-
- Working on: EPIC #3
120-
- Next issue: #42
121141
----
122142

123-
Update this file as the project evolves.
143+
As the project progresses, the AI agent will maintain this file itself.
124144
When starting a new AI session, the agent reads `AGENTS.md` and immediately has the context it needs.
125145

126146
[TIP]
127147
====
128-
Start a new AI session for each EPIC or when the conversation becomes sluggish.
148+
Compact the context before starting a new EPIC.
149+
Within a session, keep an eye on the context window.
150+
Compact the conversation manually at natural breakpoints (e.g. after completing an issue) rather than waiting for the model to auto-compact at an inconvenient moment and lose important context.
129151
The agent picks up context from `AGENTS.md` and the spec files automatically.
130152
====
131153

@@ -153,8 +175,8 @@ Prompt the AI to use the ⚓ link:#/anchor/socratic-method[*Socratic Method*] to
153175
[source]
154176
----
155177
Use the Socratic Method to help me clarify requirements for [your project].
156-
Ask me at most 3 questions at a time. Challenge my assumptions before
157-
documenting anything.
178+
Ask me at most 3 questions at a time. Challenge my assumptions.
179+
Keep asking until you fully understand the requirements.
158180
----
159181

160182
This activates targeted questioning, assumption challenging, and productive use of not-knowing.
@@ -173,13 +195,12 @@ Continue the dialogue until both you and the AI are satisfied that the requireme
173195

174196
=== Step 3: Document as PRD
175197

176-
Ask the AI to write a *Product Requirements Document (PRD)* and save it as AsciiDoc.
198+
Ask the AI to write a ⚓ link:#/anchor/prd[*Product Requirements Document (PRD)*] and save it as AsciiDoc.
177199
A PRD captures the what and why, not the how: problem statement, goals, user personas, success criteria, and scope boundaries.
178200

179201
[source]
180202
----
181203
Write a PRD based on our discussion. Save it as src/docs/specs/prd.adoc.
182-
Follow Plain English guidelines according to Strunk and White.
183204
----
184205

185206
=== Step 4: Create Detailed Specification
@@ -198,7 +219,7 @@ Save as .adoc files in src/docs/specs/.
198219
⚓ link:#/anchor/gherkin[*Gherkin*] (Given/When/Then) provides acceptance criteria that are both human-readable and machine-testable.
199220
These criteria become the foundation for TDD later.
200221

201-
Activity Diagrams force you to think about error paths, edge cases, and alternative flows early.
222+
Activity Diagrams are an important part of the specification because they define flows, error paths, and edge cases in a way the AI can follow during implementation.
202223

203224
== Phase 2: Architecture
204225

@@ -208,16 +229,17 @@ Ask the AI to derive an architecture from the specification:
208229

209230
[source]
210231
----
211-
Create an arc42 architecture document based on the specification in src/docs/specs/.
212-
Save it in src/docs/arc42/.
232+
Fill the arc42 template in src/docs/arc42/ based on the specification in src/docs/specs/.
213233
Use PlantUML C4 diagrams for architecture visualization.
214234
----
215235

236+
The arc42 template was downloaded in the prerequisites step.
237+
The AI knows the template structure and fills the 12 sections appropriately.
238+
216239
⚓ link:#/anchor/arc42[*arc42*] provides 12 sections covering everything from context to deployment.
217-
The AI knows the template structure and fills it appropriately.
218240

219241
⚓ link:#/anchor/c4-diagrams[*C4 Diagrams*] combined with PlantUML provide text-based architecture visualization at four levels: Context, Container, Component, Code.
220-
The AI can create and modify these diagrams without graphical tools.
242+
Since the documentation uses AsciiDoc, PlantUML and other text-to-diagram tools are supported natively -- the AI generates diagrams as code, and the build renders them automatically.
221243

222244
==== Architecture Decision Records
223245

@@ -238,7 +260,7 @@ The AI creates each ADR as a GitHub/GitLab issue first.
238260
You review the issue, comment, or approve it.
239261
Only after your approval is the ADR incorporated into the arc42 documentation.
240262
This way, every architectural decision is traceable through the issue history.
241-
All ADRs must align with the quality goals defined in arc42 Section 1.2.
263+
All ADRs must align with the quality requirements defined in arc42 Section 10.
242264

243265
=== Step 6: Architecture Review (ATAM)
244266

@@ -269,7 +291,7 @@ Use MoSCoW prioritization for the initial backlog order.
269291
Mark dependencies between issues with labels or cross-references.
270292
----
271293

272-
⚓ *INVEST* ensures User Stories are Independent, Negotiable, Valuable, Estimable, Small, and Testable.
294+
link:#/anchor/invest[*INVEST*] ensures User Stories are Independent, Negotiable, Valuable, Estimable, Small, and Testable.
273295

274296
⚓ link:#/anchor/moscow[*MoSCoW*] (Must have, Should have, Could have, Won't have) provides clear prioritization.
275297

@@ -281,20 +303,12 @@ As the project evolves, groom the backlog regularly to re-prioritize based on ne
281303

282304
=== Step 8: Implement Issue by Issue
283305

284-
Create a feature branch for each EPIC or logical group of issues:
285-
286-
[source,bash]
287-
----
288-
git checkout -b feature/<epic-or-issue-description>
289-
----
290-
291-
Then enter the core development loop:
292-
293306
[source]
294307
----
308+
Create a feature branch for this EPIC.
295309
Select the next logical issue from the backlog (respect dependencies).
296310
Analyze it and document your analysis as a comment on the issue.
297-
Implement it using TDD. Commit when done.
311+
Implement it using TDD (choose London or Chicago School as appropriate). Commit when done.
298312
Check if the spec or architecture docs need updating.
299313
----
300314

@@ -305,19 +319,13 @@ For each issue:
305319
. *Commit*: After the issue is implemented and all tests pass, commit with a reference to the issue number
306320
. *Check docs*: Ask whether the specification or architecture documentation needs updating based on what was learned during implementation
307321

308-
⚓ *TDD* (Test-Driven Development) comes in two schools:
322+
TDD (Test-Driven Development) comes in two schools:
309323

310-
* ⚓ link:#/anchor/tdd-london-school[*London School*] (mockist): isolate the unit under test, mock dependencies. Good for interaction-heavy code.
311-
* ⚓ link:#/anchor/tdd-chicago-school[*Chicago School*] (classicist): test behavior through the public API, use real collaborators. Good for state-based logic.
324+
* ⚓ link:#/anchor/tdd-london-school[*TDD, London School*] (mockist): isolate the unit under test, mock dependencies. Good for interaction-heavy code.
325+
* ⚓ link:#/anchor/tdd-chicago-school[*TDD, Chicago School*] (classicist): test behavior through the public API, use real collaborators. Good for state-based logic.
312326

313327
The AI selects the appropriate school based on the code's characteristics.
314328

315-
Each implementation follows the Red-Green-Refactor cycle and respects:
316-
317-
* ⚓ link:#/anchor/dry-principle[*DRY*] (Don't Repeat Yourself)
318-
* ⚓ link:#/anchor/solid-principles[*SOLID*] principles
319-
* ⚓ *KISS* (Keep It Simple, Stupid)
320-
* ⚓ link:#/anchor/domain-driven-design[*Ubiquitous Language*] from Domain-Driven Design: use the same terms in code as in the specification
321329

322330
==== Feedback Loop to Specification
323331

@@ -337,15 +345,8 @@ The spec is not just a means to generate code -- it remains the authoritative de
337345

338346
==== Merging
339347

340-
When an EPIC or a logical group of issues is complete, merge the feature branch:
341-
342-
[source,bash]
343-
----
344-
git checkout main
345-
git merge feature/<epic-or-issue-description>
346-
----
347-
348-
For team projects, use Pull Requests for code review before merging.
348+
When an EPIC is complete, the AI agent creates a Pull Request for the feature branch.
349+
You review and merge it.
349350

350351
== Phase 5: Quality Assurance
351352

0 commit comments

Comments
 (0)