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 26 Modes
MDD organises its 26 modes into 8 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
🐛 Bug
/mdd bug <description>
Fix bugs without leaving the feature doc system. MDD scores all feature docs against the bug description, confirms the match, tracks the bug as Open, fixes it, and marks it Completed with a file:line reference.
- Tag + title scoring to find related docs
- Multi-doc bugs tracked independently
- Lightweight or full BUILD MODE fix path
- Permanent Bugs section in each feature doc
🔍 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
📚 Manual
/mdd manual [--force]
Generates a comprehensive, print-ready user manual at .mdd/manual/manual.md
from all feature docs and ops runbooks. Uses content hashes so only changed sections
are regenerated , fast on repeat runs.
- Table of contents with anchor links
- Plain-English feature descriptions
- Aggregated command, API, and config tables
--forceto rebuild everything from scratch
📄 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.
Projects Built with MDD
Every project listed here was built start to finish using this exact workflow - not "used MDD for some features," but spec first, feature docs second, code third. The same seven phases, the same gates, every time.
How It Gets Built
These projects all came out of the same process. The spec-import path - spending a few hours filling out a spec template with Claude Desktop before writing a line of code - is the one I keep coming back to. Here's exactly how it works:
Getting Started with This Template
⇓ Download the MDD spec templateThen follow these steps:
- Save the file as
[project-name]-spec.mdin a folder on your computer - Open Claude Desktop (Opus mode for best results)
- Upload the spec file
- Copy and paste this prompt:
I've attached the MDD spec template. I want to create [describe your project in 1-2 sentences]. Let's go through every section of this template together and fill it out completely. Ask me questions about anything unclear. By the end, I should have a fully detailed specification ready to import into MDD.
What happens next: Claude will guide you through each section, asking questions to understand your project deeply. This usually takes 4-10 hours depending on complexity. Take your time. The better the spec, the better MDD can structure and build your project.
How MDD uses this spec: When you run /mdd import-spec ./MDs/[filename].md, MDD will:
- Read and analyze the entire document
- Extract all features, systems, and capabilities
- Classify them as COMPONENT (code to write) or SPEC (behavior to implement)
- Detect your project type (Language/Toolchain, Web API, Frontend, Library, Plugin)
- Order features in the sequence a developer would actually build them
- Automatically suggest breaking into Initiatives and Waves if the project is large enough
- Show you a dry-run preview before writing any files
You don't need to structure this document in any special way. Just write a complete, detailed specification of what you're building. MDD is smart enough to understand it.
Fill out the template with Claude Desktop (Opus mode)
Upload the template and describe your project idea. Claude walks through every section with you - what the system does, how it works, the constraints, the edge cases. This takes a couple of hours, sometimes up to ten for complex systems. The goal is precision: a spec vague enough to leave room for surprises is a spec that will cause problems later.
Import the spec (one-time conversion)
Once the spec feels complete, I create a new project folder and drop the spec into a gitignored MDs/ folder. Then:
/mdd import-spec ./MDs/spec-name.md
MDD initializes the folder structure, asks a few questions, and if the spec is large enough, breaks it into initiatives and waves. This is the last time the spec document is used. From here on, the feature docs MDD generates are the source of truth.
Execute waves sequentially
MDD structures the waves so the foundation goes first - authentication before dashboards, database layer before API layer. When you start a wave, MDD generates feature docs for every capability in that wave. You run all waves until the initiative is fully documented.
Build features one at a time
Each feature doc drives one build cycle through the seven phases: understand, data flow, documentation, test skeletons, plan, implement, verify. Tests must fail before implementation starts. Tests must pass before anything ships. The feature is not done until it works in a real environment - not a mock, not a local dev shortcut.
/mdd feature-doc-name
Why this works: The spec conversation is where the hard thinking happens - not while writing code. Feature docs are the source of truth because code drifts and docs don't; if something changes, you update the doc and rebuild from it. The gates (Red Gate, Green Gate, Integration Gate) enforce correctness at every step - there's no "I'll test it later" path through the workflow.
This is not "one prompt and done." If you skip the spec work, skip the feature docs, or shortcut the gates, you'll get roughly what you'd get from any AI coding tool - something that looks right but breaks in ways you don't discover until production. The workflow is what makes the difference.
The Projects
Here's everything built with this workflow since March 2026:
MarkdownAI
Live documents powered by directives - markdown files that can query databases, call APIs, execute shell commands, and render dynamically. Six npm packages, eighty feature docs.
Spec: 4-hour conversation | Build: 2 days
StrictDB
Unified database driver with MongoDB-style syntax across PostgreSQL, MySQL, MSSQL, SQLite, and Elasticsearch. Single shared connection layer that enforces best practices automatically - one connection pool, one configuration, one source of truth.
Spec: 1,249-line architecture document
View original spec → , npm: strictdb , GitHub , .mdd/ folder
mdd-dashboard
Browser-based visual dashboard for MDD projects. Interactive D3 dependency graphs with live reload, git-aware filtering, and full doc detail on click.
CompressMCP
Lossless dictionary-based JSON key compression for MCP tool responses. Compresses tool call responses via pre/post hooks, cutting token usage without losing any data.
PipeStage
Type-safe pipeline composition for Node.js. Compose complex data transformation pipelines with built-in error handling, validation, and parallel execution support.
PeelX
Recursive nested archive extraction CLI tool. Automatically extracts nested archives (zip in tar in gz) in one command. Python-based, distributed via PyPI and GitHub Releases.
Many more in the pipeline, including MDDv2 - a full rewrite built on MarkdownAI that in early tests runs significantly faster than the current version. MDDv2 will ship as its own package when it's ready.