@qball-inc/the-bulwark 1.0.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 (175) hide show
  1. package/.claude-plugin/plugin.json +43 -0
  2. package/agents/bulwark-fix-validator.md +633 -0
  3. package/agents/bulwark-implementer.md +391 -0
  4. package/agents/bulwark-issue-analyzer.md +308 -0
  5. package/agents/bulwark-standards-reviewer.md +221 -0
  6. package/agents/plan-creation-architect.md +323 -0
  7. package/agents/plan-creation-eng-lead.md +352 -0
  8. package/agents/plan-creation-po.md +300 -0
  9. package/agents/plan-creation-qa-critic.md +334 -0
  10. package/agents/product-ideation-competitive-analyzer.md +298 -0
  11. package/agents/product-ideation-idea-validator.md +268 -0
  12. package/agents/product-ideation-market-researcher.md +292 -0
  13. package/agents/product-ideation-pattern-documenter.md +308 -0
  14. package/agents/product-ideation-segment-analyzer.md +303 -0
  15. package/agents/product-ideation-strategist.md +259 -0
  16. package/agents/statusline-setup.md +97 -0
  17. package/hooks/hooks.json +59 -0
  18. package/package.json +45 -0
  19. package/scripts/hooks/cleanup-stale.sh +13 -0
  20. package/scripts/hooks/enforce-quality.sh +166 -0
  21. package/scripts/hooks/implementer-quality.sh +256 -0
  22. package/scripts/hooks/inject-protocol.sh +52 -0
  23. package/scripts/hooks/suggest-pipeline.sh +175 -0
  24. package/scripts/hooks/track-pipeline-start.sh +37 -0
  25. package/scripts/hooks/track-pipeline-stop.sh +52 -0
  26. package/scripts/init-rules.sh +35 -0
  27. package/scripts/init.sh +151 -0
  28. package/skills/anthropic-validator/SKILL.md +607 -0
  29. package/skills/anthropic-validator/references/agents-checklist.md +131 -0
  30. package/skills/anthropic-validator/references/commands-checklist.md +102 -0
  31. package/skills/anthropic-validator/references/hooks-checklist.md +151 -0
  32. package/skills/anthropic-validator/references/mcp-checklist.md +136 -0
  33. package/skills/anthropic-validator/references/plugins-checklist.md +148 -0
  34. package/skills/anthropic-validator/references/skills-checklist.md +85 -0
  35. package/skills/assertion-patterns/SKILL.md +296 -0
  36. package/skills/bug-magnet-data/SKILL.md +284 -0
  37. package/skills/bug-magnet-data/context/cli-args.md +91 -0
  38. package/skills/bug-magnet-data/context/db-query.md +104 -0
  39. package/skills/bug-magnet-data/context/file-contents.md +103 -0
  40. package/skills/bug-magnet-data/context/http-body.md +91 -0
  41. package/skills/bug-magnet-data/context/process-spawn.md +123 -0
  42. package/skills/bug-magnet-data/data/booleans/boundaries.yaml +143 -0
  43. package/skills/bug-magnet-data/data/collections/arrays.yaml +114 -0
  44. package/skills/bug-magnet-data/data/collections/objects.yaml +123 -0
  45. package/skills/bug-magnet-data/data/concurrency/race-conditions.yaml +118 -0
  46. package/skills/bug-magnet-data/data/concurrency/state-machines.yaml +115 -0
  47. package/skills/bug-magnet-data/data/dates/boundaries.yaml +137 -0
  48. package/skills/bug-magnet-data/data/dates/invalid.yaml +132 -0
  49. package/skills/bug-magnet-data/data/dates/timezone.yaml +118 -0
  50. package/skills/bug-magnet-data/data/encoding/charset.yaml +79 -0
  51. package/skills/bug-magnet-data/data/encoding/normalization.yaml +105 -0
  52. package/skills/bug-magnet-data/data/formats/email.yaml +154 -0
  53. package/skills/bug-magnet-data/data/formats/json.yaml +187 -0
  54. package/skills/bug-magnet-data/data/formats/url.yaml +165 -0
  55. package/skills/bug-magnet-data/data/language-specific/javascript.yaml +182 -0
  56. package/skills/bug-magnet-data/data/language-specific/python.yaml +174 -0
  57. package/skills/bug-magnet-data/data/language-specific/rust.yaml +148 -0
  58. package/skills/bug-magnet-data/data/numbers/boundaries.yaml +161 -0
  59. package/skills/bug-magnet-data/data/numbers/precision.yaml +89 -0
  60. package/skills/bug-magnet-data/data/numbers/special.yaml +69 -0
  61. package/skills/bug-magnet-data/data/strings/boundaries.yaml +109 -0
  62. package/skills/bug-magnet-data/data/strings/injection.yaml +208 -0
  63. package/skills/bug-magnet-data/data/strings/special-chars.yaml +190 -0
  64. package/skills/bug-magnet-data/data/strings/unicode.yaml +139 -0
  65. package/skills/bug-magnet-data/references/external-lists.md +115 -0
  66. package/skills/bulwark-brainstorm/SKILL.md +563 -0
  67. package/skills/bulwark-brainstorm/references/at-teammate-prompts.md +60 -0
  68. package/skills/bulwark-brainstorm/references/role-critical-analyst.md +78 -0
  69. package/skills/bulwark-brainstorm/references/role-development-lead.md +66 -0
  70. package/skills/bulwark-brainstorm/references/role-product-delivery-lead.md +79 -0
  71. package/skills/bulwark-brainstorm/references/role-product-manager.md +62 -0
  72. package/skills/bulwark-brainstorm/references/role-project-sme.md +59 -0
  73. package/skills/bulwark-brainstorm/references/role-technical-architect.md +66 -0
  74. package/skills/bulwark-research/SKILL.md +298 -0
  75. package/skills/bulwark-research/references/viewpoint-contrarian.md +63 -0
  76. package/skills/bulwark-research/references/viewpoint-direct-investigation.md +62 -0
  77. package/skills/bulwark-research/references/viewpoint-first-principles.md +65 -0
  78. package/skills/bulwark-research/references/viewpoint-practitioner.md +62 -0
  79. package/skills/bulwark-research/references/viewpoint-prior-art.md +66 -0
  80. package/skills/bulwark-scaffold/SKILL.md +330 -0
  81. package/skills/bulwark-statusline/SKILL.md +161 -0
  82. package/skills/bulwark-statusline/scripts/statusline.sh +144 -0
  83. package/skills/bulwark-verify/SKILL.md +519 -0
  84. package/skills/code-review/SKILL.md +428 -0
  85. package/skills/code-review/examples/anti-patterns/linting.ts +181 -0
  86. package/skills/code-review/examples/anti-patterns/security.ts +91 -0
  87. package/skills/code-review/examples/anti-patterns/standards.ts +195 -0
  88. package/skills/code-review/examples/anti-patterns/type-safety.ts +108 -0
  89. package/skills/code-review/examples/recommended/linting.ts +195 -0
  90. package/skills/code-review/examples/recommended/security.ts +154 -0
  91. package/skills/code-review/examples/recommended/standards.ts +231 -0
  92. package/skills/code-review/examples/recommended/type-safety.ts +181 -0
  93. package/skills/code-review/frameworks/angular.md +218 -0
  94. package/skills/code-review/frameworks/django.md +235 -0
  95. package/skills/code-review/frameworks/express.md +207 -0
  96. package/skills/code-review/frameworks/flask.md +298 -0
  97. package/skills/code-review/frameworks/generic.md +146 -0
  98. package/skills/code-review/frameworks/react.md +152 -0
  99. package/skills/code-review/frameworks/vue.md +244 -0
  100. package/skills/code-review/references/linting-patterns.md +221 -0
  101. package/skills/code-review/references/security-patterns.md +125 -0
  102. package/skills/code-review/references/standards-patterns.md +246 -0
  103. package/skills/code-review/references/type-safety-patterns.md +130 -0
  104. package/skills/component-patterns/SKILL.md +131 -0
  105. package/skills/component-patterns/references/pattern-cli-command.md +118 -0
  106. package/skills/component-patterns/references/pattern-database.md +166 -0
  107. package/skills/component-patterns/references/pattern-external-api.md +139 -0
  108. package/skills/component-patterns/references/pattern-file-parser.md +168 -0
  109. package/skills/component-patterns/references/pattern-http-server.md +162 -0
  110. package/skills/component-patterns/references/pattern-process-spawner.md +133 -0
  111. package/skills/continuous-feedback/SKILL.md +327 -0
  112. package/skills/continuous-feedback/references/collect-instructions.md +81 -0
  113. package/skills/continuous-feedback/references/specialize-code-review.md +82 -0
  114. package/skills/continuous-feedback/references/specialize-general.md +98 -0
  115. package/skills/continuous-feedback/references/specialize-test-audit.md +81 -0
  116. package/skills/create-skill/SKILL.md +359 -0
  117. package/skills/create-skill/references/agent-conventions.md +194 -0
  118. package/skills/create-skill/references/agent-template.md +195 -0
  119. package/skills/create-skill/references/content-guidance.md +291 -0
  120. package/skills/create-skill/references/decision-framework.md +124 -0
  121. package/skills/create-skill/references/template-pipeline.md +217 -0
  122. package/skills/create-skill/references/template-reference-heavy.md +111 -0
  123. package/skills/create-skill/references/template-research.md +210 -0
  124. package/skills/create-skill/references/template-script-driven.md +172 -0
  125. package/skills/create-skill/references/template-simple.md +80 -0
  126. package/skills/create-subagent/SKILL.md +353 -0
  127. package/skills/create-subagent/references/agent-conventions.md +268 -0
  128. package/skills/create-subagent/references/content-guidance.md +232 -0
  129. package/skills/create-subagent/references/decision-framework.md +134 -0
  130. package/skills/create-subagent/references/template-single-agent.md +192 -0
  131. package/skills/fix-bug/SKILL.md +241 -0
  132. package/skills/governance-protocol/SKILL.md +116 -0
  133. package/skills/init/SKILL.md +341 -0
  134. package/skills/issue-debugging/SKILL.md +385 -0
  135. package/skills/issue-debugging/references/anti-patterns.md +245 -0
  136. package/skills/issue-debugging/references/debug-report-schema.md +227 -0
  137. package/skills/mock-detection/SKILL.md +511 -0
  138. package/skills/mock-detection/references/false-positive-prevention.md +402 -0
  139. package/skills/mock-detection/references/stub-patterns.md +236 -0
  140. package/skills/pipeline-templates/SKILL.md +215 -0
  141. package/skills/pipeline-templates/references/code-change-workflow.md +277 -0
  142. package/skills/pipeline-templates/references/code-review.md +336 -0
  143. package/skills/pipeline-templates/references/fix-validation.md +421 -0
  144. package/skills/pipeline-templates/references/new-feature.md +335 -0
  145. package/skills/pipeline-templates/references/research-brainstorm.md +161 -0
  146. package/skills/pipeline-templates/references/research-planning.md +257 -0
  147. package/skills/pipeline-templates/references/test-audit.md +389 -0
  148. package/skills/pipeline-templates/references/test-execution-fix.md +238 -0
  149. package/skills/plan-creation/SKILL.md +497 -0
  150. package/skills/product-ideation/SKILL.md +372 -0
  151. package/skills/product-ideation/references/analysis-frameworks.md +161 -0
  152. package/skills/session-handoff/SKILL.md +139 -0
  153. package/skills/session-handoff/references/examples.md +223 -0
  154. package/skills/setup-lsp/SKILL.md +312 -0
  155. package/skills/setup-lsp/references/server-registry.md +85 -0
  156. package/skills/setup-lsp/references/troubleshooting.md +135 -0
  157. package/skills/subagent-output-templating/SKILL.md +415 -0
  158. package/skills/subagent-output-templating/references/examples.md +440 -0
  159. package/skills/subagent-prompting/SKILL.md +364 -0
  160. package/skills/subagent-prompting/references/examples.md +342 -0
  161. package/skills/test-audit/SKILL.md +531 -0
  162. package/skills/test-audit/references/known-limitations.md +41 -0
  163. package/skills/test-audit/references/priority-classification.md +30 -0
  164. package/skills/test-audit/references/prompts/deep-mode-detection.md +83 -0
  165. package/skills/test-audit/references/prompts/synthesis.md +57 -0
  166. package/skills/test-audit/references/rewrite-instructions.md +46 -0
  167. package/skills/test-audit/references/schemas/audit-output.yaml +100 -0
  168. package/skills/test-audit/references/schemas/diagnostic-output.yaml +49 -0
  169. package/skills/test-audit/scripts/data-flow-analyzer.ts +509 -0
  170. package/skills/test-audit/scripts/integration-mock-detector.ts +462 -0
  171. package/skills/test-audit/scripts/package.json +20 -0
  172. package/skills/test-audit/scripts/skip-detector.ts +211 -0
  173. package/skills/test-audit/scripts/verification-counter.ts +295 -0
  174. package/skills/test-classification/SKILL.md +310 -0
  175. package/skills/test-fixture-creation/SKILL.md +295 -0
