forgedev 1.1.3 → 1.2.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.
Files changed (53) hide show
  1. package/README.md +2 -1
  2. package/bin/devforge.js +2 -1
  3. package/docs/00-README.md +310 -0
  4. package/docs/01-universal-prompt-library.md +1049 -0
  5. package/docs/02-claude-code-mastery-playbook.md +283 -0
  6. package/docs/03-multi-agent-verification.md +565 -0
  7. package/docs/04-errata-and-verification-checklist.md +284 -0
  8. package/docs/05-universal-scaffolder-vision.md +452 -0
  9. package/docs/06-confidence-assessment-and-repo-prompt.md +407 -0
  10. package/docs/errata.md +58 -0
  11. package/docs/multi-agent-verification.md +66 -0
  12. package/docs/plans/.gitkeep +0 -0
  13. package/docs/playbook.md +95 -0
  14. package/docs/prompt-library.md +160 -0
  15. package/docs/uat/UAT_CHECKLIST.csv +9 -0
  16. package/docs/uat/UAT_TEMPLATE.md +163 -0
  17. package/package.json +10 -2
  18. package/src/claude-configurator.js +1 -0
  19. package/src/cli.js +5 -5
  20. package/src/index.js +3 -3
  21. package/src/utils.js +1 -1
  22. package/templates/base/docs/plans/.gitkeep +0 -0
  23. package/templates/base/docs/uat/UAT_CHECKLIST.csv.template +2 -0
  24. package/templates/base/docs/uat/UAT_TEMPLATE.md.template +22 -0
  25. package/templates/claude-code/agents/build-error-resolver.md +3 -2
  26. package/templates/claude-code/agents/code-quality-reviewer.md +1 -1
  27. package/templates/claude-code/agents/database-reviewer.md +1 -1
  28. package/templates/claude-code/agents/doc-updater.md +1 -1
  29. package/templates/claude-code/agents/harness-optimizer.md +26 -0
  30. package/templates/claude-code/agents/loop-operator.md +2 -1
  31. package/templates/claude-code/agents/product-strategist.md +124 -0
  32. package/templates/claude-code/agents/security-reviewer.md +1 -0
  33. package/templates/claude-code/agents/spec-validator.md +31 -1
  34. package/templates/claude-code/agents/uat-validator.md +4 -0
  35. package/templates/claude-code/claude-md/base.md +1 -0
  36. package/templates/claude-code/claude-md/nextjs.md +1 -1
  37. package/templates/claude-code/commands/code-review.md +7 -1
  38. package/templates/claude-code/commands/full-audit.md +3 -2
  39. package/templates/claude-code/commands/workflows.md +3 -0
  40. package/templates/claude-code/hooks/scripts/autofix-polyglot.mjs +20 -10
  41. package/templates/claude-code/hooks/scripts/autofix-python.mjs +3 -4
  42. package/templates/claude-code/hooks/scripts/autofix-typescript.mjs +3 -3
  43. package/templates/claude-code/hooks/scripts/guard-protected-files.mjs +2 -2
  44. package/templates/claude-code/skills/git-workflow/SKILL.md +2 -2
  45. package/templates/claude-code/skills/nextjs/SKILL.md +1 -1
  46. package/templates/claude-code/skills/playwright/SKILL.md +6 -5
  47. package/templates/claude-code/skills/security-web/SKILL.md +1 -0
  48. package/templates/infra/github-actions/.github/workflows/ci.yml.template +49 -0
  49. package/templates/testing/pytest/backend/tests/__init__.py +0 -0
  50. package/templates/testing/pytest/backend/tests/conftest.py.template +11 -0
  51. package/templates/testing/pytest/backend/tests/test_health.py.template +10 -0
  52. package/templates/testing/vitest/vitest.config.ts.template +18 -0
  53. package/CLAUDE.md +0 -38
