@fission-ai/openspec 1.0.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/workflow/instructions.js +1 -1
- package/dist/core/project-config.js +2 -2
- package/dist/core/templates/skill-templates.js +11 -27
- package/dist/utils/change-utils.d.ts +3 -3
- package/dist/utils/change-utils.js +3 -3
- package/package.json +1 -1
- package/schemas/spec-driven/schema.yaml +8 -3
- package/schemas/tdd/schema.yaml +0 -213
- package/schemas/tdd/templates/docs.md +0 -15
- package/schemas/tdd/templates/implementation.md +0 -11
- package/schemas/tdd/templates/spec.md +0 -11
- package/schemas/tdd/templates/test.md +0 -11
|
@@ -289,7 +289,7 @@ export async function generateApplyInstructions(projectRoot, changeName, schemaN
|
|
|
289
289
|
instruction = 'All tasks are complete! This change is ready to be archived.\nConsider running tests and reviewing the changes before archiving.';
|
|
290
290
|
}
|
|
291
291
|
else if (!tracksFile) {
|
|
292
|
-
// No tracking file
|
|
292
|
+
// No tracking file configured in schema - ready to apply
|
|
293
293
|
state = 'ready';
|
|
294
294
|
instruction = schemaInstruction?.trim() ?? 'All required artifacts complete. Proceed with implementation.';
|
|
295
295
|
}
|
|
@@ -16,11 +16,11 @@ import { z } from 'zod';
|
|
|
16
16
|
* - Consistent with other OpenSpec schemas
|
|
17
17
|
*/
|
|
18
18
|
export const ProjectConfigSchema = z.object({
|
|
19
|
-
// Required: which schema to use (e.g., "spec-driven",
|
|
19
|
+
// Required: which schema to use (e.g., "spec-driven", or project-local schema name)
|
|
20
20
|
schema: z
|
|
21
21
|
.string()
|
|
22
22
|
.min(1)
|
|
23
|
-
.describe('The workflow schema to use (e.g., "spec-driven"
|
|
23
|
+
.describe('The workflow schema to use (e.g., "spec-driven")'),
|
|
24
24
|
// Optional: project context (injected into all artifact instructions)
|
|
25
25
|
// Max size: 50KB (enforced during parsing)
|
|
26
26
|
context: z
|
|
@@ -327,7 +327,6 @@ export function getNewChangeSkillTemplate() {
|
|
|
327
327
|
Use the default schema (omit \`--schema\`) unless the user explicitly requests a different workflow.
|
|
328
328
|
|
|
329
329
|
**Use a different schema only if the user mentions:**
|
|
330
|
-
- "tdd" or "test-driven" → use \`--schema tdd\`
|
|
331
330
|
- A specific schema name → use \`--schema <name>\`
|
|
332
331
|
- "show workflows" or "what workflows" → run \`openspec schemas --json\` and let them choose
|
|
333
332
|
|
|
@@ -347,7 +346,7 @@ export function getNewChangeSkillTemplate() {
|
|
|
347
346
|
This shows which artifacts need to be created and which are ready (dependencies satisfied).
|
|
348
347
|
|
|
349
348
|
5. **Get instructions for the first artifact**
|
|
350
|
-
The first artifact depends on the schema (e.g., \`proposal\` for spec-driven
|
|
349
|
+
The first artifact depends on the schema (e.g., \`proposal\` for spec-driven).
|
|
351
350
|
Check the status output to find the first artifact with status "ready".
|
|
352
351
|
\`\`\`bash
|
|
353
352
|
openspec instructions <first-artifact-id> --change "<name>"
|
|
@@ -409,7 +408,7 @@ export function getContinueChangeSkillTemplate() {
|
|
|
409
408
|
openspec status --change "<name>" --json
|
|
410
409
|
\`\`\`
|
|
411
410
|
Parse the JSON to understand current state. The response includes:
|
|
412
|
-
- \`schemaName\`: The workflow schema being used (e.g., "spec-driven"
|
|
411
|
+
- \`schemaName\`: The workflow schema being used (e.g., "spec-driven")
|
|
413
412
|
- \`artifacts\`: Array of artifacts with their status ("done", "ready", "blocked")
|
|
414
413
|
- \`isComplete\`: Boolean indicating if all artifacts are complete
|
|
415
414
|
|
|
@@ -475,16 +474,10 @@ Common artifact patterns:
|
|
|
475
474
|
**spec-driven schema** (proposal → specs → design → tasks):
|
|
476
475
|
- **proposal.md**: Ask user about the change if not clear. Fill in Why, What Changes, Capabilities, Impact.
|
|
477
476
|
- The Capabilities section is critical - each capability listed will need a spec file.
|
|
478
|
-
- **specs
|
|
477
|
+
- **specs/<capability>/spec.md**: Create one spec per capability listed in the proposal's Capabilities section (use the capability name, not the change name).
|
|
479
478
|
- **design.md**: Document technical decisions, architecture, and implementation approach.
|
|
480
479
|
- **tasks.md**: Break down implementation into checkboxed tasks.
|
|
481
480
|
|
|
482
|
-
**tdd schema** (spec → tests → implementation → docs):
|
|
483
|
-
- **spec.md**: Feature specification defining what to build.
|
|
484
|
-
- **tests/*.test.ts**: Write tests BEFORE implementation (TDD red phase).
|
|
485
|
-
- **src/*.ts**: Implement to make tests pass (TDD green phase).
|
|
486
|
-
- **docs/*.md**: Document the implemented feature.
|
|
487
|
-
|
|
488
481
|
For other schemas, follow the \`instruction\` field from the CLI output.
|
|
489
482
|
|
|
490
483
|
**Guardrails**
|
|
@@ -530,7 +523,7 @@ export function getApplyChangeSkillTemplate() {
|
|
|
530
523
|
openspec status --change "<name>" --json
|
|
531
524
|
\`\`\`
|
|
532
525
|
Parse the JSON to understand:
|
|
533
|
-
- \`schemaName\`: The workflow being used (e.g., "spec-driven"
|
|
526
|
+
- \`schemaName\`: The workflow being used (e.g., "spec-driven")
|
|
534
527
|
- Which artifact contains the tasks (typically "tasks" for spec-driven, check status for others)
|
|
535
528
|
|
|
536
529
|
3. **Get apply instructions**
|
|
@@ -555,7 +548,6 @@ export function getApplyChangeSkillTemplate() {
|
|
|
555
548
|
Read the files listed in \`contextFiles\` from the apply instructions output.
|
|
556
549
|
The files depend on the schema being used:
|
|
557
550
|
- **spec-driven**: proposal, specs, design, tasks
|
|
558
|
-
- **tdd**: spec, tests, implementation, docs
|
|
559
551
|
- Other schemas: follow the contextFiles from CLI output
|
|
560
552
|
|
|
561
553
|
5. **Show current progress**
|
|
@@ -1329,7 +1321,7 @@ The change is implemented! One more step—let's archive it.
|
|
|
1329
1321
|
\`\`\`
|
|
1330
1322
|
## Archiving
|
|
1331
1323
|
|
|
1332
|
-
When a change is complete, we archive it. This moves it from \`openspec/changes/\` to \`openspec/archive/YYYY-MM-DD
|
|
1324
|
+
When a change is complete, we archive it. This moves it from \`openspec/changes/\` to \`openspec/changes/archive/YYYY-MM-DD-<name>/\`.
|
|
1333
1325
|
|
|
1334
1326
|
Archived changes become your project's decision history—you can always find them later to understand why something was built a certain way.
|
|
1335
1327
|
\`\`\`
|
|
@@ -1341,7 +1333,7 @@ openspec archive "<name>"
|
|
|
1341
1333
|
|
|
1342
1334
|
**SHOW:**
|
|
1343
1335
|
\`\`\`
|
|
1344
|
-
Archived to: \`openspec/archive/YYYY-MM-DD
|
|
1336
|
+
Archived to: \`openspec/changes/archive/YYYY-MM-DD-<name>/\`
|
|
1345
1337
|
|
|
1346
1338
|
The change is now part of your project's history. The code is in your codebase, the decision record is preserved.
|
|
1347
1339
|
\`\`\`
|
|
@@ -1649,7 +1641,6 @@ export function getOpsxNewCommandTemplate() {
|
|
|
1649
1641
|
Use the default schema (omit \`--schema\`) unless the user explicitly requests a different workflow.
|
|
1650
1642
|
|
|
1651
1643
|
**Use a different schema only if the user mentions:**
|
|
1652
|
-
- "tdd" or "test-driven" → use \`--schema tdd\`
|
|
1653
1644
|
- A specific schema name → use \`--schema <name>\`
|
|
1654
1645
|
- "show workflows" or "what workflows" → run \`openspec schemas --json\` and let them choose
|
|
1655
1646
|
|
|
@@ -1728,7 +1719,7 @@ export function getOpsxContinueCommandTemplate() {
|
|
|
1728
1719
|
openspec status --change "<name>" --json
|
|
1729
1720
|
\`\`\`
|
|
1730
1721
|
Parse the JSON to understand current state. The response includes:
|
|
1731
|
-
- \`schemaName\`: The workflow schema being used (e.g., "spec-driven"
|
|
1722
|
+
- \`schemaName\`: The workflow schema being used (e.g., "spec-driven")
|
|
1732
1723
|
- \`artifacts\`: Array of artifacts with their status ("done", "ready", "blocked")
|
|
1733
1724
|
- \`isComplete\`: Boolean indicating if all artifacts are complete
|
|
1734
1725
|
|
|
@@ -1794,16 +1785,10 @@ Common artifact patterns:
|
|
|
1794
1785
|
**spec-driven schema** (proposal → specs → design → tasks):
|
|
1795
1786
|
- **proposal.md**: Ask user about the change if not clear. Fill in Why, What Changes, Capabilities, Impact.
|
|
1796
1787
|
- The Capabilities section is critical - each capability listed will need a spec file.
|
|
1797
|
-
- **specs
|
|
1788
|
+
- **specs/<capability>/spec.md**: Create one spec per capability listed in the proposal's Capabilities section (use the capability name, not the change name).
|
|
1798
1789
|
- **design.md**: Document technical decisions, architecture, and implementation approach.
|
|
1799
1790
|
- **tasks.md**: Break down implementation into checkboxed tasks.
|
|
1800
1791
|
|
|
1801
|
-
**tdd schema** (spec → tests → implementation → docs):
|
|
1802
|
-
- **spec.md**: Feature specification defining what to build.
|
|
1803
|
-
- **tests/*.test.ts**: Write tests BEFORE implementation (TDD red phase).
|
|
1804
|
-
- **src/*.ts**: Implement to make tests pass (TDD green phase).
|
|
1805
|
-
- **docs/*.md**: Document the implemented feature.
|
|
1806
|
-
|
|
1807
1792
|
For other schemas, follow the \`instruction\` field from the CLI output.
|
|
1808
1793
|
|
|
1809
1794
|
**Guardrails**
|
|
@@ -1847,7 +1832,7 @@ export function getOpsxApplyCommandTemplate() {
|
|
|
1847
1832
|
openspec status --change "<name>" --json
|
|
1848
1833
|
\`\`\`
|
|
1849
1834
|
Parse the JSON to understand:
|
|
1850
|
-
- \`schemaName\`: The workflow being used (e.g., "spec-driven"
|
|
1835
|
+
- \`schemaName\`: The workflow being used (e.g., "spec-driven")
|
|
1851
1836
|
- Which artifact contains the tasks (typically "tasks" for spec-driven, check status for others)
|
|
1852
1837
|
|
|
1853
1838
|
3. **Get apply instructions**
|
|
@@ -1872,7 +1857,6 @@ export function getOpsxApplyCommandTemplate() {
|
|
|
1872
1857
|
Read the files listed in \`contextFiles\` from the apply instructions output.
|
|
1873
1858
|
The files depend on the schema being used:
|
|
1874
1859
|
- **spec-driven**: proposal, specs, design, tasks
|
|
1875
|
-
- **tdd**: spec, tests, implementation, docs
|
|
1876
1860
|
- Other schemas: follow the contextFiles from CLI output
|
|
1877
1861
|
|
|
1878
1862
|
5. **Show current progress**
|
|
@@ -2604,7 +2588,7 @@ export function getVerifyChangeSkillTemplate() {
|
|
|
2604
2588
|
openspec status --change "<name>" --json
|
|
2605
2589
|
\`\`\`
|
|
2606
2590
|
Parse the JSON to understand:
|
|
2607
|
-
- \`schemaName\`: The workflow being used (e.g., "spec-driven"
|
|
2591
|
+
- \`schemaName\`: The workflow being used (e.g., "spec-driven")
|
|
2608
2592
|
- Which artifacts exist for this change
|
|
2609
2593
|
|
|
2610
2594
|
3. **Get the change directory and load artifacts**
|
|
@@ -3195,7 +3179,7 @@ export function getOpsxVerifyCommandTemplate() {
|
|
|
3195
3179
|
openspec status --change "<name>" --json
|
|
3196
3180
|
\`\`\`
|
|
3197
3181
|
Parse the JSON to understand:
|
|
3198
|
-
- \`schemaName\`: The workflow being used (e.g., "spec-driven"
|
|
3182
|
+
- \`schemaName\`: The workflow being used (e.g., "spec-driven")
|
|
3199
3183
|
- Which artifacts exist for this change
|
|
3200
3184
|
|
|
3201
3185
|
3. **Get the change directory and load artifacts**
|
|
@@ -54,9 +54,9 @@ export declare function validateChangeName(name: string): ValidationResult;
|
|
|
54
54
|
* console.log(result.schema) // 'spec-driven' or value from config
|
|
55
55
|
*
|
|
56
56
|
* @example
|
|
57
|
-
* // Creates openspec/changes/add-auth/ with
|
|
58
|
-
* const result = await createChange('/path/to/project', 'add-auth', { schema: '
|
|
59
|
-
* console.log(result.schema) // '
|
|
57
|
+
* // Creates openspec/changes/add-auth/ with custom schema
|
|
58
|
+
* const result = await createChange('/path/to/project', 'add-auth', { schema: 'my-workflow' })
|
|
59
|
+
* console.log(result.schema) // 'my-workflow'
|
|
60
60
|
*/
|
|
61
61
|
export declare function createChange(projectRoot: string, name: string, options?: CreateChangeOptions): Promise<CreateChangeResult>;
|
|
62
62
|
//# sourceMappingURL=change-utils.d.ts.map
|
|
@@ -74,9 +74,9 @@ export function validateChangeName(name) {
|
|
|
74
74
|
* console.log(result.schema) // 'spec-driven' or value from config
|
|
75
75
|
*
|
|
76
76
|
* @example
|
|
77
|
-
* // Creates openspec/changes/add-auth/ with
|
|
78
|
-
* const result = await createChange('/path/to/project', 'add-auth', { schema: '
|
|
79
|
-
* console.log(result.schema) // '
|
|
77
|
+
* // Creates openspec/changes/add-auth/ with custom schema
|
|
78
|
+
* const result = await createChange('/path/to/project', 'add-auth', { schema: 'my-workflow' })
|
|
79
|
+
* console.log(result.schema) // 'my-workflow'
|
|
80
80
|
*/
|
|
81
81
|
export async function createChange(projectRoot, name, options = {}) {
|
|
82
82
|
// Validate the name first
|
package/package.json
CHANGED
|
@@ -34,7 +34,9 @@ artifacts:
|
|
|
34
34
|
instruction: |
|
|
35
35
|
Create specification files that define WHAT the system should do.
|
|
36
36
|
|
|
37
|
-
Create one spec file per capability
|
|
37
|
+
Create one spec file per capability listed in the proposal's Capabilities section.
|
|
38
|
+
- New capabilities: use the exact kebab-case name from the proposal (specs/<capability>/spec.md).
|
|
39
|
+
- Modified capabilities: use the existing spec folder name from openspec/specs/<capability>/ when creating the delta spec at specs/<capability>/spec.md.
|
|
38
40
|
|
|
39
41
|
Delta operations (use ## headers):
|
|
40
42
|
- **ADDED Requirements**: New capabilities
|
|
@@ -110,14 +112,17 @@ artifacts:
|
|
|
110
112
|
|
|
111
113
|
- id: tasks
|
|
112
114
|
generates: tasks.md
|
|
113
|
-
description: Implementation
|
|
115
|
+
description: Implementation checklist with trackable tasks
|
|
114
116
|
template: tasks.md
|
|
115
117
|
instruction: |
|
|
116
118
|
Create the task list that breaks down the implementation work.
|
|
117
119
|
|
|
120
|
+
**IMPORTANT: Follow the template below exactly.** The apply phase parses
|
|
121
|
+
checkbox format to track progress. Tasks not using `- [ ]` won't be tracked.
|
|
122
|
+
|
|
118
123
|
Guidelines:
|
|
119
124
|
- Group related tasks under ## numbered headings
|
|
120
|
-
- Each task
|
|
125
|
+
- Each task MUST be a checkbox: `- [ ] X.Y Task description`
|
|
121
126
|
- Tasks should be small enough to complete in one session
|
|
122
127
|
- Order tasks by dependency (what must be done first?)
|
|
123
128
|
|
package/schemas/tdd/schema.yaml
DELETED
|
@@ -1,213 +0,0 @@
|
|
|
1
|
-
name: tdd
|
|
2
|
-
version: 1
|
|
3
|
-
description: Test-driven development workflow - tests → implementation → docs
|
|
4
|
-
artifacts:
|
|
5
|
-
- id: spec
|
|
6
|
-
generates: spec.md
|
|
7
|
-
description: Feature specification defining requirements
|
|
8
|
-
template: spec.md
|
|
9
|
-
instruction: |
|
|
10
|
-
Create the feature specification that defines WHAT to build.
|
|
11
|
-
|
|
12
|
-
Sections:
|
|
13
|
-
- **Feature**: Name and high-level description of the feature's purpose and user value
|
|
14
|
-
- **Requirements**: List of specific requirements. Use SHALL/MUST for normative language.
|
|
15
|
-
- **Acceptance Criteria**: Testable criteria in WHEN/THEN format
|
|
16
|
-
|
|
17
|
-
Format requirements:
|
|
18
|
-
- Each requirement should be specific and testable
|
|
19
|
-
- Use `#### Scenario: <name>` with WHEN/THEN format for acceptance criteria
|
|
20
|
-
- Define edge cases and error scenarios explicitly
|
|
21
|
-
- Every requirement MUST have at least one scenario
|
|
22
|
-
|
|
23
|
-
Example:
|
|
24
|
-
```
|
|
25
|
-
## Feature: User Authentication
|
|
26
|
-
|
|
27
|
-
Users can securely log into the application.
|
|
28
|
-
|
|
29
|
-
## Requirements
|
|
30
|
-
|
|
31
|
-
### Requirement: Password validation
|
|
32
|
-
The system SHALL validate passwords meet minimum security requirements.
|
|
33
|
-
|
|
34
|
-
#### Scenario: Valid password accepted
|
|
35
|
-
- **WHEN** password has 8+ chars, uppercase, lowercase, and number
|
|
36
|
-
- **THEN** password is accepted
|
|
37
|
-
|
|
38
|
-
#### Scenario: Weak password rejected
|
|
39
|
-
- **WHEN** password is less than 8 characters
|
|
40
|
-
- **THEN** system displays "Password too short" error
|
|
41
|
-
```
|
|
42
|
-
|
|
43
|
-
This spec drives test creation - each scenario becomes a test case.
|
|
44
|
-
requires: []
|
|
45
|
-
|
|
46
|
-
- id: tests
|
|
47
|
-
generates: "tests/*.test.ts"
|
|
48
|
-
description: Test files written before implementation
|
|
49
|
-
template: test.md
|
|
50
|
-
instruction: |
|
|
51
|
-
Write tests BEFORE implementation (TDD red phase).
|
|
52
|
-
|
|
53
|
-
File naming:
|
|
54
|
-
- Create test files as `tests/<feature>.test.ts`
|
|
55
|
-
- One test file per feature/capability
|
|
56
|
-
- Use descriptive names matching the spec
|
|
57
|
-
|
|
58
|
-
Test structure:
|
|
59
|
-
- Use Given/When/Then format matching spec scenarios
|
|
60
|
-
- Group related tests with `describe()` blocks
|
|
61
|
-
- Each scenario from spec becomes at least one `it()` test
|
|
62
|
-
|
|
63
|
-
Coverage requirements:
|
|
64
|
-
- Cover each requirement from the spec
|
|
65
|
-
- Include happy path (success cases)
|
|
66
|
-
- Include edge cases (boundary conditions)
|
|
67
|
-
- Include error scenarios (invalid input, failures)
|
|
68
|
-
- Tests should fail initially (no implementation yet)
|
|
69
|
-
|
|
70
|
-
Example:
|
|
71
|
-
```typescript
|
|
72
|
-
describe('Password validation', () => {
|
|
73
|
-
it('accepts valid password with all requirements', () => {
|
|
74
|
-
// GIVEN a password meeting all requirements
|
|
75
|
-
const password = 'SecurePass1';
|
|
76
|
-
// WHEN validating
|
|
77
|
-
const result = validatePassword(password);
|
|
78
|
-
// THEN it should be accepted
|
|
79
|
-
expect(result.valid).toBe(true);
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
it('rejects password shorter than 8 characters', () => {
|
|
83
|
-
// GIVEN a short password
|
|
84
|
-
const password = 'Short1';
|
|
85
|
-
// WHEN validating
|
|
86
|
-
const result = validatePassword(password);
|
|
87
|
-
// THEN it should be rejected with message
|
|
88
|
-
expect(result.valid).toBe(false);
|
|
89
|
-
expect(result.error).toBe('Password too short');
|
|
90
|
-
});
|
|
91
|
-
});
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
Follow the spec requirements exactly - tests verify the spec.
|
|
95
|
-
requires:
|
|
96
|
-
- spec
|
|
97
|
-
|
|
98
|
-
- id: implementation
|
|
99
|
-
generates: "src/*.ts"
|
|
100
|
-
description: Implementation code to pass the tests
|
|
101
|
-
template: implementation.md
|
|
102
|
-
instruction: |
|
|
103
|
-
Implement the feature to make tests pass (TDD green phase).
|
|
104
|
-
|
|
105
|
-
TDD workflow:
|
|
106
|
-
1. Run tests - confirm they fail (red)
|
|
107
|
-
2. Write minimal code to pass ONE test
|
|
108
|
-
3. Run tests - confirm that test passes (green)
|
|
109
|
-
4. Refactor if needed while keeping tests green
|
|
110
|
-
5. Repeat for next failing test
|
|
111
|
-
|
|
112
|
-
Implementation guidelines:
|
|
113
|
-
- Write minimal code to pass each test - no more, no less
|
|
114
|
-
- Run tests frequently to verify progress
|
|
115
|
-
- Keep functions small and focused
|
|
116
|
-
- Use clear, descriptive names
|
|
117
|
-
|
|
118
|
-
Code organization:
|
|
119
|
-
- Create source files in `src/<feature>.ts`
|
|
120
|
-
- Export public API clearly
|
|
121
|
-
- Keep implementation details private
|
|
122
|
-
- Add JSDoc comments for public functions
|
|
123
|
-
|
|
124
|
-
Example structure:
|
|
125
|
-
```typescript
|
|
126
|
-
/**
|
|
127
|
-
* Validates a password meets security requirements.
|
|
128
|
-
* @param password - The password to validate
|
|
129
|
-
* @returns Validation result with valid flag and optional error
|
|
130
|
-
*/
|
|
131
|
-
export function validatePassword(password: string): ValidationResult {
|
|
132
|
-
if (password.length < 8) {
|
|
133
|
-
return { valid: false, error: 'Password too short' };
|
|
134
|
-
}
|
|
135
|
-
// ... additional checks
|
|
136
|
-
return { valid: true };
|
|
137
|
-
}
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
Don't over-engineer - implement only what tests require.
|
|
141
|
-
requires:
|
|
142
|
-
- tests
|
|
143
|
-
|
|
144
|
-
- id: docs
|
|
145
|
-
generates: "docs/*.md"
|
|
146
|
-
description: Documentation for the implemented feature
|
|
147
|
-
template: docs.md
|
|
148
|
-
instruction: |
|
|
149
|
-
Document the implemented feature.
|
|
150
|
-
|
|
151
|
-
Sections:
|
|
152
|
-
- **Overview**: What the feature does and why it exists (1-2 paragraphs)
|
|
153
|
-
- **Getting Started**: Quick start guide to use the feature immediately
|
|
154
|
-
- **Examples**: Code examples showing common use cases
|
|
155
|
-
- **Reference**: Detailed API documentation, configuration options
|
|
156
|
-
|
|
157
|
-
Guidelines:
|
|
158
|
-
- Write for the user, not the developer
|
|
159
|
-
- Start with the most common use case
|
|
160
|
-
- Include copy-pasteable code examples
|
|
161
|
-
- Document all configuration options with defaults
|
|
162
|
-
- Note any limitations, edge cases, or gotchas
|
|
163
|
-
- Link to related features or specs
|
|
164
|
-
|
|
165
|
-
Example structure:
|
|
166
|
-
```markdown
|
|
167
|
-
## Overview
|
|
168
|
-
|
|
169
|
-
Password validation ensures user passwords meet security requirements
|
|
170
|
-
before account creation or password changes.
|
|
171
|
-
|
|
172
|
-
## Getting Started
|
|
173
|
-
|
|
174
|
-
Import and use the validation function:
|
|
175
|
-
|
|
176
|
-
```typescript
|
|
177
|
-
import { validatePassword } from './password';
|
|
178
|
-
|
|
179
|
-
const result = validatePassword('MySecurePass1');
|
|
180
|
-
if (!result.valid) {
|
|
181
|
-
console.error(result.error);
|
|
182
|
-
}
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
## Examples
|
|
186
|
-
|
|
187
|
-
### Basic validation
|
|
188
|
-
...
|
|
189
|
-
|
|
190
|
-
### Custom error handling
|
|
191
|
-
...
|
|
192
|
-
|
|
193
|
-
## Reference
|
|
194
|
-
|
|
195
|
-
### validatePassword(password)
|
|
196
|
-
|
|
197
|
-
| Parameter | Type | Description |
|
|
198
|
-
|-----------|------|-------------|
|
|
199
|
-
| password | string | The password to validate |
|
|
200
|
-
|
|
201
|
-
**Returns**: `{ valid: boolean, error?: string }`
|
|
202
|
-
```
|
|
203
|
-
|
|
204
|
-
Reference the spec for requirements, implementation for details.
|
|
205
|
-
requires:
|
|
206
|
-
- implementation
|
|
207
|
-
|
|
208
|
-
apply:
|
|
209
|
-
requires: [tests]
|
|
210
|
-
tracks: null
|
|
211
|
-
instruction: |
|
|
212
|
-
Run tests to see failures. Implement minimal code to pass each test.
|
|
213
|
-
Refactor while keeping tests green.
|