@@ -0,0 +1,223 @@
1
+ # Session Handoff Examples
2
+
3
+ Detailed examples for reference when creating handoffs.
4
+
5
+ ## Example 1: Completed Task
6
+
7
+ ```markdown
8
+ # Session 3 Handoff
9
+
10
+ ```yaml
11
+ session: 3
12
+ date: 2026-01-05
13
+ phase: "P0 - Foundation Skills"
14
+ task: "P0.2 - Subagent Output Templating"
15
+ status: completed
16
+ tokens_end: "~95K (48%)"
17
+ ```
18
+
19
+ ---
20
+
21
+ ## Session Summary
22
+
23
+ Completed the subagent-output-templating skill with structured log format and task completion report template. All verification checks pass.
24
+
25
+ ## What Was Accomplished
26
+
27
+ - [x] Created `skills/atomic/subagent-output-templating/SKILL.md` (~120 lines)
28
+ - [x] Added examples for all output formats
29
+ - [x] Verified skill loads correctly
30
+
31
+ ## Files Created/Modified
32
+
33
+ | File | Action | Lines | Purpose |
34
+ |------|--------|-------|---------|
35
+ | skills/atomic/subagent-output-templating/SKILL.md | Created | ~120 | Output formatting skill |
36
+
37
+ ## Verification Status
38
+
39
+ | Check | Status | Notes |
40
+ |-------|--------|-------|
41
+ | Typecheck | Skipped | No TypeScript |
42
+ | Lint | Pass | Markdown lint clean |
43
+ | Tests | Skipped | Documentation only |
44
+
45
+ ## Technical Decisions
46
+
47
+ ### Structured Log Format
48
+ - **Decision**: Use YAML frontmatter in log files
49
+ - **Rationale**: Enables programmatic parsing
50
+ - **Impact**: All agents must follow format
51
+
52
+ ## What's Next
53
+
54
+ 1. Begin P0.3 - Pipeline Templates skill
55
+ 2. Create F# pipe syntax documentation
56
+
57
+ ## Blockers / Issues
58
+
59
+ None
60
+
61
+ ## Learnings
62
+
63
+ YAML frontmatter in logs enables better tooling integration.
64
+ ```
65
+
66
+ ---
67
+
68
+ ## Example 2: In-Progress Task with Blocker
69
+
70
+ ```markdown
71
+ # Session 7 Handoff
72
+
73
+ ```yaml
74
+ session: 7
75
+ date: 2026-01-10
76
+ phase: "P1 - Enforcement Hooks"
77
+ task: "P1.1 - PostToolUse Lint Hook"
78
+ status: blocked
79
+ tokens_end: "~140K (70%)"
80
+ ```
81
+
82
+ ---
83
+
84
+ ## Session Summary
85
+
86
+ Implemented lint hook but discovered undocumented exit code behavior. Paused pending clarification from Anthropic docs.
87
+
88
+ ## What Was Accomplished
89
+
90
+ - [x] Created `hooks/scripts/lint-check.sh` (~45 lines)
91
+ - [x] Added hook registration to `hooks/hooks.json`
92
+ - [ ] Verify hook blocks on lint failure (blocked)
93
+
94
+ ## Files Created/Modified
95
+
96
+ | File | Action | Lines | Purpose |
97
+ |------|--------|-------|---------|
98
+ | hooks/scripts/lint-check.sh | Created | ~45 | Lint enforcement |
99
+ | hooks/hooks.json | Modified | +8 | Hook registration |
100
+
101
+ ## Verification Status
102
+
103
+ | Check | Status | Notes |
104
+ |-------|--------|-------|
105
+ | Typecheck | Skipped | Bash only |
106
+ | Lint | Pass | ShellCheck clean |
107
+ | Tests | Fail | Hook not triggering |
108
+
109
+ ## Technical Decisions
110
+
111
+ None finalized - awaiting blocker resolution.
112
+
113
+ ## What's Next
114
+
115
+ 1. Research Claude Code hook exit code behavior
116
+ 2. Test Exit 2 vs Exit 1
117
+ 3. Update script based on findings
118
+
119
+ ## Blockers / Issues
120
+
121
+ - Hook Exit 2 not injecting error into agent context
122
+ - Need to verify against Anthropic documentation
123
+
124
+ ## Learnings
125
+
126
+ Hook behavior may differ from documentation. Need verification environment.
127
+ ```
128
+
129
+ ---
130
+
131
+ ## Example 3: Multi-Task Session
132
+
133
+ ```markdown
134
+ # Session 12 Handoff
135
+
136
+ ```yaml
137
+ session: 12
138
+ date: 2026-01-15
139
+ phase: "P2 - Just Integration"
140
+ task: "P2.1 - Justfile Templates"
141
+ status: completed
142
+ tokens_end: "~180K (90%)"
143
+ ```
144
+
145
+ ---
146
+
147
+ ## Session Summary
148
+
149
+ Completed Justfile templates for test, lint, and typecheck. Also fixed critical bug in P1.1 hook discovered during testing. High token usage due to debugging.
150
+
151
+ ## What Was Accomplished
152
+
153
+ - [x] Created `lib/templates/justfile.template` (~80 lines)
154
+ - [x] Implemented `just test`, `just lint`, `just typecheck` recipes
155
+ - [x] Fixed P1.1 hook Exit 2 handling (was Exit 1)
156
+ - [x] Updated hooks/hooks.json with correct exit codes
157
+ - [ ] Add `just build` recipe (deferred - lower priority)
158
+
159
+ ## Files Created/Modified
160
+
161
+ | File | Action | Lines | Purpose |
162
+ |------|--------|-------|---------|
163
+ | lib/templates/justfile.template | Created | ~80 | Justfile template |
164
+ | hooks/scripts/lint-check.sh | Modified | +3/-1 | Exit code fix |
165
+ | hooks/hooks.json | Modified | +2/-2 | Exit code update |
166
+
167
+ ## Verification Status
168
+
169
+ | Check | Status | Notes |
170
+ |-------|--------|-------|
171
+ | Typecheck | Pass | |
172
+ | Lint | Pass | |
173
+ | Tests | Pass | 12/12 |
174
+
175
+ ## Technical Decisions
176
+
177
+ ### Exit Code Convention
178
+ - **Decision**: Use Exit 2 for blocking errors, Exit 1 for warnings
179
+ - **Rationale**: Exit 2 injects error into agent context per Anthropic docs
180
+ - **Impact**: All hooks must follow this convention
181
+
182
+ ### Defer just build
183
+ - **Decision**: Defer build recipe to future session
184
+ - **Rationale**: Core recipes complete, token budget exhausted
185
+ - **Impact**: Minor - build not critical for current phase
186
+
187
+ ## What's Next
188
+
189
+ 1. Begin P2.2 - Just command runner integration
190
+ 2. Add `just build` recipe
191
+ 3. Document Justfile patterns in skill
192
+
193
+ ## Blockers / Issues
194
+
195
+ None
196
+
197
+ ## Learnings
198
+
199
+ - Exit 2 is the correct blocking code (documented in Anthropic hooks guide)
200
+ - Justfile recipes should be atomic and composable
201
+ ```
202
+
203
+ ---
204
+
205
+ ## Customization for CLEAR Framework
206
+
207
+ When adapting for CLEAR Framework:
208
+
209
+ 1. Change `phase` to `workpackage` in YAML header
210
+ 2. Add `branch` field to track git branch
211
+ 3. Include test counts in verification status
212
+ 4. Reference `workpackage-status.yaml` for status updates
213
+
214
+ Example CLEAR header:
215
+
216
+ ```yaml
217
+ session: 45
218
+ date: 2026-01-15
219
+ workpackage: "P2.6 - Knowledge Command"
220
+ branch: feature/p2-knowledge-cli
221
+ tokens_end: "~120K (60%)"
222
+ status: completed
223
+ ```
@@ -0,0 +1,312 @@
1
+ ---
2
+ name: setup-lsp
3
+ description: Configures Language Server Protocol integration for Claude Code projects. Use when setting up LSP servers, verifying post-restart initialization, or troubleshooting broken LSP configurations.
4
+ user-invocable: true
5
+ argument-hint: "[--lang <languages>] [--verify | --troubleshoot]"
6
+ ---
7
+
8
+ # Setup LSP
9
+
10
+ Configure Language Server Protocol integration for Claude Code projects. LSP replaces text-based grep/glob searches with semantic code intelligence: go-to-definition, find-references, hover type info, call hierarchy, and real-time error detection.
11
+
12
+ ---
13
+
14
+ ## Mandatory Execution Checklist (BINDING)
15
+
16
+ **Every applicable item below is mandatory. No deviations. No substitutions. No skipping.**
17
+
18
+ This skill uses a 9-stage pipeline. You are the orchestrator. Follow every item in order. Do NOT return to the user until all applicable items are checked.
19
+
20
+ - [ ] **Stage 1 — Parse**: Arguments read, MODE determined (`full` | `verify` | `troubleshoot`), `--lang` extracted if present
21
+ - [ ] **Stage 2 — Detect**: `references/server-registry.md` loaded, manifest files scanned, DETECTED_LANGUAGES presented to user
22
+ - [ ] **Stage 3 — Binaries**: Binary install command run for each confirmed language
23
+ - [ ] **Stage 4 — Settings**: `ENABLE_LSP_TOOL=1` set in `~/.claude/settings.json` and shell profile
24
+ - [ ] **Stage 5 — Guide Plugin Install**: Present user with exact plugin names and instructions to install via `/plugin` or CLI
25
+ - [ ] **Stage 6 — Checkpoint**: Session ID captured via `${CLAUDE_SESSION_ID}`, exact `claude --resume` command presented to user, execution STOPPED
26
+ - [ ] **Stage 7 — Verify**: (on `--verify`) Debug log read, `Total LSP servers loaded: N` checked
27
+ - [ ] **Stage 8 — Diagnostics**: (if verification failed or `--troubleshoot`) `references/troubleshooting.md` loaded, issues checked in order
28
+ - [ ] **Stage 9 — Report**: `templates/diagnostic-output.yaml` loaded, diagnostic YAML written to `logs/diagnostics/`, summary presented to user
29
+
30
+ **Do NOT declare complete until all applicable checkboxes are marked.**
31
+
32
+ ---
33
+
34
+ ## When to Use This Skill
35
+
36
+ | Trigger Pattern | Scenario | Mode |
37
+ |-----------------|----------|------|
38
+ | Starting LSP setup from scratch | Project has no LSP configured | Full setup (no flags) |
39
+ | After restarting Claude Code following plugin install | Session resumed, verifying LSP loaded | `--verify` |
40
+ | LSP tools not appearing or servers not responding | Debugging a broken LSP configuration | `--troubleshoot` |
41
+
42
+ **DO NOT use for:**
43
+ - Projects where LSP is already confirmed working (check `~/.claude/debug/latest` first)
44
+ - Adding new language support to an already-configured LSP environment (run full setup again)
45
+
46
+ ---
47
+
48
+ ## Pre-Flight Gate (BINDING)
49
+
50
+ **STOP. Before running any installation steps, check the invocation flag.**
51
+
52
+ ```
53
+ IF $ARGUMENTS contains "--verify":
54
+ SKIP to Stage 7 (Verify Initialization)
55
+ IF $ARGUMENTS contains "--troubleshoot":
56
+ SKIP to Stage 8 (Diagnostics)
57
+ IF $ARGUMENTS contains "--lang":
58
+ Extract comma-separated language names → EXPLICIT_LANGUAGES
59
+ Execute ALL stages in order, but Stage 2 uses EXPLICIT_LANGUAGES instead of scanning
60
+ OTHERWISE:
61
+ Execute ALL stages in order (Stage 1 through Stage 9)
62
+ ```
63
+
64
+ You MUST NOT skip stages or reorder them during full setup.
65
+
66
+ ---
67
+
68
+ ## Dependencies
69
+
70
+ | File | Requirement | When to Load |
71
+ |------|-------------|--------------|
72
+ | `references/server-registry.md` | REQUIRED | Stage 2 (detection) and Stage 3 (install) |
73
+ | `references/troubleshooting.md` | REQUIRED | Stage 8 (diagnostics) and whenever verification fails |
74
+ | `templates/diagnostic-output.yaml` | REQUIRED | Stage 9 (report results) |
75
+
76
+ Read each file at the stage where it is first needed. Do not defer loading.
77
+
78
+ ---
79
+
80
+ ## Usage
81
+
82
+ ```
83
+ /setup-lsp Full setup: detect → install binaries → guide plugin install → checkpoint → verify
84
+ /setup-lsp --lang typescript,python Skip detection, install specified languages directly
85
+ /setup-lsp --verify Post-restart verification only (skip installation)
86
+ /setup-lsp --troubleshoot Diagnostics only (no installation)
87
+ ```
88
+
89
+ ---
90
+
91
+ ## Workflow
92
+
93
+ ### Stage 1: Parse Arguments
94
+
95
+ Read `$ARGUMENTS`. Determine MODE (`full` | `verify` | `troubleshoot`) per Pre-Flight Gate above. If `--lang` is present, extract the comma-separated language names into EXPLICIT_LANGUAGES (e.g., `--lang typescript,python` → `["typescript", "python"]`). Report mode (and explicit languages if any) to user before proceeding.
96
+
97
+ ---
98
+
99
+ ### Stage 2: Detect Tech Stack
100
+
101
+ Read `references/server-registry.md`.
102
+
103
+ **If EXPLICIT_LANGUAGES was set in Stage 1** (via `--lang`): Look up each language name in the server registry. Build DETECTED_LANGUAGES from the matching entries (use "user-specified" as manifest path). If any language name doesn't match the registry, report the mismatch and ask user to clarify.
104
+
105
+ **Otherwise**: Scan project root and up to 2 directory levels deep for manifest files listed in the Official LSP Plugins table. For monorepos, scan each subdirectory independently. See registry for monorepo scanning guidance. Build DETECTED_LANGUAGES list (language, manifest path, plugin name).
106
+
107
+ **If DETECTED_LANGUAGES is empty** (no manifest files found):
108
+
109
+ ```
110
+ No supported languages detected in this project.
111
+
112
+ You can select languages manually from the server registry:
113
+ 1. TypeScript/JavaScript
114
+ 2. Python
115
+ 3. Go
116
+ 4. Rust
117
+ 5. Java
118
+ 6. C#
119
+ 7. PHP
120
+ 8. C/C++
121
+ 9. Kotlin
122
+ 10. Swift
123
+ 11. Lua
124
+ (See references/server-registry.md for full list)
125
+
126
+ Select languages to set up (comma-separated numbers), or 'skip' to abort:
127
+ ```
128
+
129
+ Use AskUserQuestion to present the language list. If user selects 'skip', report "No languages selected" and proceed directly to Stage 9 (Report Results).
130
+
131
+ **If DETECTED_LANGUAGES is non-empty**, present to user:
132
+
133
+ ```
134
+ Detected languages:
135
+ - {language} ({manifest path}) → plugin: {plugin-name}
136
+
137
+ Proceed with installation? (yes / adjust)
138
+ ```
139
+
140
+ Wait for user confirmation before continuing to Stage 3.
141
+
142
+ ---
143
+
144
+ ### Stage 3: Install Language Server Binaries
145
+
146
+ Read `references/server-registry.md`. Use the binary install commands for each confirmed language.
147
+
148
+ For each language in DETECTED_LANGUAGES:
149
+ 1. Run the binary install command from the registry
150
+ 2. Verify the binary is available: `which {binary-name}`
151
+ 3. Report success or failure per language
152
+
153
+ If any binary install fails: report the error, note the language as FAILED, continue with remaining languages.
154
+
155
+ ---
156
+
157
+ ### Stage 4: Configure Settings
158
+
159
+ **Step 4a — Set ENABLE_LSP_TOOL in settings.json:**
160
+
161
+ Read `~/.claude/settings.json`. Add `"ENABLE_LSP_TOOL": "1"` if not already present. Write back.
162
+
163
+ **Step 4b — Set ENABLE_LSP_TOOL in shell profile:**
164
+
165
+ Check which shell profile exists (`~/.bashrc` or `~/.zshrc`). Add `export ENABLE_LSP_TOOL=1` if not already present.
166
+
167
+ Note: `ENABLE_LSP_TOOL` is an undocumented flag required for LSP tool activation (community report #15619).
168
+
169
+ ---
170
+
171
+ ### Stage 5: Guide User Through Plugin Installation (BLOCKING — User Action Required)
172
+
173
+ **IMPORTANT: Claude CANNOT run `claude plugin install` or `claude plugin enable` commands from within a session.** These must be performed by the user.
174
+
175
+ **Step 5a — Ask about installation scope:**
176
+
177
+ Use AskUserQuestion to ask the user which scope to install plugins in:
178
+
179
+ ```
180
+ Which scope should the LSP plugins be installed in?
181
+
182
+ 1. User scope (default) — available across all your projects (~/.claude/settings.json)
183
+ 2. Project scope — shared with team via version control (.claude/settings.json)
184
+ 3. Local scope — project-specific, gitignored (.claude/settings.local.json)
185
+ ```
186
+
187
+ Record the chosen scope. For Option B CLI instructions, map to: `--scope user`, `--scope project`, or `--scope local`.
188
+
189
+ **Step 5b — Present plugin installation instructions and ask for status:**
190
+
191
+ First, present the installation instructions as plain text output (NOT inside AskUserQuestion):
192
+
193
+ ```
194
+ PLUGIN INSTALLATION — USER ACTION REQUIRED
195
+
196
+ The language server binaries are installed. Now you need to install the
197
+ Claude Code LSP plugins for each language.
198
+
199
+ Scope: {chosen scope} ({scope description})
200
+
201
+ Option A — Using /plugin (within this session):
202
+ 1. Type /plugin
203
+ 2. Go to the "Discover" tab
204
+ 3. Search for and install each plugin:
205
+ {for each language in DETECTED_LANGUAGES}
206
+ - {plugin-name}
207
+ {end}
208
+ 4. When prompted for scope, select "{scope label}" to match your
209
+ earlier choice. The options shown will be:
210
+ - "Install for you (user scope)"
211
+ - "Install for all collaborators on this repository (project scope)"
212
+ - "Install for you, in this repo only (local scope)"
213
+ Select the one matching: {chosen scope}.
214
+
215
+ Option B — Using CLI (from a separate terminal):
216
+ claude plugin marketplace update claude-plugins-official
217
+ {for each language in DETECTED_LANGUAGES}
218
+ claude plugin install {plugin-name} --scope {chosen-scope}
219
+ {end}
220
+ ```
221
+
222
+ Then use AskUserQuestion with two options:
223
+
224
+ ```
225
+ 1. "I've installed them" — plugins are already installed, proceed to next step
226
+ 2. "I'll install them in this session" — dismiss this prompt so I can use /plugin
227
+ ```
228
+
229
+ **If user selects option 1**: Proceed to Stage 6 (Checkpoint).
230
+
231
+ **If user selects option 2**: Dismiss the question and present this note as plain text:
232
+
233
+ ```
234
+ No problem. Install the plugins using /plugin or from a separate terminal.
235
+
236
+ Once installation is complete, confirm here and I'll continue with the
237
+ remaining setup (exit+resume for LSP initialization).
238
+ ```
239
+
240
+ Then WAIT for the user's natural text confirmation before proceeding to Stage 6. Do NOT present another AskUserQuestion — let the user type freely so they can use `/plugin` and other commands.
241
+
242
+ ---
243
+
244
+ ### Stage 6: Exit and Resume Checkpoint (BLOCKING)
245
+
246
+ **LSP servers only initialize at startup. This stage is mandatory and non-skippable.**
247
+
248
+ The current session ID is available as `${CLAUDE_SESSION_ID}`. Present to user and STOP:
249
+
250
+ ```
251
+ LSP SETUP REQUIRES EXIT AND RESUME
252
+
253
+ Exit Claude Code now, then resume this session:
254
+
255
+ claude --resume ${CLAUDE_SESSION_ID}
256
+
257
+ After resuming, run /setup-lsp --verify to confirm servers loaded.
258
+ ```
259
+
260
+ **Do NOT continue past this stage.** Execution resumes only when user invokes `--verify` in the resumed session.
261
+
262
+ ---
263
+
264
+ ### Stage 7: Verify Initialization
265
+
266
+ This stage runs on `--verify` invocation after session resume.
267
+
268
+ Read `~/.claude/debug/latest` (internal debug log, path may change in future versions). Search for `Total LSP servers loaded: N`.
269
+
270
+ - N > 0 → PASSED. Note which servers appear.
271
+ - N = 0 → FAILED. Proceed to Stage 8.
272
+ - Line absent → Log not yet updated. Ask user to wait 10 seconds and retry.
273
+
274
+ Also check the `/plugin` Errors tab output if available — `Executable not found in $PATH` indicates a binary installation issue (see troubleshooting issue #5).
275
+
276
+ ---
277
+
278
+ ### Stage 8: Diagnostics
279
+
280
+ Read `references/troubleshooting.md`. Work through the 5 common issues in order: run each detection method, apply fix if detected, report result. After applying fixes, re-run verification (Stage 7) and report outcome.
281
+
282
+ ---
283
+
284
+ ### Stage 9: Report Results
285
+
286
+ Read `templates/diagnostic-output.yaml`. Fill all fields. Write completed diagnostic to `logs/diagnostics/lsp-setup-{YYYYMMDD-HHMMSS}.yaml`.
287
+
288
+ Present summary:
289
+
290
+ ```
291
+ LSP Setup Complete
292
+
293
+ Detected languages: {list}
294
+ Installed binaries: {list with status: ok | failed}
295
+ Plugins installed: {list — user-confirmed}
296
+ Verification status: PASSED | FAILED | PENDING (awaiting resume)
297
+ Issues found: {count} ({list if any})
298
+ Session ID: {SESSION_ID}
299
+ Diagnostic log: ./logs/diagnostics/lsp-setup-{timestamp}.yaml
300
+ ```
301
+
302
+ If any server failed or verification failed, include next steps from `references/troubleshooting.md`.
303
+
304
+ **If plugins were installed for languages without matching source files in the project** (e.g., rust-analyzer-lsp installed but no `.rs` files or `Cargo.toml` present), append this note:
305
+
306
+ ```
307
+ Note: Some LSP servers may show startup errors if there are no matching
308
+ source files in this project yet. This is expected — the server starts
309
+ but cannot find a workspace to index. Once you add source files for that
310
+ language (e.g., create a Cargo.toml for Rust), the server will activate
311
+ automatically on next session start.
312
+ ```
@@ -0,0 +1,85 @@
1
+ # LSP Server Registry
2
+
3
+ Reference data for tech stack detection, binary installation, and plugin identification. Load this file during Stage 2 (detection) and Stage 3 (installation).
4
+
5
+ ---
6
+
7
+ ## Official LSP Plugins (claude-plugins-official marketplace)
8
+
9
+ These are the official LSP plugins available from the `claude-plugins-official` marketplace. Plugin names are used for `claude plugin install` and `/plugin` search.
10
+
11
+ | Language | Manifest Files | Plugin Name | Binary Install Command |
12
+ |----------|---------------|-------------|----------------------|
13
+ | TypeScript / JavaScript | `package.json`, `tsconfig.json` | `typescript-lsp` | `npm install -g typescript-language-server typescript` |
14
+ | Python | `pyproject.toml`, `setup.py`, `setup.cfg`, `requirements.txt` | `pyright-lsp` | `pip install pyright` or `npm install -g pyright` |
15
+ | Rust | `Cargo.toml` | `rust-analyzer-lsp` | `rustup component add rust-analyzer` |
16
+ | Go | `go.mod` | `gopls-lsp` | `go install golang.org/x/tools/gopls@latest` |
17
+ | Java | `pom.xml`, `build.gradle`, `build.gradle.kts` | `jdtls-lsp` | `brew install jdtls` (macOS) / `apt-get install jdtls` (Debian) |
18
+ | C# | `*.csproj`, `*.sln` | `csharp-lsp` | `dotnet tool install -g csharp-ls` |
19
+ | PHP | `composer.json` | `php-lsp` | `npm install -g intelephense` |
20
+ | C / C++ | `CMakeLists.txt`, `Makefile`, `*.c`, `*.cpp` | `clangd-lsp` | `brew install llvm` (macOS) / `apt-get install clangd` (Debian) |
21
+ | Kotlin | `build.gradle.kts`, `*.kt` | `kotlin-lsp` | See https://github.com/fwcd/kotlin-language-server/releases |
22
+ | Swift | `Package.swift`, `*.swift` | `swift-lsp` | Bundled with Xcode / Swift toolchain |
23
+ | Lua | `*.lua`, `.luarc.json` | `lua-lsp` | `brew install lua-language-server` (macOS) / see GitHub releases |
24
+
25
+ **Note**: Ruby (`ruby-lsp`) does not have an official marketplace plugin as of February 2026.
26
+
27
+ ---
28
+
29
+ ## Monorepo Scanning Guidance
30
+
31
+ When scanning a monorepo (a repository with multiple packages or services in subdirectories):
32
+
33
+ 1. Scan project root first for any manifest files.
34
+ 2. Scan each immediate subdirectory (depth 1) for manifest files.
35
+ 3. Scan one level deeper (depth 2) if subdirectories contain further subdirectories with recognizable names (e.g., `packages/`, `services/`, `apps/`, `modules/`).
36
+ 4. Do not scan deeper than 2 levels — returns diminishing signal.
37
+
38
+ For each unique combination of (language, plugin name) found across all scanned directories:
39
+ - Report the language once, listing all manifest paths found.
40
+ - Install the server binary once (not once per manifest).
41
+
42
+ Example output for a monorepo:
43
+ ```
44
+ Detected languages:
45
+ - TypeScript (packages/web/package.json, packages/api/package.json) → plugin: typescript-lsp
46
+ - Python (services/ml/requirements.txt) → plugin: pyright-lsp
47
+ ```
48
+
49
+ ---
50
+
51
+ ## LSP Capabilities Reference
52
+
53
+ ### Passive Capabilities (automatic, no invocation needed)
54
+
55
+ | Capability | Description |
56
+ |------------|-------------|
57
+ | Real-time error detection | Syntax and type errors highlighted as you edit |
58
+ | Diagnostic pushing | Server pushes warnings and errors to the client |
59
+ | Self-correcting edits | Some servers provide on-save auto-fix for lint violations |
60
+
61
+ ### Active Capabilities (Claude invokes these explicitly)
62
+
63
+ | Capability | Description |
64
+ |------------|-------------|
65
+ | Go-to-definition | Jump from a symbol reference to its declaration |
66
+ | Find references | List all locations where a symbol is used |
67
+ | Hover type info | Show inferred or declared type for any expression |
68
+ | Symbol search | Search the workspace for a symbol by name |
69
+ | Implementation tracing | Find concrete implementations of an interface/abstract method |
70
+ | Call hierarchy | Show callers and callees for a function |
71
+ | Rename symbol | Refactor a symbol name across all references |
72
+
73
+ Active capabilities replace grep/glob searches with semantically accurate results that respect scope, types, and inheritance.
74
+
75
+ ---
76
+
77
+ ## Plugin Installation Notes
78
+
79
+ **IMPORTANT**: Claude cannot run `claude plugin install/enable` commands from within a session. These are CLI operations the user must perform outside the session or via the `/plugin` TUI command within a session.
80
+
81
+ The correct installation flow is:
82
+ 1. Install language server binary (Claude CAN do this via npm/pip/go install etc.)
83
+ 2. User installs the plugin via `/plugin` search or `claude plugin install <name>` from a terminal
84
+ 3. Set `ENABLE_LSP_TOOL=1` in settings and shell profile
85
+ 4. Exit and resume session for LSP servers to initialize