Semantic Contracts

Semantic Anchors reference public knowledge that LLMs already understand. But your team's conventions, templates, and definitions need Semantic Contracts. A contract defines what a term means in your project — either by composing established anchors or by providing custom definitions that only exist within your team.

Specification

What we mean when we say 'spec'

    When we talk about a "specification" or "spec", we mean:

  • Persona Use Cases in Cockburn's Fully Dressed format (Primary Actor, Trigger, Main Success Scenario, Extensions, Postconditions) at User Goal level, with Business Rules (BR-IDs)
  • System Use Cases for each technical interface (API endpoint, CLI command, event, file format): input/validation, processing, output/status codes, error responses
  • Activity Diagrams for all flows (not just the happy path)
  • Acceptance criteria in Gherkin format (Given/When/Then)
  • Individual requirements in EARS syntax where applicable (When/While/If/Shall)
  • Supplementary Specifications as needed: Entity Model, State Machines, Interface Contracts, Validation Rules

Requirements Discovery

How we clarify requirements before writing specs

    Clarify requirements using the Socratic Method:

  • Ask at most 3 questions at a time, challenge assumptions
  • Use MECE to ensure questions cover all areas without overlap
  • Keep asking until you fully understand the requirements
  • Frame the scope before writing it down:

  • Impact Mapping connects deliverables to business goals and actors — so you build what moves a goal, not just what was asked.
  • User Story Mapping lays stories along the user's journey and exposes a coherent first slice.
  • Document the result as a PRD (problem, goals, personas, success criteria, scope).

Architecture Documentation

How we document architecture with diagrams, ADRs, and decision evaluation

    Architecture documentation follows arc42. Diagrams are C4 via PlantUML's bundled C4-PlantUML standard library (the `!include <C4/...>` stdlib form), not Mermaid. Decisions are Nygard ADRs with a 3-point Pugh matrix. Quality requirements are six-part Quality Attribute Scenarios (Source, Stimulus, Artifact, Environment, Response, Response Measure) with a literal Response Measure.

    That is the shared vocabulary. The procedure for actually producing such a document — scaffolding the arc42 with-help template, the cross-section traceability rules, the Chapter 11 Risks-vs-Technical-Debt structure, the ADR-to-risk-ID wiring, and the Chapter 1.2-vs-10 quality-goal marking — lives in the arc42-documentation skill, loaded on demand.

Crosscutting Concepts

Baseline arc42 Chapter 8 concepts every system documents: threat model, security, test, observability, error handling

    arc42 leaves Chapter 8 open. We require five baseline crosscutting concepts, in this order:

  • 8.1 Threat Model — STRIDE; threats get IDs (T-001…).
  • 8.2 Security — every mitigation references the T-IDs it closes.
  • 8.3 Test — testing pyramid; tests trace to Use Cases and Business Rules.
  • 8.4 Observability — logs, metrics, traces, audit trails.
  • 8.5 Error Handling — retry, circuit breaker, fallback, recovery.
  • Add further Chapter 8.x concepts (persistence, i18n, accessibility, configuration, performance) only when the system actually has that concern.

Layer Boundaries

How we handle boundaries between layers

    At every layer boundary:

  • Expose only well-defined DTOs and contracts — never domain entities
  • Use explicit mapping at every seam
  • Apply Anti-Corruption Layers when integrating external systems
  • Dependency direction points inward (DIP)

Backlog Management

