跪拜 Guibai
← All articles
Backend · AI Programming

OpenSpec Replaces Prompt-by-Prompt AI Coding with a Spec-Driven Command Workflow

By 掉头发的王富贵 ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

Most AI coding tools still operate as smart autocomplete or one-shot chat. OpenSpec adds a repeatable, auditable process layer that turns AI from a suggestion engine into a spec-compliant implementer. For teams, the archived change folders become a machine-readable development history that an AI can resume, which changes how bugs are fixed and how code is handed off.

Summary

OpenSpec wraps AI coding assistants in a lightweight specification layer that forces requirement alignment before any code is written. Instead of ad-hoc prompting, developers run a sequence of slash commands: `/openspec-explore` to scan the codebase and clarify fuzzy requirements, `/openspec-propose` to generate a change folder containing proposal, design, task list, and delta specs, then `/openspec-apply-change` to implement the tasks step by step. A verify step checks the implementation against the spec, and archive moves the completed change into a versioned history that can be referenced later for bug fixes.

The framework is IDE-agnostic — it works with Trae, VS Code, and other editors by injecting skill files during `openspec init`. The author reports writing fewer than 100 lines of code manually over two months while git stats show 10,000 lines generated through the workflow. The key discipline is keeping changes small: one interface or one small feature per proposal, because large changes burn tokens, run unpredictably, and become hard to debug.

A full walkthrough demonstrates wiring OpenSpec to a project management tool via MCP, pulling a task from Zentao, exploring the codebase, generating specs, implementing two new API endpoints (diff and log), handling compilation errors automatically, and archiving the change. The archived change folder then serves as a retrievable context for future bug reports — point AI at the archive path and it picks up where it left off.

Takeaways
OpenSpec is not a model or IDE but a framework that layers a spec-driven process on top of any AI coding assistant.
The workflow uses four core commands: explore (optional, clarifies requirements), propose (generates proposal, design, tasks, and delta specs), apply (implements tasks sequentially), and archive (moves completed changes into versioned history).
Keeping changes small — one interface or feature per proposal — avoids token burn, unpredictable output, and maintenance headaches.
Archived changes remain addressable: pointing AI at an archive path with a bug report lets it resume the original spec context and fix the issue.
OpenSpec integrates with project management tools via MCP, pulling tasks directly from systems like Zentao using natural language.
After two months of use, the author wrote fewer than 100 lines manually while git attributed 10,000 lines to AI-generated code through the workflow.
Conclusions

OpenSpec shifts the developer's role from writing code to reviewing and steering specs — the bottleneck moves from typing speed to requirement clarity and design judgement.

The archive-as-context pattern is underappreciated: it turns each completed change into a persistent, AI-readable artifact that outlives the chat session, making bug fixes a continuation rather than a restart.

Small-change discipline is not just about token cost; it forces a granularity that makes verification and rollback practical, which is what makes the workflow production-usable rather than a demo.

The framework's IDE-agnostic design — injecting skill files during init — means the process is portable across editors, which matters for teams with mixed tooling.

Concepts & terms
Spec-Driven Development (SDD)
A development approach where a formal specification — describing what the system should do — is written and agreed upon before implementation begins. OpenSpec applies this to AI coding by generating spec files that the AI must satisfy, rather than relying on conversational prompting alone.
Delta Specs
Specification files that describe only what is changing in a particular change proposal, as opposed to the full system spec. They live inside a change folder and get merged into the main specs upon archive, keeping the authoritative spec up to date incrementally.
MCP (Model Context Protocol)
A protocol that lets AI assistants interact with external tools and data sources through natural language. In this workflow, MCP connects the AI to a project management system (Zentao) so it can fetch task details directly without manual copy-paste.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