openspec validate
Validates change proposals and specifications for correct formatting.
openspec validate [item] [options]Arguments
Section titled “Arguments”| Argument | Description |
|---|---|
item | Change or spec name (optional - validates all if omitted) |
Options
Section titled “Options”| Option | Description |
|---|---|
--strict | Comprehensive validation |
--type <type> | Force type: change or spec |
--json | Machine-readable output |
--no-interactive | Disable spinner (for CI) |
Validation Checks
Section titled “Validation Checks”Basic Checks
Section titled “Basic Checks”- Directory structure exists
- Required files present (
proposal.md,tasks.md) - Spec files parseable
Strict Mode (--strict)
Section titled “Strict Mode (--strict)”- Scenario format:
#### Scenario: Name - Requirement wording: SHALL/MUST
- Delta operations valid
- No empty sections
- At least one scenario per requirement
Output
Section titled “Output”Success
Section titled “Success”$ openspec validate add-user-auth --strict
✓ add-user-auth validated successfullyErrors
Section titled “Errors”$ openspec validate add-user-auth --strict
✗ add-user-auth validation failed
Errors: specs/auth/spec.md:15 - Requirement must have at least one scenario specs/auth/spec.md:23 - Invalid scenario format (use #### Scenario:)Examples
Section titled “Examples”Validate specific change
Section titled “Validate specific change”openspec validate my-changeStrict validation
Section titled “Strict validation”openspec validate my-change --strictValidate all changes
Section titled “Validate all changes”openspec validate --strictCI/CD usage
Section titled “CI/CD usage”openspec validate --strict --no-interactiveJSON output for parsing
Section titled “JSON output for parsing”openspec validate my-change --jsonCommon Errors
Section titled “Common Errors””Requirement must have at least one scenario”
Section titled “”Requirement must have at least one scenario””Every requirement needs at least one scenario block:
### Requirement: User Login
#### Scenario: Valid credentials- **WHEN** valid email and password- **THEN** return JWT token“Invalid scenario format”
Section titled ““Invalid scenario format””Use exactly #### Scenario: (4 hashtags):
#### Scenario: Success case ✓ Correct
### Scenario: Wrong header ✗ Wrong- **Scenario: Bullet format ✗ Wrong“Change must have at least one delta”
Section titled ““Change must have at least one delta””Ensure changes/name/specs/ contains .md files with operation headers:
## ADDED Requirements...Exit Codes
Section titled “Exit Codes”| Code | Meaning |
|---|---|
| 0 | Validation passed |
| 1 | Validation failed |
| 2 | Item not found |