|
| 1 | +# Project Config Demo Guide |
| 2 | + |
| 3 | +A quick-reference guide for demonstrating the `openspec/config.yaml` feature. |
| 4 | + |
| 5 | +## Summary: What Project Config Does |
| 6 | + |
| 7 | +The feature adds `openspec/config.yaml` as a lightweight customization layer that lets teams: |
| 8 | + |
| 9 | +- **Set a default schema** - New changes automatically use this schema instead of having to specify `--schema` every time |
| 10 | +- **Inject project context** - Shared context (tech stack, conventions) shown to AI when creating any artifact |
| 11 | +- **Add per-artifact rules** - Custom rules that only apply to specific artifacts (e.g., proposal, specs) |
| 12 | + |
| 13 | +## Demo Walkthrough |
| 14 | + |
| 15 | +### Demo 1: Interactive Setup (Recommended Entry Point) |
| 16 | + |
| 17 | +The easiest way to demo is through the experimental setup command: |
| 18 | + |
| 19 | +```bash |
| 20 | +openspec artifact-experimental-setup |
| 21 | +``` |
| 22 | + |
| 23 | +After creating skills/commands, it will prompt: |
| 24 | + |
| 25 | +``` |
| 26 | +━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ |
| 27 | +
|
| 28 | +📋 Project Configuration (Optional) |
| 29 | +
|
| 30 | +Configure project defaults for OpenSpec workflows. |
| 31 | +
|
| 32 | +? Create openspec/config.yaml? (Y/n) |
| 33 | +``` |
| 34 | + |
| 35 | +Walk through: |
| 36 | + |
| 37 | +1. **Select schema** - Shows available schemas with their artifact flows |
| 38 | +2. **Add context** - Opens editor for multi-line project context (tech stack, conventions) |
| 39 | +3. **Add rules** - Checkbox to select artifacts, then line-by-line rule entry |
| 40 | + |
| 41 | +This creates `openspec/config.yaml` with the user's choices. |
| 42 | + |
| 43 | +### Demo 2: Manual Config Creation |
| 44 | + |
| 45 | +Show that users can create the config directly: |
| 46 | + |
| 47 | +```bash |
| 48 | +cat > openspec/config.yaml << 'EOF' |
| 49 | +schema: spec-driven |
| 50 | +
|
| 51 | +context: | |
| 52 | + Tech stack: TypeScript, React, Node.js, PostgreSQL |
| 53 | + API style: RESTful, documented in docs/api.md |
| 54 | + Testing: Jest + React Testing Library |
| 55 | + We value backwards compatibility for all public APIs |
| 56 | +
|
| 57 | +rules: |
| 58 | + proposal: |
| 59 | + - Include rollback plan |
| 60 | + - Identify affected teams and notify in #platform-changes |
| 61 | + specs: |
| 62 | + - Use Given/When/Then format |
| 63 | + - Reference existing patterns before inventing new ones |
| 64 | +EOF |
| 65 | +``` |
| 66 | + |
| 67 | +### Demo 3: Effect on New Changes |
| 68 | + |
| 69 | +Show that creating a new change now uses the default schema: |
| 70 | + |
| 71 | +```bash |
| 72 | +# Before config: had to specify schema |
| 73 | +openspec new change my-feature --schema spec-driven |
| 74 | + |
| 75 | +# After config: schema is automatic |
| 76 | +openspec new change my-feature |
| 77 | +# Automatically uses spec-driven from config |
| 78 | +``` |
| 79 | + |
| 80 | +### Demo 4: Context and Rules Injection |
| 81 | + |
| 82 | +The key demo moment - show how instructions are enriched: |
| 83 | + |
| 84 | +```bash |
| 85 | +# Get instructions for an artifact |
| 86 | +openspec instructions proposal --change my-feature |
| 87 | +``` |
| 88 | + |
| 89 | +Output shows the XML structure: |
| 90 | + |
| 91 | +```xml |
| 92 | +<context> |
| 93 | +Tech stack: TypeScript, React, Node.js, PostgreSQL |
| 94 | +API style: RESTful, documented in docs/api.md |
| 95 | +... |
| 96 | +</context> |
| 97 | + |
| 98 | +<rules> |
| 99 | +- Include rollback plan |
| 100 | +- Identify affected teams and notify in #platform-changes |
| 101 | +</rules> |
| 102 | + |
| 103 | +<template> |
| 104 | +[Schema's built-in proposal template] |
| 105 | +</template> |
| 106 | +``` |
| 107 | + |
| 108 | +Key points to highlight: |
| 109 | + |
| 110 | +- **Context** appears in ALL artifacts (proposal, specs, design, tasks) |
| 111 | +- **Rules** ONLY appear for the matching artifact (proposal rules only in proposal instructions) |
| 112 | + |
| 113 | +### Demo 5: Precedence Override |
| 114 | + |
| 115 | +Show the schema resolution order: |
| 116 | + |
| 117 | +```bash |
| 118 | +# Config sets schema: spec-driven |
| 119 | + |
| 120 | +# 1. CLI flag wins |
| 121 | +openspec new change feature-a --schema tdd # Uses tdd |
| 122 | + |
| 123 | +# 2. Change metadata wins over config |
| 124 | +# (if .openspec.yaml in change directory specifies schema) |
| 125 | + |
| 126 | +# 3. Config is used as default |
| 127 | +openspec new change feature-b # Uses spec-driven from config |
| 128 | + |
| 129 | +# 4. Hardcoded default (no config) |
| 130 | +# Would fall back to spec-driven anyway |
| 131 | +``` |
| 132 | + |
| 133 | +### Demo 6: Validation and Error Handling |
| 134 | + |
| 135 | +Show graceful error handling: |
| 136 | + |
| 137 | +```bash |
| 138 | +# Create config with typo |
| 139 | +echo "schema: spec-drivne" > openspec/config.yaml |
| 140 | + |
| 141 | +# Try to use it - shows fuzzy matching suggestions |
| 142 | +openspec new change test |
| 143 | +# Schema 'spec-drivne' not found |
| 144 | +# Did you mean: spec-driven (built-in) |
| 145 | +``` |
| 146 | + |
| 147 | +```bash |
| 148 | +# Unknown artifact ID in rules - warns but doesn't halt |
| 149 | +cat > openspec/config.yaml << 'EOF' |
| 150 | +schema: spec-driven |
| 151 | +rules: |
| 152 | + testplan: # Schema doesn't have this |
| 153 | + - Some rule |
| 154 | +EOF |
| 155 | + |
| 156 | +openspec instructions proposal --change test |
| 157 | +# ⚠️ Unknown artifact ID in rules: "testplan". Valid IDs for schema "spec-driven": ... |
| 158 | +# (continues working) |
| 159 | +``` |
| 160 | + |
| 161 | +## Quick Demo Script |
| 162 | + |
| 163 | +Here's a quick all-in-one demo: |
| 164 | + |
| 165 | +```bash |
| 166 | +# 1. Show there's no config initially |
| 167 | +cat openspec/config.yaml 2>/dev/null || echo "No config exists" |
| 168 | + |
| 169 | +# 2. Create a simple config |
| 170 | +cat > openspec/config.yaml << 'EOF' |
| 171 | +schema: spec-driven |
| 172 | +context: | |
| 173 | + This is a demo project using React and TypeScript. |
| 174 | + We follow semantic versioning. |
| 175 | +rules: |
| 176 | + proposal: |
| 177 | + - Include migration steps if breaking change |
| 178 | +EOF |
| 179 | + |
| 180 | +# 3. Show the config |
| 181 | +cat openspec/config.yaml |
| 182 | + |
| 183 | +# 4. Create a change (uses default schema from config) |
| 184 | +openspec new change demo-feature |
| 185 | + |
| 186 | +# 5. Show instructions with injected context/rules |
| 187 | +openspec instructions proposal --change demo-feature | head -30 |
| 188 | + |
| 189 | +# 6. Show that specs don't have proposal rules |
| 190 | +openspec instructions specs --change demo-feature | head -30 |
| 191 | +``` |
| 192 | + |
| 193 | +## What to Emphasize in Demo |
| 194 | + |
| 195 | +- **Low friction** - Teams can customize without forking schemas |
| 196 | +- **Shared context** - Everyone on the team gets the same project knowledge |
| 197 | +- **Per-artifact rules** - Targeted guidance where it matters |
| 198 | +- **Graceful failures** - Typos warn, don't break workflow |
| 199 | +- **Team sharing** - Just commit `openspec/config.yaml` and everyone benefits |
| 200 | + |
| 201 | +## Related Documentation |
| 202 | + |
| 203 | +- [Experimental Workflow Guide](./experimental-workflow.md) - Full user guide with config section |
| 204 | +- [Project Config Proposal](../openspec/changes/project-config/proposal.md) - Original design proposal |
| 205 | +- [Project Config Design](../openspec/changes/project-config/design.md) - Technical implementation details |
0 commit comments