How we create and prioritize implementation tasks

    Create EPICs and User Stories as GitHub issues from the specification.

  • User Stories follow INVEST criteria (Independent, Negotiable, Valuable, Estimable, Small, Testable)
  • Prioritize with MoSCoW (Must/Should/Could/Won't)
  • Mark dependencies between issues
  • Groom the backlog regularly as the project evolves

Vertical Slicing

How we build the first increment and grow the system in thin end-to-end slices

    Build the first increment as a walking skeleton: a deployable end-to-end slice that wires every architectural layer together and does almost nothing else.

    Grow the system as thin vertical slices — each slice cuts through all layers and delivers one small piece of user value. Slices are tracer bullets: kept and refined, never thrown away.

    When a technical unknown blocks a slice, run a spike solution first — a timeboxed, throwaway experiment that removes the risk. Spike code is discarded; only its lesson carries into the slice.

Implement Next

The implementation loop for each issue

    For each issue:

  • Create a feature branch for the EPIC
  • Select next issue from backlog (respect dependencies)
  • Analyze and document analysis as a comment on the issue
  • Implement using TDD (London or Chicago School as appropriate)
  • Each test references its Use Case ID for traceability
  • Commit with Conventional Commits, reference issue number
  • Check if spec or architecture docs need updating
  • When EPIC is complete, create a Pull Request

Refactoring

How we identify and execute refactorings safely

    Refactoring targets are named code smells, not a vague urge to "clean up".

    For any refactoring that does not complete in one step, use the Mikado Method: attempt the change, note what breaks, revert, and do the prerequisites first — never leave the build broken while you dig.

    Refactoring commits change structure only. Behaviour changes go in separate commits, and the test suite stays green at every commit.

Code Quality

Coding conventions and design principles

    Our code follows:

  • SOLID principles
  • DRY, KISS
  • Ubiquitous Language from Domain-Driven Design (same terms in code as in the specification)

Quality Review

How we review code and check for security issues

    Quality assurance follows three layers:

  • Code review using Fagan Inspection (structured, systematic, with defined phases)
  • Security review based on OWASP Top 10
  • Architecture review using ATAM (scenario-based tradeoff analysis against quality goals)
  • Use a different AI model or fresh session for reviews to avoid blind spots

Docs-as-Code

How we write and build documentation

    Documentation follows Docs-as-Code according to Ralf D. Müller:

  • AsciiDoc as format, PlantUML for inline diagrams, built by docToolchain
  • Version-controlled, peer-reviewed, and built automatically
  • Plain English according to Strunk & White (or Gutes Deutsch nach Wolf Schneider)
  • Projects following this contract include the `dtcw` wrapper and `docToolchainConfig.groovy` so PlantUML / AsciiDoc actually render.

Socratic Code Theory Recovery

Recover a program's 'theory' from source code through recursive question refinement

    Recover a program's "theory" (Naur 1985) from source code through recursive question refinement.

  • Start with 5 root questions: Q1 Problem/Users, Q2 Specification, Q3 Architecture, Q4 Quality Goals, Q5 Risks.
  • The second level of the tree is FIXED, not free. Every run emits exactly these nodes, in this order, even when a node's only leaf is [OPEN] or [ANSWERED: not applicable]:
  • - Q1.1-Q1.6: product identity, primary users, channels, why-built, success metrics, segment priority

    - Q2.1-Q2.6: actors, use-case catalog, per-interface system specs, data/entity model, acceptance criteria, cross-cutting business rules

    - Q3.1-Q3.12: the twelve arc42 chapters, in arc42 order

    - Q4.1-Q4.8: the eight ISO/IEC 25010 characteristics; plus Q4.9: which characteristic has priority

    - Q5.1-Q5.5: technical debt, security risks, operational risks, dependency/supply-chain risks, scaling/performance risks

  • Below the fixed second level, decompose adaptively and code-driven; a node is a leaf only when it can be answered from one specific file:line evidence (a directory is too coarse — decompose further) or definitively marked [OPEN]. Depth tracks code density: a small bounded context yields a shallow tree, a large one a deep tree, capped at four levels below a fixed node. Depth varies between runs — expected.
  • Q-IDs are stable: Q3.7 is always Deployment View, in every run, so trees from different runs can be diffed node-by-node.
  • Each leaf is [ANSWERED] (with file:line evidence) or [OPEN] (with Category, Ask role, and why it is unanswerable from code).
  • Quality is not wholly team knowledge. Derive quality scenarios for the Q4 branch and arc42 Chapter 10 from measurable code behaviour — literal thresholds, timeouts, budgets, the threat catalogue and test concept from Q3.8 — as [ANSWERED] with file:line; never invent target numbers. Only the quality-goal ranking (Q4.9) is [OPEN]. arc42 Chapter 10 carries the derivable scenarios, never just an [OPEN] pointer. Chapter 1.2 names only the top 3-5 quality goals; Chapter 10 covers all eight characteristics — mark each Chapter 10 entry as concretising a Chapter 1.2 top goal or as derived.
  • Open Questions are the handoff document: always emit one section per role (Product Owner, Architect, Developer, Domain Expert, Operations), even when a section is empty ("No open questions for this role").
  • Two-phase workflow: Phase 1 builds the tree; the team answers the Open Questions; Phase 2 synthesizes documentation from the answered tree.

Concise Response (TLDR)

How responses should be structured for brevity

    Responses lead with the conclusion first (BLUF). Keep to essential points. No filler, no preamble. Use short sentences, active voice, and no unnecessary words (Strunk & White).

Simple Explanation (ELI5)

How to explain complex concepts simply

    Explain complex concepts using simple language and everyday analogies. When the explanation feels hard to write, that reveals gaps in understanding — study those areas first (Feynman Technique).

Explaining and Teaching

How to teach a topic until understanding is verified, not just explained

    When asked to explain or teach something (including "why does X…"), act as a teacher running a dialogue, not a lecture — your goal is that the learner can apply it afterwards, not that you delivered it.

    Start by having the learner restate what they already understand (Socratic Method), so you teach the gap, not the whole topic; adjust depth on request (ELI5 / ELI-intern). Keep a short running checklist of what they must grasp — the problem and why it exists, the solution with its design decisions and edge cases, and why it matters — a Definition of Done for understanding, worked one item at a time; for a long or multi-session explanation, persist that checklist as a file so it survives context loss and can be resumed.

    Take one small step per turn: fill the gap with questions, not answers; ask, or explain the next smallest piece in a few sentences and then check it — then stop and wait. Never stack several steps in one turn. Lead with why something matters before its mechanics (4MAT), and keep drilling into the why beneath the why — the reasoning behind the design, not just what it does (Naur); cover what and how too.

    Check by quizzing, never "makes sense?" — open or multiple-choice questions; for multiple choice, vary which option is correct and don't reveal the answer until the learner has committed. The sharpest check is having them explain it back in their own words (Feynman Technique) or apply it to a fresh case; use a concrete artifact (an example, code, a trace) when it helps. React to the actual answer: if they've got it, advance; if not, give a short targeted hint and re-ask. "Understood" means they can use it on a new case, not recite it (Bloom's Apply, not recall) — don't move on, and don't end, until they've shown that.

    Don't announce or walk through the method you're using — let it shape what you do, not what you say. Scale to the question: a small factual ask gets a one-line answer, and the learner can say "just tell me" anytime. If you're unsure of the topic, learn it before teaching.

Writing Style

How we write technical texts — language, tone, and structure

    Writing follows Gutes Deutsch nach Wolf Schneider (or Plain English according to Strunk & White).

    Additionally:

  • Technical terms stay in English (LLM, Prompt, Token, Spec, etc.)
  • Address the reader directly, use first person sparingly but deliberately
  • Use analogies to human thinking to explain technical concepts
  • One thought per paragraph (5-8 sentences is fine)
  • Section headings are statements, not topic announcements
  • First sentence says what the paragraph is about
  • Show code and prompts, don't just claim things work
  • Conclusions make a clear statement — never end with 'it remains exciting'

TDD, Hamburg Style

Design-led TDD recipe by Ralf Westphal — close the requirements/logic gap before writing code, then test at service boundaries with minimal mocking

    Design-led TDD recipe by Ralf Westphal — close the requirements/logic gap before writing code, then test at service boundaries with minimal mocking. Use it when the problem is too complex for pure micro-step Red-Green-Refactor.

  • **ACD cycle (Analyze → Design → Code)** precedes the test loop: first model the solution to close the gap between requirements and logic, only then code.
  • **"Right from the start" philosophy** — implement correctly the first time so refactoring is a correction, not routine cleanup.
  • **Service-level testing** — test behind the public API, independent of API technology.
  • **Minimal mocking** — closer to *TDD, Chicago School* than *London School*.
  • **IOSP (Integration Operation Segregation Principle)** — a function is either composition (Integration) or logic (Operation), never both; structural support for simple unit tests.
  • **Deep Work over Small Steps** — accept that some problems can't be sliced into tiny green increments; stay red longer when the design demands it.
  • Composes: *TDD, London School*, *TDD, Chicago School*, *Red-Green-Refactor*, *IOSP*.

    Sources: https://ralfw.de/hamburg-style-tdd/, https://ralfw.de/tdd-how-it-can-be-done-right/

Strategic Architecture Analysis

How we analyze architecture strategically — mapping evolution, classifying complexity, exploring the option space, and weighing tradeoffs

    Strategic architecture analysis combines four lenses, each for a different question. Reach for it when evaluating build-vs-buy, assessing architecture fitness for changing requirements, or running a strategic technology-radar review.

    Map the value chain with Wardley Mapping to see how each component evolves — what is commodity, what is genesis, and where the strategic differentiation actually sits.

    Classify each challenge with the Cynefin Framework — Clear, Complicated, Complex, or Chaotic — so the response fits the domain instead of forcing one playbook onto every problem.

    When a decision has a wide solution space, lay the dimensions and their options out in a Morphological Box and combine them deliberately, rather than anchoring on the first design that comes to mind.

    Evaluate the shortlisted architectures against the quality goals with ATAM, naming the sensitivity points, the tradeoff points, and the risks each option carries.

    When the root cause of a problem stays unclear, drill down with the Five Whys before committing to a direction.

Presentation Planning

How to plan a presentation around one audience and one core message

    When asked to plan a presentation or talk, act as a planning partner in dialogue, not a slide generator — the goal is a plan the speaker can deliver, built around one audience and one core message.

    Elicit the brief with the Socratic Method — a few questions at a time, not a form: who the audience is and what they already know and care about, the single change you want in them (the core message or call to action), the setting and time budget, and the hard constraints. Design against the Curse of Knowledge — assume the audience lacks your context; cut jargon or unpack it.

    Shape the content top-down with the Pyramid Principle: one governing message, supported by a few MECE argument groups — no overlap, no gaps. Give the talk a spine with a narrative arc (Three-Act Structure, or Story Circle for a more personal journey): a setup that sets the stakes, a middle that builds through the supporting points, and a resolution that lands the core message. Lead each section with why it matters before the detail (4MAT); open with the bottom line, not a wind-up (BLUF), then earn it.

    Produce a plan, not slides: the one-sentence core message, the audience, the arc, and per section the single takeaway plus its evidence and rough timing. Work one part at a time — propose the core message and audience first, check them, then the arc, then fill the sections; stop and wait between steps instead of dumping a full deck. If the speaker says "just draft it", give the whole outline at once. Don't announce the method — let it shape the plan, not the talk about it.