Instead of dumping a 100-page SRS into the AI's chat window, you split it into focused markdown files the AI pulls on demand — loading only what the current task requires.
Read time15 min
LevelIntermediate
Quiz3 questions
TrackBackend Foundation
01 — the problem
Dumping everything into one file destroys your context window.
A 100-page SRS in the chat costs a fortune and overwhelms the AI before it writes a line of code. There is a better way.
Most teams have a Software Requirements Specification document — a single file containing order lifecycles, payment rules, subscription logic, notification triggers, and API contracts all mixed together. If you paste that into the AI chat, you burn thousands of tokens on rules that are irrelevant to the current task. Markdown-Driven Development (MDD) solves this by chopping the SRS into single-topic files the AI reads on demand.
Before
Monolithic SRS in chat
AI reads 100 pages of business rules to build a login endpoint. 90% of those tokens are wasted on irrelevant context.
After
docs/ folder with single-topic files
AI reads only docs/api-contracts.md when building an endpoint. Token cost drops to exactly what the task needs.
02 — the six files
TiffinConnect's docs/ structure — six files, each single-topic.
Every file covers exactly one concern. Business logic changes independently of code structure changes. Product managers can read and edit these without touching any code.
File
Contents
When AI loads it
docs/db-schema.md
Mongoose collection shapes, field types, indexes
Any schema or query work
docs/api-contracts.md
Endpoint paths, methods, request/response shapes
Any endpoint added or changed
docs/business-rules.md
Validation rules — max skip days, cancellation cut-offs, pause limits
Any business logic implementation
docs/order-lifecycle.md
All 12 order states (Pending → Accepted → Preparing → Dispatched…)
Orders, subscriptions, planner module
docs/conventions.md
Naming standards, coding style, response envelope format
Any new module or refactor
docs/open-questions.md
Unresolved edge cases with IDs, priority, and owner
Before any ambiguous implementation
The reference table in CLAUDE.md is the bridge. It tells the AI which doc file to load before working on each domain. The AI never auto-discovers docs/ — you wire the trigger explicitly in CLAUDE.md.
03 — model-driven development
MDD: docs/ files are living source of truth, not static documentation.
Markdown-Driven Development treats your docs/ files the same as code — they are version-controlled, updated in the same commit as the code change, and reviewed like a PR.
The key discipline: updating docs/db-schema.md is part of the Definition of Done for any schema change. If the Mongoose schema gains a new field, that field appears in the doc before the PR is merged. The AI reads the doc before writing queries, so stale docs produce stale code.
markdown
# docs/order-lifecycle.md — TiffinConnect
An order moves through exactly 12 states. No state can be skipped.
| State | Who sets it | Next valid states |
|---------------|---------------|-------------------------------|
| PENDING | System | ACCEPTED, REJECTED |
| ACCEPTED | Vendor | PREPARING, CANCELLED |
| PREPARING | Vendor | READY_FOR_PICKUP |
| READY_FOR_PICKUP | Vendor | DISPATCHED |
| DISPATCHED | Delivery | DELIVERED, FAILED_DELIVERY |
| DELIVERED | System | (terminal) |
| CANCELLED | Diner/Vendor | (terminal) |
| ... | ... | ... |
# AI instruction: never invent a state not in this table.# Invalid transitions must throw UnprocessableEntityException (422).
Without this file the AI invents state names. With it, the AI throws the correct exception on any invalid transition, every session, without re-prompting.
04 — before and after
What changes when the docs/ folder is in place.
Three dimensions shift immediately: context cost per session, ownership of business rules, and who can contribute to requirements.
Area
Before
After
Context per session
AI re-reads all files or guesses business rules from memory
Loads only the relevant doc for the feature being built
Rule ownership
Business logic mixed into code comments or CLAUDE.md
Business logic lives in dedicated markdown files, independently updatable
Cross-team access
Product managers cannot read or update developer-side rules
Plain markdown is readable and editable by product managers directly
Documentation freshness
Internal docs go stale over time as code evolves
Mandatory update rule keeps docs a living document
05 — do's and don'ts
Keeping your docs/ folder effective and lean.
Docs files degrade in two ways: they get mixed with the wrong concern, or they go stale. Both failures produce wrong AI output.
Do
Strict modularisation
One file per concern. Notifications go in docs/notifications.md, not business-rules.md. The AI loads less context per task.
Do
Explicit cross-referencing
In your prompt say: "Read docs/order-lifecycle.md before coding this service." The AI does not auto-discover files.
Do
Treat docs as source code
Updating a doc is part of the Definition of Done. If an endpoint contract changes, updating docs/api-contracts.md is mandatory.
Don't
Mix technical patterns with business rules
Keep code snippets out of business-rules.md. Business rules should read like policy, not implementation.
Don't
Let the AI guess edge cases
If a business rule is not written down, log it in open-questions.md. Never let the AI improvise on critical logic.
Don't
Duplicate rules across files
Each rule lives in exactly one file. If cancellation logic changes, update one place. Duplication creates contradictions.
Check your understanding
1. TiffinConnect's order lifecycle has 12 states. Where should this information live so the AI never invents a state that doesn't exist?
Correct.Not quite — the correct answer is highlighted above.
2. A product manager wants to update the subscription pause rules. In the MDD approach, what file do they edit?
Correct.Not quite — the correct answer is highlighted above.
3. What is the key difference between how the AI discovers docs/ files versus how it discovers CLAUDE.md?
Correct.Not quite — the correct answer is highlighted above.