design-driven-dev
Design-Driven Development
This skill guides a structured design-driven development workflow. The goal is to get alignment on what you're building before writing code, which dramatically reduces rework and misunderstandings.
Critical Rule: Stop and Iterate
STOP after completing each phase. Present the document to the user for review. Incorporate their numbered feedback. Only proceed to the next phase when explicitly approved.
This is the most important part of the workflow. Don't rush through design to get to code.
DOCS_DIR Discovery
Before starting any design work, determine the documentation directory:
- Check for user configuration - Has the user specified a
DOCS_DIRenvironment variable or project config? - Default to
./docs/- This is the canonical location - Discovery scan - If not set, scan for
./docs/or./doc/directories:- If exactly one found, confirm with user: "Found docs directory at
X. Use this?" - If multiple found, ask: "Which docs directory should I use? Options: A, B"
- If exactly one found, confirm with user: "Found docs directory at
- Create if needed - If neither exists, ask: "Create
./docs/for design documents?"
Once determined, use DOCS_DIR as the root for all design documents.
Folder Structure
DOCS_DIR/
├── high-level-design.md # Single HLD for entire project
└── designs/
└── <feature-name>/
├── LLD.md # Low-level design for feature
├── <sub-feature-1>-EARS.md
├── <sub-feature-2>-EARS.md
└── ...
Example:
docs/
├── high-level-design.md
└── designs/
├── authentication/
│ ├── LLD.md
│ ├── login-EARS.md
│ ├── logout-EARS.md
│ └── password-reset-EARS.md
└── payments/
├── LLD.md
├── checkout-EARS.md
└── refunds-EARS.md
Workflow Overview
- High-Level Design (HLD) - Project vision and architecture →
DOCS_DIR/high-level-design.md - Low-Level Design (LLD) - Feature-specific technical design →
DOCS_DIR/designs/<feature>/LLD.md - EARS Specifications - Sub-feature requirements →
DOCS_DIR/designs/<feature>/<subfeature>-EARS.md
See hld-template.md for HLD structure guidance.
When to Use This Workflow
Consult this skill for ALL code changes.
Full workflow (create new docs) for:
- New features
- Major refactors
- Significant behavior changes
Coherence check only (skip doc creation) for:
- Bug fixes
- Quick changes (<30 minutes)
- Debugging sessions
Even when skipping doc creation, verify intent coherence: do existing specs, tests, and code align? If not, fix the docs before changing the code.
If unsure, use the full workflow. Over-designing is safer than under-designing.
Phase 1: High-Level Design
File: DOCS_DIR/high-level-design.md
Check if an HLD exists first. For new projects or major features, create an HLD covering:
- Problem statement and goals
- Target users and personas
- System architecture overview
- Key design decisions and trade-offs
- Non-goals (what's explicitly out of scope)
Required: Link to LLDs
## Related Designs
- [Authentication LLD](./designs/authentication/LLD.md)
- [Payments LLD](./designs/payments/LLD.md)
See hld-template.md for full structure with examples.
Stop and get user approval before proceeding.
Phase 2: Low-Level Design
File: DOCS_DIR/designs/<feature>/LLD.md
Create one LLD per major feature. Each LLD should include:
- Component overview and context
- Data models and interfaces
- API contracts (if applicable)
- Error handling and edge cases
- Dependencies
Required: Link to HLD and EARS
## Related Documents
- [High-Level Design](../high-level-design.md)
- [Login EARS](./login-EARS.md)
- [Logout EARS](./logout-EARS.md)
See lld-template.md for structure guidance, including when to use narrative vs. structured format.
Stop and get user approval before proceeding.
Phase 3: EARS Specifications
File: DOCS_DIR/designs/<feature>/<subfeature>-EARS.md
Generate requirements using EARS (Easy Approach to Requirements Syntax). Create one EARS file per sub-feature.
Required: Link to parent LLD
## Related Documents
- [Authentication LLD](./LLD.md)
See ears-syntax.md for full EARS syntax, semantic ID format, and scope disambiguation guidance.
Stop and get user approval before proceeding.
Cross-Document Linking Rules
HLD → LLD
HLD must link to all LLDs:
## Related Designs
- [Authentication LLD](./designs/authentication/LLD.md)
- [Payments LLD](./designs/payments/LLD.md)
LLD → HLD
LLD must link back to HLD:
## Related Documents
- [High-Level Design](../high-level-design.md)
LLD → EARS
LLD must link to all its EARS files:
## Requirements
- [Login Form EARS](./login-EARS.md)
- [Password Reset EARS](./password-reset-EARS.md)
EARS → LLD
EARS must link back to parent LLD:
## Related Documents
- [Authentication LLD](./LLD.md)
Maintaining Intent Coherence
The Arrow of Intent
There's a chain of documents that translates intent from vision to working code:
HLD → LLDs → EARS → Tests → Code
Each level translates the previous into more specific terms:
- HLD says what and why
- LLDs say how at a feature level
- EARS says exactly what must be true in testable terms
- Tests verify those truths
- Code makes them real
The Principle: Coherence Over History
The arrow of intent must stay coherent. When one level changes, downstream levels must be reviewed and updated to match.
Mutation, not accumulation. Update docs in place. Delete what's wrong. The documentation should always reflect current intent.
The Practice: Cascade Changes Downward
When requirements or understanding change:
- Identify the entry point - Where in the chain does this change originate?
- Update at that level - Mutate the doc directly
- Cascade downward - Review and update each subsequent level:
- HLD change → review LLDs → review EARS → review tests → review code
- LLD change → review EARS → review tests → review code
- EARS change → review tests → review code
- Delete what's obsolete - Delete specs that no longer apply
Before Implementation
Before implementing (or resuming implementation), verify coherence:
- Do the EARS specs trace to the current LLD?
- Does the LLD link to the current HLD?
- Do the tests trace to current EARS?
- If drift is detected, fix the docs first—then implement.
Code Annotation Pattern
Annotate code with @spec comments linking to EARS IDs:
// @spec AUTH-LOGIN-001, AUTH-LOGIN-002, AUTH-LOGIN-003
export function LoginForm({ ... }) {
// Implementation
}
Test files also reference specs:
// @spec AUTH-LOGIN-010
it('validates email format before submission', () => {
expect(validateEmail('invalid')).toBe(false);
});
This creates traceability from requirements → code → tests.
Why This Works
| Benefit | Why It Matters |
|---|---|
| Forced checkpoints | Catches misunderstandings before you've built the wrong thing |
| Progressive reveal | Sparsity of files makes complex features manageable |
| Cross-linking | Always know where to find related context |
| Traceability | @spec annotations link code to requirements |
| Survives session breaks | Docs persist, context doesn't get lost |
| Testable requirements | EARS format ensures requirements are verifiable |
More from ericmjl/skills
html-presentations
Create single-file HTML slide presentations with vanilla JS/CSS. Themed (terminal.css, catppuccin, nord), keyboard-navigable, with inline SVG diagrams and animations. Use when the user asks for an HTML presentation, slide deck, or single-file slides without a framework.
29agents-md-improver
Proposes updates to AGENTS.md so repo-local coding-agent instructions stay accurate, non-contradictory, and consolidated. Use when the user corrects the agent (e.g. do not do X, always do Y, from now on, remember this), asks to edit or sync AGENTS.md, CLAUDE.md, .claude/CLAUDE.md, or GEMINI.md, wants one canonical instruction file or to deduplicate agent docs, or flags conflicting or outdated repository agent rules.
22scientific-eda
Defensive exploratory data analysis for scientific data (CSV, FASTA, etc.). Context-first, human-guided; one plot at a time, ask why before executing, append-only journal per session, scripts with PEP723 and uv run, WebP plots. Use when opening data files for EDA or when the user wants guided scientific data exploration.
20skill-creator
Guide for authoring Agent Skills with strong YAML `description` triggers, progressive disclosure, and bundled resources. Use when creating or updating a skill, running init_skill.py or package_skill.py, or improving a bland skill description so agents load the skill on the right user tasks.
18ml-experimentation
Conduct machine learning experiments from planning through evaluation and report writing. Use when running ML experiments, testing hypotheses, training models, or writing up results. Covers single-hypothesis scoping, fast iteration loops, targeted logging, JOURNAL.md protocol, data-backed diagnostic plots, and scientific report writing.
16gh-cli
Use GitHub CLI (gh) for common operations like creating PRs, viewing GitHub Actions logs, managing issues, reviewing PRs, and more. Use this when you need to interact with GitHub repositories directly from the command line.
14