@@ -0,0 +1,284 @@
1
+ # Errata & Verification Checklist
2
+ ## What to Test Before You Trust Any of These Documents
3
+
4
+ ---
5
+
6
+ ## Status: These Documents Are a Starting Framework, Not Tested Production Code
7
+
8
+ I generated these documents by synthesizing best practices from Anthropic's
9
+ official docs, community guides, and your specific CLAUDE.md. However:
10
+
11
+ - The hook scripts have NOT been tested against a live Claude Code session
12
+ - The subagent definitions have NOT been tested with actual task delegation
13
+ - The prompt templates are patterns that need tuning to your codebase
14
+ - Claude Code's API surface changes frequently — verify against current docs
15
+
16
+ **Your job before relying on any of this: run each piece in isolation, confirm
17
+ it works, then integrate.**
18
+
19
+ ---
20
+
21
+ ## Known Errors to Fix
22
+
23
+ ### 1. PostToolUse Hook — Wrong Variable Reference
24
+
25
+ **File:** `multi-agent-verification.md` and `claude-code-mastery-playbook.md`
26
+
27
+ **Problem:** The auto-lint PostToolUse hook references `$TOOL_INPUT_FILE` which
28
+ may not exist as an environment variable. Hook input comes via JSON on stdin.
29
+
30
+ **Fix:** Replace the post-edit.sh hook with:
31
+
32
+ ```bash
33
+ #!/bin/bash
34
+ # .claude/hooks/post-edit.sh
35
+ INPUT=$(cat)
36
+ FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // empty')
37
+
38
+ if [ -z "$FILE_PATH" ]; then exit 0; fi
39
+
40
+ # Auto-lint TypeScript files
41
+ if [[ "$FILE_PATH" == *.ts || "$FILE_PATH" == *.tsx ]]; then
42
+ npx eslint --fix "$FILE_PATH" 2>&1 || true
43
+ fi
44
+
45
+ # Auto-lint Python files
46
+ if [[ "$FILE_PATH" == *.py ]]; then
47
+ cd "$CLAUDE_PROJECT_DIR/backend" && ruff check --fix "$FILE_PATH" 2>&1 || true
48
+ fi
49
+
50
+ exit 0
51
+ ```
52
+
53
+ **Dependency:** Requires `jq` installed (`sudo apt install jq` or `brew install jq`).
54
+
55
+ ### 2. Stop Hook — Infinite Loop Risk
56
+
57
+ **File:** `claude-code-mastery-playbook-v2.md`
58
+
59
+ **Problem:** The stop hook must check `stop_hook_active` to prevent infinite loops.
60
+ The scripts include this check, but if your stop hook is slow (full test suite)
61
+ AND also blocks with exit code 2, Claude will run the hook again after fixing,
62
+ creating a potential long loop.
63
+
64
+ **Mitigation:** Keep stop hooks fast (under 30 seconds). If your full test suite
65
+ takes >60 seconds, move it to TaskCompleted instead of Stop. Use Stop only for
66
+ fast checks (typecheck, lint).
67
+
68
+ ### 3. Agent `disallowedTools` Format
69
+
70
+ **File:** `multi-agent-verification.md`
71
+
72
+ **Problem:** The subagent frontmatter uses `disallowedTools: Write, Edit, MultiEdit, Notebook`.
73
+ Verify the exact YAML format against your Claude Code version. The official docs show
74
+ the format as a YAML list:
75
+
76
+ ```yaml
77
+ disallowedTools:
78
+ - Write
79
+ - Edit
80
+ - MultiEdit
81
+ - Notebook
82
+ ```
83
+
84
+ Or as a comma-separated string — check which your version supports.
85
+
86
+ ### 4. `$CLAUDE_PROJECT_DIR` in settings.json
87
+
88
+ **File:** Both playbooks
89
+
90
+ **Problem:** Hook commands in settings.json use `$CLAUDE_PROJECT_DIR`. This IS a valid
91
+ environment variable provided by Claude Code to hooks, but verify it resolves
92
+ correctly in your environment. Some users report issues when running from nested directories.
93
+
94
+ **Test:** Add a simple hook first that just echoes the variable:
95
+ ```json
96
+ {
97
+ "hooks": {
98
+ "SessionStart": [{
99
+ "hooks": [{
100
+ "type": "command",
101
+ "command": "echo \"Project dir: $CLAUDE_PROJECT_DIR\" >&2"
102
+ }]
103
+ }]
104
+ }
105
+ }
106
+ ```
107
+
108
+ ### 5. Mermaid Diagram Rendering
109
+
110
+ **File:** `universal-prompt-library.md`
111
+
112
+ **Problem:** The Mermaid diagram uses `style` directives with `fill` colors. Not all
113
+ Mermaid renderers support this (GitHub does, some VS Code extensions don't).
114
+
115
+ **Test:** Paste the Mermaid block into https://mermaid.live to verify rendering.
116
+ If your tool doesn't support `style`, remove those lines — the diagram works without them.
117
+
118
+ ---
119
+
120
+ ## Verification Checklist (Test Each Piece Before Trusting It)
121
+
122
+ ### Phase 1: Verify Hooks (Do This First)
123
+
124
+ ```bash
125
+ # Step 1: Verify jq is installed
126
+ jq --version
127
+ # If not: brew install jq (Mac) or sudo apt install jq (Linux)
128
+
129
+ # Step 2: Create the hooks directory
130
+ mkdir -p .claude/hooks
131
+ chmod +x .claude/hooks/*.sh
132
+
133
+ # Step 3: Test protected files hook manually
134
+ echo '{"tool_input":{"file_path":".env"}}' | .claude/hooks/protect-files.sh
135
+ echo $? # Should print 2 (blocked)
136
+
137
+ echo '{"tool_input":{"file_path":"src/App.tsx"}}' | .claude/hooks/protect-files.sh
138
+ echo $? # Should print 0 (allowed)
139
+
140
+ # Step 4: Test post-edit hook manually
141
+ echo '{"tool_input":{"file_path":"src/App.tsx"}}' | .claude/hooks/post-edit.sh
142
+ echo $? # Should print 0
143
+
144
+ # Step 5: Test stop hook manually
145
+ echo '{"stop_hook_active": false}' | .claude/hooks/stop-quality-gate.sh
146
+ # Should run your 5 checks (or fail if you're not in the right directory)
147
+
148
+ echo '{"stop_hook_active": true}' | .claude/hooks/stop-quality-gate.sh
149
+ echo $? # Should print 0 (skip when already in stop hook)
150
+
151
+ # Step 6: Add hooks to settings.json
152
+ # Start with JUST the protected files hook
153
+ # Run a Claude Code session and try to edit .env
154
+ # Verify it gets blocked
155
+
156
+ # Step 7: Add remaining hooks one at a time
157
+ # Test each in a real session before adding the next
158
+ ```
159
+
160
+ ### Phase 2: Verify Subagents
161
+
162
+ ```bash
163
+ # Step 1: Create one agent file
164
+ mkdir -p .claude/agents
165
+ # Copy the code-quality-reviewer.md content to .claude/agents/code-quality-reviewer.md
166
+
167
+ # Step 2: In a Claude Code session, test delegation
168
+ # Type: "Task the code-quality-reviewer with: review src/App.tsx"
169
+ # Verify:
170
+ # - It creates a separate context (you see "Delegating to code-quality-reviewer")
171
+ # - It can READ files
172
+ # - It CANNOT write/edit files (disallowedTools enforced)
173
+ # - It returns a structured report
174
+
175
+ # Step 3: If disallowedTools aren't enforced, check the YAML format
176
+ # Try both formats:
177
+ # disallowedTools: Write, Edit (comma-separated)
178
+ # disallowedTools: (YAML list)
179
+ # - Write
180
+ # - Edit
181
+
182
+ # Step 4: Test each agent one at a time before relying on the chain
183
+ ```
184
+
185
+ ### Phase 3: Verify Commands
186
+
187
+ ```bash
188
+ # Step 1: Create one command
189
+ mkdir -p .claude/commands
190
+ # Copy audit-spec.md content to .claude/commands/audit-spec.md
191
+
192
+ # Step 2: In a Claude Code session, test it
193
+ # Type: /project:audit-spec phases/some-spec.md
194
+ # Verify it produces a structured table
195
+
196
+ # Step 3: Test each command one at a time
197
+ ```
198
+
199
+ ### Phase 4: Verify Skills
200
+
201
+ ```bash
202
+ # Step 1: Create one skill
203
+ mkdir -p .claude/skills/playwright
204
+ # Copy playwright testing skill content to .claude/skills/playwright/SKILL.md
205
+
206
+ # Step 2: In a Claude Code session, ask Claude to write a Playwright test
207
+ # Verify it loaded the skill (it should follow your patterns, not generic ones)
208
+
209
+ # Step 3: Test each skill one at a time
210
+ ```
211
+
212
+ ### Phase 5: Verify Directory-Scoped CLAUDE.md
213
+
214
+ ```bash
215
+ # Step 1: Create backend/CLAUDE.md with backend rules
216
+ # Step 2: In a Claude Code session, ask Claude to edit a backend file
217
+ # Step 3: Ask Claude: "What rules are you following for this file?"
218
+ # Verify it mentions the backend-specific rules
219
+
220
+ # Step 4: Do the same for src/CLAUDE.md and e2e/CLAUDE.md
221
+ ```
222
+
223
+ ---
224
+
225
+ ## Things That Are Intentionally Generic (And Need Your Customization)
226
+
227
+ | Document Section | What You Need to Customize |
228
+ |-----------------|---------------------------|
229
+ | Stop hook — 5 checks | Replace with YOUR project's actual lint/type/test commands |
230
+ | Protected files list | Add YOUR project's protected paths (migrations, configs) |
231
+ | Subagent security checklist | Add YOUR project's security patterns (auth helpers, RBAC checks) |
232
+ | Playwright skill patterns | Add YOUR project's fixture patterns, auth setup, test IDs |
233
+ | Frontend/Backend skill patterns | Add YOUR project's actual component patterns, API patterns |
234
+ | Prompt templates | Replace `[bracketed placeholders]` with your real context |
235
+ | Spec file paths | Replace `phases/[module].md` with your actual spec file paths |
236
+
237
+ ---
238
+
239
+ ## Things I Cannot Verify (You Must Test Yourself)
240
+
241
+ 1. **Your Claude Code version** — hooks API has changed across versions.
242
+ Run `claude --version` and check the changelog for your version.
243
+
244
+ 2. **Your project's test suite speed** — if tests take >60 seconds,
245
+ the Stop hook will slow down every task completion significantly.
246
+ Move slow tests to TaskCompleted or a manual command instead.
247
+
248
+ 3. **Your token budget** — running 5 subagents on every feature adds
249
+ ~50-80K tokens. On Max plan that's fine. On Pro plan, you'll hit
250
+ limits faster. Adjust by using fewer agents or running them less often.
251
+
252
+ 4. **Subagent model availability** — the agent files specify `model: opus`
253
+ or `model: sonnet`. Verify these model names match what your plan supports.
254
+
255
+ 5. **VS Code extension version** — the extension updates independently of
256
+ the CLI. Some features (hooks, subagents) may behave slightly differently
257
+ in the VS Code panel vs terminal.
258
+
259
+ 6. **Team/Enterprise features** — Claude Code Review ($15-25/PR) requires
260
+ Team or Enterprise plan. Subagents and hooks work on all plans.
261
+
262
+ ---
263
+
264
+ ## Recommended Rollout Order
265
+
266
+ Don't try to implement everything at once. Do this over 1-2 weeks:
267
+
268
+ **Week 1:**
269
+ - Day 1: Slim down your CLAUDE.md to ~150 lines (move specs to skills)
270
+ - Day 2: Set up and test the 3 essential hooks (protect, post-edit, stop)
271
+ - Day 3: Create the backend/CLAUDE.md and src/CLAUDE.md directory scoping
272
+ - Day 4-5: Use the new setup on a real task. Note what works and what doesn't.
273
+
274
+ **Week 2:**
275
+ - Day 1: Create and test 2 subagents (code-quality + security)
276
+ - Day 2: Create the audit commands (audit-spec, audit-wiring)
277
+ - Day 3: Create remaining skills and subagents
278
+ - Day 4-5: Run the full verification chain on an existing module. Tune based on results.
279
+
280
+ **Ongoing:**
281
+ - Treat CLAUDE.md, hooks, skills, and agents like code: review when things
282
+ go wrong, prune regularly, and test changes by observing behavior.
283
+ - After fixing a recurring issue, add it to Known Pitfalls in CLAUDE.md
284
+ or create a new hook to prevent it deterministically.