@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,364 @@
1
+ ---
2
+ name: subagent-prompting
3
+ description: Template for structured sub-agent invocation using 4-part prompting (GOAL/CONSTRAINTS/CONTEXT/OUTPUT) and F# pipeline notation. Use when orchestrating sub-agents or designing multi-agent workflows.
4
+ user-invocable: false
5
+ ---
6
+
7
+ # Sub-Agent Prompting Template
8
+
9
+ ## Overview
10
+
11
+ This skill provides a standardized template for invoking sub-agents with deterministic inputs and predictable outputs. Use this when:
12
+
13
+ - Orchestrating specialist sub-agents (code auditor, test auditor, etc.)
14
+ - Designing multi-agent workflows with conditional branching
15
+ - Ensuring consistent prompt structure across sub-agent invocations
16
+
17
+ ## 4-Part Template (Required)
18
+
19
+ Every sub-agent invocation MUST include all four parts. Incomplete prompts lead to unpredictable behavior.
20
+
21
+ ### GOAL (What Success Looks Like)
22
+
23
+ State the high-level objective, not just the action. Good goals are outcome-focused.
24
+
25
+ ```markdown
26
+ ## GOAL
27
+
28
+ [Describe the desired end state, not the process]
29
+
30
+ Examples:
31
+ - GOOD: "Identify all security vulnerabilities that could allow unauthorized data access"
32
+ - BAD: "Review the auth file"
33
+
34
+ - GOOD: "Refactor authentication module for improved maintainability without breaking existing tests"
35
+ - BAD: "Refactor the code"
36
+ ```
37
+
38
+ ### CONSTRAINTS (What You Cannot Do)
39
+
40
+ Explicit boundaries prevent scope creep and unexpected changes.
41
+
42
+ ```markdown
43
+ ## CONSTRAINTS
44
+
45
+ - [Hard limit 1: e.g., "Do NOT modify any files"]
46
+ - [Hard limit 2: e.g., "Do NOT add new dependencies"]
47
+ - [Hard limit 3: e.g., "Maintain backward API compatibility"]
48
+ - [Resource limit: e.g., "Complete within 50 tool calls"]
49
+
50
+ Examples:
51
+ - "Identify issues only - do NOT implement fixes"
52
+ - "Read-only analysis - no file modifications"
53
+ - "Focus only on files in src/auth/ directory"
54
+ ```
55
+
56
+ ### CONTEXT (What You Need to Know)
57
+
58
+ Provide all information required to complete the task. Sub-agents run in isolated context and cannot access parent conversation.
59
+
60
+ ```markdown
61
+ ## CONTEXT
62
+
63
+ ### Files to Analyze
64
+ - `path/to/file1.ts` - [brief description of relevance]
65
+ - `path/to/file2.ts` - [brief description of relevance]
66
+
67
+ ### Related Context
68
+ - Previous findings: [summary of relevant prior work]
69
+ - Architecture notes: [relevant design decisions]
70
+ - Known issues: [existing problems to be aware of]
71
+
72
+ ### Standards to Apply
73
+ - [Coding standard or guideline reference]
74
+ - [Security policy reference if applicable]
75
+ ```
76
+
77
+ ### OUTPUT (What to Deliver)
78
+
79
+ Specify concrete deliverables with exact format requirements.
80
+
81
+ ```markdown
82
+ ## OUTPUT
83
+
84
+ ### Primary Deliverable
85
+ Write findings to: `logs/{agent-name}-{timestamp}.md`
86
+
87
+ ### Output Format
88
+ [Specify structure: YAML, Markdown sections, etc.]
89
+
90
+ ### Summary Requirements
91
+ Return to main thread: [max 200 tokens summary of key findings]
92
+
93
+ ### Diagnostic Output
94
+ Write to: `logs/diagnostics/{agent-name}-{timestamp}.yaml`
95
+ ```
96
+
97
+ ---
98
+
99
+ ## Pipeline Syntax (F# Conceptual Notation)
100
+
101
+ ### Understanding the Notation
102
+
103
+ F# pipe syntax (`|>`) is a **conceptual notation** for planning and documentation. It is NOT directly executable Claude Code syntax.
104
+
105
+ ```fsharp
106
+ // This is documentation, not executable code
107
+ Agent1 (task) |> Agent2 (task) |> Agent3 (task)
108
+ ```
109
+
110
+ **Purpose**: Visualize workflow dependencies and conditional logic before implementation.
111
+
112
+ ### Mapping to Task() Invocations
113
+
114
+ Each pipeline stage maps to a sequential `Task()` call from the main thread:
115
+
116
+ ```fsharp
117
+ // Conceptual pipeline
118
+ CodeAuditor (security) |> CodeAuditor (architecture) |> (if findings > 0 then IssueDebugger else Done)
119
+ ```
120
+
121
+ **Actual execution**:
122
+
123
+ 1. Main thread invokes: `Task(description="Security audit", subagent_type="sonnet", prompt="[4-part prompt]")`
124
+ 2. Main thread reads log output, extracts findings
125
+ 3. Main thread invokes: `Task(description="Architecture audit", subagent_type="sonnet", prompt="[4-part prompt]")`
126
+ 4. Main thread reads log output, extracts findings
127
+ 5. IF `findings.count > 0`: Main thread invokes IssueDebugger
128
+ 6. ELSE: Pipeline complete
129
+
130
+ ### Pipeline Patterns
131
+
132
+ **Code Review Pipeline:**
133
+ ```fsharp
134
+ CodeAuditor (security)
135
+ |> CodeAuditor (architecture)
136
+ |> TestAuditor (coverage)
137
+ |> (if findings > 0 then IssueDebugger else Done)
138
+ ```
139
+
140
+ **Fix Validation Pipeline:**
141
+ ```fsharp
142
+ IssueDebugger (root cause)
143
+ |> Implementer (apply fix)
144
+ |> CodeAuditor (verify quality)
145
+ |> TestAuditor (verify tests)
146
+ |> (if issues > 0 then IssueDebugger else Done) // Loop until clean
147
+ ```
148
+
149
+ **Test Audit Pipeline:**
150
+ ```fsharp
151
+ TestAuditor (classify all)
152
+ |> (if mock_heavy > 0 then VerificationScriptCreator else Done)
153
+ |> Implementer (rewrite flagged)
154
+ |> TestAuditor (re-verify)
155
+ ```
156
+
157
+ ### Key Constraint
158
+
159
+ Sub-agents CANNOT spawn other sub-agents. All pipeline orchestration happens from the main thread.
160
+
161
+ ---
162
+
163
+ ## Custom Agent vs Built-in Agent
164
+
165
+ ### Agent Selection Priority
166
+
167
+ Before spawning a pipeline stage:
168
+
169
+ 1. **Check `.claude/agents/`** for a custom agent matching the task
170
+ 2. **If custom agent exists**: Use its `name` field as `subagent_type` - this invokes the custom agent
171
+ 3. **If no custom agent**: Use `general-purpose` and provide full specialized instructions in the prompt
172
+
173
+ ### Important: 4-Part Prompt Always Required
174
+
175
+ Regardless of agent type, every Task invocation MUST include the 4-part prompt (GOAL/CONSTRAINTS/CONTEXT/OUTPUT) and follow subagent-output-templating for output format.
176
+
177
+ ### Built-in Agent Types
178
+
179
+ | Type | Use Case |
180
+ |------|----------|
181
+ | `general-purpose` | Multi-step tasks, code writing, analysis |
182
+ | `Explore` | Fast codebase exploration, file search |
183
+ | `Plan` | Architecture planning, implementation design |
184
+ | `Bash` | Command execution |
185
+
186
+ ### Example: Custom Agent EXISTS
187
+
188
+ ```python
189
+ # .claude/agents/security-auditor.md exists with name: security-auditor
190
+ Task(
191
+ description="Security audit",
192
+ subagent_type="security-auditor", # Invokes the custom agent
193
+ prompt="""
194
+ ## GOAL
195
+ Identify security vulnerabilities in calculator.ts
196
+
197
+ ## CONSTRAINTS
198
+ - Do NOT modify files
199
+
200
+ ## CONTEXT
201
+ File: src/calculator.ts
202
+
203
+ ## OUTPUT
204
+ Write to: logs/security-audit-{timestamp}.yaml
205
+ """
206
+ )
207
+ ```
208
+
209
+ ### Example: Custom Agent DOES NOT Exist
210
+
211
+ ```python
212
+ # No custom agent for this task - use general-purpose
213
+ Task(
214
+ description="Security audit",
215
+ subagent_type="general-purpose",
216
+ model="sonnet",
217
+ prompt="""
218
+ ## GOAL
219
+ Identify security vulnerabilities in calculator.ts using OWASP Top 10 patterns.
220
+
221
+ ## CONSTRAINTS
222
+ - Do NOT modify files
223
+ - Focus on injection, auth, and data exposure risks
224
+
225
+ ## CONTEXT
226
+ File: src/calculator.ts
227
+ This is a calculator module with arithmetic operations.
228
+
229
+ ## OUTPUT
230
+ Write findings to: logs/security-audit-{timestamp}.yaml
231
+ Format: YAML with findings array, severity, and recommendations
232
+ """
233
+ )
234
+ ```
235
+
236
+ Note: When no custom agent exists, the prompt must include all specialized instructions that would otherwise be in the custom agent's markdown file.
237
+
238
+ ---
239
+
240
+ ## Model Selection Guidance
241
+
242
+ ### Task-Type Based Selection (Objective)
243
+
244
+ Model selection is based on **task type**, not subjective complexity. This keeps selection deterministic and objective.
245
+
246
+ | Model | Task Type | Examples |
247
+ |-------|-----------|----------|
248
+ | **Haiku** | Lookups & Execution | Web fetch, file read/summarize, collect logs, run tests, typecheck, lint, simple classification |
249
+ | **Sonnet** | Review & Analysis | Code review, test review, audits, failure analysis, security analysis |
250
+ | **Opus** | Write & Fix | Write code, write tests, write fixes, apply changes |
251
+
252
+ ### Selection Rules
253
+
254
+ 1. **Determine task type from the action verb**:
255
+ - Lookup/Execute/Run/Fetch → **Haiku**
256
+ - Review/Analyze/Audit/Classify → **Sonnet**
257
+ - Write/Fix/Implement/Apply → **Opus**
258
+
259
+ 2. **Custom agent override**: If a custom sub-agent has `agent:` in its frontmatter, use that model instead of these rules.
260
+
261
+ 3. **Always specify model**: Every Task() invocation must include `subagent_type`.
262
+
263
+ ### Pipeline Example
264
+
265
+ ```
266
+ Orchestrator (Opus) writes initial code
267
+
268
+ Sub-agent (Sonnet) reviews → finds issues
269
+
270
+ Sub-agent (Opus) fixes
271
+
272
+ Sub-agent (Sonnet) re-reviews
273
+
274
+ [Loop until clean]
275
+ ```
276
+
277
+ ### Anti-Patterns
278
+
279
+ | Anti-Pattern | Why It's Wrong | Correct Approach |
280
+ |--------------|----------------|------------------|
281
+ | Using Opus for lookups | Wastes budget on simple tasks | Use Haiku for lookups |
282
+ | Using Haiku for code review | Misses nuanced issues | Use Sonnet for analysis |
283
+ | Using Sonnet for writing fixes | Suboptimal quality | Use Opus for writing |
284
+ | No model specified | Unpredictable behavior | Always specify `subagent_type` |
285
+ | Ignoring custom agent frontmatter | Overrides intended behavior | Respect `agent:` field |
286
+
287
+ ---
288
+
289
+ ## Diagnostic Output (Required)
290
+
291
+ When this skill is used to invoke a sub-agent, the sub-agent MUST write diagnostic output.
292
+
293
+ ### Diagnostic File Location
294
+
295
+ ```
296
+ logs/diagnostics/{skill-name}-{YYYYMMDD-HHMMSS}.yaml
297
+ ```
298
+
299
+ ### Diagnostic Format
300
+
301
+ ```yaml
302
+ skill: subagent-prompting
303
+ timestamp: 2026-01-10T12:30:45Z
304
+ diagnostics:
305
+ model_requested: sonnet
306
+ model_actual: sonnet
307
+ context_type: main
308
+ parent_vars_accessible: true
309
+ hooks_fired: []
310
+ execution_time_ms: 1250
311
+ completion_status: success
312
+ notes: "Skill invoked successfully"
313
+ ```
314
+
315
+ ### When to Write Diagnostics
316
+
317
+ - At the END of skill execution (success or failure)
318
+ - Include actual model used (may differ from requested)
319
+ - Record execution time for performance tracking
320
+
321
+ ---
322
+
323
+ ## Quick Reference
324
+
325
+ ### Prompt Checklist
326
+
327
+ ```markdown
328
+ [ ] GOAL: Outcome-focused objective stated
329
+ [ ] CONSTRAINTS: Hard limits explicitly listed
330
+ [ ] CONTEXT: All required files and background provided
331
+ [ ] OUTPUT: Log path, format, and summary requirements specified
332
+ [ ] DIAGNOSTIC: logs/diagnostics/ path included
333
+ ```
334
+
335
+ ### Task() Invocation Template
336
+
337
+ ```python
338
+ Task(
339
+ description="[3-5 word summary]",
340
+ subagent_type="sonnet", # or "haiku", "opus"
341
+ prompt="""
342
+ ## GOAL
343
+ [Outcome-focused objective]
344
+
345
+ ## CONSTRAINTS
346
+ - [Limit 1]
347
+ - [Limit 2]
348
+
349
+ ## CONTEXT
350
+ [Files, background, standards]
351
+
352
+ ## OUTPUT
353
+ Write to: logs/{agent}-{timestamp}.md
354
+ Diagnostic: logs/diagnostics/{agent}-{timestamp}.yaml
355
+ Summary: [max 200 tokens]
356
+ """
357
+ )
358
+ ```
359
+
360
+ ---
361
+
362
+ ## References
363
+
364
+ For extended examples and edge cases, see `references/examples.md`.
@@ -0,0 +1,342 @@
1
+ # Sub-Agent Prompting Examples
2
+
3
+ Extended examples for the subagent-prompting skill. Load this file for detailed reference when designing sub-agent invocations.
4
+
5
+ ---
6
+
7
+ ## Example 1: Code Auditor Invocation
8
+
9
+ ### Complete 4-Part Prompt
10
+
11
+ ```markdown
12
+ ## GOAL
13
+
14
+ Identify security vulnerabilities and code quality issues in the authentication module that could lead to unauthorized access or data exposure.
15
+
16
+ ## CONSTRAINTS
17
+
18
+ - Do NOT modify any files - this is read-only analysis
19
+ - Focus only on files in `src/auth/` directory
20
+ - Do NOT analyze test files
21
+ - Complete analysis within 30 tool calls
22
+ - Identify issues only - do NOT implement fixes
23
+
24
+ ## CONTEXT
25
+
26
+ ### Files to Analyze
27
+ - `src/auth/login.ts` - Handles user login flow
28
+ - `src/auth/session.ts` - Session management
29
+ - `src/auth/middleware.ts` - Auth middleware for routes
30
+ - `src/auth/tokens.ts` - JWT token handling
31
+
32
+ ### Related Context
33
+ - Previous audit found XSS in user input handling (fixed in v2.1)
34
+ - Session tokens use RS256 algorithm
35
+ - No rate limiting currently implemented
36
+
37
+ ### Standards to Apply
38
+ - OWASP Top 10 2021
39
+ - Company security policy v3.2
40
+ - TypeScript strict mode compliance
41
+
42
+ ## OUTPUT
43
+
44
+ ### Primary Deliverable
45
+ Write findings to: `logs/code-auditor-20260110-143022.md`
46
+
47
+ ### Output Format
48
+ ```markdown
49
+ # Security Audit Report
50
+
51
+ ## Critical Issues
52
+ [List with file:line references]
53
+
54
+ ## High Priority Issues
55
+ [List with file:line references]
56
+
57
+ ## Medium Priority Issues
58
+ [List with file:line references]
59
+
60
+ ## Recommendations
61
+ [Prioritized action items]
62
+ ```
63
+
64
+ ### Summary Requirements
65
+ Return to main thread: Max 200 tokens summarizing critical findings count and top recommendation.
66
+
67
+ ### Diagnostic Output
68
+ Write to: `logs/diagnostics/code-auditor-20260110-143022.yaml`
69
+ ```
70
+
71
+ ---
72
+
73
+ ## Example 2: Test Auditor Invocation
74
+
75
+ ### Complete 4-Part Prompt
76
+
77
+ ```markdown
78
+ ## GOAL
79
+
80
+ Classify all tests in the repository to identify mock-heavy tests that verify mock behavior rather than real system behavior.
81
+
82
+ ## CONSTRAINTS
83
+
84
+ - Read-only analysis - do NOT modify test files
85
+ - Process all files matching `**/*.test.ts` and `**/*.spec.ts`
86
+ - Flag tests where >50% of assertions verify mock calls
87
+ - Do NOT flag integration tests that use real dependencies
88
+
89
+ ## CONTEXT
90
+
91
+ ### Test Patterns to Recognize
92
+
93
+ **Real Integration Test Indicators:**
94
+ - Spawns actual processes
95
+ - Makes real HTTP requests
96
+ - Reads/writes actual files
97
+ - Uses real database connections
98
+
99
+ **Mock-Heavy Test Indicators:**
100
+ - jest.mock() or vi.mock() for system under test
101
+ - Assertions on mock.toHaveBeenCalledWith()
102
+ - No actual output verification
103
+ - Mocked spawn/exec for CLI tools
104
+
105
+ ### Known Good Tests (Do Not Flag)
106
+ - `tests/integration/` directory - all real integration tests
107
+ - `tests/e2e/` directory - end-to-end tests
108
+
109
+ ## OUTPUT
110
+
111
+ ### Primary Deliverable
112
+ Write to: `logs/test-auditor-20260110-150000.yaml`
113
+
114
+ ### Output Format
115
+ ```yaml
116
+ summary:
117
+ total_tests: 156
118
+ real_tests: 89
119
+ mock_heavy: 67
120
+
121
+ classifications:
122
+ - file: src/auth/__tests__/login.test.ts
123
+ type: mock_heavy
124
+ mock_percentage: 85
125
+ reason: "Mocks entire auth service, verifies mock calls only"
126
+ priority: high
127
+
128
+ - file: tests/integration/api.test.ts
129
+ type: real
130
+ mock_percentage: 0
131
+ reason: "Spawns actual server, makes real HTTP requests"
132
+ ```
133
+
134
+ ### Summary Requirements
135
+ Return: "Classified X tests: Y real, Z mock-heavy (priority rewrite: N)"
136
+
137
+ ### Diagnostic Output
138
+ Write to: `logs/diagnostics/test-auditor-20260110-150000.yaml`
139
+ ```
140
+
141
+ ---
142
+
143
+ ## Example 3: Issue Debugger with Validation Loop
144
+
145
+ ### Complete 4-Part Prompt
146
+
147
+ ```markdown
148
+ ## GOAL
149
+
150
+ Identify the root cause of failing login tests and implement a fix that passes all tests without breaking existing functionality.
151
+
152
+ ## CONSTRAINTS
153
+
154
+ - Only modify files directly related to the bug
155
+ - Do NOT refactor unrelated code
156
+ - Maintain backward API compatibility
157
+ - All existing tests must continue to pass
158
+ - New fix must include a regression test
159
+
160
+ ## CONTEXT
161
+
162
+ ### Failing Test Output
163
+ ```
164
+ FAIL src/auth/__tests__/login.test.ts
165
+ ✕ should reject expired tokens (45ms)
166
+
167
+ Expected: 401 Unauthorized
168
+ Received: 200 OK
169
+
170
+ at src/auth/middleware.ts:47
171
+ ```
172
+
173
+ ### Recent Changes
174
+ - Commit abc123: "Refactored token validation" (3 days ago)
175
+ - This is when tests started failing
176
+
177
+ ### Files to Investigate
178
+ - `src/auth/middleware.ts:47` - Error location
179
+ - `src/auth/tokens.ts` - Token validation logic
180
+ - `src/auth/__tests__/login.test.ts` - Failing test
181
+
182
+ ## OUTPUT
183
+
184
+ ### Primary Deliverable
185
+ Write debug journey to: `logs/issue-debugger-20260110-160000.md`
186
+
187
+ ### Output Format
188
+ ```markdown
189
+ # Debug Journey
190
+
191
+ ## Root Cause Analysis
192
+ [Detailed explanation with file:line references]
193
+
194
+ ## Fix Applied
195
+ [Description of changes made]
196
+
197
+ ## Files Modified
198
+ - [file1]: [what changed]
199
+ - [file2]: [what changed]
200
+
201
+ ## Verification
202
+ - [ ] Failing test now passes
203
+ - [ ] All other tests still pass
204
+ - [ ] Regression test added
205
+
206
+ ## Test Output
207
+ [Paste final test results]
208
+ ```
209
+
210
+ ### Validation Loop
211
+ MUST run tests after fix:
212
+ 1. Apply fix
213
+ 2. Run: `just test`
214
+ 3. IF tests fail: Analyze, adjust, repeat
215
+ 4. IF tests pass: Document and complete
216
+
217
+ ### Summary Requirements
218
+ Return: "Fixed [root cause] in [file]. All X tests passing."
219
+
220
+ ### Diagnostic Output
221
+ Write to: `logs/diagnostics/issue-debugger-20260110-160000.yaml`
222
+ ```
223
+
224
+ ---
225
+
226
+ ## Example 4: Pipeline Orchestration (Main Thread)
227
+
228
+ ### Code Review Pipeline Implementation
229
+
230
+ ```markdown
231
+ # Main Thread Orchestration
232
+
233
+ ## Step 1: Security Audit
234
+ ```python
235
+ result1 = Task(
236
+ description="Security audit of auth module",
237
+ subagent_type="sonnet",
238
+ prompt="[4-part prompt for security audit]"
239
+ )
240
+ # Read: logs/code-auditor-security-*.md
241
+ security_findings = extract_findings(result1)
242
+ ```
243
+
244
+ ## Step 2: Architecture Audit
245
+ ```python
246
+ result2 = Task(
247
+ description="Architecture review of auth module",
248
+ subagent_type="sonnet",
249
+ prompt="[4-part prompt for architecture review]"
250
+ )
251
+ # Read: logs/code-auditor-architecture-*.md
252
+ arch_findings = extract_findings(result2)
253
+ ```
254
+
255
+ ## Step 3: Test Coverage Audit
256
+ ```python
257
+ result3 = Task(
258
+ description="Test coverage analysis",
259
+ subagent_type="haiku",
260
+ prompt="[4-part prompt for test coverage]"
261
+ )
262
+ # Read: logs/test-auditor-*.yaml
263
+ test_findings = extract_findings(result3)
264
+ ```
265
+
266
+ ## Step 4: Conditional Branch
267
+ ```python
268
+ total_findings = security_findings + arch_findings + test_findings
269
+ if total_findings > 0:
270
+ Task(
271
+ description="Fix identified issues",
272
+ subagent_type="sonnet",
273
+ prompt="[4-part prompt including all findings as CONTEXT]"
274
+ )
275
+ else:
276
+ # Pipeline complete - all checks passed
277
+ log_success()
278
+ ```
279
+ ```
280
+
281
+ ---
282
+
283
+ ## Common Mistakes to Avoid
284
+
285
+ ### Mistake 1: Missing CONSTRAINTS
286
+
287
+ **Bad:**
288
+ ```markdown
289
+ ## GOAL
290
+ Review the auth code.
291
+
292
+ ## CONTEXT
293
+ Look at src/auth/
294
+
295
+ ## OUTPUT
296
+ Tell me what you find.
297
+ ```
298
+
299
+ **Good:**
300
+ ```markdown
301
+ ## GOAL
302
+ Identify security vulnerabilities in authentication that could allow unauthorized access.
303
+
304
+ ## CONSTRAINTS
305
+ - Read-only analysis - do NOT modify files
306
+ - Focus on OWASP Top 10 categories
307
+ - Complete within 25 tool calls
308
+
309
+ ## CONTEXT
310
+ [Specific files, standards, background]
311
+
312
+ ## OUTPUT
313
+ [Specific log path, format, summary requirements]
314
+ ```
315
+
316
+ ### Mistake 2: Vague OUTPUT Specification
317
+
318
+ **Bad:**
319
+ ```markdown
320
+ ## OUTPUT
321
+ Return the results.
322
+ ```
323
+
324
+ **Good:**
325
+ ```markdown
326
+ ## OUTPUT
327
+ Write to: `logs/auditor-20260110.md`
328
+ Format: Markdown with Critical/High/Medium sections
329
+ Summary: Max 200 tokens with finding counts
330
+ Diagnostic: `logs/diagnostics/auditor-20260110.yaml`
331
+ ```
332
+
333
+ ### Mistake 3: No Diagnostic Output
334
+
335
+ **Bad:** (missing diagnostic section entirely)
336
+
337
+ **Good:**
338
+ ```markdown
339
+ ### Diagnostic Output
340
+ Write to: `logs/diagnostics/{agent}-{timestamp}.yaml`
341
+ Include: model_actual, execution_time_ms, completion_status
342
+ ```