specdacular 0.10.1 → 0.11.0
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/README.md +3 -3
- package/bin/install.js +3 -1
- package/bin/specd.js +135 -0
- package/commands/specd.best-practices.md +75 -0
- package/commands/specd.docs.md +81 -0
- package/commands/specd.docs.review.md +80 -0
- package/commands/specd.generate-skills.learn.md +65 -0
- package/commands/specd.new-runner-task.md +52 -0
- package/commands/specd.new.md +6 -6
- package/commands/specd.runner-status.md +27 -0
- package/package.json +6 -2
- package/runner/main/agent/parser.js +39 -0
- package/runner/main/agent/runner.js +137 -0
- package/runner/main/agent/template.js +16 -0
- package/runner/main/bootstrap.js +69 -0
- package/runner/main/db.js +45 -0
- package/runner/main/index.js +103 -0
- package/runner/main/ipc.js +72 -0
- package/runner/main/notifications/telegram.js +45 -0
- package/runner/main/orchestrator.js +193 -0
- package/runner/main/paths.js +36 -0
- package/runner/main/pipeline/resolver.js +20 -0
- package/runner/main/pipeline/sequencer.js +42 -0
- package/runner/main/server/api.js +125 -0
- package/runner/main/server/index.js +33 -0
- package/runner/main/server/websocket.js +24 -0
- package/runner/main/state/manager.js +83 -0
- package/runner/main/template-manager.js +41 -0
- package/runner/main/test/agent-parser.test.js +44 -0
- package/runner/main/test/bootstrap.test.js +58 -0
- package/runner/main/test/db.test.js +72 -0
- package/runner/main/test/paths.test.js +29 -0
- package/runner/main/test/state-manager.test.js +72 -0
- package/runner/main/test/template-manager.test.js +66 -0
- package/runner/main/worktree/manager.js +95 -0
- package/runner/package.json +22 -0
- package/runner/preload.js +19 -0
- package/specdacular/HELP.md +14 -11
- package/specdacular/agents/best-practices-researcher.md +271 -0
- package/specdacular/references/load-context.md +4 -7
- package/specdacular/templates/orchestrator/CONCERNS.md +1 -1
- package/specdacular/templates/orchestrator/PROJECTS.md +3 -4
- package/specdacular/templates/tasks/PLAN.md +2 -2
- package/specdacular/workflows/best-practices.md +472 -0
- package/specdacular/workflows/context-add.md +16 -30
- package/specdacular/workflows/context-manual-review.md +7 -7
- package/specdacular/workflows/docs-review.md +273 -0
- package/specdacular/workflows/docs.md +420 -0
- package/specdacular/workflows/generate-learn-skill.md +214 -0
- package/specdacular/workflows/new.md +5 -4
- package/specdacular/workflows/orchestrator/new.md +4 -4
- package/specdacular/workflows/orchestrator/plan.md +6 -6
- package/commands/specd.codebase.map.md +0 -72
- package/commands/specd.codebase.review.md +0 -39
- package/specdacular/workflows/map-codebase.md +0 -715
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
<purpose>
|
|
2
|
+
Generate a project-specific /{namespace}:learn skill that captures coding lessons into the project's docs/ files. Reads existing docs to customize the skill's target table, section headings, and formatting.
|
|
3
|
+
|
|
4
|
+
**Output:** `.claude/commands/{namespace}/learn.md`
|
|
5
|
+
</purpose>
|
|
6
|
+
|
|
7
|
+
<philosophy>
|
|
8
|
+
|
|
9
|
+
## Read, Don't Guess
|
|
10
|
+
|
|
11
|
+
The skill must reference actual doc files with accurate descriptions. Read every doc before generating the skill.
|
|
12
|
+
|
|
13
|
+
## Match The Format
|
|
14
|
+
|
|
15
|
+
Each project's docs have their own style. The learn skill should write entries that match — scan existing entries for format patterns (bullet style, heading levels, code block conventions).
|
|
16
|
+
|
|
17
|
+
</philosophy>
|
|
18
|
+
|
|
19
|
+
<process>
|
|
20
|
+
|
|
21
|
+
<step name="check_prerequisites">
|
|
22
|
+
Verify that docs exist.
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
ls docs/*.md 2>/dev/null
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
**If no docs found:**
|
|
29
|
+
```
|
|
30
|
+
No docs/ folder found. The learn skill needs docs to write to.
|
|
31
|
+
|
|
32
|
+
Run /specd.docs first to generate topic-based documentation.
|
|
33
|
+
```
|
|
34
|
+
End workflow.
|
|
35
|
+
|
|
36
|
+
Continue to derive_namespace.
|
|
37
|
+
</step>
|
|
38
|
+
|
|
39
|
+
<step name="derive_namespace">
|
|
40
|
+
Determine the skill namespace.
|
|
41
|
+
|
|
42
|
+
**If user provided `$ARGUMENTS`:** Use first non-flag token as namespace.
|
|
43
|
+
|
|
44
|
+
**If no argument:** Infer from project:
|
|
45
|
+
```bash
|
|
46
|
+
basename $(pwd) | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/-/g'
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Use AskUserQuestion:
|
|
50
|
+
- header: "Namespace"
|
|
51
|
+
- question: "What namespace for your skill? (invoked as `/{ns}:learn`)"
|
|
52
|
+
- options:
|
|
53
|
+
- "{inferred name} (Recommended)" — Use the detected project name
|
|
54
|
+
- "Custom" — Enter a different namespace
|
|
55
|
+
|
|
56
|
+
Set `$NAMESPACE`.
|
|
57
|
+
|
|
58
|
+
Continue to analyze_docs.
|
|
59
|
+
</step>
|
|
60
|
+
|
|
61
|
+
<step name="analyze_docs">
|
|
62
|
+
Read all doc files and build the target mapping.
|
|
63
|
+
|
|
64
|
+
**For each file in docs/:**
|
|
65
|
+
|
|
66
|
+
1. Read the file
|
|
67
|
+
2. Extract:
|
|
68
|
+
- Filename (e.g., `css-and-styles.md`)
|
|
69
|
+
- Top-level `##` section headings
|
|
70
|
+
- Brief description of what it covers (from first paragraph or heading pattern)
|
|
71
|
+
- Entry format — how existing entries are written (bullet style, one-liners vs paragraphs)
|
|
72
|
+
|
|
73
|
+
3. Check if `docs/rules.md` exists — if yes, extract its section headings too (these become the rule categories)
|
|
74
|
+
|
|
75
|
+
**Build `$DOC_TABLE`** — a markdown table with one row per doc:
|
|
76
|
+
```
|
|
77
|
+
| Doc | Content |
|
|
78
|
+
|-----|---------|
|
|
79
|
+
| `docs/rules.md` | Project-wide rules (Styling, Components, ...) |
|
|
80
|
+
| `docs/css-and-styles.md` | Fonts, colors, spacing, SCSS |
|
|
81
|
+
| `docs/react-query-and-apis.md` | Hooks, mutations, API calls |
|
|
82
|
+
| ... | ... |
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
**Build `$RULES_SECTIONS`** — list of section headings in rules.md (if it exists).
|
|
86
|
+
|
|
87
|
+
Continue to generate_skill.
|
|
88
|
+
</step>
|
|
89
|
+
|
|
90
|
+
<step name="generate_skill">
|
|
91
|
+
Generate the learn skill file.
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
mkdir -p .claude/commands/$NAMESPACE
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Write `.claude/commands/$NAMESPACE/learn.md` with the following content (replacing all template variables):
|
|
98
|
+
|
|
99
|
+
```markdown
|
|
100
|
+
# /{NAMESPACE}:learn — Capture a lesson into project docs
|
|
101
|
+
|
|
102
|
+
Capture a coding lesson, mistake, or pattern from the current conversation and add it to the appropriate documentation files so future sessions don't repeat the same mistake.
|
|
103
|
+
|
|
104
|
+
## Input
|
|
105
|
+
|
|
106
|
+
The user may provide an explicit lesson as an argument: `$ARGUMENTS`
|
|
107
|
+
|
|
108
|
+
If no argument is provided, infer the lesson from the recent conversation — look for corrections, mistakes, or new patterns that were discussed.
|
|
109
|
+
|
|
110
|
+
## Steps
|
|
111
|
+
|
|
112
|
+
### 1. Identify the lessons
|
|
113
|
+
|
|
114
|
+
Extract one or more lessons from the conversation or argument. Each lesson should be a clear, actionable statement. Examples:
|
|
115
|
+
- "Never use X — use Y instead"
|
|
116
|
+
- "Always wrap Z in an error boundary"
|
|
117
|
+
- "Use the existing useX hook instead of writing custom fetch logic"
|
|
118
|
+
|
|
119
|
+
### 2. Classify each lesson
|
|
120
|
+
|
|
121
|
+
For each lesson, determine:
|
|
122
|
+
|
|
123
|
+
**Type:**
|
|
124
|
+
- **Rule** — A hard constraint ("never X", "always Y"). Goes into `docs/rules.md` AND a topic doc.
|
|
125
|
+
- **Pattern** — A technique or code example ("here's how to do X"). Goes into a topic doc only.
|
|
126
|
+
|
|
127
|
+
**Target doc — pick from:**
|
|
128
|
+
|
|
129
|
+
{$DOC_TABLE}
|
|
130
|
+
|
|
131
|
+
**Section — read the target doc to find the right section heading to append under.**
|
|
132
|
+
|
|
133
|
+
### 3. Present to the user for confirmation
|
|
134
|
+
|
|
135
|
+
Show each lesson with your suggested classification. Use AskUserQuestion to let the user confirm or adjust the destination for each lesson.
|
|
136
|
+
|
|
137
|
+
For each lesson, present:
|
|
138
|
+
- The lesson text (editable — the user can tweak the wording)
|
|
139
|
+
- Whether it's a Rule (→ rules.md + topic doc) or Pattern (→ topic doc only)
|
|
140
|
+
- Which topic doc it goes to
|
|
141
|
+
|
|
142
|
+
### 4. Check for duplicates
|
|
143
|
+
|
|
144
|
+
Before writing, read the target files and scan for similar existing rules or patterns. If something similar exists, ask the user: "This looks similar to an existing entry: '...'. Update it, add as new, or skip?"
|
|
145
|
+
|
|
146
|
+
### 5. Write the lessons
|
|
147
|
+
|
|
148
|
+
**For rules (→ rules.md):**
|
|
149
|
+
- Read `docs/rules.md`
|
|
150
|
+
- Find the right section heading
|
|
151
|
+
- Append the rule as a bullet point matching existing format
|
|
152
|
+
- Use the pattern: `- Never/Always [action] — [what to use instead]`
|
|
153
|
+
|
|
154
|
+
**For topic docs:**
|
|
155
|
+
- Read the target doc
|
|
156
|
+
- Find the most relevant section heading
|
|
157
|
+
- Append the lesson under that section
|
|
158
|
+
- If it's a pattern with a code example, include the code block
|
|
159
|
+
- If no existing section fits, append a new section at the end
|
|
160
|
+
|
|
161
|
+
### 6. Confirm what was written
|
|
162
|
+
|
|
163
|
+
After writing, summarize what was added and where.
|
|
164
|
+
|
|
165
|
+
## Important
|
|
166
|
+
|
|
167
|
+
- Do NOT commit automatically — let the user batch commits
|
|
168
|
+
- Keep rule entries short (one line) — details go in the topic doc
|
|
169
|
+
- Match the existing writing style and formatting of each doc
|
|
170
|
+
- If the user says `/{NAMESPACE}:learn` with no context and no argument, ask: "What's the lesson?"
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
**Replace in the template:**
|
|
174
|
+
- All `{NAMESPACE}` → `$NAMESPACE`
|
|
175
|
+
- `{$DOC_TABLE}` → the actual doc table built in analyze_docs
|
|
176
|
+
- If `docs/rules.md` doesn't exist, remove the rules.md references and simplify — all lessons go to topic docs only
|
|
177
|
+
|
|
178
|
+
Continue to completion.
|
|
179
|
+
</step>
|
|
180
|
+
|
|
181
|
+
<step name="completion">
|
|
182
|
+
Present what was generated.
|
|
183
|
+
|
|
184
|
+
```
|
|
185
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
186
|
+
SKILL GENERATED
|
|
187
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
188
|
+
|
|
189
|
+
Created: .claude/commands/{namespace}/learn.md
|
|
190
|
+
|
|
191
|
+
Usage:
|
|
192
|
+
/{namespace}:learn — Infer lesson from conversation
|
|
193
|
+
/{namespace}:learn "never use X" — Explicit lesson
|
|
194
|
+
|
|
195
|
+
Targets these docs:
|
|
196
|
+
{list of doc files}
|
|
197
|
+
|
|
198
|
+
To refine with evals and benchmarks:
|
|
199
|
+
/skill-creator — Anthropic plugin for skill testing and improvement
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
End workflow.
|
|
203
|
+
</step>
|
|
204
|
+
|
|
205
|
+
</process>
|
|
206
|
+
|
|
207
|
+
<success_criteria>
|
|
208
|
+
- docs/ read and analyzed for structure
|
|
209
|
+
- Namespace derived from project or user input
|
|
210
|
+
- .claude/commands/{namespace}/learn.md created
|
|
211
|
+
- Doc target table matches real docs with accurate descriptions
|
|
212
|
+
- Skill format matches existing doc entry styles
|
|
213
|
+
- No auto-commit
|
|
214
|
+
</success_criteria>
|
|
@@ -90,21 +90,22 @@ End main workflow.
|
|
|
90
90
|
|
|
91
91
|
**Check for codebase docs:**
|
|
92
92
|
```bash
|
|
93
|
-
|
|
93
|
+
[ -f "CLAUDE.md" ] && cat CLAUDE.md || echo "no_claude_md"
|
|
94
|
+
ls docs/*.md 2>/dev/null
|
|
94
95
|
```
|
|
95
96
|
|
|
96
|
-
**If
|
|
97
|
+
**If CLAUDE.md or docs/ found:**
|
|
97
98
|
```
|
|
98
99
|
Found codebase documentation. I'll reference these when defining requirements.
|
|
99
100
|
```
|
|
100
|
-
Read the
|
|
101
|
+
Read the CLAUDE.md routing table and referenced docs to understand project structure, code patterns, and architecture.
|
|
101
102
|
|
|
102
103
|
**If no codebase docs found:**
|
|
103
104
|
Use AskUserQuestion:
|
|
104
105
|
- header: "No Codebase Docs"
|
|
105
106
|
- question: "I didn't find codebase documentation. How should we proceed?"
|
|
106
107
|
- options:
|
|
107
|
-
- "Run
|
|
108
|
+
- "Run /specd.docs first" — Generates topic docs and CLAUDE.md routing table
|
|
108
109
|
- "Continue without" — Proceed without codebase context
|
|
109
110
|
- "Custom location" — Docs are elsewhere
|
|
110
111
|
|
|
@@ -13,10 +13,10 @@ Called from the main `new.md` workflow after orchestrator mode detection.
|
|
|
13
13
|
<step name="load_system_docs">
|
|
14
14
|
Read system-level codebase docs:
|
|
15
15
|
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
16
|
+
- `docs/PROJECTS.md` — Project registry
|
|
17
|
+
- `docs/TOPOLOGY.md` — Communication patterns
|
|
18
|
+
- `docs/CONTRACTS.md` — Shared interfaces
|
|
19
|
+
- `docs/CONCERNS.md` — System-level concerns
|
|
20
20
|
|
|
21
21
|
Read project list from `.specd/config.json` `"projects"` array.
|
|
22
22
|
|
|
@@ -13,16 +13,16 @@ Called from the main `plan.md` workflow after orchestrator mode detection.
|
|
|
13
13
|
<step name="load_cross_project_context">
|
|
14
14
|
Load system-level and sub-project context.
|
|
15
15
|
|
|
16
|
-
**System-level
|
|
17
|
-
-
|
|
18
|
-
-
|
|
19
|
-
-
|
|
16
|
+
**System-level docs:**
|
|
17
|
+
- `docs/PROJECTS.md` — Project registry
|
|
18
|
+
- `docs/TOPOLOGY.md` — Communication patterns
|
|
19
|
+
- `docs/CONTRACTS.md` — Shared interfaces
|
|
20
20
|
|
|
21
21
|
**Sub-project context:**
|
|
22
22
|
From task config.json `"projects"` array, for each project:
|
|
23
23
|
- Read `{project-path}/.specd/tasks/{task-name}/FEATURE.md` — Project-specific requirements
|
|
24
|
-
- Read `{project-path}
|
|
25
|
-
- Read `{project-path}
|
|
24
|
+
- Read `{project-path}/CLAUDE.md` — Project routing table and docs (if exists)
|
|
25
|
+
- Read `{project-path}/docs/*.md` — Project topic docs (if exists)
|
|
26
26
|
|
|
27
27
|
```
|
|
28
28
|
Orchestrator mode: {N} projects involved in this task.
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: specd.codebase.map
|
|
3
|
-
description: Analyze codebase with parallel agents to produce AI-optimized documentation
|
|
4
|
-
argument-hint: ""
|
|
5
|
-
allowed-tools:
|
|
6
|
-
- Read
|
|
7
|
-
- Bash
|
|
8
|
-
- Glob
|
|
9
|
-
- Grep
|
|
10
|
-
- Write
|
|
11
|
-
- Task
|
|
12
|
-
---
|
|
13
|
-
|
|
14
|
-
<objective>
|
|
15
|
-
Analyze existing codebase using parallel mapper agents to produce 4 AI-optimized documents.
|
|
16
|
-
|
|
17
|
-
Each mapper agent explores a focus area and **writes documents directly** to `.specd/codebase/`. The orchestrator only receives confirmations, keeping context usage minimal.
|
|
18
|
-
|
|
19
|
-
Output: .specd/codebase/ folder with 4 documents designed for Claude consumption.
|
|
20
|
-
</objective>
|
|
21
|
-
|
|
22
|
-
<execution_context>
|
|
23
|
-
@~/.claude/specdacular/workflows/map-codebase.md
|
|
24
|
-
</execution_context>
|
|
25
|
-
|
|
26
|
-
<context>
|
|
27
|
-
**These documents are FOR CLAUDE, not humans.**
|
|
28
|
-
|
|
29
|
-
Each document answers a question Claude can't get from reading code:
|
|
30
|
-
|
|
31
|
-
| Document | Question it answers |
|
|
32
|
-
|----------|---------------------|
|
|
33
|
-
| MAP.md | "Where is X? What functions exist?" |
|
|
34
|
-
| PATTERNS.md | "How do I write code that fits here?" |
|
|
35
|
-
| STRUCTURE.md | "Where do I put new code?" |
|
|
36
|
-
| CONCERNS.md | "What will bite me?" |
|
|
37
|
-
|
|
38
|
-
**Principle:** Don't document what Claude can grep. Document tribal knowledge, gotchas, and patterns.
|
|
39
|
-
</context>
|
|
40
|
-
|
|
41
|
-
<when_to_use>
|
|
42
|
-
**Use map-codebase for:**
|
|
43
|
-
- First time working with a codebase
|
|
44
|
-
- Before planning a new feature
|
|
45
|
-
- After significant refactoring
|
|
46
|
-
- Onboarding Claude to an unfamiliar repo
|
|
47
|
-
|
|
48
|
-
**Skip map-codebase for:**
|
|
49
|
-
- Trivial codebases (<10 files)
|
|
50
|
-
- When you already have recent codebase docs
|
|
51
|
-
</when_to_use>
|
|
52
|
-
|
|
53
|
-
<process>
|
|
54
|
-
1. Check if .specd/codebase/ already exists (offer to refresh or skip)
|
|
55
|
-
2. Create .specd/codebase/ directory
|
|
56
|
-
3. Spawn 4 parallel specd-codebase-mapper agents:
|
|
57
|
-
- Agent 1: map focus → writes MAP.md
|
|
58
|
-
- Agent 2: patterns focus → writes PATTERNS.md
|
|
59
|
-
- Agent 3: structure focus → writes STRUCTURE.md
|
|
60
|
-
- Agent 4: concerns focus → writes CONCERNS.md
|
|
61
|
-
4. Wait for agents to complete, collect confirmations
|
|
62
|
-
5. Verify all 4 documents exist
|
|
63
|
-
6. Commit codebase map
|
|
64
|
-
7. Report completion
|
|
65
|
-
</process>
|
|
66
|
-
|
|
67
|
-
<success_criteria>
|
|
68
|
-
- [ ] .specd/codebase/ directory created
|
|
69
|
-
- [ ] All 4 documents written by mapper agents
|
|
70
|
-
- [ ] Documents contain real code examples (not placeholders)
|
|
71
|
-
- [ ] Parallel agents completed without errors
|
|
72
|
-
</success_criteria>
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: specd.codebase.review
|
|
3
|
-
description: "Review and edit codebase context files section by section"
|
|
4
|
-
argument-hint: ""
|
|
5
|
-
allowed-tools:
|
|
6
|
-
- Read
|
|
7
|
-
- Write
|
|
8
|
-
- Edit
|
|
9
|
-
- Bash
|
|
10
|
-
- Glob
|
|
11
|
-
- Grep
|
|
12
|
-
- Task
|
|
13
|
-
- AskUserQuestion
|
|
14
|
-
---
|
|
15
|
-
|
|
16
|
-
<objective>
|
|
17
|
-
Walk through and review a codebase context file (.specd/codebase/*.md) section by section. Confirm, edit, remove, or re-map individual sections.
|
|
18
|
-
|
|
19
|
-
Output: Updated context file with reviewed/edited sections and updated timestamps.
|
|
20
|
-
</objective>
|
|
21
|
-
|
|
22
|
-
<execution_context>
|
|
23
|
-
Follow the context-manual-review workflow:
|
|
24
|
-
@~/.claude/specdacular/workflows/context-manual-review.md
|
|
25
|
-
</execution_context>
|
|
26
|
-
|
|
27
|
-
<context>
|
|
28
|
-
**Context workflows:**
|
|
29
|
-
@~/.claude/specdacular/workflows/context-manual-review.md
|
|
30
|
-
@~/.claude/specdacular/workflows/context-add.md
|
|
31
|
-
</context>
|
|
32
|
-
|
|
33
|
-
<success_criteria>
|
|
34
|
-
- [ ] User selects a context file to review
|
|
35
|
-
- [ ] Section list shown with tag status
|
|
36
|
-
- [ ] User can confirm, edit, remove, or re-map each section
|
|
37
|
-
- [ ] Timestamps updated after review
|
|
38
|
-
- [ ] Changes committed
|
|
39
|
-
</success_criteria>
|