specdx 0.2.0-alpha.3 → 0.3.0-alpha.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/.claude-plugin/plugin.json +6 -0
- package/dist/changelog-URU2TFNM.js +86 -0
- package/dist/changelog-URU2TFNM.js.map +1 -0
- package/dist/{chunk-JLK2NNAF.js → chunk-276J7LR6.js} +12 -16
- package/dist/chunk-276J7LR6.js.map +1 -0
- package/dist/{lint-V42NAO3U.js → chunk-ATLVRGHI.js} +6 -102
- package/dist/chunk-ATLVRGHI.js.map +1 -0
- package/dist/chunk-GAM4MXPC.js +15 -0
- package/dist/chunk-GAM4MXPC.js.map +1 -0
- package/dist/chunk-LU6M5O63.js +1147 -0
- package/dist/chunk-LU6M5O63.js.map +1 -0
- package/dist/{chunk-CV2CHFFG.js → chunk-XLEN6ZYM.js} +29 -5
- package/dist/chunk-XLEN6ZYM.js.map +1 -0
- package/dist/diff-55PTEVB3.js +100 -0
- package/dist/diff-55PTEVB3.js.map +1 -0
- package/dist/explain-YXUILNEA.js +102 -0
- package/dist/explain-YXUILNEA.js.map +1 -0
- package/dist/{graph-G3ILOAV6.js → graph-OWQJWVSN.js} +7 -5
- package/dist/{graph-G3ILOAV6.js.map → graph-OWQJWVSN.js.map} +1 -1
- package/dist/index.js +1552 -6
- package/dist/index.js.map +1 -1
- package/dist/lint-U7VLGS75.js +111 -0
- package/dist/lint-U7VLGS75.js.map +1 -0
- package/dist/main.js +11 -6
- package/dist/main.js.map +1 -1
- package/dist/{pack-RWWFJSPV.js → pack-OJAC7JF2.js} +7 -5
- package/dist/{pack-RWWFJSPV.js.map → pack-OJAC7JF2.js.map} +1 -1
- package/dist/ready-3OIF4QHM.js +159 -0
- package/dist/ready-3OIF4QHM.js.map +1 -0
- package/dist/skills/spec-type-reference.md +57 -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 +29 -0
- package/dist/skills/specdx-onboard.md +49 -0
- package/dist/skills/specdx-plan-from-spec.md +72 -0
- package/dist/skills/specdx-pre-commit.md +56 -0
- package/dist/skills/specdx-sprint-review.md +69 -0
- package/dist/skills/{specdx-start-task/SKILL.md → specdx-start-task.md} +1 -1
- package/dist/{skills-5XHJEKA2.js → skills-XJYTWGDK.js} +15 -9
- package/dist/skills-XJYTWGDK.js.map +1 -0
- package/dist/status-LYZUO6AJ.js +145 -0
- package/dist/status-LYZUO6AJ.js.map +1 -0
- package/dist/{validate-XZWUCAWU.js → validate-DOZZEZFC.js} +7 -5
- package/dist/{validate-XZWUCAWU.js.map → validate-DOZZEZFC.js.map} +1 -1
- package/hooks/hooks.json +8 -0
- package/hooks/run-hook.cmd +46 -0
- package/hooks/session-start +77 -0
- package/package.json +5 -2
- package/dist/chunk-CV2CHFFG.js.map +0 -1
- package/dist/chunk-JLK2NNAF.js.map +0 -1
- package/dist/lint-V42NAO3U.js.map +0 -1
- package/dist/skills/specdx-author-spec/SKILL.md +0 -115
- package/dist/skills-5XHJEKA2.js.map +0 -1
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Spec Type Reference
|
|
2
|
+
|
|
3
|
+
## Frontmatter Fields (all types)
|
|
4
|
+
|
|
5
|
+
| Field | Required | Type | Notes |
|
|
6
|
+
|-------|----------|------|-------|
|
|
7
|
+
| id | yes | string | Unique across spec suite |
|
|
8
|
+
| type | yes | SpecType | See types below |
|
|
9
|
+
| title | yes | string | Human-readable title |
|
|
10
|
+
| status | yes | "draft" \| "review" \| "approved" \| "superseded" | |
|
|
11
|
+
| version | yes | string | Semantic version |
|
|
12
|
+
| created | yes | string | ISO date, must be quoted in YAML |
|
|
13
|
+
| authors | yes | string[] | At least one entry |
|
|
14
|
+
| updated | no | string | ISO date |
|
|
15
|
+
| tags | no | string[] | Keywords for search/pack relevance |
|
|
16
|
+
| references | no | SpecReference[] | Cross-references to other specs |
|
|
17
|
+
|
|
18
|
+
### Extra Fields for `user-story` type
|
|
19
|
+
|
|
20
|
+
| Field | Required | Type | Notes |
|
|
21
|
+
|-------|----------|------|-------|
|
|
22
|
+
| story_id | yes | string | Unique story identifier |
|
|
23
|
+
| priority | yes | "critical" \| "high" \| "medium" \| "low" | |
|
|
24
|
+
| estimate | yes | string | Story point or time estimate |
|
|
25
|
+
|
|
26
|
+
## Required Sections by Type
|
|
27
|
+
|
|
28
|
+
| Type | Required Sections |
|
|
29
|
+
|------|-------------------|
|
|
30
|
+
| prd | Problem Statement, Goals, Non-Goals, Features, Success Criteria |
|
|
31
|
+
| technical-design | Overview, Architecture, Data Model, API Design, Dependencies, Risks, Open Questions |
|
|
32
|
+
| user-story | Description, Acceptance Criteria, Dependencies, Notes |
|
|
33
|
+
| test-plan | Scope, Test Cases, Coverage Matrix, Edge Cases |
|
|
34
|
+
| adr | Context, Decision, Status, Consequences |
|
|
35
|
+
| api-contract | Endpoints, Request/Response Schemas, Auth, Error Codes |
|
|
36
|
+
|
|
37
|
+
## References Format
|
|
38
|
+
|
|
39
|
+
The `references` frontmatter field is an array of `SpecReference` objects:
|
|
40
|
+
|
|
41
|
+
```yaml
|
|
42
|
+
references:
|
|
43
|
+
- id: "spec-id-here"
|
|
44
|
+
relationship: "depends-on"
|
|
45
|
+
- id: "another-spec-id"
|
|
46
|
+
relationship: "implemented-by"
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Relationship Values
|
|
50
|
+
|
|
51
|
+
| Value | Meaning |
|
|
52
|
+
|-------|---------|
|
|
53
|
+
| implemented-by | This spec is implemented by the referenced spec |
|
|
54
|
+
| decomposed-into | This spec breaks down into the referenced spec |
|
|
55
|
+
| depends-on | This spec depends on the referenced spec |
|
|
56
|
+
| supersedes | This spec replaces the referenced spec |
|
|
57
|
+
| related-to | General association with the referenced spec |
|
|
@@ -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")
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: specdx-author-spec
|
|
3
|
+
description: Use when the user wants to create a new spec, write a PRD, document a technical design, record an architecture decision, add a user story, or write a test plan. Guides spec authoring with iterative linting.
|
|
4
|
+
allowed-tools: Bash(npx specdx *), Read, Write, Edit
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Author a Spec
|
|
8
|
+
|
|
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
|
+
|
|
11
|
+
## Steps
|
|
12
|
+
|
|
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
|
|
15
|
+
|
|
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
|
|
19
|
+
|
|
20
|
+
3. **Finalize** — Read `specdx-author-spec/step-03-finalize.md`
|
|
21
|
+
- Register in spec.config.yaml, run final validation
|
|
22
|
+
|
|
23
|
+
## How to use
|
|
24
|
+
|
|
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.
|
|
26
|
+
|
|
27
|
+
Each step file is self-contained with its own instructions. Do NOT read ahead — load one step at a time.
|
|
28
|
+
|
|
29
|
+
For detailed reference on spec types and their fields, see `spec-type-reference.md` in this directory.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: specdx-onboard
|
|
3
|
+
description: "Use when a new developer joins the project, asks 'what is this project', 'explain the specs', 'how does this codebase work', 'what specs exist', or wants an overview of the spec suite. Provides a guided tour of the project's specs."
|
|
4
|
+
allowed-tools: Bash(npx specdx *)
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Onboard — Spec Suite Overview
|
|
8
|
+
|
|
9
|
+
Walk a new developer through the project's spec suite so they understand what exists, how specs relate, and where to start.
|
|
10
|
+
|
|
11
|
+
## Workflow
|
|
12
|
+
|
|
13
|
+
### Step 1: Get the overview
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npx specdx explain --format json
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
This returns the project name, spec count, types, statuses, a brief description of each spec, and the dependency graph.
|
|
20
|
+
|
|
21
|
+
### Step 2: Load full spec content
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npx specdx pack --full --format xml
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
This loads all spec content so you can reference specific details.
|
|
28
|
+
|
|
29
|
+
### Step 3: Walk through the project
|
|
30
|
+
|
|
31
|
+
Guide the developer through:
|
|
32
|
+
|
|
33
|
+
1. **What the project does** — summarise the PRD's Problem Statement and Goals
|
|
34
|
+
2. **How it's built** — summarise the Technical Design's Architecture and key decisions
|
|
35
|
+
3. **What specs exist** — list each spec with its type, status, and purpose
|
|
36
|
+
4. **How specs relate** — explain the dependency graph (what depends on what)
|
|
37
|
+
5. **Current health** — note any warnings, stale specs, or open questions
|
|
38
|
+
|
|
39
|
+
### Step 4: Invite questions
|
|
40
|
+
|
|
41
|
+
> "That's the spec landscape. What area would you like to dig into? I can explain any spec in more detail, show you the dependency chain for a specific feature, or help you find where a topic is covered."
|
|
42
|
+
|
|
43
|
+
## Tips
|
|
44
|
+
|
|
45
|
+
- Start high-level, then drill down based on the developer's questions
|
|
46
|
+
- Reference specific spec sections when explaining (e.g. "See PRD Feature F3 for details")
|
|
47
|
+
- If a spec is marked `draft`, note that it's tentative and may change
|
|
48
|
+
- If a spec is marked `superseded`, briefly mention what replaced it
|
|
49
|
+
- Use the dependency graph to explain why specs exist (e.g. "The test plan depends on the technical design because test cases reference the API endpoints defined there")
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: specdx-plan-from-spec
|
|
3
|
+
description: "Use when the user asks to plan implementation, create a plan from specs, or says 'how should I build this', 'plan this', 'create an implementation plan', or 'what's the approach'. Generates a step-by-step plan grounded in project specs."
|
|
4
|
+
allowed-tools: Bash(npx specdx *)
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Plan From Spec
|
|
8
|
+
|
|
9
|
+
Generate an implementation plan grounded in the project's specs.
|
|
10
|
+
|
|
11
|
+
## Workflow
|
|
12
|
+
|
|
13
|
+
### Step 1: Load spec context
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npx specdx pack --task "$ARGUMENTS" --format xml --full
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Replace `$ARGUMENTS` with the user's task description.
|
|
20
|
+
|
|
21
|
+
If the output is too large (over 8000 tokens), re-run without `--full`:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npx specdx pack --task "$ARGUMENTS" --format xml
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Step 2: Understand the specs
|
|
28
|
+
|
|
29
|
+
Read the packed output. Each `<spec>` has:
|
|
30
|
+
- `id` and `type` — what kind of spec
|
|
31
|
+
- `relevance` — how relevant to the task (0-1)
|
|
32
|
+
- Sections with the actual content
|
|
33
|
+
|
|
34
|
+
Focus on the highest-relevance specs first.
|
|
35
|
+
|
|
36
|
+
### Step 3: Generate the plan
|
|
37
|
+
|
|
38
|
+
Create a step-by-step implementation plan with:
|
|
39
|
+
|
|
40
|
+
1. **File targets** — which files to create or modify
|
|
41
|
+
2. **Dependency order** — what to build first based on the spec dependency graph
|
|
42
|
+
3. **Test expectations** — what tests to write for each step
|
|
43
|
+
4. **Spec references** — link each step back to the relevant spec section (e.g. "implements PRD Feature F2", "satisfies test-plan edge case 3")
|
|
44
|
+
|
|
45
|
+
### Step 4: Structure for execution
|
|
46
|
+
|
|
47
|
+
If the user has the superpowers plugin installed, structure the plan to be compatible with the `writing-plans` skill format:
|
|
48
|
+
|
|
49
|
+
- Use checkbox syntax (`- [ ]`) for each step
|
|
50
|
+
- Include exact file paths
|
|
51
|
+
- Include code snippets where helpful
|
|
52
|
+
- Group steps into logical tasks (2-5 minutes each)
|
|
53
|
+
|
|
54
|
+
If the user doesn't have superpowers, use a simpler numbered list format.
|
|
55
|
+
|
|
56
|
+
## Spec types and what they tell you
|
|
57
|
+
|
|
58
|
+
| Type | What to extract for the plan |
|
|
59
|
+
|---|---|
|
|
60
|
+
| `prd` | Feature list (F1, F2...), success criteria, non-goals (what NOT to build) |
|
|
61
|
+
| `technical-design` | Architecture, data model, API design, dependencies, risks |
|
|
62
|
+
| `user-story` | Acceptance criteria, priority, estimate |
|
|
63
|
+
| `test-plan` | Test cases, coverage matrix, edge cases |
|
|
64
|
+
| `adr` | Decisions and constraints to respect |
|
|
65
|
+
| `api-contract` | Endpoints, schemas, auth requirements |
|
|
66
|
+
|
|
67
|
+
## How to use the context
|
|
68
|
+
|
|
69
|
+
1. **Reference specs** — mention feature IDs or spec sections when your plan relates to them
|
|
70
|
+
2. **Flag gaps** — if the task needs decisions not covered by any spec, say so
|
|
71
|
+
3. **Respect non-goals** — if the PRD says "not X", don't plan for X
|
|
72
|
+
4. **Note risks** — if the technical design lists risks relevant to the task, address them in the plan
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: specdx-pre-commit
|
|
3
|
+
description: "Use when the user is about to commit, mentions committing, or says 'let's commit', 'ready to commit', 'wrap up', or 'commit this'. Checks spec health and flags drift before committing."
|
|
4
|
+
allowed-tools: Bash(npx specdx *)
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Pre-Commit Spec Check
|
|
8
|
+
|
|
9
|
+
Run spec health checks before committing to catch drift early.
|
|
10
|
+
|
|
11
|
+
<HARD-GATE>
|
|
12
|
+
Do NOT skip the diff step. Even if the user says "just commit", run the checks and surface the results before proceeding. Silent skipping leads to undetected spec drift.
|
|
13
|
+
</HARD-GATE>
|
|
14
|
+
|
|
15
|
+
## Workflow
|
|
16
|
+
|
|
17
|
+
### Step 1: Lint
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npx specdx lint
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
If lint errors are found, report them and ask the user to fix before committing.
|
|
24
|
+
|
|
25
|
+
### Step 2: Diff
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npx specdx diff
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
If the command fails (e.g. no git history), skip this step and note it.
|
|
32
|
+
|
|
33
|
+
### Step 3: Present results
|
|
34
|
+
|
|
35
|
+
**If no spec changes detected:**
|
|
36
|
+
> "No spec changes — safe to commit."
|
|
37
|
+
|
|
38
|
+
**If changes detected, present a summary:**
|
|
39
|
+
- Which specs changed and what sections were modified
|
|
40
|
+
- Downstream specs that may need updating (with staleness scores)
|
|
41
|
+
- Whether any downstream specs are flagged as stale
|
|
42
|
+
|
|
43
|
+
### Step 4: Ask the user
|
|
44
|
+
|
|
45
|
+
> "Do you want to update downstream specs before committing, or proceed as-is?"
|
|
46
|
+
|
|
47
|
+
Respect the user's decision either way.
|
|
48
|
+
|
|
49
|
+
## Rationalizations to Resist
|
|
50
|
+
|
|
51
|
+
| Thought | Reality |
|
|
52
|
+
|---------|---------|
|
|
53
|
+
| "The user just wants to commit quickly" | A 5-second check prevents hours of drift debugging. |
|
|
54
|
+
| "There are no spec files in the diff" | Code changes can still drift from specs. Run the check. |
|
|
55
|
+
| "I already ran lint earlier" | Specs may have changed since. Run it again. |
|
|
56
|
+
| "The diff command failed, so skip everything" | Report the lint results at minimum. |
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: specdx-sprint-review
|
|
3
|
+
description: "Use when the user asks for a summary, sprint review, spec health report, progress update, or says 'how are specs looking', 'spec health', or 'what changed'. Generates a shareable spec health report."
|
|
4
|
+
allowed-tools: Bash(npx specdx *)
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Sprint Review — Spec Health Report
|
|
8
|
+
|
|
9
|
+
Generate a shareable summary of spec suite health and recent changes.
|
|
10
|
+
|
|
11
|
+
## Workflow
|
|
12
|
+
|
|
13
|
+
### Step 1: Get current health
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npx specdx status --format json
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Parse the JSON output to understand: project name, spec count, lint health (errors/warnings), stale specs, verdict.
|
|
20
|
+
|
|
21
|
+
### Step 2: Get recent changes
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npx specdx diff --format json
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
If this fails (e.g. no git history or no baseline branch), skip and note "diff unavailable".
|
|
28
|
+
|
|
29
|
+
Parse the JSON to understand: which specs changed, sections modified, downstream impact.
|
|
30
|
+
|
|
31
|
+
### Step 3: Synthesise the report
|
|
32
|
+
|
|
33
|
+
Present a markdown report covering:
|
|
34
|
+
|
|
35
|
+
1. **Health verdict** — healthy/warnings/errors with spec count
|
|
36
|
+
2. **Lint status** — errors and warnings count
|
|
37
|
+
3. **Recent changes** — specs added, modified, or removed (from diff)
|
|
38
|
+
4. **Downstream impact** — which specs may need attention, staleness scores
|
|
39
|
+
5. **Stale specs** — any specs not updated past the threshold
|
|
40
|
+
6. **Recommended actions** — concrete suggestions (e.g. "technical-design hasn't been updated since prd changed 5 days ago")
|
|
41
|
+
|
|
42
|
+
### Step 4: Format for sharing
|
|
43
|
+
|
|
44
|
+
Present the report in clean markdown that can be pasted directly into Slack, a PR description, or a standup document.
|
|
45
|
+
|
|
46
|
+
## Reading the output
|
|
47
|
+
|
|
48
|
+
The `status --format json` output looks like:
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"project": "my-project",
|
|
52
|
+
"specCount": 3,
|
|
53
|
+
"byStatus": {"approved": 2, "draft": 1},
|
|
54
|
+
"lintHealth": {"errors": 0, "warnings": 2, "passing": 3},
|
|
55
|
+
"staleSpecs": [{"specId": "tech", "daysSinceUpdate": 15}],
|
|
56
|
+
"verdict": "warnings"
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
The `diff --format json` output looks like:
|
|
61
|
+
```json
|
|
62
|
+
{
|
|
63
|
+
"diffs": [{"specId": "prd", "summary": "prd: 1 field(s) changed, 1 section(s) changed"}],
|
|
64
|
+
"added": [],
|
|
65
|
+
"removed": [],
|
|
66
|
+
"impact": [{"changedSpec": "prd", "downstream": [{"specId": "tech", "staleness": 0.7}]}],
|
|
67
|
+
"summary": "1 spec changed, 1 downstream affected"
|
|
68
|
+
}
|
|
69
|
+
```
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: specdx-start-task
|
|
3
|
-
description:
|
|
3
|
+
description: Use when the user describes work they're about to do, mentions implementing a feature, asks to start a task, or says 'implement', 'build', 'add', 'fix', or 'refactor'. Loads relevant spec context before coding.
|
|
4
4
|
allowed-tools: Bash(npx specdx *)
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -7,7 +7,14 @@ import { statSync } from "fs";
|
|
|
7
7
|
import { join, dirname } from "path";
|
|
8
8
|
import { fileURLToPath } from "url";
|
|
9
9
|
var __dirname = dirname(fileURLToPath(import.meta.url));
|
|
10
|
-
var
|
|
10
|
+
var SKILL_NAMES = [
|
|
11
|
+
"specdx-start-task",
|
|
12
|
+
"specdx-author-spec",
|
|
13
|
+
"specdx-pre-commit",
|
|
14
|
+
"specdx-sprint-review",
|
|
15
|
+
"specdx-plan-from-spec",
|
|
16
|
+
"specdx-onboard"
|
|
17
|
+
];
|
|
11
18
|
function getSkillSourceDir() {
|
|
12
19
|
const bundledPath = join(__dirname, "skills");
|
|
13
20
|
try {
|
|
@@ -19,13 +26,13 @@ function getSkillSourceDir() {
|
|
|
19
26
|
}
|
|
20
27
|
async function installSkills(projectDir) {
|
|
21
28
|
const sourceDir = getSkillSourceDir();
|
|
22
|
-
const
|
|
29
|
+
const commandsDir = join(projectDir, ".claude", "commands");
|
|
23
30
|
const installed = [];
|
|
24
31
|
const updated = [];
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
const
|
|
28
|
-
const targetPath = join(
|
|
32
|
+
await mkdir(commandsDir, { recursive: true });
|
|
33
|
+
for (const skillName of SKILL_NAMES) {
|
|
34
|
+
const sourcePath = join(sourceDir, `${skillName}.md`);
|
|
35
|
+
const targetPath = join(commandsDir, `${skillName}.md`);
|
|
29
36
|
const content = await readFile(sourcePath, "utf-8");
|
|
30
37
|
let exists = false;
|
|
31
38
|
try {
|
|
@@ -33,7 +40,6 @@ async function installSkills(projectDir) {
|
|
|
33
40
|
exists = true;
|
|
34
41
|
} catch {
|
|
35
42
|
}
|
|
36
|
-
await mkdir(targetDir, { recursive: true });
|
|
37
43
|
await writeFile(targetPath, content, "utf-8");
|
|
38
44
|
if (exists) {
|
|
39
45
|
updated.push(skillName);
|
|
@@ -67,7 +73,7 @@ var skills_default = defineCommand({
|
|
|
67
73
|
for (const file of result.installed) console.log(` \u2713 Installed ${file}`);
|
|
68
74
|
for (const file of result.updated) console.log(` \u2713 Updated ${file}`);
|
|
69
75
|
console.log(`
|
|
70
|
-
Skills installed to .claude/
|
|
76
|
+
Skills installed to .claude/commands/`);
|
|
71
77
|
} catch (err) {
|
|
72
78
|
console.error(`
|
|
73
79
|
\u2717 ${err.message}
|
|
@@ -81,4 +87,4 @@ var skills_default = defineCommand({
|
|
|
81
87
|
export {
|
|
82
88
|
skills_default as default
|
|
83
89
|
};
|
|
84
|
-
//# sourceMappingURL=skills-
|
|
90
|
+
//# sourceMappingURL=skills-XJYTWGDK.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/skills.ts","../../skills/src/install.ts"],"sourcesContent":["import { defineCommand } from \"citty\";\nimport { installSkills } from \"@specdx/skills\";\n\nexport default defineCommand({\n meta: { name: \"skills\", description: \"Manage specdx skills for AI coding tools\" },\n subCommands: {\n install: defineCommand({\n meta: { name: \"install\", description: \"Install Claude Code skill files\" },\n args: {\n dir: {\n type: \"string\",\n description: \"Target directory (default: current directory)\",\n default: \".\",\n },\n },\n async run({ args }) {\n try {\n const result = await installSkills(args.dir);\n if (result.installed.length === 0 && result.updated.length === 0) {\n console.log(\" No skill files to install.\");\n return;\n }\n for (const file of result.installed) console.log(` ✓ Installed ${file}`);\n for (const file of result.updated) console.log(` ✓ Updated ${file}`);\n console.log(`\\n Skills installed to .claude/commands/`);\n } catch (err) {\n console.error(`\\n ✗ ${(err as Error).message}\\n`);\n process.exit(1);\n }\n },\n }),\n },\n});\n","import { mkdir, writeFile, readFile, stat } from \"node:fs/promises\";\nimport { statSync } from \"node:fs\";\nimport { join, dirname } from \"node:path\";\nimport { fileURLToPath } from \"node:url\";\n\nconst __dirname = dirname(fileURLToPath(import.meta.url));\n\n/** Skill file names (without .md extension) */\nexport const SKILL_NAMES = [\n \"specdx-start-task\",\n \"specdx-author-spec\",\n \"specdx-pre-commit\",\n \"specdx-sprint-review\",\n \"specdx-plan-from-spec\",\n \"specdx-onboard\",\n];\n\nexport interface InstallResult {\n installed: string[];\n updated: string[];\n}\n\nfunction getSkillSourceDir(): string {\n // When bundled: skills at __dirname/skills (sibling of bundle)\n // In dev: skills at __dirname/../skills (sibling of src/)\n const bundledPath = join(__dirname, \"skills\");\n try {\n statSync(bundledPath);\n return bundledPath;\n } catch {\n return join(__dirname, \"..\", \"skills\");\n }\n}\n\nexport async function installSkills(projectDir: string): Promise<InstallResult> {\n const sourceDir = getSkillSourceDir();\n const commandsDir = join(projectDir, \".claude\", \"commands\");\n const installed: string[] = [];\n const updated: string[] = [];\n\n await mkdir(commandsDir, { recursive: true });\n\n for (const skillName of SKILL_NAMES) {\n const sourcePath = join(sourceDir, `${skillName}.md`);\n const targetPath = join(commandsDir, `${skillName}.md`);\n\n const content = await readFile(sourcePath, \"utf-8\");\n\n // Check if target already exists\n let exists = false;\n try {\n await stat(targetPath);\n exists = true;\n } catch {\n // File doesn't exist\n }\n\n await writeFile(targetPath, content, \"utf-8\");\n\n if (exists) {\n updated.push(skillName);\n } else {\n installed.push(skillName);\n }\n }\n\n return { installed, updated };\n}\n"],"mappings":";AAAA,SAAS,qBAAqB;;;ACA9B,SAAS,OAAO,WAAW,UAAU,YAAY;AACjD,SAAS,gBAAgB;AACzB,SAAS,MAAM,eAAe;AAC9B,SAAS,qBAAqB;AAE9B,IAAM,YAAY,QAAQ,cAAc,YAAY,GAAG,CAAC;AAGjD,IAAM,cAAc;EACzB;EACA;EACA;EACA;EACA;EACA;;AAQF,SAAS,oBAAiB;AAGxB,QAAM,cAAc,KAAK,WAAW,QAAQ;AAC5C,MAAI;AACF,aAAS,WAAW;AACpB,WAAO;EACT,QAAQ;AACN,WAAO,KAAK,WAAW,MAAM,QAAQ;EACvC;AACF;AAEA,eAAsB,cAAc,YAAkB;AACpD,QAAM,YAAY,kBAAiB;AACnC,QAAM,cAAc,KAAK,YAAY,WAAW,UAAU;AAC1D,QAAM,YAAsB,CAAA;AAC5B,QAAM,UAAoB,CAAA;AAE1B,QAAM,MAAM,aAAa,EAAE,WAAW,KAAI,CAAE;AAE5C,aAAW,aAAa,aAAa;AACnC,UAAM,aAAa,KAAK,WAAW,GAAG,SAAS,KAAK;AACpD,UAAM,aAAa,KAAK,aAAa,GAAG,SAAS,KAAK;AAEtD,UAAM,UAAU,MAAM,SAAS,YAAY,OAAO;AAGlD,QAAI,SAAS;AACb,QAAI;AACF,YAAM,KAAK,UAAU;AACrB,eAAS;IACX,QAAQ;IAER;AAEA,UAAM,UAAU,YAAY,SAAS,OAAO;AAE5C,QAAI,QAAQ;AACV,cAAQ,KAAK,SAAS;IACxB,OAAO;AACL,gBAAU,KAAK,SAAS;IAC1B;EACF;AAEA,SAAO,EAAE,WAAW,QAAO;AAC7B;;;ADhEA,IAAO,iBAAQ,cAAc;AAAA,EAC3B,MAAM,EAAE,MAAM,UAAU,aAAa,2CAA2C;AAAA,EAChF,aAAa;AAAA,IACX,SAAS,cAAc;AAAA,MACrB,MAAM,EAAE,MAAM,WAAW,aAAa,kCAAkC;AAAA,MACxE,MAAM;AAAA,QACJ,KAAK;AAAA,UACH,MAAM;AAAA,UACN,aAAa;AAAA,UACb,SAAS;AAAA,QACX;AAAA,MACF;AAAA,MACA,MAAM,IAAI,EAAE,KAAK,GAAG;AAClB,YAAI;AACF,gBAAM,SAAS,MAAM,cAAc,KAAK,GAAG;AAC3C,cAAI,OAAO,UAAU,WAAW,KAAK,OAAO,QAAQ,WAAW,GAAG;AAChE,oBAAQ,IAAI,8BAA8B;AAC1C;AAAA,UACF;AACA,qBAAW,QAAQ,OAAO,UAAW,SAAQ,IAAI,sBAAiB,IAAI,EAAE;AACxE,qBAAW,QAAQ,OAAO,QAAS,SAAQ,IAAI,oBAAe,IAAI,EAAE;AACpE,kBAAQ,IAAI;AAAA,wCAA2C;AAAA,QACzD,SAAS,KAAK;AACZ,kBAAQ,MAAM;AAAA,WAAU,IAAc,OAAO;AAAA,CAAI;AACjD,kBAAQ,KAAK,CAAC;AAAA,QAChB;AAAA,MACF;AAAA,IACF,CAAC;AAAA,EACH;AACF,CAAC;","names":[]}
|