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,472 @@
|
|
|
1
|
+
<purpose>
|
|
2
|
+
Detect a repo's tech stack, ask user for focus areas, spawn 3 research agents, merge findings into docs/best-practices.md.
|
|
3
|
+
|
|
4
|
+
**Output:** `docs/best-practices.md` in the target repo
|
|
5
|
+
</purpose>
|
|
6
|
+
|
|
7
|
+
<philosophy>
|
|
8
|
+
|
|
9
|
+
## Detect, Don't Ask
|
|
10
|
+
|
|
11
|
+
Auto-detect the tech stack from marker files and dependencies. The user shouldn't have to tell us what they use.
|
|
12
|
+
|
|
13
|
+
## Options, Not Opinions
|
|
14
|
+
|
|
15
|
+
Present what's available with context and tradeoffs. Light "recommended" tags are fine, but the user chooses. Research agents must capture multiple options per topic.
|
|
16
|
+
|
|
17
|
+
## User Steers Research
|
|
18
|
+
|
|
19
|
+
Ask for focus areas before dispatching agents. Focused research is deeper and more useful than broad-but-shallow.
|
|
20
|
+
|
|
21
|
+
## Verify Before Publishing
|
|
22
|
+
|
|
23
|
+
Web-sourced claims must be treated as untrusted. URLs may be stale, recommendations may be outdated. The merge step should flag low-confidence items.
|
|
24
|
+
|
|
25
|
+
</philosophy>
|
|
26
|
+
|
|
27
|
+
<process>
|
|
28
|
+
|
|
29
|
+
<step name="detect_stack">
|
|
30
|
+
Detect all tech stacks in the repo from marker files and dependency parsing.
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
# Detect marker files at repo root
|
|
34
|
+
STACKS=""
|
|
35
|
+
|
|
36
|
+
# Node.js / TypeScript
|
|
37
|
+
if [ -f "package.json" ]; then
|
|
38
|
+
DEPS=$(cat package.json | grep -E '"(dependencies|devDependencies)"' -A 100 | grep -oE '"(next|react|vue|svelte|angular|express|fastify|nestjs|nuxt|remix|astro|hono|elysia|bun|deno)"' | tr -d '"' | sort -u | tr '\n' ', ' | sed 's/,$//')
|
|
39
|
+
if [ -f "tsconfig.json" ] || grep -q '"typescript"' package.json 2>/dev/null; then
|
|
40
|
+
STACKS="$STACKS\nTypeScript: $DEPS"
|
|
41
|
+
else
|
|
42
|
+
STACKS="$STACKS\nNode.js: $DEPS"
|
|
43
|
+
fi
|
|
44
|
+
fi
|
|
45
|
+
|
|
46
|
+
# Python
|
|
47
|
+
if [ -f "pyproject.toml" ]; then
|
|
48
|
+
DEPS=$(grep -E '(fastapi|django|flask|starlette|litestar|sanic|tornado|streamlit|gradio|celery|pytest)' pyproject.toml 2>/dev/null | grep -oE '(fastapi|django|flask|starlette|litestar|sanic|tornado|streamlit|gradio|celery|pytest)' | sort -u | tr '\n' ', ' | sed 's/,$//')
|
|
49
|
+
STACKS="$STACKS\nPython: $DEPS"
|
|
50
|
+
elif [ -f "requirements.txt" ]; then
|
|
51
|
+
DEPS=$(grep -oiE '(fastapi|django|flask|starlette|litestar|sanic|tornado|streamlit|gradio|celery|pytest)' requirements.txt 2>/dev/null | sort -u | tr '\n' ', ' | sed 's/,$//')
|
|
52
|
+
STACKS="$STACKS\nPython: $DEPS"
|
|
53
|
+
elif [ -f "setup.py" ] || [ -f "setup.cfg" ]; then
|
|
54
|
+
STACKS="$STACKS\nPython: (legacy setup)"
|
|
55
|
+
fi
|
|
56
|
+
|
|
57
|
+
# Go
|
|
58
|
+
if [ -f "go.mod" ]; then
|
|
59
|
+
DEPS=$(grep -oE '(gin-gonic|echo|fiber|chi|gorilla|gorm|sqlx|ent)' go.mod 2>/dev/null | sort -u | tr '\n' ', ' | sed 's/,$//')
|
|
60
|
+
STACKS="$STACKS\nGo: $DEPS"
|
|
61
|
+
fi
|
|
62
|
+
|
|
63
|
+
# Rust
|
|
64
|
+
if [ -f "Cargo.toml" ]; then
|
|
65
|
+
DEPS=$(grep -oE '(actix-web|axum|rocket|warp|tokio|serde|diesel|sqlx|sea-orm)' Cargo.toml 2>/dev/null | sort -u | tr '\n' ', ' | sed 's/,$//')
|
|
66
|
+
STACKS="$STACKS\nRust: $DEPS"
|
|
67
|
+
fi
|
|
68
|
+
|
|
69
|
+
# Java / Kotlin
|
|
70
|
+
if [ -f "pom.xml" ]; then
|
|
71
|
+
DEPS=$(grep -oE '(spring-boot|quarkus|micronaut|jakarta)' pom.xml 2>/dev/null | sort -u | tr '\n' ', ' | sed 's/,$//')
|
|
72
|
+
STACKS="$STACKS\nJava: $DEPS"
|
|
73
|
+
elif [ -f "build.gradle" ] || [ -f "build.gradle.kts" ]; then
|
|
74
|
+
DEPS=$(grep -oE '(spring-boot|quarkus|micronaut|ktor)' build.gradle* 2>/dev/null | sort -u | tr '\n' ', ' | sed 's/,$//')
|
|
75
|
+
STACKS="$STACKS\nJava/Kotlin: $DEPS"
|
|
76
|
+
fi
|
|
77
|
+
|
|
78
|
+
# Ruby
|
|
79
|
+
if [ -f "Gemfile" ]; then
|
|
80
|
+
DEPS=$(grep -oE "'(rails|sinatra|hanami|rspec|sidekiq)'" Gemfile 2>/dev/null | tr -d "'" | sort -u | tr '\n' ', ' | sed 's/,$//')
|
|
81
|
+
STACKS="$STACKS\nRuby: $DEPS"
|
|
82
|
+
fi
|
|
83
|
+
|
|
84
|
+
# PHP
|
|
85
|
+
if [ -f "composer.json" ]; then
|
|
86
|
+
DEPS=$(grep -oE '"(laravel|symfony|slim|phpunit)"' composer.json 2>/dev/null | tr -d '"' | sort -u | tr '\n' ', ' | sed 's/,$//')
|
|
87
|
+
STACKS="$STACKS\nPHP: $DEPS"
|
|
88
|
+
fi
|
|
89
|
+
|
|
90
|
+
# .NET / C#
|
|
91
|
+
if ls *.csproj 2>/dev/null | head -1 > /dev/null; then
|
|
92
|
+
DEPS=$(grep -oE '(AspNetCore|EntityFramework|Blazor|MAUI)' *.csproj 2>/dev/null | sort -u | tr '\n' ', ' | sed 's/,$//')
|
|
93
|
+
STACKS="$STACKS\n.NET: $DEPS"
|
|
94
|
+
fi
|
|
95
|
+
|
|
96
|
+
# Elixir
|
|
97
|
+
if [ -f "mix.exs" ]; then
|
|
98
|
+
DEPS=$(grep -oE ':(phoenix|ecto|absinthe|oban|live_view)' mix.exs 2>/dev/null | tr -d ':' | sort -u | tr '\n' ', ' | sed 's/,$//')
|
|
99
|
+
STACKS="$STACKS\nElixir: $DEPS"
|
|
100
|
+
fi
|
|
101
|
+
|
|
102
|
+
# Clean up and display
|
|
103
|
+
echo "$STACKS" | grep -v '^$'
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
**Also detect project signals for calibrated recommendations:**
|
|
107
|
+
```bash
|
|
108
|
+
# Project maturity signals
|
|
109
|
+
[ -f "Dockerfile" ] || [ -f "docker-compose.yml" ] && echo "SIGNAL: Docker"
|
|
110
|
+
[ -d ".github/workflows" ] || [ -f ".gitlab-ci.yml" ] || [ -f "Jenkinsfile" ] && echo "SIGNAL: CI/CD"
|
|
111
|
+
[ -d "tests" ] || [ -d "test" ] || [ -d "__tests__" ] || [ -d "spec" ] && echo "SIGNAL: Test directory"
|
|
112
|
+
[ -f ".eslintrc*" ] || [ -f "eslint.config.*" ] || [ -f ".prettierrc*" ] || [ -f "ruff.toml" ] || [ -f ".flake8" ] && echo "SIGNAL: Linting configured"
|
|
113
|
+
find . -maxdepth 3 -name "*.ts" -o -name "*.py" -o -name "*.go" -o -name "*.rs" -o -name "*.java" -o -name "*.rb" 2>/dev/null | head -200 | wc -l | xargs echo "SIGNAL: Source files:"
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Store detected stacks as `$DETECTED_STACKS` and signals as `$PROJECT_SIGNALS`.
|
|
117
|
+
|
|
118
|
+
Continue to present_stacks.
|
|
119
|
+
</step>
|
|
120
|
+
|
|
121
|
+
<step name="present_stacks">
|
|
122
|
+
Show detected stacks to the user.
|
|
123
|
+
|
|
124
|
+
```
|
|
125
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
126
|
+
BEST PRACTICES RESEARCH
|
|
127
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
128
|
+
|
|
129
|
+
Detected stacks:
|
|
130
|
+
{$DETECTED_STACKS formatted as a list}
|
|
131
|
+
|
|
132
|
+
Project signals:
|
|
133
|
+
{$PROJECT_SIGNALS}
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
**If no stacks detected:**
|
|
137
|
+
```
|
|
138
|
+
No tech stacks detected from marker files. This might be an empty repo
|
|
139
|
+
or use an uncommon setup.
|
|
140
|
+
|
|
141
|
+
You can still run research — just tell me what stack you're using.
|
|
142
|
+
```
|
|
143
|
+
Use AskUserQuestion to ask what stack to research.
|
|
144
|
+
|
|
145
|
+
**If 3+ stacks detected (monorepo risk per research pitfalls):**
|
|
146
|
+
Use AskUserQuestion:
|
|
147
|
+
- header: "Multiple Stacks Detected"
|
|
148
|
+
- question: "I found several tech stacks. Which should I research? (Multiple stacks in a repo can include build tool configs that aren't your main stack.)"
|
|
149
|
+
- options: Each detected stack as a separate option, plus "All of them"
|
|
150
|
+
|
|
151
|
+
Store selected stacks as `$SELECTED_STACKS`. If fewer than 3 stacks or user selects "All", use all detected stacks.
|
|
152
|
+
|
|
153
|
+
Continue to ask_focus.
|
|
154
|
+
</step>
|
|
155
|
+
|
|
156
|
+
<step name="ask_focus">
|
|
157
|
+
Ask user for research focus areas (DEC-003).
|
|
158
|
+
|
|
159
|
+
Use AskUserQuestion:
|
|
160
|
+
- header: "Research Focus"
|
|
161
|
+
- question: "What should I focus on? I'll research deeper in your chosen areas."
|
|
162
|
+
- options:
|
|
163
|
+
- "Everything — full breadth across all categories"
|
|
164
|
+
- "Project structure & patterns — architecture, file layout, common libraries"
|
|
165
|
+
- "Claude Code tools — MCP servers, skills, hooks, CLAUDE.md patterns"
|
|
166
|
+
- "Tooling & DX — linting, formatting, testing, CI/CD, pre-commit hooks"
|
|
167
|
+
|
|
168
|
+
Store response as `$FOCUS_AREAS`.
|
|
169
|
+
|
|
170
|
+
Continue to spawn_agents.
|
|
171
|
+
</step>
|
|
172
|
+
|
|
173
|
+
<step name="spawn_agents">
|
|
174
|
+
Spawn 3 parallel research agents with stack and focus context. All agents run in background simultaneously.
|
|
175
|
+
|
|
176
|
+
**Spawn all 3 agents in a single message using the Agent tool with `run_in_background: true`:**
|
|
177
|
+
|
|
178
|
+
### Agent 1: Stack Patterns
|
|
179
|
+
|
|
180
|
+
```
|
|
181
|
+
Agent(
|
|
182
|
+
subagent_type: "general-purpose"
|
|
183
|
+
model: "sonnet"
|
|
184
|
+
description: "Stack patterns research"
|
|
185
|
+
run_in_background: true
|
|
186
|
+
prompt: "First, read ~/.claude/specdacular/agents/best-practices-researcher.md for your role and output format.
|
|
187
|
+
|
|
188
|
+
<focus_area>stack-patterns</focus_area>
|
|
189
|
+
|
|
190
|
+
<detected_stacks>
|
|
191
|
+
$SELECTED_STACKS
|
|
192
|
+
</detected_stacks>
|
|
193
|
+
|
|
194
|
+
<user_focus>
|
|
195
|
+
$FOCUS_AREAS
|
|
196
|
+
</user_focus>
|
|
197
|
+
|
|
198
|
+
<project_signals>
|
|
199
|
+
$PROJECT_SIGNALS
|
|
200
|
+
</project_signals>
|
|
201
|
+
|
|
202
|
+
Research project structure options, architectural patterns, and common libraries for the detected stacks.
|
|
203
|
+
|
|
204
|
+
<search_targets>
|
|
205
|
+
1. Search: '{primary_stack} project structure best practices 2026'
|
|
206
|
+
2. Search: '{primary_stack} recommended libraries production 2026'
|
|
207
|
+
3. Search: 'awesome-{primary_stack} github'
|
|
208
|
+
4. Search: '{primary_framework} vs alternatives comparison 2026' (if framework detected)
|
|
209
|
+
5. Fetch: Official docs or awesome-list for top finding (verify claims)
|
|
210
|
+
</search_targets>
|
|
211
|
+
|
|
212
|
+
<output_instructions>
|
|
213
|
+
Return structured markdown following the 'Stack Patterns Output' format from your role file.
|
|
214
|
+
Every recommendation must include: name, purpose, tradeoffs, when to use it.
|
|
215
|
+
Assign confidence levels. Cite sources.
|
|
216
|
+
Do NOT write files — just return the markdown.
|
|
217
|
+
</output_instructions>"
|
|
218
|
+
)
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### Agent 2: Claude Code Ecosystem
|
|
222
|
+
|
|
223
|
+
```
|
|
224
|
+
Agent(
|
|
225
|
+
subagent_type: "general-purpose"
|
|
226
|
+
model: "sonnet"
|
|
227
|
+
description: "Claude Code ecosystem research"
|
|
228
|
+
run_in_background: true
|
|
229
|
+
prompt: "First, read ~/.claude/specdacular/agents/best-practices-researcher.md for your role and output format.
|
|
230
|
+
|
|
231
|
+
<focus_area>claude-code-ecosystem</focus_area>
|
|
232
|
+
|
|
233
|
+
<detected_stacks>
|
|
234
|
+
$SELECTED_STACKS
|
|
235
|
+
</detected_stacks>
|
|
236
|
+
|
|
237
|
+
<user_focus>
|
|
238
|
+
$FOCUS_AREAS
|
|
239
|
+
</user_focus>
|
|
240
|
+
|
|
241
|
+
Research Claude Code MCP servers, skills, hooks, and CLAUDE.md patterns relevant to the detected stacks.
|
|
242
|
+
|
|
243
|
+
<search_targets>
|
|
244
|
+
1. Search: 'Claude Code MCP servers {primary_stack} 2026'
|
|
245
|
+
2. Search: 'awesome-mcp-servers github' — fetch the README for the full server list
|
|
246
|
+
3. Search: 'awesome-claude-code github' — fetch for skills and hooks patterns
|
|
247
|
+
4. Search: 'Claude Code CLAUDE.md best practices {primary_stack}'
|
|
248
|
+
5. Fetch: punkpeye/awesome-mcp-servers README or mcpservers.org for current server list
|
|
249
|
+
</search_targets>
|
|
250
|
+
|
|
251
|
+
<security_note>
|
|
252
|
+
43% of examined MCP servers had critical security flaws (2026 research).
|
|
253
|
+
For every MCP server you recommend, include a note about whether it's from an official/verified source.
|
|
254
|
+
Always link to the official registry page, not raw install commands from web results.
|
|
255
|
+
</security_note>
|
|
256
|
+
|
|
257
|
+
<output_instructions>
|
|
258
|
+
Return structured markdown following the 'Claude Code Ecosystem Output' format from your role file.
|
|
259
|
+
Include MCP servers with: name, purpose, install command (from official source only), stack relevance, confidence, security notes.
|
|
260
|
+
Include CLAUDE.md recommendations, skill patterns, and hook patterns.
|
|
261
|
+
Do NOT write files — just return the markdown.
|
|
262
|
+
</output_instructions>"
|
|
263
|
+
)
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
### Agent 3: Tooling & DX
|
|
267
|
+
|
|
268
|
+
```
|
|
269
|
+
Agent(
|
|
270
|
+
subagent_type: "general-purpose"
|
|
271
|
+
model: "sonnet"
|
|
272
|
+
description: "Tooling and DX research"
|
|
273
|
+
run_in_background: true
|
|
274
|
+
prompt: "First, read ~/.claude/specdacular/agents/best-practices-researcher.md for your role and output format.
|
|
275
|
+
|
|
276
|
+
<focus_area>tooling-dx</focus_area>
|
|
277
|
+
|
|
278
|
+
<detected_stacks>
|
|
279
|
+
$SELECTED_STACKS
|
|
280
|
+
</detected_stacks>
|
|
281
|
+
|
|
282
|
+
<user_focus>
|
|
283
|
+
$FOCUS_AREAS
|
|
284
|
+
</user_focus>
|
|
285
|
+
|
|
286
|
+
<project_signals>
|
|
287
|
+
$PROJECT_SIGNALS
|
|
288
|
+
</project_signals>
|
|
289
|
+
|
|
290
|
+
Research linters, formatters, testing frameworks, CI patterns, and pre-commit hooks for the detected stacks.
|
|
291
|
+
|
|
292
|
+
<search_targets>
|
|
293
|
+
1. Search: '{primary_stack} linter formatter comparison 2026'
|
|
294
|
+
2. Search: '{primary_stack} testing framework comparison 2026'
|
|
295
|
+
3. Search: '{primary_stack} CI/CD github actions best practices 2026'
|
|
296
|
+
4. Search: '{primary_stack} pre-commit hooks developer experience'
|
|
297
|
+
5. Fetch: Official docs for top linter/formatter to verify current config format
|
|
298
|
+
</search_targets>
|
|
299
|
+
|
|
300
|
+
<calibration>
|
|
301
|
+
Use project signals to calibrate recommendations:
|
|
302
|
+
- If CI/CD signal detected: focus on optimizing existing, not setting up from scratch
|
|
303
|
+
- If linting signal detected: compare existing tools to alternatives
|
|
304
|
+
- If no test directory: emphasize testing setup as priority
|
|
305
|
+
- Source file count indicates project scale: tailor recommendations accordingly
|
|
306
|
+
</calibration>
|
|
307
|
+
|
|
308
|
+
<output_instructions>
|
|
309
|
+
Return structured markdown following the 'Tooling & DX Output' format from your role file.
|
|
310
|
+
Present options as comparisons (tool A vs tool B) with tradeoffs.
|
|
311
|
+
Include pre-commit hook recommendations.
|
|
312
|
+
Do NOT write files — just return the markdown.
|
|
313
|
+
</output_instructions>"
|
|
314
|
+
)
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
After spawning all 3, continue to collect_results.
|
|
318
|
+
|
|
319
|
+
Continue to collect_results.
|
|
320
|
+
</step>
|
|
321
|
+
|
|
322
|
+
<step name="collect_results">
|
|
323
|
+
Wait for all 3 background agents to complete and collect their outputs.
|
|
324
|
+
|
|
325
|
+
**The agents were spawned with `run_in_background: true`, so they will notify when done.** Wait for all 3 notifications before proceeding.
|
|
326
|
+
|
|
327
|
+
**For each agent, when it completes:**
|
|
328
|
+
- Read the returned output (structured markdown)
|
|
329
|
+
- Store as `$AGENT_1_OUTPUT`, `$AGENT_2_OUTPUT`, `$AGENT_3_OUTPUT`
|
|
330
|
+
- If an agent failed or returned empty output, note it but continue
|
|
331
|
+
|
|
332
|
+
**Display status:**
|
|
333
|
+
```
|
|
334
|
+
Research agents complete:
|
|
335
|
+
- Stack Patterns: {✓ complete | ✗ failed}
|
|
336
|
+
- Claude Code Ecosystem: {✓ complete | ✗ failed}
|
|
337
|
+
- Tooling & DX: {✓ complete | ✗ failed}
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
**If any agent failed:**
|
|
341
|
+
```
|
|
342
|
+
Note: {agent name} research failed. The output doc will have reduced
|
|
343
|
+
coverage in that section. You can re-run /specd.best-practices to retry.
|
|
344
|
+
```
|
|
345
|
+
|
|
346
|
+
**If all agents failed:**
|
|
347
|
+
```
|
|
348
|
+
All research agents failed. This may be due to rate limiting or network
|
|
349
|
+
issues. Try again in a few minutes with /specd.best-practices.
|
|
350
|
+
```
|
|
351
|
+
End workflow.
|
|
352
|
+
|
|
353
|
+
Continue to merge_and_write.
|
|
354
|
+
</step>
|
|
355
|
+
|
|
356
|
+
<step name="merge_and_write">
|
|
357
|
+
Merge agent outputs into `docs/best-practices.md`.
|
|
358
|
+
|
|
359
|
+
```bash
|
|
360
|
+
mkdir -p docs
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
**Get project name from current directory:**
|
|
364
|
+
```bash
|
|
365
|
+
basename $(pwd)
|
|
366
|
+
```
|
|
367
|
+
Store as `$PROJECT_NAME`.
|
|
368
|
+
|
|
369
|
+
**Build the output document** by assembling agent outputs into the category structure. Write using the Write tool to `docs/best-practices.md`:
|
|
370
|
+
|
|
371
|
+
```markdown
|
|
372
|
+
# Best Practices: {$SELECTED_STACKS} ({$PROJECT_NAME})
|
|
373
|
+
|
|
374
|
+
> Generated: {today's date} by `/specd.best-practices`
|
|
375
|
+
> Re-run to refresh with latest recommendations.
|
|
376
|
+
|
|
377
|
+
---
|
|
378
|
+
|
|
379
|
+
## Detected Stack
|
|
380
|
+
|
|
381
|
+
{$SELECTED_STACKS with framework details from detect_stack step}
|
|
382
|
+
|
|
383
|
+
**Project signals:** {$PROJECT_SIGNALS summary — Docker, CI/CD, tests, linting, file count}
|
|
384
|
+
|
|
385
|
+
---
|
|
386
|
+
|
|
387
|
+
## Project Structure & Patterns
|
|
388
|
+
|
|
389
|
+
{Insert $AGENT_1_OUTPUT here — Stack Patterns agent findings}
|
|
390
|
+
|
|
391
|
+
{If agent 1 failed: "⚠️ Stack patterns research was unavailable. Re-run `/specd.best-practices` to retry."}
|
|
392
|
+
|
|
393
|
+
---
|
|
394
|
+
|
|
395
|
+
## Claude Code Configuration
|
|
396
|
+
|
|
397
|
+
{Insert $AGENT_2_OUTPUT here — Claude Code Ecosystem agent findings}
|
|
398
|
+
|
|
399
|
+
{If agent 2 failed: "⚠️ Claude Code ecosystem research was unavailable. Re-run `/specd.best-practices` to retry."}
|
|
400
|
+
|
|
401
|
+
---
|
|
402
|
+
|
|
403
|
+
## Tooling & DX
|
|
404
|
+
|
|
405
|
+
{Insert $AGENT_3_OUTPUT here — Tooling & DX agent findings}
|
|
406
|
+
|
|
407
|
+
{If agent 3 failed: "⚠️ Tooling & DX research was unavailable. Re-run `/specd.best-practices` to retry."}
|
|
408
|
+
|
|
409
|
+
---
|
|
410
|
+
|
|
411
|
+
## Sources
|
|
412
|
+
|
|
413
|
+
{Aggregate all source URLs from agent outputs into a single list.
|
|
414
|
+
Only include URLs that agents marked as verified.
|
|
415
|
+
Group by: Official Docs, Community Resources, Registries.}
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
**Merge rules to follow:**
|
|
419
|
+
|
|
420
|
+
1. **Organize by category, not by agent.** Each agent's output maps to one section, but if an agent's findings touch another section's topic, move that content to the appropriate section.
|
|
421
|
+
|
|
422
|
+
2. **Contradiction detection:** Before writing, scan all 3 agent outputs for cases where the same technology or tool is mentioned with conflicting recommendations. If found, add a note:
|
|
423
|
+
```
|
|
424
|
+
> **Note:** Different research sources have varying perspectives on {tool}.
|
|
425
|
+
> {Perspective 1} vs {Perspective 2}. Consider your specific needs.
|
|
426
|
+
```
|
|
427
|
+
|
|
428
|
+
3. **Confidence filtering:**
|
|
429
|
+
- HIGH confidence findings: include directly as recommendations
|
|
430
|
+
- MEDIUM confidence findings: include with source attribution
|
|
431
|
+
- LOW confidence findings: move to a "For Awareness (Unverified)" subsection at the bottom of each major section, or omit if section is already comprehensive
|
|
432
|
+
|
|
433
|
+
4. **URL verification:** Only include URLs that agents reported as verified (fetched successfully). Drop broken or unverified URLs.
|
|
434
|
+
|
|
435
|
+
5. **Do NOT modify CLAUDE.md** (DEC-002). The output file is `docs/best-practices.md` only.
|
|
436
|
+
|
|
437
|
+
Continue to completion.
|
|
438
|
+
</step>
|
|
439
|
+
|
|
440
|
+
<step name="completion">
|
|
441
|
+
Show summary to user.
|
|
442
|
+
|
|
443
|
+
```
|
|
444
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
445
|
+
BEST PRACTICES GENERATED
|
|
446
|
+
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
|
|
447
|
+
|
|
448
|
+
**Stack:** {$SELECTED_STACKS}
|
|
449
|
+
**Output:** docs/best-practices.md
|
|
450
|
+
|
|
451
|
+
**Sections:**
|
|
452
|
+
- Project Structure & Patterns: {count} recommendations
|
|
453
|
+
- Claude Code Configuration: {count} MCP servers, {count} skills/hooks
|
|
454
|
+
- Tooling & DX: {count} recommendations
|
|
455
|
+
|
|
456
|
+
The doc is ready to review. It is NOT committed or added to CLAUDE.md.
|
|
457
|
+
You can commit it if you find it useful, or re-run to refresh.
|
|
458
|
+
```
|
|
459
|
+
|
|
460
|
+
End workflow.
|
|
461
|
+
</step>
|
|
462
|
+
|
|
463
|
+
</process>
|
|
464
|
+
|
|
465
|
+
<success_criteria>
|
|
466
|
+
- Tech stack auto-detected from repo marker files and dependencies
|
|
467
|
+
- User asked for focus areas before agent dispatch
|
|
468
|
+
- 3 research agents spawned with stack-aware context
|
|
469
|
+
- Agent outputs merged into categorized docs/best-practices.md
|
|
470
|
+
- Each recommendation has: name, purpose, tradeoffs, when to use it
|
|
471
|
+
- Generation date stamped, CLAUDE.md not modified
|
|
472
|
+
</success_criteria>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<purpose>
|
|
2
|
-
Guide the user to add new content to a codebase
|
|
2
|
+
Guide the user to add new content to a codebase doc file (docs/*.md). Identifies the correct file and section, checks for duplicates, confirms placement, and writes the content with a USER_MODIFIED tag.
|
|
3
3
|
|
|
4
|
-
Output: Updated
|
|
4
|
+
Output: Updated doc file with new content added to the correct section.
|
|
5
5
|
</purpose>
|
|
6
6
|
|
|
7
7
|
<philosophy>
|
|
@@ -43,17 +43,17 @@ After writing content, update the document-level `Last Modified:` timestamp. If
|
|
|
43
43
|
<process>
|
|
44
44
|
|
|
45
45
|
<step name="validate">
|
|
46
|
-
Check that codebase
|
|
46
|
+
Check that codebase doc files exist.
|
|
47
47
|
|
|
48
48
|
```bash
|
|
49
|
-
|
|
49
|
+
grep -rl "generated_by: specd" docs/ 2>/dev/null || ls docs/*.md 2>/dev/null
|
|
50
50
|
```
|
|
51
51
|
|
|
52
52
|
**If no files found:**
|
|
53
53
|
```
|
|
54
|
-
No codebase
|
|
54
|
+
No codebase doc files found.
|
|
55
55
|
|
|
56
|
-
Run /specd.
|
|
56
|
+
Run /specd.docs to generate topic-based documentation.
|
|
57
57
|
```
|
|
58
58
|
End workflow.
|
|
59
59
|
|
|
@@ -81,7 +81,7 @@ Determine where the content belongs.
|
|
|
81
81
|
|
|
82
82
|
Search all context files for key terms from the user's description:
|
|
83
83
|
|
|
84
|
-
Use Grep to search
|
|
84
|
+
Use Grep to search `docs/*.md` for the main keywords/concepts from the user's input.
|
|
85
85
|
|
|
86
86
|
**If similar content found:**
|
|
87
87
|
```
|
|
@@ -105,11 +105,10 @@ If "Cancel": End workflow.
|
|
|
105
105
|
|
|
106
106
|
**Step 2: Identify best file**
|
|
107
107
|
|
|
108
|
-
Based on the content type, determine the target file
|
|
109
|
-
- **
|
|
110
|
-
- **
|
|
111
|
-
-
|
|
112
|
-
- **CONCERNS.md** — Gotchas, anti-patterns, tech debt, fragile areas, warnings
|
|
108
|
+
Based on the content type, determine the target file from docs/:
|
|
109
|
+
- **rules.md** — Always-true project rules, conventions, import patterns
|
|
110
|
+
- **{topic}.md** — Topic-specific docs (e.g., react-query.md, testing-patterns.md, project-structure.md)
|
|
111
|
+
- Read the CLAUDE.md routing table to see which docs exist and what they cover
|
|
113
112
|
|
|
114
113
|
**Step 3: Identify best section**
|
|
115
114
|
|
|
@@ -142,27 +141,14 @@ Use AskUserQuestion:
|
|
|
142
141
|
- "Cancel" — Don't add
|
|
143
142
|
|
|
144
143
|
**If "Different section":**
|
|
145
|
-
Show all sections across all
|
|
144
|
+
Show all sections across all doc files as options:
|
|
146
145
|
|
|
147
146
|
```
|
|
148
147
|
Available sections:
|
|
149
148
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
##
|
|
153
|
-
...
|
|
154
|
-
|
|
155
|
-
PATTERNS.md:
|
|
156
|
-
## Workflow/Command Pattern
|
|
157
|
-
...
|
|
158
|
-
|
|
159
|
-
STRUCTURE.md:
|
|
160
|
-
## Directory Layout
|
|
161
|
-
...
|
|
162
|
-
|
|
163
|
-
CONCERNS.md:
|
|
164
|
-
## Gotchas
|
|
165
|
-
## Anti-patterns
|
|
149
|
+
{For each docs/*.md file:}
|
|
150
|
+
{filename}:
|
|
151
|
+
{list of ## headings}
|
|
166
152
|
...
|
|
167
153
|
```
|
|
168
154
|
|
|
@@ -203,7 +189,7 @@ Continue to commit.
|
|
|
203
189
|
<step name="commit">
|
|
204
190
|
@~/.claude/specdacular/references/commit-docs.md
|
|
205
191
|
|
|
206
|
-
- **$FILES:**
|
|
192
|
+
- **$FILES:** `docs/{file}`
|
|
207
193
|
- **$MESSAGE:** `docs: add to {file} — {brief description of what was added}`
|
|
208
194
|
- **$LABEL:** `context addition`
|
|
209
195
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<purpose>
|
|
2
|
-
Manual review of a codebase
|
|
2
|
+
Manual review of a codebase doc file (docs/*.md). Shows a section list and lets the user pick which section to review, edit, remove, re-map, or add new content.
|
|
3
3
|
|
|
4
4
|
Edits are tagged with `<!-- USER_MODIFIED: YYYY-MM-DD -->`. Re-mapping spawns a targeted agent for just that section and shows a semantic diff.
|
|
5
5
|
|
|
@@ -88,17 +88,17 @@ Never skip tagging. Never defer to a later step.
|
|
|
88
88
|
<process>
|
|
89
89
|
|
|
90
90
|
<step name="validate">
|
|
91
|
-
Check that codebase
|
|
91
|
+
Check that codebase doc files exist.
|
|
92
92
|
|
|
93
93
|
```bash
|
|
94
|
-
|
|
94
|
+
grep -rl "generated_by: specd" docs/ 2>/dev/null || ls docs/*.md 2>/dev/null
|
|
95
95
|
```
|
|
96
96
|
|
|
97
97
|
**If no files found:**
|
|
98
98
|
```
|
|
99
|
-
No codebase
|
|
99
|
+
No codebase doc files found.
|
|
100
100
|
|
|
101
|
-
Run /specd.
|
|
101
|
+
Run /specd.docs to generate topic-based documentation.
|
|
102
102
|
```
|
|
103
103
|
End workflow.
|
|
104
104
|
|
|
@@ -262,7 +262,7 @@ description: "Re-map section: {section title}"
|
|
|
262
262
|
```
|
|
263
263
|
Focus: {MAPPER_FOCUS}
|
|
264
264
|
|
|
265
|
-
You are re-mapping a SINGLE SECTION of
|
|
265
|
+
You are re-mapping a SINGLE SECTION of docs/{file}.
|
|
266
266
|
|
|
267
267
|
Section heading: {exact heading text}
|
|
268
268
|
Heading level: {## or ###}
|
|
@@ -360,7 +360,7 @@ Still commit the timestamp update (Last Reviewed changed).
|
|
|
360
360
|
|
|
361
361
|
@~/.claude/specdacular/references/commit-docs.md
|
|
362
362
|
|
|
363
|
-
- **$FILES:**
|
|
363
|
+
- **$FILES:** `docs/{file}`
|
|
364
364
|
- **$MESSAGE:** `docs: review {file}` with brief summary of changes
|
|
365
365
|
- **$LABEL:** `context review`
|
|
366
366
|
|