Why MDD
The Problem
Most people prompt Claude Code like this: fix the bug in my auth system. Claude reads 40 files, burns through context, produces something that technically compiles but misses the bigger picture. The model is spending most of its budget on orientation - figuring out what your project even is - rather than solving your actual problem.
The Solution
MDD flips this. Write structured documentation first. Claude reads
one doc instead of 40 files - 200 tokens instead of 20,000. Every invocation
of /mdd starts with a clear, human-authored map of the feature, the
data flow, the test plan, and the acceptance criteria. Claude never needs to guess.
The core insight: The documentation you write before coding is not overhead. It is the primary context Claude Code consumes. Writing it first is the highest-leverage thing you can do.
| Phase | What MDD does |
|---|---|
| 📄 Document | Generates structured feature docs, data-flow maps, and test plans before any code is written |
| 🔍 Audit | Deploys parallel agents to read every file and surface severity-rated findings |
| 📈 Analyze | Compares findings against documentation, identifies root causes, and ranks fixes by impact |
| ✅ Fix & Verify | Implements fixes with mandatory red/green/integration gates - nothing ships until tests pass in a real environment |
How It Works
MDD is installed as a Claude Code slash command. When you run /mdd,
the router reads the first argument and loads only the command file that
handles that mode. The full instruction set spans 28,000 tokens - none of
it is loaded unless it is needed.
Lazy-Loading Architecture
The /mdd command is split across 7 focused files. The router
dispatches to exactly one file per invocation:
| File | ~Tokens | Handles |
|---|---|---|
| mdd.md (router) | ~460 | Entry point - reads mode, delegates to the correct command file |
| mdd-build.md | ~8,000 | Full 7-phase feature development pipeline with gates |
| mdd-audit.md | ~4,500 | Parallel agent code review with manifest tracking |
| mdd-manage.md | ~3,200 | status, scan, update, note, deprecate |
| mdd-lifecycle.md | ~4,800 | reverse-engineer, graph, upgrade, commands |
| mdd-plan.md | ~4,200 | plan-initiative, plan-wave, plan-execute |
| mdd-ops.md | ~2,800 | ops, runop, update-op, ops list |
A /mdd status loads ~460 tokens. A /mdd audit loads ~700 tokens.
The full 28,000-token set is always available - never loaded unnecessarily.
This design means your context window stays clean. Claude Code enters each mode with a fresh, focused instruction set rather than carrying the weight of every other mode it will never use in this session.
Installation
MDD installs globally via npm. One command puts /mdd in every
Claude Code session on your machine.
npm install -g @thedecipherist/mdd
mdd install
mdd install copies mdd.md to ~/.claude/commands/ (so /mdd
appears as a slash command) and the six mode files to ~/.claude/mdd/ (so they
don't clutter the command picker). It also injects a guidance block into
~/.claude/CLAUDE.md. After that, /mdd is available in any project,
any directory, any session.
Options
Standard install (recommended)
Installs to your Claude Code global commands directory automatically.
mdd install
Custom directory
Install to a specific path - useful for team-shared configurations.
mdd install --dir /path/to/claude/commands
Update to latest version
Pull the latest MDD version and re-install the command files.
npm update -g @thedecipherist/mdd
mdd install
Note: You only need to run mdd install once after
installing or updating. The slash command is registered globally and persists
across all Claude Code sessions.
Claude Automatically Suggests MDD
mdd install injects a guidance block into ~/.claude/CLAUDE.md that teaches Claude to recognise when you're in an MDD project and suggest the right workflow — even when you don't type /mdd.
Whenever Claude detects a .mdd/ directory in the current project it evaluates your request before responding:
- Existing feature match — scans
.startup.mdtags and flags overlap: "This looks related to02-user-auth. Want to use/mdd update 02?" - Ops / infrastructure — deploy, CI/CD, Docker, commit hooks, cron: "Want to document this as a runbook with
/mdd ops?" - Initiative-scale — 3+ independent concerns: "Want to plan this with
/mdd plan-initiative?" - Single feature — "Want me to use
/mdd <description>to build this with docs and tests first?"
Claude always asks — never auto-invokes. Tag-based detection means no full docs are loaded into context: just the compact tag list in .startup.md.
Branch Guard — Never Work on main
mdd install also registers a Claude Code PreToolUse hook — a shell script that fires before every file write in any MDD project. If the current branch is main or master, the hook blocks the operation:
⛔ MDD BRANCH GUARD
File modification is blocked on branch 'main'.
MDD never writes files directly on main or master.
Create a feature branch, then re-run your /mdd command:
git checkout -b feat/<feature-name>
Unlike instruction-based checks, hooks fire at the OS level on every tool call — they cannot be compacted away or forgotten by Claude. MDD instructions and the hook work together: instructions guide Claude's decisions, the hook enforces the rule even if earlier context is lost.
| Mode | Auto-created branch |
|---|---|
/mdd <feature> | feat/<feature-slug> |
/mdd audit | fix/mdd-audit-<date> |
/mdd plan-initiative | feat/init-<initiative-slug> |
/mdd plan-execute | feat/<wave-slug> |
All 24 Modes
MDD organises its 24 modes into 6 groups. Each group is loaded independently - running a manage command never loads the build pipeline, and running a plan command never loads the audit system. Pick the mode that matches what you need right now.
⚡ Build
/mdd <feature description>
The flagship mode. Runs the full 7-phase feature development pipeline with mandatory gates before any code is written, tested, or shipped.
- Understand context
- Map data flow
- Generate documentation
- Write test skeletons
- Plan implementation
- Implement with iteration
- Verify in real environment
🔍 Audit
/mdd audit
Parallel agent code review that scales agent count to codebase size. Each file gets a full fresh context budget. Findings are severity-rated and resumable if interrupted.
- Agent scaling by file count
- Manifest-tracked progress
- Severity-rated findings
- Automatic resume detection
📄 Manage
Day-to-day project tracking and maintenance.
/mdd status- project health summary/mdd scan- detect drift from docs/mdd update- update feature docs/mdd rebuild-tags- generate tags & rebuild startup/mdd connect- rebuild the connections map/mdd note- append a project note/mdd deprecate- mark features retired
🔄 Lifecycle
Understand and evolve existing codebases.
/mdd reverse-engineer- generate docs from code/mdd graph- dependency visualization/mdd upgrade- plan major version migrations; also addspathto existing docs/mdd import-spec <file>- convert a spec or brainstorm doc into MDD feature docs/mdd commands- list all available modes
📋 Plan
Multi-feature initiative and wave planning.
/mdd plan-initiative- scope a feature set/mdd plan-wave- phase work into waves/mdd plan-execute- run a planned wave
⚙️ Ops
Repeatable operational procedures and runbooks.
/mdd ops- create an ops runbook/mdd runop- execute a runbook step-by-step/mdd update-op- revise an existing runbook/mdd ops list- list all runbooks
📄 Import Spec
/mdd import-spec <spec-file>
Convert large brainstorming documents and Claude conversation exports into structured MDD feature docs automatically.
- Initiative and wave detection
- Path grouping by product area
- Duplicate merging across sections
- Dry-run preview before writing
📁 Path Grouping
Product tree navigation for large projects.
Add a path field to any feature doc
(Auth/Login, E-commerce/Cart) to group docs into
a human-readable product tree. Dashboards and listing tools use this field
for hierarchical navigation views. Run /mdd upgrade to
automatically add path to all existing docs in a project.
🔁 Connections Map
/mdd connect
Pre-computed .mdd/connections.md committed to every project —
gives Claude and the dashboard instant access to the full relationship graph
without reading every doc.
- Path tree grouped by
pathfield — dashboard renders directly - Mermaid dependency graph with status-coded nodes
- Source file overlap — co-change risk detection
- Auto-regenerated by every doc-mutating MDD operation
/mdd statusand/mdd scandetect staleness
Build Mode
Build mode is the core of MDD. When you run /mdd <feature description>,
Claude Code enters a structured 7-phase pipeline. No code is written until
documentation, data flow, and tests exist. Three mandatory gates enforce this.
The Pipeline
The Three Gates
🔴 Red Gate
All tests must exist and fail for the right reason before implementation begins. This confirms the test suite actually catches regressions - a passing test with no implementation is a broken test.
🟢 Green Gate
All tests must pass. If they do not, MDD enters a 5-iteration diagnosis loop - root cause first, never symptom-patching. After 5 failed iterations the loop stops and the issue is escalated clearly.
✅ Integration Gate
The feature is verified in a real environment - not a mocked test runner. Actual API calls, actual database queries, actual edge cases. This gate cannot be skipped.
Key Highlights
- Parallel context agents - the Understand phase uses multiple agents to read the codebase simultaneously, preserving the main session's context budget
- Documentation-first enforcement - the Red Gate physically prevents implementation until docs and failing tests exist
- Root-cause-first diagnosis - the Green Gate loop diagnoses the deepest root cause before touching code
- Real environment verification - the Integration Gate runs against a live environment, not mocks
Audit Mode
/mdd audit reviews your entire codebase using parallel sub-agents.
Agent count scales automatically with the size of the project. Every file gets a
full, uncontaminated context budget.
Agent Scaling
| File Count | Agents Deployed | Strategy |
|---|---|---|
| < 10 files | 1 agent | Sequential - single focused pass |
| 10 – 25 files | 2 agents | Split into two parallel batches |
| 26 – 50 files | 3 agents | Three parallel batches |
| 51 – 100 files | 5 agents | Five parallel batches |
| 100+ files | 8 agents | Eight parallel batches |
Context clear after every file - each file gets a full, fresh analysis budget. Findings from file 1 do not crowd out the analysis of file 50.
Manifest System
MDD tracks audit progress using a manifest file written to .mdd/audit/.
Each file's status is tracked with a single character:
[ ]- pending, not yet reviewed[~]- in progress, agent currently reading[x]- complete, no significant findings[!]- findings recorded, needs attention[e]- error, agent failed to read this file
If an audit is interrupted - by a timeout, a crash, or a manual stop - MDD automatically detects the incomplete manifest on the next run and resumes from where it left off. No work is lost.
Finding Severity Levels
Critical
Security vulnerabilities, data loss risks, or logic errors that produce incorrect results in production.
High
Significant bugs, missing error handling, or architectural issues that will cause problems under real load.
Medium
Code quality issues, test gaps, or patterns that will become problems as the codebase grows.
Low
Style inconsistencies, minor inefficiencies, and documentation gaps that do not affect correctness.
Real Results
The Claude Code Mastery Starter Kit ran a full MDD audit on itself - 57 source files, end to end. Here are the numbers.
| Phase | Duration | Output |
|---|---|---|
| A1 - Create documentation | 8 min | Feature docs, data-flow maps, test plans |
| A2 - Read files and take notes | 18 min | 57 files reviewed, manifest complete |
| A3 - Analyse and rank findings | 7 min | 20 findings, severity-rated and prioritised |
| A5 - Fix and verify | 15 min | All fixes implemented, 125 tests green |
| Total | 48 min | Production-ready codebase, fully documented |
Source: The Claude Code Mastery Project Starter Kit self-audited itself using MDD v1.0.0. All times measured wall-clock. No manual intervention between phases.
From Starter Kit to Standalone
Where MDD came from
MDD started as a single file inside the
Claude Code Mastery Project Starter Kit.
The original mdd.md was a monolithic instruction document - roughly
28,000 tokens loaded in full on every single /mdd
invocation, regardless of which mode was being used. A /mdd status
check was carrying the same weight as a full build pipeline run.
Two changes that made it a product
1. Split into 7 focused files with lazy loading. The router
reads the mode argument and loads only the relevant command file. A
/mdd status now consumes ~460 tokens instead of 28,000. The full
instruction set is always available - never loaded unnecessarily.
2. Extracted as a standalone npm package. MDD is now
@thedecipherist/mdd - installable independently, versioned
independently, and usable in any project regardless of tech stack.
What this means for you
You no longer need the starter kit to use MDD. Any project, any tech stack, any team. Install once, use everywhere.
The starter kit still exists and is actively maintained. MDD is now one component you can adopt independently - or as part of the full kit if you want the complete scaffolding, conventions, and toolchain that surrounds it.
Dashboards
MDD ships with two companion dashboards for exploring your .mdd/ workspace.
Both are available as standalone packages today and will soon be merged directly
into the mdd package — launchable via the mdd command
without a separate install.
mdd-tui
A live terminal UI for navigating your MDD workspace without leaving the command line. Split-pane view: scrollable file list on the left, full markdown render on the right. Shows doc health, drift status, audit reports, initiative/wave progress, and ops runbooks.
Install & run:
npm install -g mdd-tui
mdd-tui
Keyboard-driven navigation (j/k to move,
h/l to switch panes, r to refresh,
q to quit). Collapsible initiative tree with wave-level progress counters.
mdd-dashboard in active development
A visual, browser-based dashboard for MDD projects. Renders your feature dependency graph as an interactive D3 diagram with live reload on file changes. Click any node to see the full doc, git history, source files, and depends-on navigation.
Status: mdd-dashboard is in active development and not yet fully operational. Early adopters welcome — expect rough edges while it catches up to the full MDD feature set.
Install & run:
npm install -g mdd-dashboard
mdd-dashboard
# Dashboard running at http://localhost:7321
Force/tree layout toggle, three-tier filters (live search, type chips, git-aware), SSE live reload, and a mini-map overlay for large graphs.
Coming soon: Both dashboards will be merged into the mdd
package — launch either directly from the mdd CLI, no separate install needed.
Companion Tools
MDD is one part of a broader ecosystem. These tools are designed to work alongside it - each independently useful, each better in combination.
mdd-tui
A terminal dashboard for MDD. Visualise audit progress, browse findings, track manifest status, and monitor active build pipelines - all from the command line.
Claude Code Mastery Project Starter Kit
Full project scaffolding for Claude Code. Includes MDD, StrictDB, a conventions guide, TypeScript config, pre-commit hooks, and the complete project structure that the mastery guides are built around.
StrictDB
A shared database access layer that enforces a single connection pattern across your entire project. Eliminates the class of bugs that come from multiple files managing their own database connections.