@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.
- package/.claude-plugin/plugin.json +43 -0
- package/agents/bulwark-fix-validator.md +633 -0
- package/agents/bulwark-implementer.md +391 -0
- package/agents/bulwark-issue-analyzer.md +308 -0
- package/agents/bulwark-standards-reviewer.md +221 -0
- package/agents/plan-creation-architect.md +323 -0
- package/agents/plan-creation-eng-lead.md +352 -0
- package/agents/plan-creation-po.md +300 -0
- package/agents/plan-creation-qa-critic.md +334 -0
- package/agents/product-ideation-competitive-analyzer.md +298 -0
- package/agents/product-ideation-idea-validator.md +268 -0
- package/agents/product-ideation-market-researcher.md +292 -0
- package/agents/product-ideation-pattern-documenter.md +308 -0
- package/agents/product-ideation-segment-analyzer.md +303 -0
- package/agents/product-ideation-strategist.md +259 -0
- package/agents/statusline-setup.md +97 -0
- package/hooks/hooks.json +59 -0
- package/package.json +45 -0
- package/scripts/hooks/cleanup-stale.sh +13 -0
- package/scripts/hooks/enforce-quality.sh +166 -0
- package/scripts/hooks/implementer-quality.sh +256 -0
- package/scripts/hooks/inject-protocol.sh +52 -0
- package/scripts/hooks/suggest-pipeline.sh +175 -0
- package/scripts/hooks/track-pipeline-start.sh +37 -0
- package/scripts/hooks/track-pipeline-stop.sh +52 -0
- package/scripts/init-rules.sh +35 -0
- package/scripts/init.sh +151 -0
- package/skills/anthropic-validator/SKILL.md +607 -0
- package/skills/anthropic-validator/references/agents-checklist.md +131 -0
- package/skills/anthropic-validator/references/commands-checklist.md +102 -0
- package/skills/anthropic-validator/references/hooks-checklist.md +151 -0
- package/skills/anthropic-validator/references/mcp-checklist.md +136 -0
- package/skills/anthropic-validator/references/plugins-checklist.md +148 -0
- package/skills/anthropic-validator/references/skills-checklist.md +85 -0
- package/skills/assertion-patterns/SKILL.md +296 -0
- package/skills/bug-magnet-data/SKILL.md +284 -0
- package/skills/bug-magnet-data/context/cli-args.md +91 -0
- package/skills/bug-magnet-data/context/db-query.md +104 -0
- package/skills/bug-magnet-data/context/file-contents.md +103 -0
- package/skills/bug-magnet-data/context/http-body.md +91 -0
- package/skills/bug-magnet-data/context/process-spawn.md +123 -0
- package/skills/bug-magnet-data/data/booleans/boundaries.yaml +143 -0
- package/skills/bug-magnet-data/data/collections/arrays.yaml +114 -0
- package/skills/bug-magnet-data/data/collections/objects.yaml +123 -0
- package/skills/bug-magnet-data/data/concurrency/race-conditions.yaml +118 -0
- package/skills/bug-magnet-data/data/concurrency/state-machines.yaml +115 -0
- package/skills/bug-magnet-data/data/dates/boundaries.yaml +137 -0
- package/skills/bug-magnet-data/data/dates/invalid.yaml +132 -0
- package/skills/bug-magnet-data/data/dates/timezone.yaml +118 -0
- package/skills/bug-magnet-data/data/encoding/charset.yaml +79 -0
- package/skills/bug-magnet-data/data/encoding/normalization.yaml +105 -0
- package/skills/bug-magnet-data/data/formats/email.yaml +154 -0
- package/skills/bug-magnet-data/data/formats/json.yaml +187 -0
- package/skills/bug-magnet-data/data/formats/url.yaml +165 -0
- package/skills/bug-magnet-data/data/language-specific/javascript.yaml +182 -0
- package/skills/bug-magnet-data/data/language-specific/python.yaml +174 -0
- package/skills/bug-magnet-data/data/language-specific/rust.yaml +148 -0
- package/skills/bug-magnet-data/data/numbers/boundaries.yaml +161 -0
- package/skills/bug-magnet-data/data/numbers/precision.yaml +89 -0
- package/skills/bug-magnet-data/data/numbers/special.yaml +69 -0
- package/skills/bug-magnet-data/data/strings/boundaries.yaml +109 -0
- package/skills/bug-magnet-data/data/strings/injection.yaml +208 -0
- package/skills/bug-magnet-data/data/strings/special-chars.yaml +190 -0
- package/skills/bug-magnet-data/data/strings/unicode.yaml +139 -0
- package/skills/bug-magnet-data/references/external-lists.md +115 -0
- package/skills/bulwark-brainstorm/SKILL.md +563 -0
- package/skills/bulwark-brainstorm/references/at-teammate-prompts.md +60 -0
- package/skills/bulwark-brainstorm/references/role-critical-analyst.md +78 -0
- package/skills/bulwark-brainstorm/references/role-development-lead.md +66 -0
- package/skills/bulwark-brainstorm/references/role-product-delivery-lead.md +79 -0
- package/skills/bulwark-brainstorm/references/role-product-manager.md +62 -0
- package/skills/bulwark-brainstorm/references/role-project-sme.md +59 -0
- package/skills/bulwark-brainstorm/references/role-technical-architect.md +66 -0
- package/skills/bulwark-research/SKILL.md +298 -0
- package/skills/bulwark-research/references/viewpoint-contrarian.md +63 -0
- package/skills/bulwark-research/references/viewpoint-direct-investigation.md +62 -0
- package/skills/bulwark-research/references/viewpoint-first-principles.md +65 -0
- package/skills/bulwark-research/references/viewpoint-practitioner.md +62 -0
- package/skills/bulwark-research/references/viewpoint-prior-art.md +66 -0
- package/skills/bulwark-scaffold/SKILL.md +330 -0
- package/skills/bulwark-statusline/SKILL.md +161 -0
- package/skills/bulwark-statusline/scripts/statusline.sh +144 -0
- package/skills/bulwark-verify/SKILL.md +519 -0
- package/skills/code-review/SKILL.md +428 -0
- package/skills/code-review/examples/anti-patterns/linting.ts +181 -0
- package/skills/code-review/examples/anti-patterns/security.ts +91 -0
- package/skills/code-review/examples/anti-patterns/standards.ts +195 -0
- package/skills/code-review/examples/anti-patterns/type-safety.ts +108 -0
- package/skills/code-review/examples/recommended/linting.ts +195 -0
- package/skills/code-review/examples/recommended/security.ts +154 -0
- package/skills/code-review/examples/recommended/standards.ts +231 -0
- package/skills/code-review/examples/recommended/type-safety.ts +181 -0
- package/skills/code-review/frameworks/angular.md +218 -0
- package/skills/code-review/frameworks/django.md +235 -0
- package/skills/code-review/frameworks/express.md +207 -0
- package/skills/code-review/frameworks/flask.md +298 -0
- package/skills/code-review/frameworks/generic.md +146 -0
- package/skills/code-review/frameworks/react.md +152 -0
- package/skills/code-review/frameworks/vue.md +244 -0
- package/skills/code-review/references/linting-patterns.md +221 -0
- package/skills/code-review/references/security-patterns.md +125 -0
- package/skills/code-review/references/standards-patterns.md +246 -0
- package/skills/code-review/references/type-safety-patterns.md +130 -0
- package/skills/component-patterns/SKILL.md +131 -0
- package/skills/component-patterns/references/pattern-cli-command.md +118 -0
- package/skills/component-patterns/references/pattern-database.md +166 -0
- package/skills/component-patterns/references/pattern-external-api.md +139 -0
- package/skills/component-patterns/references/pattern-file-parser.md +168 -0
- package/skills/component-patterns/references/pattern-http-server.md +162 -0
- package/skills/component-patterns/references/pattern-process-spawner.md +133 -0
- package/skills/continuous-feedback/SKILL.md +327 -0
- package/skills/continuous-feedback/references/collect-instructions.md +81 -0
- package/skills/continuous-feedback/references/specialize-code-review.md +82 -0
- package/skills/continuous-feedback/references/specialize-general.md +98 -0
- package/skills/continuous-feedback/references/specialize-test-audit.md +81 -0
- package/skills/create-skill/SKILL.md +359 -0
- package/skills/create-skill/references/agent-conventions.md +194 -0
- package/skills/create-skill/references/agent-template.md +195 -0
- package/skills/create-skill/references/content-guidance.md +291 -0
- package/skills/create-skill/references/decision-framework.md +124 -0
- package/skills/create-skill/references/template-pipeline.md +217 -0
- package/skills/create-skill/references/template-reference-heavy.md +111 -0
- package/skills/create-skill/references/template-research.md +210 -0
- package/skills/create-skill/references/template-script-driven.md +172 -0
- package/skills/create-skill/references/template-simple.md +80 -0
- package/skills/create-subagent/SKILL.md +353 -0
- package/skills/create-subagent/references/agent-conventions.md +268 -0
- package/skills/create-subagent/references/content-guidance.md +232 -0
- package/skills/create-subagent/references/decision-framework.md +134 -0
- package/skills/create-subagent/references/template-single-agent.md +192 -0
- package/skills/fix-bug/SKILL.md +241 -0
- package/skills/governance-protocol/SKILL.md +116 -0
- package/skills/init/SKILL.md +341 -0
- package/skills/issue-debugging/SKILL.md +385 -0
- package/skills/issue-debugging/references/anti-patterns.md +245 -0
- package/skills/issue-debugging/references/debug-report-schema.md +227 -0
- package/skills/mock-detection/SKILL.md +511 -0
- package/skills/mock-detection/references/false-positive-prevention.md +402 -0
- package/skills/mock-detection/references/stub-patterns.md +236 -0
- package/skills/pipeline-templates/SKILL.md +215 -0
- package/skills/pipeline-templates/references/code-change-workflow.md +277 -0
- package/skills/pipeline-templates/references/code-review.md +336 -0
- package/skills/pipeline-templates/references/fix-validation.md +421 -0
- package/skills/pipeline-templates/references/new-feature.md +335 -0
- package/skills/pipeline-templates/references/research-brainstorm.md +161 -0
- package/skills/pipeline-templates/references/research-planning.md +257 -0
- package/skills/pipeline-templates/references/test-audit.md +389 -0
- package/skills/pipeline-templates/references/test-execution-fix.md +238 -0
- package/skills/plan-creation/SKILL.md +497 -0
- package/skills/product-ideation/SKILL.md +372 -0
- package/skills/product-ideation/references/analysis-frameworks.md +161 -0
- package/skills/session-handoff/SKILL.md +139 -0
- package/skills/session-handoff/references/examples.md +223 -0
- package/skills/setup-lsp/SKILL.md +312 -0
- package/skills/setup-lsp/references/server-registry.md +85 -0
- package/skills/setup-lsp/references/troubleshooting.md +135 -0
- package/skills/subagent-output-templating/SKILL.md +415 -0
- package/skills/subagent-output-templating/references/examples.md +440 -0
- package/skills/subagent-prompting/SKILL.md +364 -0
- package/skills/subagent-prompting/references/examples.md +342 -0
- package/skills/test-audit/SKILL.md +531 -0
- package/skills/test-audit/references/known-limitations.md +41 -0
- package/skills/test-audit/references/priority-classification.md +30 -0
- package/skills/test-audit/references/prompts/deep-mode-detection.md +83 -0
- package/skills/test-audit/references/prompts/synthesis.md +57 -0
- package/skills/test-audit/references/rewrite-instructions.md +46 -0
- package/skills/test-audit/references/schemas/audit-output.yaml +100 -0
- package/skills/test-audit/references/schemas/diagnostic-output.yaml +49 -0
- package/skills/test-audit/scripts/data-flow-analyzer.ts +509 -0
- package/skills/test-audit/scripts/integration-mock-detector.ts +462 -0
- package/skills/test-audit/scripts/package.json +20 -0
- package/skills/test-audit/scripts/skip-detector.ts +211 -0
- package/skills/test-audit/scripts/verification-counter.ts +295 -0
- package/skills/test-classification/SKILL.md +310 -0
- package/skills/test-fixture-creation/SKILL.md +295 -0
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
# Agent Conventions
|
|
2
|
+
|
|
3
|
+
Conventions for generating Claude Code agents. The Stage 2 generator sub-agent references this to produce agents that follow the correct register, include proper configuration, and document permission requirements.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## System-Prompt Register
|
|
8
|
+
|
|
9
|
+
Agent bodies in `.claude/agents/` are system prompts. They define WHO the agent IS, not WHAT to DO.
|
|
10
|
+
|
|
11
|
+
### The Critical Distinction
|
|
12
|
+
|
|
13
|
+
**System-prompt register (CORRECT for agents):**
|
|
14
|
+
|
|
15
|
+
The body reads as identity, expertise, and behavioral guidelines.
|
|
16
|
+
|
|
17
|
+
```markdown
|
|
18
|
+
# Security Reviewer
|
|
19
|
+
|
|
20
|
+
You are a code security reviewer specializing in web application vulnerabilities. Your expertise covers OWASP top 10, injection attacks, authentication flaws, and cryptographic misuse.
|
|
21
|
+
|
|
22
|
+
## Your Mission
|
|
23
|
+
|
|
24
|
+
Analyze code changes for security vulnerabilities. You prioritize:
|
|
25
|
+
1. Input validation and sanitization
|
|
26
|
+
2. Authentication and authorization boundaries
|
|
27
|
+
3. Data exposure and information leakage
|
|
28
|
+
4. Dependency vulnerabilities
|
|
29
|
+
|
|
30
|
+
## How You Work
|
|
31
|
+
|
|
32
|
+
When reviewing code, you:
|
|
33
|
+
1. Read all changed files completely
|
|
34
|
+
2. Trace data flow from user input to output
|
|
35
|
+
3. Classify each finding by CVSS severity
|
|
36
|
+
4. Report findings in structured format with remediation guidance
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
**Task-instruction register (WRONG for agents):**
|
|
40
|
+
|
|
41
|
+
The body reads as step-by-step execution instructions.
|
|
42
|
+
|
|
43
|
+
```markdown
|
|
44
|
+
# Security Review Steps
|
|
45
|
+
|
|
46
|
+
## Steps
|
|
47
|
+
1. Read the files provided in the prompt
|
|
48
|
+
2. Look for security issues
|
|
49
|
+
3. Check for SQL injection
|
|
50
|
+
4. Check for XSS
|
|
51
|
+
5. Write a report to logs/security-review.md
|
|
52
|
+
|
|
53
|
+
## Output
|
|
54
|
+
Write findings to logs/security-review.md
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
### Why This Matters
|
|
58
|
+
|
|
59
|
+
- Agents run as forked contexts — the body IS the system prompt
|
|
60
|
+
- System prompts establish identity, which produces consistent behavior across invocations
|
|
61
|
+
- Task instructions belong in the invoking prompt (GOAL/CONSTRAINTS/CONTEXT/OUTPUT), not the agent definition
|
|
62
|
+
- Identity-based agents adapt to different tasks while maintaining consistent quality
|
|
63
|
+
|
|
64
|
+
### Register Checklist
|
|
65
|
+
|
|
66
|
+
When generating an agent body, verify:
|
|
67
|
+
|
|
68
|
+
- [ ] Opens with "You are a..." or equivalent identity statement
|
|
69
|
+
- [ ] Describes expertise and specialization areas
|
|
70
|
+
- [ ] Explains behavioral patterns ("When you encounter X, you...")
|
|
71
|
+
- [ ] Uses present tense, not imperative ("You analyze..." not "Analyze...")
|
|
72
|
+
- [ ] Protocol section describes HOW the agent works, not WHAT to do for a specific task
|
|
73
|
+
- [ ] Output section describes format conventions, not specific file paths for one invocation
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## Frontmatter Structure
|
|
78
|
+
|
|
79
|
+
### Required Fields
|
|
80
|
+
|
|
81
|
+
```yaml
|
|
82
|
+
---
|
|
83
|
+
name: {agent-name}
|
|
84
|
+
description: {single-line description with "Use when..." trigger}
|
|
85
|
+
model: {haiku|sonnet|opus}
|
|
86
|
+
tools:
|
|
87
|
+
- {tool-1}
|
|
88
|
+
- {tool-N}
|
|
89
|
+
---
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### Optional Fields
|
|
93
|
+
|
|
94
|
+
```yaml
|
|
95
|
+
skills:
|
|
96
|
+
- {skill-dependency-1}
|
|
97
|
+
- {skill-dependency-N}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Model Selection Guidance
|
|
101
|
+
|
|
102
|
+
| Use Case | Model | Rationale |
|
|
103
|
+
|----------|-------|-----------|
|
|
104
|
+
| Quick lookups, simple classification | haiku | Fast, low-cost |
|
|
105
|
+
| Analysis, review, research, generation | sonnet | Balanced capability and speed |
|
|
106
|
+
| Complex implementation, architecture, novel problems | opus | Highest quality reasoning |
|
|
107
|
+
|
|
108
|
+
**Default to Sonnet** unless the task clearly requires Haiku's speed or Opus's depth.
|
|
109
|
+
|
|
110
|
+
### Tool Selection
|
|
111
|
+
|
|
112
|
+
Only include tools the agent actually needs. Common patterns:
|
|
113
|
+
|
|
114
|
+
| Agent Type | Typical Tools |
|
|
115
|
+
|------------|--------------|
|
|
116
|
+
| Read-only reviewer | Read, Glob, Grep, Write (for reports only) |
|
|
117
|
+
| Code writer | Read, Grep, Glob, Write, Edit, Bash |
|
|
118
|
+
| Research agent | Read, Glob, Grep, WebFetch, WebSearch |
|
|
119
|
+
|
|
120
|
+
---
|
|
121
|
+
|
|
122
|
+
## Stop Hooks
|
|
123
|
+
|
|
124
|
+
Agents that emit diagnostic output should have a Stop hook configured. The hook runs when the agent completes.
|
|
125
|
+
|
|
126
|
+
### Hook Configuration
|
|
127
|
+
|
|
128
|
+
Stop hooks are configured in `.claude/hooks.json` (or project-level hooks), NOT in the agent's frontmatter (agent-scoped hooks are broken per GitHub #18392/#19213).
|
|
129
|
+
|
|
130
|
+
```json
|
|
131
|
+
{
|
|
132
|
+
"hooks": {
|
|
133
|
+
"SubagentStop": [
|
|
134
|
+
{
|
|
135
|
+
"matcher": "bulwark-{agent-name}",
|
|
136
|
+
"hooks": [
|
|
137
|
+
{
|
|
138
|
+
"type": "command",
|
|
139
|
+
"command": "echo 'Agent {agent-name} completed'"
|
|
140
|
+
}
|
|
141
|
+
]
|
|
142
|
+
}
|
|
143
|
+
]
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
### What to Document
|
|
149
|
+
|
|
150
|
+
Since Stop hooks must be configured separately (not in the agent .md file), the generated agent should include a "Permissions Setup" section that documents:
|
|
151
|
+
|
|
152
|
+
1. The Stop hook command to add
|
|
153
|
+
2. Where to add it (`.claude/hooks.json` or project hooks)
|
|
154
|
+
3. What the hook does (e.g., log completion, trigger follow-up)
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## Permissions Setup
|
|
159
|
+
|
|
160
|
+
Tool permissions for agents cannot be enforced automatically (GitHub feature request #10093, closed NOT_PLANNED Jan 2026). Generated agents must include manual permission setup documentation.
|
|
161
|
+
|
|
162
|
+
### Required Documentation
|
|
163
|
+
|
|
164
|
+
Every generated agent must include a section like:
|
|
165
|
+
|
|
166
|
+
```markdown
|
|
167
|
+
## Permissions Setup
|
|
168
|
+
|
|
169
|
+
This agent requires the following permissions to be configured in your project settings:
|
|
170
|
+
|
|
171
|
+
### Tool Permissions
|
|
172
|
+
|
|
173
|
+
Add to `.claude/settings.json` or `.claude/settings.local.json`:
|
|
174
|
+
|
|
175
|
+
\`\`\`json
|
|
176
|
+
{
|
|
177
|
+
"permissions": {
|
|
178
|
+
"allow": [
|
|
179
|
+
"Read",
|
|
180
|
+
"Glob",
|
|
181
|
+
"Grep",
|
|
182
|
+
"Write($PROJECT_DIR/logs/*)"
|
|
183
|
+
]
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
\`\`\`
|
|
187
|
+
|
|
188
|
+
### Hook Configuration (Optional)
|
|
189
|
+
|
|
190
|
+
If this agent emits diagnostic output, add a SubagentStop hook:
|
|
191
|
+
|
|
192
|
+
\`\`\`json
|
|
193
|
+
{
|
|
194
|
+
"hooks": {
|
|
195
|
+
"SubagentStop": [
|
|
196
|
+
{
|
|
197
|
+
"matcher": "{agent-name}",
|
|
198
|
+
"hooks": [
|
|
199
|
+
{
|
|
200
|
+
"type": "command",
|
|
201
|
+
"command": "echo '{agent-name} completed at $(date)' >> logs/agent-completions.log"
|
|
202
|
+
}
|
|
203
|
+
]
|
|
204
|
+
}
|
|
205
|
+
]
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
\`\`\`
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## Output Conventions
|
|
214
|
+
|
|
215
|
+
### Diagnostic Output
|
|
216
|
+
|
|
217
|
+
Agents that produce diagnostic output should follow this pattern:
|
|
218
|
+
|
|
219
|
+
```yaml
|
|
220
|
+
diagnostic:
|
|
221
|
+
agent: {agent-name}
|
|
222
|
+
timestamp: "{ISO-8601}"
|
|
223
|
+
|
|
224
|
+
task:
|
|
225
|
+
description: "{what was requested}"
|
|
226
|
+
input: "{input provided}"
|
|
227
|
+
|
|
228
|
+
execution:
|
|
229
|
+
steps_completed: 0
|
|
230
|
+
findings: 0
|
|
231
|
+
errors: 0
|
|
232
|
+
|
|
233
|
+
output:
|
|
234
|
+
report_path: "{path to main output}"
|
|
235
|
+
verdict: "{pass/fail/complete/partial}"
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### Log Output (SA2)
|
|
239
|
+
|
|
240
|
+
All agent output goes to `$PROJECT_DIR/logs/`. The agent definition should specify:
|
|
241
|
+
|
|
242
|
+
```markdown
|
|
243
|
+
## Output
|
|
244
|
+
|
|
245
|
+
Write all output to `$PROJECT_DIR/logs/` directory (`$PROJECT_DIR` is the project root where `.claude/` lives):
|
|
246
|
+
- Main report: `$PROJECT_DIR/logs/{agent-name}-{timestamp}.{ext}`
|
|
247
|
+
- Diagnostics: `$PROJECT_DIR/logs/diagnostics/{agent-name}-{timestamp}.yaml`
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
**IMPORTANT**: `$PROJECT_DIR` ensures paths resolve to the project root, not the skill directory or CWD. Without this prefix, agents may write output into `.claude/skills/` or other incorrect locations.
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
## Invocation Documentation
|
|
255
|
+
|
|
256
|
+
Every generated agent should include an Invocation section:
|
|
257
|
+
|
|
258
|
+
```markdown
|
|
259
|
+
## Invocation
|
|
260
|
+
|
|
261
|
+
This agent is invoked via the **Task tool**:
|
|
262
|
+
|
|
263
|
+
| Method | How to Use |
|
|
264
|
+
|--------|-----------|
|
|
265
|
+
| **Direct** | `Task(subagent_type="{agent-name}", prompt="...")` |
|
|
266
|
+
| **Pipeline stage** | Referenced by orchestrator skills |
|
|
267
|
+
| **User request** | Ask Claude to "run the {agent-name}" |
|
|
268
|
+
```
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
# Content Guidance
|
|
2
|
+
|
|
3
|
+
Instruction writing patterns, description rules, and common pitfalls for generating high-quality agents. The Stage 2 generator sub-agent references this alongside agent-conventions.md to produce agents that behave reliably and instruct clearly.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Description Field Rules
|
|
8
|
+
|
|
9
|
+
The YAML frontmatter `description` field controls agent discovery and activation.
|
|
10
|
+
|
|
11
|
+
### Format Rules
|
|
12
|
+
|
|
13
|
+
1. **Single line only.** Multi-line descriptions silently break discovery (GitHub #9817/#4700).
|
|
14
|
+
2. **Maximum ~200 characters.** Longer descriptions get truncated in menus.
|
|
15
|
+
3. **Start with an action noun or role.** "Code-writing agent that...", "Critical analysis of..."
|
|
16
|
+
|
|
17
|
+
### "When to Use" Framing
|
|
18
|
+
|
|
19
|
+
The description must tell the invoker WHEN to use this agent.
|
|
20
|
+
|
|
21
|
+
**Good — trigger-specific:**
|
|
22
|
+
```yaml
|
|
23
|
+
description: Code-writing agent that implements fixes and features following Bulwark standards. Quality enforced by direct implementer-quality.sh invocation after each Write/Edit.
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
**Bad — vague:**
|
|
27
|
+
```yaml
|
|
28
|
+
description: An agent for implementing code changes.
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
**Bad — too broad:**
|
|
32
|
+
```yaml
|
|
33
|
+
description: Helps with code and testing across various projects and frameworks.
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Pattern
|
|
37
|
+
|
|
38
|
+
```
|
|
39
|
+
{Role/action} that {what it does} {using what method/standard}. {Quality/safety note if applicable}.
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
---
|
|
43
|
+
|
|
44
|
+
## System-Prompt Writing Patterns
|
|
45
|
+
|
|
46
|
+
How to write agent bodies that produce consistent, reliable behavior. See agent-conventions.md for the full system-prompt vs task-instruction distinction.
|
|
47
|
+
|
|
48
|
+
### Identity First
|
|
49
|
+
|
|
50
|
+
Open with a clear identity statement. This anchors all subsequent behavior.
|
|
51
|
+
|
|
52
|
+
**Good:**
|
|
53
|
+
```markdown
|
|
54
|
+
You are a meticulous standards reviewer for Claude Code assets. Your role is to critically analyze assets against official standards and produce structured validation reports.
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
**Bad:**
|
|
58
|
+
```markdown
|
|
59
|
+
This document describes how to review standards.
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Expertise Anchoring
|
|
63
|
+
|
|
64
|
+
After identity, establish expertise areas. This constrains behavior to relevant domains.
|
|
65
|
+
|
|
66
|
+
**Good:**
|
|
67
|
+
```markdown
|
|
68
|
+
Your expertise covers:
|
|
69
|
+
- OWASP top 10 vulnerabilities
|
|
70
|
+
- Authentication and authorization patterns
|
|
71
|
+
- Input validation and sanitization
|
|
72
|
+
- Cryptographic best practices
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
**Bad:**
|
|
76
|
+
```markdown
|
|
77
|
+
You know about security stuff.
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Behavioral Patterns Over Procedures
|
|
81
|
+
|
|
82
|
+
Describe HOW the agent behaves, not step-by-step task execution.
|
|
83
|
+
|
|
84
|
+
**Good:**
|
|
85
|
+
```markdown
|
|
86
|
+
When reviewing code, you:
|
|
87
|
+
1. Read all changed files completely before forming any opinion
|
|
88
|
+
2. Trace data flow from input boundaries to output
|
|
89
|
+
3. Classify findings by severity using CVSS scoring
|
|
90
|
+
4. Provide specific remediation for every finding
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
**Bad:**
|
|
94
|
+
```markdown
|
|
95
|
+
Steps:
|
|
96
|
+
1. Read file A
|
|
97
|
+
2. Read file B
|
|
98
|
+
3. Write report to logs/review.md
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Binding Language for Agents
|
|
104
|
+
|
|
105
|
+
Without explicit binding language, Claude treats agent instructions as suggestions.
|
|
106
|
+
|
|
107
|
+
### Pre-Flight Gate Pattern
|
|
108
|
+
|
|
109
|
+
```markdown
|
|
110
|
+
## Pre-Flight Gate
|
|
111
|
+
|
|
112
|
+
**MANDATORY: Read this section FIRST. These instructions are BINDING, not advisory.**
|
|
113
|
+
|
|
114
|
+
Before doing ANY work, confirm you understand these REQUIRED obligations:
|
|
115
|
+
|
|
116
|
+
1. **REQUIRED**: [obligation 1]
|
|
117
|
+
2. **REQUIRED**: [obligation 2]
|
|
118
|
+
|
|
119
|
+
Failure to follow these obligations produces non-compliant output.
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
### Mission DO/DO NOT Pattern
|
|
123
|
+
|
|
124
|
+
```markdown
|
|
125
|
+
## Mission
|
|
126
|
+
|
|
127
|
+
**DO**:
|
|
128
|
+
- [concrete action 1]
|
|
129
|
+
- [concrete action 2]
|
|
130
|
+
|
|
131
|
+
**DO NOT**:
|
|
132
|
+
- [specific prohibition 1]
|
|
133
|
+
- [specific prohibition 2]
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### Anti-Thought Traps
|
|
137
|
+
|
|
138
|
+
Address rationalizations Claude uses to skip obligations:
|
|
139
|
+
|
|
140
|
+
```markdown
|
|
141
|
+
If you find yourself thinking "this step isn't necessary for this particular task" — STOP.
|
|
142
|
+
The obligation exists for consistency across all invocations, not just this one.
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## Common Pitfalls
|
|
148
|
+
|
|
149
|
+
### Pitfall 1: Task-Instruction Register
|
|
150
|
+
|
|
151
|
+
Writing an agent body as step-by-step task instructions instead of identity and behavioral guidelines. See agent-conventions.md for the full distinction and examples.
|
|
152
|
+
|
|
153
|
+
**Impact**: Agent behaves inconsistently because it has no stable identity to anchor behavior.
|
|
154
|
+
|
|
155
|
+
### Pitfall 2: Over-Specified Output Paths
|
|
156
|
+
|
|
157
|
+
Hardcoding specific file paths in the agent body for a single use case.
|
|
158
|
+
|
|
159
|
+
```markdown
|
|
160
|
+
# WRONG — too specific, no $PROJECT_DIR prefix
|
|
161
|
+
Write your report to logs/security-review-PR-123.md
|
|
162
|
+
|
|
163
|
+
# CORRECT — parameterized convention with $PROJECT_DIR
|
|
164
|
+
Write your report to $PROJECT_DIR/logs/{agent-name}-{timestamp}.md
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
**Impact**: Agent only works for one invocation pattern.
|
|
168
|
+
|
|
169
|
+
### Pitfall 3: Missing Tool Constraints
|
|
170
|
+
|
|
171
|
+
Agents with Write/Edit/Bash access but no constraints on what they can modify.
|
|
172
|
+
|
|
173
|
+
**Prevention**: Include explicit allowed/forbidden sections:
|
|
174
|
+
|
|
175
|
+
```markdown
|
|
176
|
+
## Tool Usage Constraints
|
|
177
|
+
|
|
178
|
+
### Write
|
|
179
|
+
- **Allowed**: Source files (within scope), $PROJECT_DIR/logs/
|
|
180
|
+
- **Forbidden**: Config files, files outside task scope
|
|
181
|
+
|
|
182
|
+
### Bash
|
|
183
|
+
- **Allowed**: Quality checks, read-only git, file inspection
|
|
184
|
+
- **Forbidden**: Git modifications, package installation, destructive commands
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### Pitfall 4: No Diagnostic Output
|
|
188
|
+
|
|
189
|
+
Agents that complete work but produce no observable artifact for the orchestrator.
|
|
190
|
+
|
|
191
|
+
**Prevention**: Always include a diagnostic output section, even for simple agents:
|
|
192
|
+
|
|
193
|
+
```markdown
|
|
194
|
+
## Diagnostic Output
|
|
195
|
+
|
|
196
|
+
Write to: $PROJECT_DIR/logs/diagnostics/{agent-name}-{timestamp}.yaml
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### Pitfall 5: Missing Permissions Documentation
|
|
200
|
+
|
|
201
|
+
Agent works in development but fails in other environments because tool permissions aren't documented.
|
|
202
|
+
|
|
203
|
+
**Prevention**: Always include a "Permissions Setup" section (see agent-conventions.md).
|
|
204
|
+
|
|
205
|
+
### Pitfall 6: Undocumented Skill Dependencies
|
|
206
|
+
|
|
207
|
+
Agent silently depends on skills listed in frontmatter but doesn't reference them in the body.
|
|
208
|
+
|
|
209
|
+
**Prevention**: Include a "Related Skills" section explaining what each skill dependency provides.
|
|
210
|
+
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## Generate-and-Customize Contract
|
|
214
|
+
|
|
215
|
+
All generated agents are scaffolds, not production-ready output.
|
|
216
|
+
|
|
217
|
+
### Required Disclaimer
|
|
218
|
+
|
|
219
|
+
Every generated agent should include this understanding in the post-generation summary:
|
|
220
|
+
|
|
221
|
+
```
|
|
222
|
+
This is a scaffold — a starting point for your agent. You should:
|
|
223
|
+
1. Review and customize the identity and expertise sections
|
|
224
|
+
2. Adjust tool permissions to match your project's security requirements
|
|
225
|
+
3. Configure permissions in .claude/settings.json
|
|
226
|
+
4. Test by invoking via Task tool and reviewing output quality
|
|
227
|
+
5. Add project-specific protocol steps as needed
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
### Why This Matters
|
|
231
|
+
|
|
232
|
+
Agent bodies define system prompts that anchor all behavior. A generic scaffold provides structure, but domain expertise and project-specific conventions must be customized by the user.
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# Decision Framework
|
|
2
|
+
|
|
3
|
+
Interview questions and classification logic for the create-subagent pipeline. The orchestrator uses this at Stage 0 (Pre-Flight) for interview + routing, and Stage 1 (Classify) for tool permissions and configuration decisions.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Stage 0: Adaptive Interview
|
|
8
|
+
|
|
9
|
+
### Core Questions (Always Ask)
|
|
10
|
+
|
|
11
|
+
Present all 5 questions to the user via AskUserQuestion. These determine routing (single vs pipeline/teams redirect), tool needs, and diagnostic requirements.
|
|
12
|
+
|
|
13
|
+
| # | Question | What It Reveals |
|
|
14
|
+
|---|----------|-----------------|
|
|
15
|
+
| Q1 | What is this agent's identity and mission? Describe WHO it is and what expertise it has. Give 2-3 examples of how it would be invoked. | System-prompt content, invocation patterns, scope |
|
|
16
|
+
| Q2 | What tools does it need access to? (Read/Write/Edit/Bash/Glob/Grep/WebFetch/WebSearch/Task/other) | Tool permissions, safety constraints |
|
|
17
|
+
| Q3 | Does it orchestrate multiple distinct stages or operations, or perform a single focused task? | Routing check (single → proceed, multiple → follow-ups → possible redirect) |
|
|
18
|
+
| Q4 | Does it need to emit structured diagnostic output (logs, reports, YAML)? | Diagnostic section, output paths |
|
|
19
|
+
| Q5 | Should it have restricted permissions, or full access to available tools? | permissionMode, tool allowlist |
|
|
20
|
+
|
|
21
|
+
### Follow-Up Questions (Conditional)
|
|
22
|
+
|
|
23
|
+
Ask follow-ups when Q3 indicates multiple stages/operations. These determine whether to redirect to create-skill.
|
|
24
|
+
|
|
25
|
+
| Trigger | Follow-Up Questions |
|
|
26
|
+
|---------|-------------------|
|
|
27
|
+
| Q3 = "multiple stages" | Q6: Do the stages depend on each other's output? (sequential vs parallel) |
|
|
28
|
+
| Q3 = "multiple stages" | Q7: Do workers need to communicate with each other directly? (Task tool vs Agent Teams) |
|
|
29
|
+
| Q4 = "yes, diagnostics" | Q8: What format — YAML report, Markdown log, or both? |
|
|
30
|
+
| Q5 = "restricted" | Q9: Which specific tools should be allowed? Which should be explicitly forbidden? |
|
|
31
|
+
|
|
32
|
+
### Interview Behavior
|
|
33
|
+
|
|
34
|
+
- Present Q1-Q5 in a single AskUserQuestion call (not one-at-a-time)
|
|
35
|
+
- If answers are ambiguous, ask 1-2 clarifying follow-ups (do not over-interview)
|
|
36
|
+
- If the user provides a `--doc` requirements document, extract Q1-Q5 answers from it and present for confirmation instead of asking fresh
|
|
37
|
+
- Total interview: 1-2 AskUserQuestion rounds maximum
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Stage 0: Routing Check
|
|
42
|
+
|
|
43
|
+
After receiving all interview answers, check whether the use case requires pipeline orchestration. Sub-agents are single-purpose — they cannot spawn other sub-agents.
|
|
44
|
+
|
|
45
|
+
### Routing Logic
|
|
46
|
+
|
|
47
|
+
```
|
|
48
|
+
Q3 = "single focused task" → PROCEED to Stage 1 (single-agent)
|
|
49
|
+
Q3 = "multiple stages"
|
|
50
|
+
AND Q6 = "dependent stages" → REDIRECT to /create-skill
|
|
51
|
+
Q3 = "multiple stages"
|
|
52
|
+
AND Q7 = "direct worker communication" → REDIRECT to /create-skill
|
|
53
|
+
Q3 = "multiple stages"
|
|
54
|
+
AND Q6 = "independent"
|
|
55
|
+
AND Q7 = "no direct communication" → PROCEED to Stage 1 (independent parallel
|
|
56
|
+
workers are still single-purpose agents —
|
|
57
|
+
create each one separately)
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Redirect Message
|
|
61
|
+
|
|
62
|
+
If routing check triggers a redirect, present this message and STOP:
|
|
63
|
+
|
|
64
|
+
```
|
|
65
|
+
This use case requires a pipeline skill that orchestrates multiple sub-agents.
|
|
66
|
+
Sub-agents are single-purpose — they can't spawn other sub-agents.
|
|
67
|
+
|
|
68
|
+
Use /create-skill instead. It will generate:
|
|
69
|
+
- An orchestrating skill (SKILL.md) with pipeline stages
|
|
70
|
+
- Dedicated sub-agent files (.claude/agents/*.md) for each stage
|
|
71
|
+
|
|
72
|
+
The generated sub-agents will have deterministic behavior locked into their
|
|
73
|
+
system prompts, and the orchestrating skill handles sequencing, error handling,
|
|
74
|
+
and synthesis.
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
Do NOT proceed to Stage 1 after a redirect. Write diagnostic YAML with `outcome: redirected`.
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Stage 1: Two-Decision Classification
|
|
82
|
+
|
|
83
|
+
After the interview (and routing check passes), make two independent decisions. Each decision is self-contained.
|
|
84
|
+
|
|
85
|
+
### Decision A: Tool Permissions
|
|
86
|
+
|
|
87
|
+
Determines the agent's tool access and safety constraints.
|
|
88
|
+
|
|
89
|
+
```
|
|
90
|
+
Q5 = "full access" → no tools: list in frontmatter (inherits all)
|
|
91
|
+
Q5 = "restricted"
|
|
92
|
+
AND Q9 = specific list → tools: [listed tools] in frontmatter
|
|
93
|
+
Q2 = includes "Write" or "Edit" → include quality gate guidance in protocol
|
|
94
|
+
Q2 = includes "Bash" → include allowed/forbidden command lists in protocol
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
**Default**: Restrict tools to what the agent actually needs. Fewer tools = safer agent.
|
|
98
|
+
|
|
99
|
+
### Decision B: Supporting Configuration
|
|
100
|
+
|
|
101
|
+
Determines what additional configuration the agent needs.
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
Always:
|
|
105
|
+
→ Include "Permissions Setup" section documenting manual config
|
|
106
|
+
|
|
107
|
+
If Q4 = "yes, diagnostics":
|
|
108
|
+
→ Include diagnostic output section with paths and schema
|
|
109
|
+
→ Add subagent-output-templating to skills: dependency (if reporting to orchestrator)
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Classification Output
|
|
113
|
+
|
|
114
|
+
After classification, present the two decisions to the user for confirmation before proceeding to Stage 2:
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
Classification:
|
|
118
|
+
- Tool permissions: {full/restricted: [list]} — {one-line reason}
|
|
119
|
+
- Configuration: {list of extras} — {one-line reason}
|
|
120
|
+
|
|
121
|
+
Proceed with generation? [Yes / Adjust]
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## Edge Cases
|
|
127
|
+
|
|
128
|
+
| Scenario | Resolution |
|
|
129
|
+
|----------|------------|
|
|
130
|
+
| Q3 = "multiple stages" but Q6/Q7 answers are ambiguous | Ask one clarifying question. If still ambiguous, default to redirect (safer to use create-skill than to create an infeasible agent). |
|
|
131
|
+
| Agent needs Write but no quality gates exist in target project | Include quality gate section with "adapt to project's quality enforcement" note. |
|
|
132
|
+
| User provides conflicting Q2/Q5 answers | Ask one clarifying question to resolve. |
|
|
133
|
+
| Very complex agent (>250 lines estimated) | Warn about complexity. Suggest splitting into focused agent + orchestrating skill. |
|
|
134
|
+
| User explicitly requests a pipeline agent | Redirect to create-skill. Explain: "Pipeline agents are infeasible as sub-agents because sub-agents cannot spawn other sub-agents." |
|