Getting Started
Install Draft as a Claude Code plugin and initialize your project in under a minute. Also available for Cursor, GitHub Copilot, and Gemini.
# Install the plugin
/plugin marketplace add mayurpise/draft
/plugin install draft
# Initialize your project (once)
/draft:init
# Create a feature track
/draft:new-track "Add user authentication"
# Start implementing
/draft:implement
# Verify test coverage (95%+ target)
/draft:coverage
# Validate quality (architecture, security, performance)
/draft:validate
# Check progress
/draft:status
Prerequisites: Claude Code CLI, Git, and Node.js 18+.
Other Editors
Cursor β One command, no clone required:
curl -o .cursorrules https://raw.githubusercontent.com/mayurpise/draft/main/integrations/cursor/.cursorrules
GitHub Copilot β One command, no clone required:
mkdir -p .github && curl -o .github/copilot-instructions.md https://raw.githubusercontent.com/mayurpise/draft/main/integrations/copilot/.github/copilot-instructions.md
Gemini β One command, no clone required:
curl -o GEMINI.md https://raw.githubusercontent.com/mayurpise/draft/main/integrations/gemini/GEMINI.md
Command Reference
Draft provides 12 slash commands for the full development lifecycle.
Overview and intent mapping
Initialize project context (product, tech-stack, workflow, architecture)
Update context files (re-scan tech stack, architecture, workflow)
Create spec + plan for a feature or fix
Execute tasks with TDD workflow
Display progress overview
Git-aware rollback at any level
Module decomposition + dependency mapping
Code coverage report (target 95%+)
Systematic quality validation (architecture, security, performance)
Generate Jira export for review
Push issues to Jira via MCP
The Core Problem
AI coding assistants are powerful but undirected. Without structure, they make assumptions, choose arbitrary approaches, and produce code that doesn't fit your codebase.
Assumption-Driven
Guesses at requirements instead of asking clarifying questions
Arbitrary Choices
Picks random technical approaches without considering your stack
Poor Fit
Produces code that doesn't match existing patterns or conventions
No Checkpoints
Skips verification and claims completion without proof
Problems with Chat-Driven Development
Traditional AI chat interfaces have fundamental limitations that get worse over time.
Context Window Fills Up
Long chats exhaust token limits; AI loses early context and forgets decisions
Hallucination Increases
More tokens in context means more confusion and worse decisions
No Persistent Memory
Close the chat, lose the context. Every session starts from zero.
Unsearchable History
"Where did I work on feature X?" β good luck finding it in chat logs
No Team Visibility
Your chat history is invisible to colleagues. No review, no audit trail.
Repeated Context Loading
Every new session requires re-explaining the project from scratch
How Draft Solves This
The Draft Workflow
Draft solves this through Context-Driven Development: structured documents that constrain and guide AI behavior. By treating context as a managed artifact alongside code, your repository becomes the single source of truth.
Step 1: Context β Why it exists
Without context, AI reinvents your project from scratch every session. It guesses your tech stack, ignores your conventions, and builds features that don't fit. /draft:init fixes this by creating persistent files that tell the AI who your users are (product.md), what technologies to use (tech-stack.md), and how your team works (workflow.md). For existing codebases, it also generates architecture.md β a deep system map with mermaid diagrams covering directory structure, entry points, data flows, design patterns, existing module dependencies, and external integrations. This means every future track gets immediate, rich context without re-analyzing the codebase. These files live in git, survive across sessions, and load automatically β so the AI always starts with your ground truth instead of assumptions.
Step 2: Spec & Plan β Why it exists
When you ask AI to "add authentication," it immediately writes code. If the approach is wrong, you discover it during code review β after hours of work. /draft:new-track forces the AI to write a specification and phased plan before touching code. You review the approach in a quick spec PR, not a massive code PR. Disagreements get resolved in a 5-minute document edit instead of a multi-hour rewrite. The plan breaks work into phases with verification steps, so the AI tackles one thing at a time instead of attempting everything at once.
Step 3: Decompose β Why it exists (optional)
For multi-module features, jumping straight to implementation creates tangled code with unclear boundaries. /draft:decompose maps your feature into discrete modules with defined responsibilities, API surfaces, and a dependency graph. This gives you an implementation order (build the database layer before the API layer) and prevents circular dependencies. Each module is small enough to reason about, test independently, and review in isolation.
Step 4: Implement β Why it exists
Even with a plan, AI can drift: skip tests, claim completion without proof, or make sweeping changes across unrelated files. /draft:implement executes one task at a time from the plan, follows the TDD cycle (write test first, then code, then refactor), runs a verification gate before marking anything complete, and triggers a two-stage review at phase boundaries. The AI can only work on what's specified, in the order specified, with proof required at every step.
Step 5: Verify Quality β Why it exists
Passing tests doesn't guarantee good code. AI can violate architectural patterns, introduce security vulnerabilities, or create performance bottlenecks β all while every test passes. /draft:coverage measures test completeness (95%+ target) and classifies uncovered lines. /draft:validate runs context-aware quality checks: architecture conformance (patterns from architecture.md), security scans (hardcoded secrets, SQL injection, XSS), performance anti-patterns (N+1 queries, blocking I/O), and regression risk (blast radius of changes). Both generate reports with file:line references and actionable remediation. Auto-runs at track completion when enabled in workflow.md β non-blocking by default to maintain velocity while surfacing issues.
The Constraint Hierarchy
Each document layer narrows the solution space. By the time AI writes code, most decisions are already made.
The AI becomes an executor of pre-approved work, not an autonomous decision-maker. Explicit specs, phased plans, verification steps, and status markers keep implementation focused and accountable.
Review Before Code
This is Draft's most important feature. In traditional AI coding, you discover the AI's design decisions during code review β after it's already built the wrong thing. With Draft, the AI writes a spec first. You review the approach in a document, not a diff. Disagreements are resolved by editing a paragraph, not rewriting a module.
Practical impact: Faster reviews (approve approach, not implementation details). Fewer rewrites (catch design issues before code exists). Knowledge transfer (specs document why, not just what). Onboarding (new team members read specs to understand features).
Team Workflow: Alignment Before Code
Draft's most powerful application is team-wide: every markdown file goes through commit β review β update β merge before a single line of code is written. By the time implementation starts, the entire team has already agreed on what to build, how to build it, and in what order.
The PR cycle on documents, not code
/draft:init. For brownfield projects, Draft performs deep architecture discovery β generating architecture.md with mermaid diagrams of system structure, data flows, and patterns. Team reviews project vision, technical choices, system architecture, and workflow preferences via PR. Product managers review product.md without reading code. Engineers review architecture.md and tech-stack.md without context-switching into implementation./draft:new-track. Team reviews requirements, acceptance criteria, phased task breakdown, and dependencies via PR. Disagreements surface as markdown comments β resolved by editing a paragraph, not rewriting a module./draft:decompose. Team reviews module boundaries, API surfaces, dependency graph, and implementation order via PR. Senior engineers validate the architecture without touching the codebase./draft:jira-preview and /draft:jira-create. Epics, stories, and sub-tasks are created from the approved plan. Individual team members pick up Jira stories and implement β with or without Draft's /draft:implement.spec.md), in what order (plan.md), with what boundaries (architecture.md). After implementation, /draft:coverage verifies tests (95%+ target) and /draft:validate checks quality (architecture conformance, security, performance). Both generate reports in the track directory for PR review.Why this changes how teams work
spec.md and plan.md to understand featuresThe CLI is single-user, but the artifacts it produces are the collaboration layer. Draft handles planning and decomposition. Git handles review. Jira handles distribution. Changing a sentence in spec.md takes seconds. Changing an architectural decision after 2,000 lines of code takes days.
Project Structure
Draft uses a set of markdown files to capture project context, specifications, and implementation plans. Each file has a specific purpose.
Product vision, target users, and success criteria
Style, branding, and UX standards
Languages, frameworks, and patterns
System map, data flows, patterns, mermaid diagrams (brownfield)
TDD preferences and commit strategy
Jira project config for sync (optional)
Master list of all work tracks
Requirements for a specific track
Module decomposition and dependencies (optional)
draft/
βββ product.md # Product vision and goals
βββ tech-stack.md # Technical choices
βββ architecture.md # System map + mermaid diagrams (brownfield)
βββ workflow.md # TDD, commit, validation, architecture mode
βββ validation-report.md # Project-level quality checks (generated)
βββ jira.md # Jira project config (optional)
βββ tracks.md # Master track list
βββ tracks/
βββ <track-id>/
βββ spec.md # Requirements
βββ plan.md # Phased task breakdown
βββ architecture.md # Track modules (optional)
βββ metadata.json
βββ validation-report.md # Quality checks (generated)
βββ jira-export.md # Jira stories (optional)
Status Markers
Simple markers track progress throughout specs and plans. Progress is explicit, not assumed.
Evidence before claims, always. Never mark [x] without running verification, confirming output shows success, and showing evidence in the response.
Jira Integration
Sync tracks to Jira with a two-step workflow. Preview before pushing to catch issues early.
Preview
Generate jira-export.md with epic and stories
Review
Adjust story points, descriptions, acceptance criteria
Create
Push to Jira via MCP server
Auto Story Points
Story points are calculated from task count:
TDD Workflow
AI-generated code without tests is a liability β it works until it doesn't, and you have no safety net. When TDD is enabled in workflow.md, Draft forces the AI to prove its code works at every step.
feat(track-id): description). Small, focused commits make reverts surgical and git blame useful.Why this matters for engineers: Every completed task has a test proving it works. You can refactor with confidence, onboard new team members who read tests as documentation, and revert individual tasks without collateral damage. The AI can't claim "it should work" β it has to show evidence.
Architecture Discovery
For brownfield projects, /draft:init doesn't just detect your tech stack β it performs a deep three-phase codebase analysis that generates architecture.md. This document becomes the persistent context every future track references, so the AI never has to re-analyze your codebase from scratch.
Why this exists
Without architecture discovery, every new track starts cold. The AI explores your codebase, builds a mental model, and starts working β then loses that understanding when the session ends. The next track starts the same exploration over again. Architecture discovery pays the analysis cost once during init, then every track, every question, and every implementation gets immediate, rich context about how your system actually works.
Phase 1: Orientation (The System Map)
Scans the codebase to produce a high-level system map with mermaid diagrams.
System Architecture
Layered architecture diagram showing actual components β presentation, business logic, and data layers with real names from the codebase.
Directory Hierarchy
Maps every top-level directory to its single responsibility and key files. Generates a tree diagram of the project structure.
Entry Points
Identifies all entry points: API routes, main loops, event listeners, CLI commands, serverless handlers. Critical paths through the system.
Request/Response Flow
Traces one representative request through the full stack with actual file and class names β not generic placeholders.
Tech Stack Inventory
Cross-references detected dependencies with config files. Records language versions, framework versions, and where each is configured.
Phase 2: Logic (The "How" & "Why")
Examines specific files and functions to understand business logic, data flows, and patterns.
Data Lifecycle
Maps how 3-5 primary domain objects enter the system, where they're modified, and where they're persisted. Mermaid flowchart of the data pipeline.
Design Patterns
Identifies dominant patterns: Repository, Factory, Middleware, Observer, etc. Documents where each is used and why.
Complexity Hotspots
Flags god objects, circular dependencies, and high-complexity areas. Unclear business logic is marked "Unknown/Legacy Context Required" β never guessed.
Conventions
Extracts existing conventions: error handling, logging, naming, validation patterns. New code must respect these guardrails.
External Dependencies
Maps external service integrations: auth providers, email services, storage, queues, third-party APIs. Mermaid diagram of all connections.
Phase 3: Module Discovery (Existing Modules)
Reverse-engineers the existing module structure from import graphs and directory boundaries. This is discovering what already exists β not planning new modules (that's /draft:decompose).
Module Dependencies
Analyzes imports to build a dependency graph of existing modules. Detects circular dependencies. Mermaid diagram with actual module names.
Module Inventory
Each module documented with: responsibility, source files, exported API surface, dependencies, complexity rating, and a story summarizing what it does.
Dependency Order
Topological ordering from leaf modules (foundational, no dependencies) to the most dependent. Shows which parts of the system are the foundation.
/draft:init discovers and documents existing modules (marked [x] Existing). /draft:decompose plans new modules for features or refactors. Both write to the same section of architecture.md β init sets the baseline, decompose extends it. Existing modules are never removed by decompose.
Refresh Mode
/draft:init refresh re-scans the codebase and diffs against the existing architecture.md. It detects new directories, removed components, changed integration points, new domain objects, and new or merged modules β then updates all mermaid diagrams and module documentation to reflect the current state. Changes are presented for review before writing.
Pay the analysis cost once, benefit on every track. Architecture discovery turns your codebase into a documented system that any AI assistant can understand instantly. Every /draft:new-track starts with full context: where things are, how they connect, what patterns to follow, and what to avoid.
Architecture Mode
Standard Draft gives you specs and plans. Architecture Mode goes deeper β it forces the AI to design before it codes. Every module gets a dependency analysis. Every algorithm gets documented in plain language. Every function signature gets approved before implementation begins. This is how you build complex features without the AI creating a tangled mess.
Why Architecture Mode exists
When AI builds a multi-module feature, it makes ad-hoc decisions about module boundaries, function signatures, and data flow. These decisions compound β a bad interface choice in module A cascades through modules B, C, and D. By the time you notice, the entire implementation needs restructuring. Architecture Mode front-loads these decisions into reviewable checkpoints where changes cost minutes instead of hours.
Module Decomposition
Problem: AI creates tangled code with unclear boundaries. Solution: Break the feature into 1-3 file modules with defined APIs, dependencies, and implementation order. You review the architecture before any code is written.
Algorithm Stories
Problem: AI jumps to code without understanding the algorithm. Solution: Write a natural-language Input β Process β Output description at the top of each file. You approve the algorithm before the AI writes a single line of implementation.
Execution State
Problem: AI invents random variable names and data structures on the fly. Solution: Define all intermediate state variables (input, processing, output, error) before coding. You control the data model.
Function Skeletons
Problem: AI creates functions with unclear signatures and unexpected interfaces. Solution: Generate stubs with complete types, parameters, and docstrings β no bodies. You approve function names and contracts before TDD begins.
Chunk Reviews
Problem: AI dumps 500+ lines in one shot, making review impossible. Solution: Implementation is capped at ~200-line chunks with mandatory developer review after each. Every chunk is a reviewable, committable unit.
Code Coverage
Problem: AI writes tests that look good but miss critical paths. Solution: Auto-detect your coverage tool, run it, classify every uncovered line (testable / defensive / infrastructure), and suggest specific tests for gaps.
How each checkpoint helps engineers
/draft:coverage measures test quality. Every uncovered line is classified: testable (needs a test), defensive (acceptable), or infrastructure (acceptable). You decide what matters, not the AI./draft:validate runs systematic quality checks using Draft context. Detects architecture violations (patterns from architecture.md), security issues (hardcoded secrets, SQL injection, XSS), performance anti-patterns (N+1 queries, blocking I/O), and regression risks (blast radius analysis). Generates validation-report.md with actionable fixes. Non-blocking by default β surfaces issues without halting progress.Implementation Flow
The decomposition process
Before Architecture Mode's checkpoints activate, /draft:decompose maps your feature into modules. Here's what happens concretely:
Architecture Mode is optional. Simple features, bug fixes, and config changes use the standard Draft workflow. Enable it when module boundaries, algorithm design, and coverage measurement add value. Good fit: multi-module features, new projects, complex algorithms, teams wanting maximum review granularity. Overkill: simple features touching 1-2 files, bug fixes with clear scope, configuration changes.
Revert Workflow
AI makes mistakes. When it does, you need to undo cleanly β not just git reset --hard and lose everything. Draft's revert understands the logical structure of your work. It knows which commits belong to which task, which tasks belong to which phase, and it updates both git history and Draft's tracking state together. You pick the granularity, review what will change, and confirm before anything happens.
Quality Disciplines
AI's default failure mode is to guess at fixes, skip verification, and claim success. Draft embeds three quality agents directly into the workflow β they activate automatically at the right moments and enforce disciplined engineering practices.
Systematic Debugging
The problem: When AI hits an error, it tries random changes hoping something sticks. Each "fix" often introduces new bugs. The solution: When a task is blocked ([!]), the Debugger Agent enforces a four-phase process that mirrors how senior engineers actually debug β understand first, then fix.
Why this matters: After 3 failed hypothesis cycles, the agent escalates to you with everything it has learned and eliminated β no more silent spirals of random attempts. Root cause is documented in plan.md, so the team learns from every bug.
Two-Stage Review
The problem: AI happily moves on to the next phase even if it missed requirements or wrote poor code. The solution: At every phase boundary, the Reviewer Agent runs two sequential checks. Stage 1 catches what's missing. Stage 2 catches what's messy. Only when both pass does the work proceed.
Why this matters: Critical issues (broken functionality, security vulnerabilities) must be fixed before proceeding β no exceptions. Important issues should be fixed. Minor issues are noted but don't block. This prevents both perfectionism paralysis and quality erosion.
Code Coverage
The problem: TDD ensures you write tests, but doesn't guarantee those tests are comprehensive. You can have 100% of your tests passing while 40% of your code is untested. The solution: /draft:coverage runs your project's coverage tool and classifies every uncovered line, so you know exactly what's tested, what's not, and whether that matters.
Should be covered. Suggests specific tests to write.
Error handlers for impossible states. Acceptable to leave.
Framework boilerplate and entry points. Acceptable.
Systematic Validation
The problem: AI can pass all tests while violating architectural patterns, introducing security vulnerabilities, or creating performance bottlenecks. Tests measure "does it work" but not "is it good." The solution: /draft:validate uses Draft context (architecture.md, tech-stack.md) to catch quality issues tests miss β architecture violations, hardcoded secrets, N+1 queries, missing input validation, and more.
Pattern violations, layer boundaries, dependency rules
Hardcoded secrets, SQL injection, XSS, weak hashing
N+1 queries, blocking I/O, missing pagination
Blast radius analysis, critical path detection
Why this matters: Validation runs automatically at track completion (configurable in workflow.md). Non-blocking by default β issues documented in validation-report.md with file:line references and remediation guidance. Complements coverage (quantitative test metrics) with qualitative codebase health checks.
The Economics
Writing specs feels slower. It isn't. The overhead is constant (~20% for simple tasks), but savings scale with complexity, team size, and criticality.
For critical product development, Draft isn't overhead β it's risk mitigation.
Core Principles
Plan before you build
Create specs and plans that guide development before writing code
Maintain context
Ensure agents follow style guides and product goals consistently
Iterate safely
Review plans before code is written, catch issues early
Work as a team
Share project context across team members through git-tracked specs
Verify before claiming
Evidence before assertions, always β run tests, show proof
When to Use Draft
Good fit
Design Decisions
Features requiring architecture choices, API design, or data model decisions
Team Review
Work that will be reviewed by others β specs are faster to review than code
Multi-Step Work
Complex implementations spanning multiple files, modules, or phases
Repeated Failures
Anything where "just do it" has resulted in rework or misalignment
Overkill
One-line bug fixes, typo corrections, exploratory prototypes you'll throw away, simple config changes.
Constraint Mechanisms
How Draft keeps AI focused and accountable:
Draft adds structure. Use it when structure has value. The AI becomes an executor of pre-approved work, not an autonomous decision-maker.