Skip to main content
SPEC FILE · STAGE 04 · MYSPEC

solution.md

HOW it works - architecture, modules, data model, and APIs, drawn as diagrams an agent can read and a human can review.

DEFINITION // GEO SNIPPETENTITY EXTRACT

solution.md is the technical blueprint of a spec bundle: the technology stack, high-level architecture with Mermaid and C4 diagrams, system modules with interfaces and data models, the entity-relationship model, API design, security, deployment, success criteria tied to NFRs, and key decisions with alternatives. It uses only technologies the constitution approves and provides a design for every requirement.

THINK OF IT AS - THE ARCHITECT'S DRAWING SET

The brief said "a three-bedroom house with a home office". The drawing set says where the load-bearing walls go, how the plumbing runs, and which wire feeds which socket - on separate sheets (site plan, floor plan, electrical, plumbing) that all describe one building. solution.md is that set: the architecture flowchart is the site plan, the ER diagram the floor plan, the sequence diagram the plumbing. Different sheets, one consistent structure, so no two builders (or agents) improvise a different house.

SECTION 01 PURPOSE

Why the HOW gets its own file

Without a written design, a coding agent invents the schema on task 1 and a different one on task 7. solution.md pins the shape of the system - modules, entities, endpoints, error codes - before any task exists, so every task implements the same design. It also records why: each significant decision lists its rationale and the alternatives rejected, which is what reviewers ask about six months later.

  • Constrained by the constitution - only approved technologies; the reviewer checks the stack table against it.
  • Complete over the requirements - every FR maps to a module or decision; every measurable NFR becomes a Success Criteria row.
  • Sized to the project - optional sections are omitted, never padded with placeholders.
SECTION 02 WHERE & WHEN

Where it lives and when it is written

In the MySpec greenfield workflow it is stage 4, written to specs/<bundle>/solution.md after the requirements are approved: a collect substage asks about the choices the constitution left open (hosting, data store, integration style), generate drafts the document, and review checks coverage and constitution compliance. Older bundles named the file design.md; it carries the same solution file type and the MCP server matches on type, not name.

The other methodologies split this job differently: Spec Kit's plan.md is a solution-style plan with constitution gates, and OpenSpec's design.md is a short, optional decisions record for a single change.

SECTION 03 ANATOMY

The sections

solution.md - section skeleton ([optional] may be omitted) markdown
# System Solution: [Project Name]

## Overview
### Description                     1–3 paragraphs: what, architectural style, which FRs
### Technology Stack                | Component | Technology | Rationale |   (≤ 8 rows)
### Design Decisions Summary        | Decision | Choice | Rationale |        (≤ 6 rows)

## High-Level Architecture Design
### Architecture Description        ≤ 6 bullets: subsystems + request flow
### Architecture Diagram            Mermaid flowchart
### C4 Context / Container diagrams the system in its environment; its deployable units
### Module Interactions [optional]  Mermaid sequenceDiagram (required with 3+ modules)

## System Modules                   per module: Responsibilities, Key Components,
                                    Key Interfaces, Data Models, Dependencies, Error Handling
## Data Model
### Entity-Relationship Diagram     Mermaid erDiagram
### Entities                        purpose, key fields, relationships, indexes / constraints

## API / Protocol Design            REST / Messaging / WebSocket / Schemas / Error Codes - only what applies
## Security Architecture            Authn & Authz · Input Validation · Data Protection
## Deployment & Operations          Infrastructure Layout · Scaling Strategy · Configuration
## Observability [optional]         Tracing · Structured Logging · Metrics & Alerts
## Testing Strategy [optional]
## Success Criteria                 | Criterion | Target | Measurement |  one row per measurable NFR
## Key Solution Decisions           | Decision | Rationale | Alternatives Considered |

Per-module sections repeat as ### Module N: [Name] and never nest deeper than ####. Code blocks are language-neutral pseudocode in text fences - the solution describes interfaces and shapes, not implementation.

System Modules - one module, excerpt markdown
### Module 2: Billing

**Responsibilities**
- Meter usage events idempotently; compute invoices in integer cents.

**Key Interfaces**
```text
recordUsage(tenantId, idempotencyKey, units) -> UsageEvent | DuplicateAck
closePeriod(tenantId, period) -> Invoice
```

**Data Models**
```text
UsageEvent { id, tenantId, idempotencyKey (unique per tenant), units > 0, recordedAt }
```

**Dependencies** - Identity (tenant lookup), Persistence (Postgres)
**Error Handling** - duplicate key → cached 200; missing tenant → 404 problem+json
SECTION 04 DIAGRAMS

The diagrams it must contain

Diagrams are not decoration here; the reviewer fails a solution without them. Every Mermaid block renders live in the MySpec editor, and labels with spaces, parentheses, or non-ASCII characters are quoted so they render everywhere.

DiagramMermaid typeRequired?Shows
ArchitectureflowchartAlwaysSubsystems and the request flow between them
C4 Context + ContainerC4Context / C4ContainerWhen your org enables C4 diagramsThe system among its users and neighbours; its deployable units and data stores, named exactly as the modules and infrastructure sections name them
Data modelerDiagramAlwaysEntities, cardinalities, relationships
Module interactionssequenceDiagramWith 3+ modulesThe happy path across internal modules
LifecyclestateDiagram-v2OptionalWorkflow or entity state transitions
Reference shapes for the three core diagrams mermaid
```mermaid
flowchart TB
    subgraph Client
        Web[Web App]
    end
    subgraph Backend
        API[API Gateway]
        Service[Service Layer]
        DB[(Database)]
    end
    Web --> API --> Service --> DB
```

```mermaid
erDiagram
    User ||--o{ Order : places
    Order ||--|{ OrderItem : contains
    Product ||--o{ OrderItem : includes
```

```mermaid
sequenceDiagram
    Client->>+API: Request
    API->>+Service: Process
    Service->>+DB: Query
    DB-->>-Service: Result
    Service-->>-API: Response
    API-->>-Client: Response
```
SECTION 05 RULES

Authoring and review rules

✓ PASSES REVIEW
  • Uses only technologies approved in the constitution; the stack table has at most eight rows.
  • Every functional requirement has a corresponding solution; every measurable NFR maps to a Success Criteria row.
  • Decisions carry rationale and alternatives considered; the design follows SOLID and accounts for operations.
  • Contains the required Mermaid and C4 diagrams, with names consistent between diagrams and prose.
  • Reflects the user's explicit choices from the collect substage - the generator does not override them.
✗ SENT BACK
  • Placeholder-padded optional sections, or a document scaled for an enterprise when the project is a CLI.
  • Real code instead of pseudocode; module sections nested beyond four heading levels.
  • A schema or API that contradicts an acceptance criterion, or a stack choice the constitution forbids.
  • Metadata footers (version, date, status).
SECTION 06 AGENTS

How coding agents use it

  • Schema and contract source. An agent implementing a task reads the entity definitions, interfaces, and error codes here instead of inventing column names - the single biggest source of silent bugs in prompt-driven builds.
  • Module vocabulary. tasks.md is required to use the modules, APIs, and data models named here, so a task title tells the agent exactly which sheet to open.
  • Review anchor. "Architecture matches solution.md diagram" is a checkable PR statement; via the MCP server a reviewer bot can read_spec_file and compare.
SPEC FILES FIELD GUIDE

Related spec files

WORKFLOWS MYSPEC · SPEC KIT · OPENSPEC

Workflows that write it

Let the AI Architect write it for you

MySpec interviews you, then drafts every spec file with collect → generate → review gates. Free during Open Beta.