specdx 0.3.0-alpha.1 → 0.3.0-alpha.3
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/.claude-plugin/plugin.json +1 -1
- package/dist/{changelog-NPN34DIO.js → changelog-OUP2RXWN.js} +4 -4
- package/dist/check-3XQYO3HU.js +109 -0
- package/dist/check-3XQYO3HU.js.map +1 -0
- package/dist/chunk-6BWZEAST.js +1051 -0
- package/dist/chunk-6BWZEAST.js.map +1 -0
- package/dist/{chunk-AO3ZQKLJ.js → chunk-DDFLMRPC.js} +4 -4
- package/dist/{chunk-AO3ZQKLJ.js.map → chunk-DDFLMRPC.js.map} +1 -1
- package/dist/{chunk-276J7LR6.js → chunk-PHR7AV6I.js} +2 -2
- package/dist/{chunk-6DTOYCZ6.js → chunk-WTFWNYJA.js} +29 -3
- package/dist/chunk-WTFWNYJA.js.map +1 -0
- package/dist/{chunk-XLEN6ZYM.js → chunk-ZX4HVL5M.js} +92 -4
- package/dist/chunk-ZX4HVL5M.js.map +1 -0
- package/dist/{diff-GWJONALU.js → diff-275PLXYH.js} +4 -4
- package/dist/dist-PQCG2XXF.js +11 -0
- package/dist/dist-PQCG2XXF.js.map +1 -0
- package/dist/{explain-YXUILNEA.js → explain-I7AQMEEH.js} +3 -3
- package/dist/generate-PC7BIB7G.js +13 -0
- package/dist/generate-PC7BIB7G.js.map +1 -0
- package/dist/generate-story-7WHPPFHY.js +192 -0
- package/dist/generate-story-7WHPPFHY.js.map +1 -0
- package/dist/generate-test-plan-U5LMWGKX.js +154 -0
- package/dist/generate-test-plan-U5LMWGKX.js.map +1 -0
- package/dist/{graph-OWQJWVSN.js → graph-RCAPF55A.js} +3 -3
- package/dist/index.js +162 -15
- package/dist/index.js.map +1 -1
- package/dist/{lint-CHWVBUV5.js → lint-6Z2TVWAQ.js} +4 -4
- package/dist/main.js +22 -13
- package/dist/main.js.map +1 -1
- package/dist/migrate-L7W5RHSS.js +56 -0
- package/dist/migrate-L7W5RHSS.js.map +1 -0
- package/dist/{pack-OJAC7JF2.js → pack-PI6V6OR2.js} +52 -9
- package/dist/{pack-OJAC7JF2.js.map → pack-PI6V6OR2.js.map} +1 -1
- package/dist/ready-B7IFPL3S.js +159 -0
- package/dist/ready-B7IFPL3S.js.map +1 -0
- package/dist/skills/specdx-author-spec/step-01-frontmatter.md +66 -0
- package/dist/skills/specdx-author-spec/step-02-sections.md +70 -0
- package/dist/skills/specdx-author-spec/step-03-finalize.md +48 -0
- package/dist/skills/specdx-author-spec.md +13 -113
- package/dist/skills/specdx-check-drift.md +71 -0
- package/dist/skills/specdx-review-spec.md +77 -0
- package/dist/skills/specdx-verify.md +70 -0
- package/dist/{skills-XJYTWGDK.js → skills-3GBBWZW2.js} +5 -2
- package/dist/skills-3GBBWZW2.js.map +1 -0
- package/dist/{status-VMALGNS5.js → status-AV5GSWVI.js} +5 -5
- package/dist/update-HIWDDEZQ.js +132 -0
- package/dist/update-HIWDDEZQ.js.map +1 -0
- package/dist/{validate-DOZZEZFC.js → validate-N2WSG75W.js} +3 -3
- package/package.json +2 -1
- package/dist/chunk-6DTOYCZ6.js.map +0 -1
- package/dist/chunk-XLEN6ZYM.js.map +0 -1
- package/dist/skills-XJYTWGDK.js.map +0 -1
- /package/dist/{changelog-NPN34DIO.js.map → changelog-OUP2RXWN.js.map} +0 -0
- /package/dist/{chunk-276J7LR6.js.map → chunk-PHR7AV6I.js.map} +0 -0
- /package/dist/{diff-GWJONALU.js.map → diff-275PLXYH.js.map} +0 -0
- /package/dist/{explain-YXUILNEA.js.map → explain-I7AQMEEH.js.map} +0 -0
- /package/dist/{graph-OWQJWVSN.js.map → graph-RCAPF55A.js.map} +0 -0
- /package/dist/{lint-CHWVBUV5.js.map → lint-6Z2TVWAQ.js.map} +0 -0
- /package/dist/{status-VMALGNS5.js.map → status-AV5GSWVI.js.map} +0 -0
- /package/dist/{validate-DOZZEZFC.js.map → validate-N2WSG75W.js.map} +0 -0
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import {
|
|
2
|
+
sharedArgs
|
|
3
|
+
} from "./chunk-GAM4MXPC.js";
|
|
4
|
+
import {
|
|
5
|
+
createLintEngine,
|
|
6
|
+
getPreset
|
|
7
|
+
} from "./chunk-WTFWNYJA.js";
|
|
8
|
+
import {
|
|
9
|
+
DEFAULT_DIFF_CONFIG
|
|
10
|
+
} from "./chunk-DDFLMRPC.js";
|
|
11
|
+
import {
|
|
12
|
+
buildGraph,
|
|
13
|
+
createLogger,
|
|
14
|
+
loadConfig,
|
|
15
|
+
parseSpec,
|
|
16
|
+
resolveGlob
|
|
17
|
+
} from "./chunk-PHR7AV6I.js";
|
|
18
|
+
import "./chunk-ZX4HVL5M.js";
|
|
19
|
+
|
|
20
|
+
// src/commands/ready.ts
|
|
21
|
+
import { defineCommand } from "citty";
|
|
22
|
+
async function runReady() {
|
|
23
|
+
const configDir = process.cwd();
|
|
24
|
+
const config = await loadConfig(void 0, configDir);
|
|
25
|
+
const checks = [];
|
|
26
|
+
const specs = [];
|
|
27
|
+
for (const [key, entry] of Object.entries(config.specs)) {
|
|
28
|
+
const paths = await resolveGlob(entry.path, configDir);
|
|
29
|
+
for (const p of paths) {
|
|
30
|
+
const spec = await parseSpec(p);
|
|
31
|
+
specs.push({ spec, key, entry });
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
const requiredEntries = Object.entries(config.specs).filter(
|
|
35
|
+
([, entry]) => entry.required
|
|
36
|
+
);
|
|
37
|
+
const missingRequired = [];
|
|
38
|
+
for (const [key, entry] of requiredEntries) {
|
|
39
|
+
const paths = await resolveGlob(entry.path, configDir);
|
|
40
|
+
if (paths.length === 0) {
|
|
41
|
+
missingRequired.push(key);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
checks.push({
|
|
45
|
+
name: "Required specs present",
|
|
46
|
+
passed: missingRequired.length === 0,
|
|
47
|
+
details: missingRequired.length === 0 ? `All ${requiredEntries.length} required specs found` : `Missing: ${missingRequired.join(", ")}`
|
|
48
|
+
});
|
|
49
|
+
const presetName = config.lint?.extends ?? "recommended";
|
|
50
|
+
const rules = getPreset(presetName);
|
|
51
|
+
let graph;
|
|
52
|
+
let graphError;
|
|
53
|
+
try {
|
|
54
|
+
graph = buildGraph(config);
|
|
55
|
+
} catch (err) {
|
|
56
|
+
graphError = err.message;
|
|
57
|
+
}
|
|
58
|
+
const engine = createLintEngine({ rules, config, graph });
|
|
59
|
+
const lintResults = engine.lint(specs.map((s) => s.spec));
|
|
60
|
+
if (graphError) {
|
|
61
|
+
lintResults.diagnostics.push({
|
|
62
|
+
ruleId: "structure/no-circular-deps",
|
|
63
|
+
severity: "error",
|
|
64
|
+
message: graphError,
|
|
65
|
+
filePath: "spec.config.yaml"
|
|
66
|
+
});
|
|
67
|
+
lintResults.hasErrors = true;
|
|
68
|
+
}
|
|
69
|
+
const errors = lintResults.diagnostics.filter((d) => d.severity === "error").length;
|
|
70
|
+
const warnings = lintResults.diagnostics.filter((d) => d.severity === "warn").length;
|
|
71
|
+
checks.push({
|
|
72
|
+
name: "Lint health",
|
|
73
|
+
passed: errors === 0,
|
|
74
|
+
details: `${errors} errors, ${warnings} warnings`
|
|
75
|
+
});
|
|
76
|
+
const integrityIssues = [];
|
|
77
|
+
if (graphError) {
|
|
78
|
+
integrityIssues.push(graphError);
|
|
79
|
+
}
|
|
80
|
+
const refErrors = lintResults.diagnostics.filter(
|
|
81
|
+
(d) => d.ruleId === "structure/valid-references"
|
|
82
|
+
);
|
|
83
|
+
for (const d of refErrors) {
|
|
84
|
+
integrityIssues.push(d.message);
|
|
85
|
+
}
|
|
86
|
+
checks.push({
|
|
87
|
+
name: "No integrity issues",
|
|
88
|
+
passed: integrityIssues.length === 0,
|
|
89
|
+
details: integrityIssues.length === 0 ? "References and dependencies valid" : integrityIssues.join("; ")
|
|
90
|
+
});
|
|
91
|
+
const thresholdDays = config.diff?.staleness_threshold_days ?? DEFAULT_DIFF_CONFIG.staleness_threshold_days;
|
|
92
|
+
const now = Date.now();
|
|
93
|
+
const staleSpecs = [];
|
|
94
|
+
for (const { spec } of specs) {
|
|
95
|
+
const dateStr = spec.frontmatter.updated || spec.frontmatter.created;
|
|
96
|
+
if (dateStr) {
|
|
97
|
+
const days = Math.floor((now - new Date(dateStr).getTime()) / (1e3 * 60 * 60 * 24));
|
|
98
|
+
if (days > thresholdDays) {
|
|
99
|
+
staleSpecs.push({ specId: spec.frontmatter.id, days });
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
checks.push({
|
|
104
|
+
name: "No stale specs",
|
|
105
|
+
passed: staleSpecs.length === 0,
|
|
106
|
+
details: staleSpecs.length === 0 ? `All specs within ${thresholdDays}-day threshold` : staleSpecs.map((s) => `${s.specId} (${s.days}d)`).join(", ")
|
|
107
|
+
});
|
|
108
|
+
const storyCoverageErrors = lintResults.diagnostics.filter(
|
|
109
|
+
(d) => d.ruleId === "completeness/story-coverage"
|
|
110
|
+
);
|
|
111
|
+
checks.push({
|
|
112
|
+
name: "Story coverage",
|
|
113
|
+
passed: storyCoverageErrors.length === 0,
|
|
114
|
+
details: storyCoverageErrors.length === 0 ? "All PRD features have corresponding stories" : storyCoverageErrors.map((d) => d.message).join("; ")
|
|
115
|
+
});
|
|
116
|
+
const ready = checks.every((c) => c.passed);
|
|
117
|
+
return { project: config.project?.name ?? "project", ready, checks };
|
|
118
|
+
}
|
|
119
|
+
var ready_default = defineCommand({
|
|
120
|
+
meta: { name: "ready", description: "Check if spec suite is ready for implementation" },
|
|
121
|
+
args: {
|
|
122
|
+
...sharedArgs
|
|
123
|
+
},
|
|
124
|
+
async run({ args }) {
|
|
125
|
+
const logger = createLogger({ quiet: args.quiet, verbose: args.verbose });
|
|
126
|
+
logger.debug("Running readiness checks...");
|
|
127
|
+
const result = await runReady();
|
|
128
|
+
if (args.format === "json") {
|
|
129
|
+
console.log(JSON.stringify(result, null, 2));
|
|
130
|
+
if (!result.ready) process.exit(1);
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
const icon = result.ready ? "\u2713" : "\u2717";
|
|
134
|
+
const label = result.ready ? "ready for implementation" : "not ready for implementation";
|
|
135
|
+
console.log(`
|
|
136
|
+
${icon} ${result.project} \u2014 ${label}
|
|
137
|
+
`);
|
|
138
|
+
for (const check of result.checks) {
|
|
139
|
+
const checkIcon = check.passed ? "\u2713" : "\u2717";
|
|
140
|
+
console.log(` ${checkIcon} ${check.name}: ${check.details}`);
|
|
141
|
+
}
|
|
142
|
+
const failCount = result.checks.filter((c) => !c.passed).length;
|
|
143
|
+
if (failCount > 0) {
|
|
144
|
+
console.log(`
|
|
145
|
+
Verdict: NOT READY \u2014 ${failCount} issue${failCount > 1 ? "s" : ""} to resolve
|
|
146
|
+
`);
|
|
147
|
+
} else {
|
|
148
|
+
console.log(`
|
|
149
|
+
Verdict: READY
|
|
150
|
+
`);
|
|
151
|
+
}
|
|
152
|
+
if (!result.ready) process.exit(1);
|
|
153
|
+
}
|
|
154
|
+
});
|
|
155
|
+
export {
|
|
156
|
+
ready_default as default,
|
|
157
|
+
runReady
|
|
158
|
+
};
|
|
159
|
+
//# sourceMappingURL=ready-B7IFPL3S.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/ready.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\nimport { loadConfig, parseSpec, resolveGlob, buildGraph, createLogger } from \"@specdx/core\";\nimport { createLintEngine, getPreset } from \"@specdx/lint\";\nimport type { ParsedSpec } from \"@specdx/core\";\nimport { DEFAULT_DIFF_CONFIG } from \"@specdx/diff\";\nimport { sharedArgs } from \"../shared-args.js\";\n\nexport interface ReadyCheck {\n name: string;\n passed: boolean;\n details: string;\n}\n\nexport interface ReadyResult {\n project: string;\n ready: boolean;\n checks: ReadyCheck[];\n}\n\nexport async function runReady(): Promise<ReadyResult> {\n const configDir = process.cwd();\n const config = await loadConfig(undefined, configDir);\n\n const checks: ReadyCheck[] = [];\n\n // Resolve and parse all specs\n const specs: { spec: ParsedSpec; key: string; entry: { path: string; required?: boolean; owner?: string } }[] = [];\n for (const [key, entry] of Object.entries(config.specs)) {\n const paths = await resolveGlob(entry.path, configDir);\n for (const p of paths) {\n const spec = await parseSpec(p);\n specs.push({ spec, key, entry: entry as { path: string; required?: boolean; owner?: string } });\n }\n }\n\n // Check 1: Required specs exist\n const requiredEntries = Object.entries(config.specs).filter(\n ([, entry]) => (entry as { required?: boolean }).required,\n );\n const missingRequired: string[] = [];\n for (const [key, entry] of requiredEntries) {\n const paths = await resolveGlob(entry.path, configDir);\n if (paths.length === 0) {\n missingRequired.push(key);\n }\n }\n checks.push({\n name: \"Required specs present\",\n passed: missingRequired.length === 0,\n details:\n missingRequired.length === 0\n ? `All ${requiredEntries.length} required specs found`\n : `Missing: ${missingRequired.join(\", \")}`,\n });\n\n // Check 2: Lint health (no errors)\n const presetName = config.lint?.extends ?? \"recommended\";\n const rules = getPreset(presetName);\n\n let graph;\n let graphError: string | undefined;\n try {\n graph = buildGraph(config);\n } catch (err) {\n graphError = (err as Error).message;\n }\n\n const engine = createLintEngine({ rules, config, graph });\n const lintResults = engine.lint(specs.map((s) => s.spec));\n\n if (graphError) {\n lintResults.diagnostics.push({\n ruleId: \"structure/no-circular-deps\",\n severity: \"error\",\n message: graphError,\n filePath: \"spec.config.yaml\",\n });\n lintResults.hasErrors = true;\n }\n\n const errors = lintResults.diagnostics.filter((d) => d.severity === \"error\").length;\n const warnings = lintResults.diagnostics.filter((d) => d.severity === \"warn\").length;\n checks.push({\n name: \"Lint health\",\n passed: errors === 0,\n details: `${errors} errors, ${warnings} warnings`,\n });\n\n // Check 3: No integrity issues (broken refs, circular deps)\n const integrityIssues: string[] = [];\n if (graphError) {\n integrityIssues.push(graphError);\n }\n const refErrors = lintResults.diagnostics.filter(\n (d) => d.ruleId === \"structure/valid-references\",\n );\n for (const d of refErrors) {\n integrityIssues.push(d.message);\n }\n checks.push({\n name: \"No integrity issues\",\n passed: integrityIssues.length === 0,\n details:\n integrityIssues.length === 0\n ? \"References and dependencies valid\"\n : integrityIssues.join(\"; \"),\n });\n\n // Check 4: No stale specs\n const thresholdDays =\n config.diff?.staleness_threshold_days ?? DEFAULT_DIFF_CONFIG.staleness_threshold_days;\n const now = Date.now();\n const staleSpecs: { specId: string; days: number }[] = [];\n for (const { spec } of specs) {\n const dateStr =\n (spec.frontmatter.updated as string | undefined) ||\n (spec.frontmatter.created as string | undefined);\n if (dateStr) {\n const days = Math.floor((now - new Date(dateStr).getTime()) / (1000 * 60 * 60 * 24));\n if (days > thresholdDays) {\n staleSpecs.push({ specId: spec.frontmatter.id as string, days });\n }\n }\n }\n checks.push({\n name: \"No stale specs\",\n passed: staleSpecs.length === 0,\n details:\n staleSpecs.length === 0\n ? `All specs within ${thresholdDays}-day threshold`\n : staleSpecs.map((s) => `${s.specId} (${s.days}d)`).join(\", \"),\n });\n\n // Check 5: Story coverage — every PRD feature has a user story\n const storyCoverageErrors = lintResults.diagnostics.filter(\n (d) => d.ruleId === \"completeness/story-coverage\",\n );\n checks.push({\n name: \"Story coverage\",\n passed: storyCoverageErrors.length === 0,\n details:\n storyCoverageErrors.length === 0\n ? \"All PRD features have corresponding stories\"\n : storyCoverageErrors.map((d) => d.message).join(\"; \"),\n });\n\n const ready = checks.every((c) => c.passed);\n return { project: config.project?.name ?? \"project\", ready, checks };\n}\n\nexport default defineCommand({\n meta: { name: \"ready\", description: \"Check if spec suite is ready for implementation\" },\n args: {\n ...sharedArgs,\n },\n async run({ args }) {\n const logger = createLogger({ quiet: args.quiet, verbose: args.verbose });\n logger.debug(\"Running readiness checks...\");\n\n const result = await runReady();\n\n if (args.format === \"json\") {\n console.log(JSON.stringify(result, null, 2));\n if (!result.ready) process.exit(1);\n return;\n }\n\n // Pretty format\n const icon = result.ready ? \"✓\" : \"✗\";\n const label = result.ready ? \"ready for implementation\" : \"not ready for implementation\";\n\n console.log(`\\n ${icon} ${result.project} — ${label}\\n`);\n\n for (const check of result.checks) {\n const checkIcon = check.passed ? \"✓\" : \"✗\";\n console.log(` ${checkIcon} ${check.name}: ${check.details}`);\n }\n\n const failCount = result.checks.filter((c) => !c.passed).length;\n if (failCount > 0) {\n console.log(`\\n Verdict: NOT READY — ${failCount} issue${failCount > 1 ? \"s\" : \"\"} to resolve\\n`);\n } else {\n console.log(`\\n Verdict: READY\\n`);\n }\n\n if (!result.ready) process.exit(1);\n },\n});\n"],"mappings":"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","names":[]}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
---
|
|
2
|
+
step: 1
|
|
3
|
+
name: Frontmatter
|
|
4
|
+
description: Determine spec type, check existing specs, create file with frontmatter
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Step 1: Frontmatter
|
|
8
|
+
|
|
9
|
+
## Determine the type
|
|
10
|
+
|
|
11
|
+
Ask what kind of spec they need:
|
|
12
|
+
|
|
13
|
+
| Type | Use when | Required sections |
|
|
14
|
+
|---|---|---|
|
|
15
|
+
| `prd` | Defining what to build | Problem Statement, Goals, Non-Goals, Features, Success Criteria |
|
|
16
|
+
| `technical-design` | Describing how it works | Overview, Architecture, Data Model, API Design, Dependencies, Risks, Open Questions |
|
|
17
|
+
| `user-story` | Capturing a user workflow | Description, Acceptance Criteria, Dependencies, Notes |
|
|
18
|
+
| `test-plan` | Planning test coverage | Scope, Test Cases, Coverage Matrix, Edge Cases |
|
|
19
|
+
| `adr` | Recording a decision | Context, Decision, Status, Consequences |
|
|
20
|
+
| `api-contract` | Defining an API | Endpoints, Request/Response Schemas, Auth, Error Codes |
|
|
21
|
+
|
|
22
|
+
For detailed guidance on each type, read `spec-type-reference.md` in the parent directory.
|
|
23
|
+
|
|
24
|
+
## Check existing specs
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
npx specdx validate
|
|
28
|
+
npx specdx graph
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
This shows what specs exist and their dependency relationships. Use this to determine where the new spec fits.
|
|
32
|
+
|
|
33
|
+
## Create the file with frontmatter
|
|
34
|
+
|
|
35
|
+
```yaml
|
|
36
|
+
---
|
|
37
|
+
id: "<type>-<short-name>"
|
|
38
|
+
type: "<spec-type>"
|
|
39
|
+
title: "<clear title>"
|
|
40
|
+
status: "draft"
|
|
41
|
+
version: "0.1"
|
|
42
|
+
created: "<YYYY-MM-DD>"
|
|
43
|
+
authors: ["<name>"]
|
|
44
|
+
tags: ["<keyword>", "<keyword>"]
|
|
45
|
+
references:
|
|
46
|
+
- id: "<other-spec-id>"
|
|
47
|
+
relationship: "depends-on"
|
|
48
|
+
---
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Rules:
|
|
52
|
+
- **Always quote dates**: `"2026-03-18"` — unquoted YAML dates fail validation
|
|
53
|
+
- **authors must have at least one entry** — `authors: []` fails validation
|
|
54
|
+
- **id** must be unique across the spec suite
|
|
55
|
+
- **type** must be one of: `prd`, `technical-design`, `user-story`, `test-plan`, `adr`, `api-contract`
|
|
56
|
+
- **status** must be one of: `draft`, `review`, `approved`, `superseded`
|
|
57
|
+
- **references.relationship** must be one of: `implemented-by`, `decomposed-into`, `depends-on`, `supersedes`, `related-to`
|
|
58
|
+
|
|
59
|
+
Run an initial lint to verify frontmatter:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
npx specdx lint --path <file>
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
**Next:** When frontmatter passes lint, read `step-02-sections.md` in this directory.
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
---
|
|
2
|
+
step: 2
|
|
3
|
+
name: Sections
|
|
4
|
+
description: Write sections one at a time, lint after every 2-3 sections
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Step 2: Write Sections
|
|
8
|
+
|
|
9
|
+
## Write sections one at a time
|
|
10
|
+
|
|
11
|
+
For each required section:
|
|
12
|
+
1. Explain what the section should contain
|
|
13
|
+
2. Ask the user for their thoughts
|
|
14
|
+
3. Draft the section
|
|
15
|
+
4. Refine based on feedback
|
|
16
|
+
|
|
17
|
+
### PRD tips
|
|
18
|
+
- Use **F1**, **F2** etc. for features — the `story-coverage` lint rule checks each has a user story
|
|
19
|
+
- Be specific in Non-Goals — this prevents scope creep
|
|
20
|
+
|
|
21
|
+
### Technical Design tips
|
|
22
|
+
- Include concrete field names and types in Data Model
|
|
23
|
+
- List specific risks with likelihood and mitigation
|
|
24
|
+
|
|
25
|
+
### ADR tips
|
|
26
|
+
- State the decision in one clear sentence, then elaborate
|
|
27
|
+
- List both positive AND negative consequences
|
|
28
|
+
|
|
29
|
+
### User Story tips
|
|
30
|
+
- Acceptance criteria should be testable
|
|
31
|
+
- Include the priority and estimate in frontmatter
|
|
32
|
+
|
|
33
|
+
### Test Plan tips
|
|
34
|
+
- Coverage matrix should map to features from the PRD
|
|
35
|
+
- Edge cases are often where bugs hide — be thorough
|
|
36
|
+
|
|
37
|
+
### API Contract tips
|
|
38
|
+
- Include both success and error response schemas
|
|
39
|
+
- Document auth requirements per endpoint
|
|
40
|
+
|
|
41
|
+
## Lint after every 2-3 sections
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
npx specdx lint --path <file>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Common issues:
|
|
48
|
+
|
|
49
|
+
| Issue | Fix |
|
|
50
|
+
|---|---|
|
|
51
|
+
| Vague language ("as appropriate", "etc.", "TBD") | Replace with concrete language |
|
|
52
|
+
| Missing required section | Add it, even if minimal |
|
|
53
|
+
| Broken reference | Check the referenced spec ID exists |
|
|
54
|
+
|
|
55
|
+
<HARD-GATE>
|
|
56
|
+
Do NOT skip the lint step between sections. Run `npx specdx lint --path <file>`
|
|
57
|
+
after every 2-3 sections. Do NOT write the entire spec and lint at the end.
|
|
58
|
+
</HARD-GATE>
|
|
59
|
+
|
|
60
|
+
## Rationalizations to Resist
|
|
61
|
+
|
|
62
|
+
| Thought | Reality |
|
|
63
|
+
|---------|---------|
|
|
64
|
+
| "I'll lint at the end, it's faster" | Lint catches issues early. Fixing 1 issue now beats fixing 10 later. |
|
|
65
|
+
| "This section is simple, no need to lint" | Simple sections have frontmatter and reference issues too. |
|
|
66
|
+
| "The user seems in a hurry" | Shipping a broken spec wastes more time than linting. |
|
|
67
|
+
| "I already know the lint rules" | Rules evolve. Run the tool. |
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
**Next:** When all sections are written and linting clean, read `step-03-finalize.md` in this directory.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
---
|
|
2
|
+
step: 3
|
|
3
|
+
name: Finalize
|
|
4
|
+
description: Register in spec.config.yaml, run final validation
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Step 3: Finalize
|
|
8
|
+
|
|
9
|
+
## Register in spec.config.yaml
|
|
10
|
+
|
|
11
|
+
If this is a new spec, add it to `spec.config.yaml`:
|
|
12
|
+
|
|
13
|
+
```yaml
|
|
14
|
+
specs:
|
|
15
|
+
new-spec:
|
|
16
|
+
path: specs/new-spec.md
|
|
17
|
+
type: technical-design
|
|
18
|
+
requires: ["prd"]
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
The `requires` field establishes dependency relationships used by `specdx graph` and `specdx pack`.
|
|
22
|
+
|
|
23
|
+
If the spec replaces an existing entry, update the path. If it's a glob pattern (e.g. `specs/stories/*.md`), no config change is needed — the new file is picked up automatically.
|
|
24
|
+
|
|
25
|
+
## Final validation
|
|
26
|
+
|
|
27
|
+
Run the full validation suite:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npx specdx lint --path <file> --preset strict
|
|
31
|
+
npx specdx lint
|
|
32
|
+
npx specdx validate
|
|
33
|
+
npx specdx graph
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
This verifies:
|
|
37
|
+
- The new spec passes strict linting
|
|
38
|
+
- The full suite still passes (no broken cross-references)
|
|
39
|
+
- The config is valid
|
|
40
|
+
- The dependency graph is acyclic
|
|
41
|
+
|
|
42
|
+
## Report
|
|
43
|
+
|
|
44
|
+
Provide the user with:
|
|
45
|
+
- **Spec type** and file path
|
|
46
|
+
- **Lint status** (pass/fail, any remaining warnings)
|
|
47
|
+
- **Graph position** (what it depends on, what depends on it)
|
|
48
|
+
- **Next steps** (e.g. "run `npx specdx pack --task '...'` to include this spec in LLM context")
|
|
@@ -6,124 +6,24 @@ allowed-tools: Bash(npx specdx *), Read, Write, Edit
|
|
|
6
6
|
|
|
7
7
|
# Author a Spec
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
This skill follows a 3-step workflow. Load each step file as you reach it — this keeps the context focused and prevents bloat in long authoring sessions.
|
|
10
10
|
|
|
11
|
-
##
|
|
11
|
+
## Steps
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
1. **Frontmatter** — Read `specdx-author-spec/step-01-frontmatter.md` next to this file
|
|
14
|
+
- Determine spec type, check existing specs, create file with frontmatter
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
| `technical-design` | Describing how it works | Overview, Architecture, Data Model, API Design, Dependencies, Risks, Open Questions |
|
|
19
|
-
| `user-story` | Capturing a user workflow | Description, Acceptance Criteria, Dependencies, Notes |
|
|
20
|
-
| `test-plan` | Planning test coverage | Scope, Test Cases, Coverage Matrix, Edge Cases |
|
|
21
|
-
| `adr` | Recording a decision | Context, Decision, Status, Consequences |
|
|
22
|
-
| `api-contract` | Defining an API | Endpoints, Request/Response Schemas, Auth, Error Codes |
|
|
16
|
+
2. **Sections** — Read `specdx-author-spec/step-02-sections.md`
|
|
17
|
+
- Write sections one at a time, lint after every 2-3 sections
|
|
18
|
+
- HARD GATE: Do NOT skip lint between sections
|
|
23
19
|
|
|
24
|
-
|
|
20
|
+
3. **Finalize** — Read `specdx-author-spec/step-03-finalize.md`
|
|
21
|
+
- Register in spec.config.yaml, run final validation
|
|
25
22
|
|
|
26
|
-
|
|
27
|
-
npx specdx validate
|
|
28
|
-
npx specdx graph
|
|
29
|
-
```
|
|
23
|
+
## How to use
|
|
30
24
|
|
|
31
|
-
|
|
25
|
+
Start by reading `specdx-author-spec/step-01-frontmatter.md` (relative to this file's directory). Complete that step fully before moving to step 2.
|
|
32
26
|
|
|
33
|
-
|
|
27
|
+
Each step file is self-contained with its own instructions. Do NOT read ahead — load one step at a time.
|
|
34
28
|
|
|
35
|
-
|
|
36
|
-
---
|
|
37
|
-
id: "<type>-<short-name>"
|
|
38
|
-
type: "<spec-type>"
|
|
39
|
-
title: "<clear title>"
|
|
40
|
-
status: "draft"
|
|
41
|
-
version: "0.1"
|
|
42
|
-
created: "<YYYY-MM-DD>"
|
|
43
|
-
authors: ["<name>"]
|
|
44
|
-
tags: ["<keyword>", "<keyword>"]
|
|
45
|
-
references:
|
|
46
|
-
- id: "<other-spec-id>"
|
|
47
|
-
relationship: "depends-on"
|
|
48
|
-
---
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
Rules:
|
|
52
|
-
- **Always quote dates**: `"2026-03-18"` — unquoted YAML dates fail validation
|
|
53
|
-
- **authors must have at least one entry** — `authors: []` fails validation
|
|
54
|
-
- **id** must be unique across the spec suite
|
|
55
|
-
- **type** must be one of: `prd`, `technical-design`, `user-story`, `test-plan`, `adr`, `api-contract`
|
|
56
|
-
- **status** must be one of: `draft`, `review`, `approved`, `superseded`
|
|
57
|
-
- **references.relationship** must be one of: `implemented-by`, `decomposed-into`, `depends-on`, `supersedes`, `related-to`
|
|
58
|
-
|
|
59
|
-
## Step 4: Write sections one at a time
|
|
60
|
-
|
|
61
|
-
For each required section:
|
|
62
|
-
1. Explain what the section should contain
|
|
63
|
-
2. Ask the user for their thoughts
|
|
64
|
-
3. Draft the section
|
|
65
|
-
4. Refine based on feedback
|
|
66
|
-
|
|
67
|
-
### PRD tips
|
|
68
|
-
- Use **F1**, **F2** etc. for features — the `story-coverage` lint rule checks each has a user story
|
|
69
|
-
- Be specific in Non-Goals — this prevents scope creep
|
|
70
|
-
|
|
71
|
-
### Technical Design tips
|
|
72
|
-
- Include concrete field names and types in Data Model
|
|
73
|
-
- List specific risks with likelihood and mitigation
|
|
74
|
-
|
|
75
|
-
### ADR tips
|
|
76
|
-
- State the decision in one clear sentence, then elaborate
|
|
77
|
-
- List both positive AND negative consequences
|
|
78
|
-
|
|
79
|
-
## Step 5: Lint after every 2-3 sections
|
|
80
|
-
|
|
81
|
-
```bash
|
|
82
|
-
npx specdx lint --path <file>
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
Common issues:
|
|
86
|
-
|
|
87
|
-
| Issue | Fix |
|
|
88
|
-
|---|---|
|
|
89
|
-
| Vague language ("as appropriate", "etc.", "TBD") | Replace with concrete language |
|
|
90
|
-
| Missing required section | Add it, even if minimal |
|
|
91
|
-
| Broken reference | Check the referenced spec ID exists |
|
|
92
|
-
|
|
93
|
-
<HARD-GATE>
|
|
94
|
-
Do NOT skip the lint step between sections. Run `npx specdx lint --path <file>`
|
|
95
|
-
after every 2-3 sections. Do NOT write the entire spec and lint at the end.
|
|
96
|
-
</HARD-GATE>
|
|
97
|
-
|
|
98
|
-
## Rationalizations to Resist
|
|
99
|
-
|
|
100
|
-
| Thought | Reality |
|
|
101
|
-
|---------|---------|
|
|
102
|
-
| "I'll lint at the end, it's faster" | Lint catches issues early. Fixing 1 issue now beats fixing 10 later. |
|
|
103
|
-
| "This section is simple, no need to lint" | Simple sections have frontmatter and reference issues too. |
|
|
104
|
-
| "The user seems in a hurry" | Shipping a broken spec wastes more time than linting. |
|
|
105
|
-
| "I already know the lint rules" | Rules evolve. Run the tool. |
|
|
106
|
-
|
|
107
|
-
## Step 6: Register in spec.config.yaml
|
|
108
|
-
|
|
109
|
-
If this is a new spec, add it to `spec.config.yaml`:
|
|
110
|
-
|
|
111
|
-
```yaml
|
|
112
|
-
specs:
|
|
113
|
-
new-spec:
|
|
114
|
-
path: specs/new-spec.md
|
|
115
|
-
type: technical-design
|
|
116
|
-
requires: ["prd"]
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
The `requires` field establishes dependency relationships used by `specdx graph` and `specdx pack`.
|
|
120
|
-
|
|
121
|
-
## Step 7: Final validation
|
|
122
|
-
|
|
123
|
-
```bash
|
|
124
|
-
npx specdx lint --path <file> --preset strict
|
|
125
|
-
npx specdx lint
|
|
126
|
-
npx specdx validate
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
Report: spec type, file path, lint status, and any remaining warnings.
|
|
29
|
+
For detailed reference on spec types and their fields, see `spec-type-reference.md` in this directory.
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: specdx-check-drift
|
|
3
|
+
description: "Use when the user says 'check drift', 'did I drift from spec', 'am I still aligned', or as part of a pre-commit check. Compares recent code changes against spec definitions."
|
|
4
|
+
allowed-tools: Bash(npx specdx *), Read
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Check Spec Drift
|
|
8
|
+
|
|
9
|
+
Compare recent code changes against spec definitions to detect drift.
|
|
10
|
+
|
|
11
|
+
## Workflow
|
|
12
|
+
|
|
13
|
+
### Step 1: Check for spec changes
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npx specdx diff
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
This shows which specs changed since the last commit. Note any upstream spec changes.
|
|
20
|
+
|
|
21
|
+
### Step 2: Check implementation alignment
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npx specdx check --format json
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
This compares specs against code. Note any missing implementations or mismatches.
|
|
28
|
+
|
|
29
|
+
### Step 3: Cross-reference changes
|
|
30
|
+
|
|
31
|
+
Compare the two results:
|
|
32
|
+
|
|
33
|
+
| Situation | Meaning |
|
|
34
|
+
|---|---|
|
|
35
|
+
| Spec changed, code matches | Spec was updated to reflect reality. Good. |
|
|
36
|
+
| Spec changed, code doesn't match | Spec was updated but code wasn't. Needs code update. |
|
|
37
|
+
| Spec unchanged, code diverges | Code drifted from spec. Either update code or update spec. |
|
|
38
|
+
| Both changed in alignment | Normal development. Verify alignment. |
|
|
39
|
+
|
|
40
|
+
### Step 4: Present drift report
|
|
41
|
+
|
|
42
|
+
```
|
|
43
|
+
## Drift Report
|
|
44
|
+
|
|
45
|
+
### Spec Changes (since last commit)
|
|
46
|
+
[diff results — which specs changed and how]
|
|
47
|
+
|
|
48
|
+
### Implementation Alignment
|
|
49
|
+
[check results — score, findings]
|
|
50
|
+
|
|
51
|
+
### Drift Detected
|
|
52
|
+
- [list of drifts with suggested resolution: "update code" or "update spec"]
|
|
53
|
+
|
|
54
|
+
### Verdict
|
|
55
|
+
[aligned | minor drift | significant drift]
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Step 5: Suggest resolution
|
|
59
|
+
|
|
60
|
+
For each drift:
|
|
61
|
+
- If spec is the source of truth → suggest code changes
|
|
62
|
+
- If code is intentionally ahead → suggest spec updates
|
|
63
|
+
- If unclear → ask the user which direction to go
|
|
64
|
+
|
|
65
|
+
## Rationalizations to Resist
|
|
66
|
+
|
|
67
|
+
| Thought | Reality |
|
|
68
|
+
|---------|---------|
|
|
69
|
+
| "No specs changed, so no drift" | Code can drift even when specs don't change. Run the check. |
|
|
70
|
+
| "The check score is high enough" | Even 95% means 5% drift. Review the findings. |
|
|
71
|
+
| "I'll check drift later" | Drift compounds. Check now. |
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: specdx-review-spec
|
|
3
|
+
description: "Use when the user asks to review a spec, says 'is this spec good enough', 'review my spec', 'check spec quality', or 'audit this spec'. Runs multi-layer spec quality review."
|
|
4
|
+
allowed-tools: Bash(npx specdx *), Read, Agent
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Review Spec Quality
|
|
8
|
+
|
|
9
|
+
Run a three-layer review of a spec: completeness, consistency, and adversarial analysis. Each layer uses a specialized subagent.
|
|
10
|
+
|
|
11
|
+
## Workflow
|
|
12
|
+
|
|
13
|
+
### Step 1: Identify the spec to review
|
|
14
|
+
|
|
15
|
+
Ask the user which spec to review if not clear from context. Get the file path.
|
|
16
|
+
|
|
17
|
+
### Step 2: Gather context
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npx specdx lint --path <spec-file> --preset strict
|
|
21
|
+
npx specdx graph
|
|
22
|
+
npx specdx status --format json
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### Step 3: Run three review passes
|
|
26
|
+
|
|
27
|
+
Dispatch three subagents using the templates in the `templates/` directory next to this file's parent directory. Each subagent gets the spec path and related context.
|
|
28
|
+
|
|
29
|
+
**Pass 1 — Completeness** (use `templates/spec-reviewer.md`):
|
|
30
|
+
- Are all required sections present and non-empty?
|
|
31
|
+
- Is the frontmatter valid?
|
|
32
|
+
- Are cross-references intact?
|
|
33
|
+
|
|
34
|
+
**Pass 2 — Consistency** (use `templates/consistency-reviewer.md`):
|
|
35
|
+
- Is terminology consistent across specs?
|
|
36
|
+
- Do names and IDs align?
|
|
37
|
+
- Are versions and statuses coherent?
|
|
38
|
+
|
|
39
|
+
**Pass 3 — Adversarial** (use `templates/adversarial-reviewer.md`):
|
|
40
|
+
- What edge cases are missing?
|
|
41
|
+
- What's ambiguous?
|
|
42
|
+
- What could go wrong?
|
|
43
|
+
|
|
44
|
+
### Step 4: Aggregate results
|
|
45
|
+
|
|
46
|
+
Present a combined report:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
## Spec Review: <spec-title>
|
|
50
|
+
|
|
51
|
+
### Completeness
|
|
52
|
+
[pass 1 results]
|
|
53
|
+
|
|
54
|
+
### Consistency
|
|
55
|
+
[pass 2 results]
|
|
56
|
+
|
|
57
|
+
### Adversarial Analysis
|
|
58
|
+
[pass 3 results]
|
|
59
|
+
|
|
60
|
+
### Summary
|
|
61
|
+
- X critical issues
|
|
62
|
+
- Y improvements recommended
|
|
63
|
+
- Overall: ready for implementation | needs revision | needs major rework
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
<HARD-GATE>
|
|
67
|
+
Do NOT skip any of the three review passes. Each catches different classes of problems. A spec that passes completeness review may still have critical adversarial gaps.
|
|
68
|
+
</HARD-GATE>
|
|
69
|
+
|
|
70
|
+
## Rationalizations to Resist
|
|
71
|
+
|
|
72
|
+
| Thought | Reality |
|
|
73
|
+
|---------|---------|
|
|
74
|
+
| "The spec looks fine to me" | You're not adversarial enough. Run all three passes. |
|
|
75
|
+
| "Three passes is overkill for a small spec" | Small specs have the most gaps. Run all three. |
|
|
76
|
+
| "The completeness pass already found issues, so skip the rest" | Consistency and adversarial reviews find different issues. |
|
|
77
|
+
| "I can combine the passes into one review" | Separate passes with different prompts catch more. |
|