Skip to content

Documentation-First Development

Documentation-first development means every implementation starts from a written specification, not a verbal prompt. The AI produces structured documentation first, and only writes code from that documentation. This is the single most effective pattern for consistent, high-quality AI-assisted development.

AI coding assistants have a default behaviour that undermines quality:

  1. Premature implementation — Given a task, AI jumps straight to code. The first attempt becomes the final attempt, with all its assumptions baked in.
  2. Inconsistent results — The same prompt produces different implementations across sessions. Without a specification, there is no stable reference point.
  3. Context loss between sessions — Session 1 makes architectural decisions. Session 2 starts from zero. Those decisions are lost unless they were written down.
  4. Unvalidated assumptions — AI makes dozens of implicit decisions (data structures, error handling, API boundaries) without surfacing them for review.

The result: code that works for the demo case, breaks on edge cases, and has to be rewritten when requirements become clearer.

Document first. Code second. All implementation happens from documentation.

Research & Document → Review & Strengthen → Implement from Docs

The documentation phase produces structured outputs that serve as implementation inputs. The code phase consumes those outputs. The two phases are separated — often across different AI sessions, different tools, or different days.

OutputPurposeWhen to use
Executive SummaryArchitecture overview, key decisions, trade-offsStart of any project or major feature
SpecificationDetailed technical spec with interfaces and constraintsBefore implementing any non-trivial feature
Implementation PlanTest cases first, then ordered implementation stepsBefore any coding session
Research ReportFindings, comparisons, evidence-based recommendationsWhen evaluating options or investigating unknowns

A technical-focus document covering architecture, key decisions, and trade-offs. This is not a business document — it is a technical briefing that establishes the boundaries of the system.

An executive summary should answer:

  • What is being built and why?
  • What are the key architectural decisions?
  • What trade-offs were made and why?
  • What are the constraints (technical, resource, timeline)?

Detailed technical documentation with clear interfaces, data structures, error handling, and constraints. A specification is precise enough that an AI coding assistant can implement from it without asking clarifying questions.

Key elements:

  • Interface definitions (inputs, outputs, error cases)
  • Data structures with types and constraints
  • State transitions and lifecycle
  • Dependencies and integration points
  • What is explicitly out of scope

Test cases first, then natural language implementation steps. These are covered in detail on the Implementation Plans page.

Evidence-based findings from investigation. A research report presents what was found, what was compared, and what is recommended — with reasoning.

Structure:

  • Question or problem statement
  • Methodology (what was investigated and how)
  • Findings (factual, with evidence)
  • Comparison (if evaluating options)
  • Recommendation (with reasoning and caveats)

What you do NOT do during the documentation phase

Section titled “What you do NOT do during the documentation phase”
ActionWhy not
Write large code blocksCode is an implementation detail — it belongs in the implementation phase
Implement features directlyImplementing without a spec means validating against nothing
Skip documentation for “simple” tasksSimple tasks have a way of becoming complex; the spec catches this early
Include aspirational languageDocument what IS, not what WILL BE. “Production-ready” is meaningless in a spec
Mix documentation and implementationSwitching between modes produces worse results in both

The documentation phase is about thinking, not typing code. The AI is doing design work, not implementation work.

AI has two distinct strengths that this workflow exploits:

AI is excellent at producing structured documentation. Given clear prompts and constraints, AI generates thorough specifications, identifies edge cases, surfaces assumptions, and organises information into structured formats. This is arguably where AI provides the most value — not in the code itself, but in the thinking that precedes it.

Structured documentation is excellent input for AI implementation. When the coding phase begins, the AI has explicit context: interfaces are defined, test cases are written, edge cases are enumerated, constraints are documented. The implementation becomes a translation exercise, not a design exercise.

AI Strength: Analysis & Structure → Documentation Output
Documentation Output → AI Strength: Translation & Implementation

The feedback loop is deliberate. AI produces documentation that AI is optimised to consume. The human reviews and strengthens the documentation in between — catching blind spots that AI alone would miss.

Documentation produced in the research phase becomes the input for the implementation phase:

PhaseToolProducesConsumes
ResearchConversational AIExecutive summaries, specs, plans, reportsRequirements, questions, constraints
ReviewDifferent AI or human reviewStrengthened documentationDraft documentation
ImplementationCLI-based AI coding toolWorking code with testsReviewed documentation

The implementation phase begins with the AI reading the specification and implementation plan. The invocation is explicit:

“Let’s use Jimmy’s Workflow to execute this plan”

This triggers the PRE-FLIGHT phase, which uses the documentation as its context inventory.

Documentation-first development feeds directly into Jimmy’s Workflow v2.1:

Workflow phaseDocumentation input
PRE-FLIGHTReads the specification — checks that all interfaces, dependencies, and requirements are available
IMPLEMENTFollows the implementation plan step by step
VALIDATETests against the success criteria defined in the plan
CHECKPOINTRecords completion against the specification

Without documentation-first, PRE-FLIGHT has nothing to check against. The AI invents requirements as it goes. With documentation-first, PRE-FLIGHT becomes a genuine verification step — does the AI have everything the spec says it needs?

Not every task needs a full specification. Use the decision table:

Task typeDocumentation levelExample
New feature or systemFull: executive summary + spec + implementation planBuilding an authentication system
Significant changeSpec + implementation planRefactoring data layer to new pattern
Moderate changeImplementation plan onlyAdding a new API endpoint to existing pattern
Bug fixInline description in commit/PRFixing off-by-one error in pagination
Trivial changeNoneFixing a typo

The threshold: if the task involves decisions that a future session would need to understand, document it.