Magic Specification-Driven Development (SDD) Workflow
Project description
๐ช Magic Spec
Specification-Driven Development (SDD) workflow for AI coding agents.
Stop your AI from writing code before it understands the problem.
magic-spec installs a structured pipeline โ Thought โ Spec โ Task โ Run โ Code โ directly into any project, regardless of stack.
โจ What is Magic Spec?
magic-spec is a set of markdown-based workflow instructions for AI coding agents (Cursor, Claude, Gemini, Copilot, etc.). It acts as an operating system for agentic development, enforcing a rigorous, structured pipeline:
๐ก Idea โ ๐ Specification โ ๐บ๏ธ Task & Plan โ โก Run โ ๐ Code
Once installed, your AI agent will automatically:
- Convert raw thoughts into structured specification files.
- Build a phased implementation plan from approved specs.
- Decompose the plan into atomic, trackable tasks.
- Analyze its own workflow and suggest improvements โ automatically, at phase completion.
No code is written until a specification exists. No spec is implemented without a plan.
๐ Quick Start
Works with any project โ Rust, Go, Python, JavaScript, or anything else.
No runtime lock-in. Requires only Node.js or Python to install.
Option A โ Node.js (npx)
npx magic-spec@latest
Option B โ Python (uvx)
uvx magic-spec
Both commands do exactly the same thing:
- Copy
.magic/(the SDD engine) into your project. - Copy
.agent/workflows/magic.*.md(agent trigger wrappers) into your project. - Run the init script โ creates your
.design/workspace withINDEX.mdandRULES.md.
๐งญ Core Philosophy
| Principle | Description |
|---|---|
| Specs First, Code Later | The agent is forbidden from writing code from raw input. All ideas become specs first. |
| Deterministic Process | A strict pipeline is enforced: Thought โ Spec โ Task โ Run โ Code. |
| Constitution-Driven | All project decisions live in .design/RULES.md โ the project's living constitution. |
| Self-Improving | After each phase and at plan completion, the Task workflow automatically runs a retrospective and generates improvement recommendations. |
๐ฉบ System Health (CLI Doctor)
You can check if your SDD workspace is properly initialized and healthy without invoking the AI. Just append the --doctor (or --check) flag:
npx magic-spec@latest --doctor
# or
uvx magic-spec --doctor
This returns a visually formatted validation report of your project's .design structure, preventing broken context before you start coding.
๐ What Gets Installed
After running npx magic-spec@latest in your project root:
your-project/
โ
โโโ .agent/workflows/ # Agent entry points (slash commands)
โ โโโ magic.onboard.md # Interactive tutorial for new devs
โ โโโ magic.rule.md
โ โโโ magic.run.md
โ โโโ magic.spec.md
โ โโโ magic.task.md
โ
โโโ .magic/ # SDD Engine (workflow logic, read-only)
โ โโโ init.md
โ โโโ onboard.md # Onboarding script payload
โ โโโ retrospective.md
โ โโโ rule.md
โ โโโ run.md
โ โโโ spec.md
โ โโโ task.md
โ โโโ scripts/
โ โโโ check-prerequisites.* # Used by --doctor
โ โโโ generate-context.* # Auto-compiles CONTEXT.md
โ โโโ init.sh # Init for macOS / Linux
โ โโโ init.ps1 # Init for Windows
โ
โโโ .design/ # Your project workspace (generated)
โโโ INDEX.md # Spec registry
โโโ RULES.md # Project constitution
โโโ PLAN.md # Implementation plan
โโโ specifications/ # Your specification files
โโโ tasks/ # Task breakdowns per phase
๐ The Workflow Pipeline
graph TD
IDEA["๐ก Idea"] --> INIT{"๐๏ธ Auto-Init"}
INIT -->|.design/ exists| SPEC
INIT -->|.design/ missing| CREATE["Create .design/ structure"] --> SPEC
SPEC["๐ Specification"] <--> RULE["๐ Rule"]
SPEC --> TASK["๐บ๏ธ Task & Plan"]
TASK --> RUN["โก Run"]
RUN --> CODE["๐ Code"]
RUN -.->|"auto: phase done"| RETRO["๐ Retrospective"]
RETRO -.->|Feedback loop| SPEC
Core Workflows
| # | Workflow | Purpose |
|---|---|---|
| 1 | Specification | Converts raw thoughts into structured specs. Verifies specs against project state. Manages statuses: Draft โ RFC โ Stable โ Deprecated. |
| 2 | Task | Reads Stable specs, builds a dependency graph, produces a phased PLAN.md, and decomposes into atomic tasks. |
| 3 | Run | Executes tasks with sequential and parallel tracks. Automatically runs a retrospective at phase and plan completion. |
Auxiliary Workflows
| Workflow | Purpose |
|---|---|
| Rule | Manages the project constitution (RULES.md ยง7). Add, amend, or remove conventions. |
| Onboard | Interactive tutorial guiding new developers through their first Magic SDD cycle. |
Retrospective runs automatically inside the Run workflow โ at phase completion (snapshot) and plan completion (full analysis). No manual command needed.
๐ฌ How to Use (with any AI agent)
Just talk to your AI agent naturally. Initialization is automatic โ no setup command required.
"Dispatch this thought into specs: I want a user auth system with JWT and Redis..."
โ Runs Specification workflow
"Create an implementation plan"
โ Runs Task workflow
"Generate tasks for Phase 1"
โ Runs Task workflow
"Execute the next task"
โ Runs Run workflow
"Add rule: always use snake_case for file names"
โ Runs Rule workflow
"Check if specs match the actual project state"
โ Runs Specification workflow (Consistency Check)
"Start the interactive tutorial"
โ Runs Onboard workflow
The AI reads the corresponding .magic/*.md workflow file and executes the request within the bounds of the SDD system. No code escapes the pipeline. โจ
๐ Updating
Pull the latest engine improvements without touching your project data:
# Node.js
npx magic-spec@latest --update
# Python
uvx magic-spec --update
The update overwrites .magic/ (the engine) but never touches .design/ (your specs, plans, and tasks).
๐ค Compatibility
Works with any AI coding agent that can read markdown workflow files:
- Cursor (
.cursorrules+ Agent mode) - Claude (Projects)
- Gemini (via Gemini Code)
- GitHub Copilot (Agent mode)
- Any terminal-based or API-driven agent
๐ License
MIT ยฉ 2026 Oleg Alexandrov
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file magic_spec-1.2.3.tar.gz.
File metadata
- Download URL: magic_spec-1.2.3.tar.gz
- Upload date:
- Size: 7.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
565424831db6bb380f1f50d57ad0052a0f8623e2ae8de119ea34e1584178e6ad
|
|
| MD5 |
4af3b4df92bcc01ba76704f86914b8a3
|
|
| BLAKE2b-256 |
dad60c40f8aba887d35810d8584692ee279c25ad0cb09fe7c0a5e9b43b266d0a
|
File details
Details for the file magic_spec-1.2.3-py3-none-any.whl.
File metadata
- Download URL: magic_spec-1.2.3-py3-none-any.whl
- Upload date:
- Size: 8.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fbfc0f5b44f1c20a941b4c01304b96726a237d98c7d641b9d12a874399538ccf
|
|
| MD5 |
4109f4d9d3f525e19a40f839e2da39fb
|
|
| BLAKE2b-256 |
73e65cb6ac273fdb654eaea107397825415b74cad31203529ff1a9a8c23111af
|