# OpenSpec — Spec-Driven AI Development > OpenSpec provides structured specifications that AI coding agents follow to produce consistent code. 36K+ stars. Works with Cursor, Claude Code, Copilot. MIT. ## Install Save in your project root: # OpenSpec — Spec-Driven AI Development > Structured specification format that AI coding agents follow to produce consistent, high-quality code. 36K+ GitHub stars. ## Quick Use 1. Install the VS Code extension or use the CLI: ```bash npm install -g openspec openspec init ``` 2. This creates an `openspec.yaml` in your project root: ```yaml project: name: "my-app" stack: ["Next.js", "TypeScript", "Tailwind"] specs: - name: "User Authentication" description: "OAuth2 login with Google and GitHub" requirements: - "Use NextAuth.js v5" - "Support Google and GitHub providers" - "Store sessions in database" constraints: - "No client-side token storage" - "CSRF protection enabled" ``` 3. Point your AI agent at the spec: ``` Implement the "User Authentication" spec from openspec.yaml ``` The AI agent reads the structured spec and produces code that matches all requirements and constraints. ## Intro OpenSpec is a specification-driven development (SDD) framework for AI coding assistants. Instead of writing long, ambiguous natural language prompts, you define structured specs that any AI tool can interpret consistently. Key benefits: - **Consistent output**: Same spec produces similar code regardless of which AI tool you use - **Reviewable**: Specs are version-controlled, reviewable, and diffable — unlike chat history - **Composable**: Break large features into small specs, implement incrementally - **Tool-agnostic**: Works with Cursor, Claude Code, GitHub Copilot, Codex, Windsurf - **Testable**: Specs include acceptance criteria that can be verified automatically Think of it as: `.cursorrules` tells the AI HOW to code, OpenSpec tells it WHAT to build. ## FAQ **Q: How is this different from .cursorrules or CLAUDE.md?** A: Those define coding style and conventions. OpenSpec defines features and requirements. They're complementary — use both. **Q: Does the AI agent need special support for OpenSpec?** A: No. Any AI that can read YAML/Markdown can follow OpenSpec files. The structure is self-explanatory. **Q: Can I use it for existing projects?** A: Yes. Run `openspec init` and add specs for new features. No need to spec existing code. **Q: How detailed should specs be?** A: Enough that two different developers (or AI agents) would build roughly the same thing. Include requirements, constraints, and acceptance criteria. ## Works With - Claude Code, Cursor, GitHub Copilot, Codex, Windsurf - Any AI coding agent that reads project files - VS Code (official extension) - Git (specs are version-controlled YAML files) ## Source & Thanks - GitHub: https://github.com/Fission-AI/OpenSpec (36K+ stars) - License: MIT - Docs: https://openspec.dev --- Source: https://tokrepo.com/en/workflows/5720ef91-76d7-4586-8fe8-71ba8c921d58 Author: TokRepo精选