Skip to main content

Magic Specification-Driven Development (SDD) Workflow

Project description

๐Ÿช„ Magic Spec

NPM version PyPI version License: MIT

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:

  1. Copy .magic/ (the SDD engine) into your project.
  2. Copy .agent/workflows/magic.*.md (agent trigger wrappers) into your project.
  3. Run the init script โ€” creates your .design/ workspace with INDEX.md and RULES.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:

๐Ÿ“„ License

MIT ยฉ 2026 Oleg Alexandrov

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

magic_spec-1.2.3.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

magic_spec-1.2.3-py3-none-any.whl (8.4 kB view details)

Uploaded Python 3

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

Hashes for magic_spec-1.2.3.tar.gz
Algorithm Hash digest
SHA256 565424831db6bb380f1f50d57ad0052a0f8623e2ae8de119ea34e1584178e6ad
MD5 4af3b4df92bcc01ba76704f86914b8a3
BLAKE2b-256 dad60c40f8aba887d35810d8584692ee279c25ad0cb09fe7c0a5e9b43b266d0a

See more details on using hashes here.

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

Hashes for magic_spec-1.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 fbfc0f5b44f1c20a941b4c01304b96726a237d98c7d641b9d12a874399538ccf
MD5 4109f4d9d3f525e19a40f839e2da39fb
BLAKE2b-256 73e65cb6ac273fdb654eaea107397825415b74cad31203529ff1a9a8c23111af

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page