@@ -61,107 +61,116 @@ OpenSpec turns specifications into living documentation that drives development.
6161
6262## Getting Started
6363
64- ### 1. Initialize Your Project
64+ ### 1. Initialize OpenSpec in Your Project
6565
6666``` bash
67- # Create a new project or navigate to existing one
68- mkdir my-project && cd my-project
67+ # Navigate to your project
68+ cd my-project
6969
7070# Initialize OpenSpec
7171openspec init
7272
73+ # You'll be asked:
74+ # "Which AI tool do you use?"
75+ # > Claude Code
76+ # Cursor (coming soon)
77+ # Aider (coming soon)
78+ # Continue (coming soon)
79+
7380# This creates:
7481# openspec/
75- # ├── specs/ # Your specifications
82+ # ├── specs/ # Current specifications (truth)
7683# ├── changes/ # Proposed changes
77- # └── README.md # Instructions for your team
84+ # └── README.md # AI instructions
7885```
7986
80- ### 2. Create Your First Spec
81-
82- ``` bash
83- # Create a capability spec
84- mkdir -p openspec/specs/user-auth
85- echo " # User Authentication Specification
86-
87- ## Purpose
88- Handle user authentication and session management.
89-
90- ## Requirements
91- ### Requirement: User Login
92- The system SHALL authenticate users with email and password.
87+ ### 2. Start Working with Your AI Assistant
9388
94- #### Scenario: Valid credentials
95- - WHEN a user submits valid credentials
96- - THEN return a JWT token with 24-hour expiry" > openspec/specs/user-auth/spec.md
89+ After initialization, copy these prompts to your AI assistant (Claude Code, Cursor, etc.):
9790
98- # Validate the spec
99- openspec validate --specs
91+ ``` markdown
92+ // First, establish project context:
93+ "Please read openspec/project.md and help me fill it out
94+ with details about my project, tech stack, and conventions"
95+
96+ // Then create your first change proposal:
97+ "I want to add user authentication with JWT tokens.
98+ Please create an OpenSpec change proposal for this feature"
99+
100+ // Your AI will:
101+ // 1. Create openspec/changes/add-user-auth/
102+ // 2. Write proposal.md explaining why and what
103+ // 3. Create tasks.md with implementation steps
104+ // 4. Generate spec deltas showing what's being added
105+ // 5. Implement the code following the tasks
100106```
101107
102- ### 3. Propose a Change
108+ ### 3. AI-Driven Development Workflow
103109
104- ``` bash
105- # When you need to add two-factor authentication:
106- mkdir -p openspec/changes/add-2fa/specs/user-auth
107-
108- # Create the proposal
109- echo " ## Why
110- Improve security by requiring a second authentication factor.
111-
112- ## What Changes
113- - Add OTP-based two-factor authentication
114- - Require 2FA for admin accounts
115-
116- ## Impact
117- - Affected specs: user-auth
118- - Affected code: auth service, login UI" > openspec/changes/add-2fa/proposal.md
119-
120- # Create the delta (what's being added)
121- echo " ## ADDED Requirements
122- ### Requirement: Two-Factor Authentication
123- The system SHALL require OTP verification after password authentication.
124-
125- #### Scenario: OTP verification required
126- - WHEN a user submits valid credentials
127- - THEN prompt for OTP code
128- - AND verify code before issuing JWT" > openspec/changes/add-2fa/specs/user-auth/spec.md
129-
130- # See what changes
131- openspec diff add-2fa
110+ ``` markdown
111+ // When starting a new feature:
112+ You: "I need to add two-factor authentication to our auth system"
113+
114+ AI: "I'll create an OpenSpec change proposal for 2FA. Let me first
115+ check the current auth specs..."
116+ *reads openspec/specs/user-auth/spec.md*
117+ *creates openspec/changes/add-2fa/ with:*
118+ - proposal.md (why and impact)
119+ - tasks.md (implementation checklist)
120+ - design.md (technical decisions)
121+ - specs/user-auth/spec.md (ADDED requirements)
122+
123+ You: "Great, let's implement it"
124+
125+ AI: "Following the tasks in openspec/changes/add-2fa/tasks.md:
126+ Task 1.1: Create OTP model..."
127+ *implements each task, marking complete*
132128```
133129
134- ### 4. Track Implementation
130+ ### 4. Track and Complete Changes
135131
136132``` bash
137- # View active changes
133+ # View active changes (what's being worked on)
138134openspec list
139135
140- # Show change details
141- openspec show add-2fa
136+ # See the difference between proposed and current specs
137+ openspec diff add-2fa
138+
139+ # Validate your changes are properly formatted
140+ openspec validate add-2fa --strict
142141
143- # After implementing , archive the change
142+ # After deployment , archive the completed change
144143openspec archive add-2fa
144+ # This moves the change to archive/ and updates specs/
145145```
146146
147- ## Minimal Example
147+ ### Key Points
148+
149+ - ** You don't write spec files manually** - Your AI assistant creates them
150+ - ** Specs are living documentation** - They evolve with your code
151+ - ** Changes are proposals** - They show what will be modified before implementation
152+ - ** AI follows the specs** - Ensuring consistent, documented development
153+
154+ ## Example: How AI Creates OpenSpec Files
148155
149- Directory structure :
156+ When you ask your AI assistant to "add two-factor authentication", it creates :
150157
151158```
152159openspec/
153160├── specs/
154161│ └── auth/
155- │ └── spec.md
162+ │ └── spec.md # Current auth spec (if exists)
156163└── changes/
157- └── add-2fa/
158- ├── proposal.md
164+ └── add-2fa/ # AI creates this entire structure
165+ ├── proposal.md # Why and what changes
166+ ├── tasks.md # Implementation checklist
167+ ├── design.md # Technical decisions (optional)
159168 └── specs/
160169 └── auth/
161- └── spec.md # delta format
170+ └── spec.md # Delta showing additions
162171```
163172
164- Spec format ( ` openspec/specs/auth/spec.md ` ):
173+ ### AI-Generated Spec (created in ` openspec/specs/auth/spec.md ` ):
165174
166175``` markdown
167176# Auth Specification
@@ -178,7 +187,7 @@ The system SHALL issue a JWT on successful login.
178187- THEN a JWT is returned
179188```
180189
181- Change delta format ( ` openspec/changes/add-2fa/specs/auth/spec.md ` ):
190+ ### AI-Generated Change Delta (created in ` openspec/changes/add-2fa/specs/auth/spec.md ` ):
182191
183192``` markdown
184193# Delta for Auth
@@ -192,6 +201,25 @@ The system MUST require a second factor during login.
192201- THEN an OTP challenge is required
193202```
194203
204+ ### AI-Generated Tasks (created in ` openspec/changes/add-2fa/tasks.md ` ):
205+
206+ ``` markdown
207+ ## 1. Database Setup
208+ - [ ] 1.1 Add OTP secret column to users table
209+ - [ ] 1.2 Create OTP verification logs table
210+
211+ ## 2. Backend Implementation
212+ - [ ] 2.1 Add OTP generation endpoint
213+ - [ ] 2.2 Modify login flow to require OTP
214+ - [ ] 2.3 Add OTP verification endpoint
215+
216+ ## 3. Frontend Updates
217+ - [ ] 3.1 Create OTP input component
218+ - [ ] 3.2 Update login flow UI
219+ ```
220+
221+ ** Important:** You don't create these files manually. Your AI assistant generates them based on your requirements and the existing codebase.
222+
195223### Understanding Delta Format
196224
197225Deltas describe how specifications change using operation headers:
@@ -259,50 +287,73 @@ Outputs shape:
259287
260288## AI Integration
261289
262- OpenSpec is designed to work seamlessly with AI coding assistants like Claude, GitHub Copilot, and Cursor .
290+ OpenSpec is built for AI-driven development. Your AI assistant creates and manages all specs and changes .
263291
264- ### How AI Assistants Use OpenSpec
292+ ### The AI Workflow
265293
266- 1 . ** Context Loading ** - AI reads specs to understand current capabilities
267- 2 . ** Change Creation ** - AI creates properly formatted proposals and deltas
268- 3 . ** Task Execution ** - AI follows tasks.md to implement changes systematically
269- 4 . ** Validation ** - AI uses CLI to validate changes before committing
294+ 1 . ** You describe what you want ** - "Add user authentication" or "Improve performance"
295+ 2 . ** AI creates the change proposal ** - Generates proposal.md, tasks.md, and spec deltas
296+ 3 . ** AI implements following specs ** - Works through tasks.md systematically
297+ 4 . ** You deploy and archive ** - Once deployed, archive the change to update specs
270298
271- ### Setting Up AI Integration
299+ ### How Your AI Assistant Works with OpenSpec
300+
301+ ``` markdown
302+ // Starting a new feature:
303+ You: "Add password reset functionality"
304+
305+ AI: "I'll create an OpenSpec change proposal. Let me check the current auth specs first..."
306+ *Runs: openspec list --specs*
307+ *Reads: openspec/specs/auth/spec.md*
308+ *Creates: openspec/changes/add-password-reset/*
309+
310+ // AI automatically:
311+ - Checks existing specs to understand current state
312+ - Creates properly structured change proposals
313+ - Generates spec deltas showing what's being added/modified
314+ - Implements code following the tasks checklist
315+ - Validates changes with openspec validate
316+ ```
317+
318+ ### Setting Up Your AI Assistant
272319
273320``` bash
274- # Update AI configuration files (only modifies existing files)
275- openspec update
321+ # After running 'openspec init', your AI is configured
322+ # The init command:
323+ # 1. Asks which AI tool you use (Claude Code, Cursor, etc.)
324+ # 2. Creates the appropriate configuration files
325+ # 3. Sets up AI-specific instructions
276326
277- # This updates:
278- # - openspec/README.md with latest conventions
279- # - CLAUDE.md (if exists) with Claude-specific instructions
280- # - .cursorrules (if exists) with Cursor rules
281- # - Other AI config files as needed
327+ # To update AI configurations later:
328+ openspec update
282329```
283330
284- ### Example AI Workflow
331+ ### What Makes OpenSpec AI-Native
285332
286- ``` markdown
287- // Tell your AI assistant:
288- "We use OpenSpec for spec-driven development.
289- Before making changes, check openspec/specs/ for current state.
290- Create proposals in openspec/changes/ for new features."
291-
292- // AI will then:
293- 1. Run `openspec list --specs` to see capabilities
294- 2. Read relevant specs with `openspec show <spec>`
295- 3. Create change proposal if needed
296- 4. Implement following the tasks.md checklist
297- 5. Validate with `openspec validate --strict`
298- ```
333+ - ** Structured Format** - AI understands the exact format for specs and changes
334+ - ** Clear Conventions** - Requirements use SHALL/MUST, scenarios follow patterns
335+ - ** Validation Tools** - AI can verify its work with ` openspec validate `
336+ - ** Task Tracking** - AI marks tasks complete as it implements
337+ - ** Context Aware** - AI reads existing specs before making changes
299338
300- ### Best Practices for AI Development
339+ ### Common AI Commands
301340
302- - Always have AI read specs before implementing
303- - Use ` openspec validate ` to catch formatting issues
304- - Let AI create proposals for complex changes
305- - Archive changes only after deployment
341+ ``` markdown
342+ // Creating changes:
343+ "Create an OpenSpec change proposal for [feature]"
344+ "Add a new capability for [functionality]"
345+ "Modify the [spec-name] spec to include [enhancement]"
346+
347+ // Implementation:
348+ "Implement the tasks in openspec/changes/[change-name]/tasks.md"
349+ "Continue with the next task"
350+ "Mark task 2.1 as complete"
351+
352+ // Validation:
353+ "Validate the current change with openspec"
354+ "Check if the spec formatting is correct"
355+ "Show me the diff for this change"
356+ ```
306357
307358## Comparison with Alternatives
308359
0 commit comments