@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,172 @@
|
|
|
1
|
+
# Template: Script-Driven Skill
|
|
2
|
+
|
|
3
|
+
Use this template when the skill requires deterministic code execution (AST analysis, data transforms, file processing) alongside LLM stages. Typical for analysis tools that combine static tooling with LLM judgment.
|
|
4
|
+
|
|
5
|
+
**When to use**: Decision C = scripts needed for deterministic execution.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## File Structure
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
skills/{skill-name}/
|
|
13
|
+
├── SKILL.md
|
|
14
|
+
├── scripts/
|
|
15
|
+
│ ├── {script-1}.ts (or .sh, .py)
|
|
16
|
+
│ └── {script-N}.ts
|
|
17
|
+
└── references/
|
|
18
|
+
├── {reference-1}.md
|
|
19
|
+
└── {reference-N}.md
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Generated SKILL.md Structure
|
|
23
|
+
|
|
24
|
+
```markdown
|
|
25
|
+
---
|
|
26
|
+
name: {skill-name}
|
|
27
|
+
description: {single-line, trigger-specific, "Use when..." framing}
|
|
28
|
+
user-invocable: true
|
|
29
|
+
skills:
|
|
30
|
+
- subagent-prompting # If sub-agents used
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
# {Skill Title}
|
|
34
|
+
|
|
35
|
+
{One-paragraph summary. Mention both deterministic (script) and LLM stages.}
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## When to Use This Skill
|
|
40
|
+
|
|
41
|
+
{Trigger pattern table + DO NOT use for section.}
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Dependencies
|
|
46
|
+
|
|
47
|
+
| Category | Files | Requirement | When to Load |
|
|
48
|
+
|----------|-------|-------------|--------------|
|
|
49
|
+
| **Scripts** | `scripts/{name}.ts` | **REQUIRED** | Run at Stage 0 before LLM stages |
|
|
50
|
+
| **References** | `references/{name}.md` | **REQUIRED** | Load for LLM stage context |
|
|
51
|
+
|
|
52
|
+
**Script execution**: Scripts run via the project task runner (e.g., `just {recipe-name} {args}`). Do NOT run scripts via `npx` or `node` directly unless no task runner recipe exists.
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## Usage
|
|
57
|
+
|
|
58
|
+
```
|
|
59
|
+
/{skill-name} {arguments} [flags]
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
## Pre-Flight Gate (BLOCKING)
|
|
65
|
+
|
|
66
|
+
**STOP. Scripts MUST run before any LLM analysis.**
|
|
67
|
+
|
|
68
|
+
### What You MUST Do
|
|
69
|
+
|
|
70
|
+
1. Run all required scripts first — they produce deterministic metadata
|
|
71
|
+
2. Read script output before proceeding to LLM stages
|
|
72
|
+
3. LLM stages consume script output as structured input
|
|
73
|
+
|
|
74
|
+
### What You MUST NOT Do
|
|
75
|
+
|
|
76
|
+
- Do NOT skip script execution
|
|
77
|
+
- Do NOT substitute LLM judgment for script output
|
|
78
|
+
- Do NOT proceed to LLM stages if scripts fail
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Pipeline
|
|
83
|
+
|
|
84
|
+
```fsharp
|
|
85
|
+
// {skill-name} pipeline
|
|
86
|
+
Stage0_Scripts(args) // Deterministic — run scripts via task runner
|
|
87
|
+
|> Stage1_{Name}(script_data) // LLM stage — {purpose}
|
|
88
|
+
|> Stage2_{Name}(stage1_output) // LLM stage — {purpose}
|
|
89
|
+
|> Diagnostics(all_outputs)
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Stage Definitions
|
|
95
|
+
|
|
96
|
+
### Stage 0: Script Execution (Deterministic)
|
|
97
|
+
|
|
98
|
+
Run scripts and capture output:
|
|
99
|
+
|
|
100
|
+
```
|
|
101
|
+
Scripts:
|
|
102
|
+
├── `just {recipe-1} {target}` → {output-path-1}
|
|
103
|
+
├── `just {recipe-2} {target}` → {output-path-2}
|
|
104
|
+
└── Read all script outputs before proceeding
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**Script output format**: Scripts produce JSON or YAML to a known path. The orchestrator reads this structured data and passes it to LLM stages.
|
|
108
|
+
|
|
109
|
+
### Stage 1: {Name} (LLM Stage)
|
|
110
|
+
|
|
111
|
+
{LLM analysis that consumes script output as structured input.}
|
|
112
|
+
|
|
113
|
+
### Stage N: Diagnostics (REQUIRED)
|
|
114
|
+
|
|
115
|
+
Write to `$PROJECT_DIR/logs/diagnostics/{skill-name}-{YYYYMMDD-HHMMSS}.yaml`
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## Error Handling
|
|
120
|
+
|
|
121
|
+
| Scenario | Action |
|
|
122
|
+
|----------|--------|
|
|
123
|
+
| Script fails to execute | Check: Is the script executable? Is the task runner recipe defined? Report error and STOP. |
|
|
124
|
+
| Script produces empty output | Report: "Script {name} produced no output for {target}." STOP. |
|
|
125
|
+
| Script output malformed | Report the parse error. Do NOT proceed with LLM stages on bad data. |
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## Completion Checklist
|
|
130
|
+
|
|
131
|
+
- [ ] All scripts executed successfully
|
|
132
|
+
- [ ] Script output consumed by LLM stages
|
|
133
|
+
- [ ] All log files written
|
|
134
|
+
- [ ] Diagnostic YAML written
|
|
135
|
+
- [ ] Results presented to user
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
## Generated Script Structure
|
|
139
|
+
|
|
140
|
+
Scripts should be self-contained and produce structured output:
|
|
141
|
+
|
|
142
|
+
```typescript
|
|
143
|
+
// scripts/{name}.ts
|
|
144
|
+
// Purpose: {what this script does}
|
|
145
|
+
// Input: {command-line args}
|
|
146
|
+
// Output: {JSON/YAML to stdout or file}
|
|
147
|
+
|
|
148
|
+
import { /* minimal deps */ } from '...';
|
|
149
|
+
|
|
150
|
+
// Parse args
|
|
151
|
+
const target = process.argv[2];
|
|
152
|
+
if (!target) {
|
|
153
|
+
console.error('Usage: {script-name} <target>');
|
|
154
|
+
process.exit(1);
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// Process
|
|
158
|
+
const result = analyze(target);
|
|
159
|
+
|
|
160
|
+
// Output structured data
|
|
161
|
+
console.log(JSON.stringify(result, null, 2));
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
## Guidance for Generator
|
|
165
|
+
|
|
166
|
+
- Scripts must be self-contained — no imports from project-specific modules
|
|
167
|
+
- Scripts produce structured output (JSON/YAML) that LLM stages consume
|
|
168
|
+
- The task runner recipe is the execution interface — scripts are not invoked directly
|
|
169
|
+
- Stage 0 (scripts) must complete before any LLM stages start
|
|
170
|
+
- If the skill needs a Justfile recipe, include it in the post-generation summary as a manual setup step
|
|
171
|
+
- Script-driven skills are the most complex type — expect 200-400 lines for SKILL.md plus script files
|
|
172
|
+
- Consider whether a simpler approach (LLM-only) would work before committing to scripts
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Template: Simple Skill
|
|
2
|
+
|
|
3
|
+
Use this template when the skill is a vanilla SKILL.md with no supporting files. Typical for guideline skills, knowledge layers, and single-purpose utilities.
|
|
4
|
+
|
|
5
|
+
**When to use**: Decision C = no references, no templates, no scripts.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## File Structure
|
|
10
|
+
|
|
11
|
+
```
|
|
12
|
+
skills/{skill-name}/
|
|
13
|
+
└── SKILL.md
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Generated SKILL.md Structure
|
|
17
|
+
|
|
18
|
+
```markdown
|
|
19
|
+
---
|
|
20
|
+
name: {skill-name}
|
|
21
|
+
description: {single-line, trigger-specific, "Use when..." framing}
|
|
22
|
+
user-invocable: {true/false}
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
# {Skill Title}
|
|
26
|
+
|
|
27
|
+
{One-paragraph summary of what this skill does and why it exists.}
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## When to Use This Skill
|
|
32
|
+
|
|
33
|
+
**Load this skill when the user request matches ANY of these patterns:**
|
|
34
|
+
|
|
35
|
+
| Trigger Pattern | Example User Request |
|
|
36
|
+
|-----------------|---------------------|
|
|
37
|
+
| {pattern-1} | "{example request 1}" |
|
|
38
|
+
| {pattern-2} | "{example request 2}" |
|
|
39
|
+
| {pattern-3} | "{example request 3}" |
|
|
40
|
+
|
|
41
|
+
**DO NOT use for:**
|
|
42
|
+
- {anti-trigger 1} (use {alternative} instead)
|
|
43
|
+
- {anti-trigger 2}
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Usage
|
|
48
|
+
|
|
49
|
+
{If user-invocable: invocation syntax and arguments.}
|
|
50
|
+
{If not user-invocable: how consuming skills/agents reference this.}
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Instructions
|
|
55
|
+
|
|
56
|
+
{Core skill content. For simple skills this is the main body:
|
|
57
|
+
guidelines, rules, patterns, or knowledge that Claude should apply.}
|
|
58
|
+
|
|
59
|
+
{Use numbered steps for procedural skills.}
|
|
60
|
+
{Use tables for rule-based skills.}
|
|
61
|
+
{Use sections for knowledge skills.}
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Completion Checklist
|
|
66
|
+
|
|
67
|
+
Before returning to the user, verify:
|
|
68
|
+
|
|
69
|
+
- [ ] {Outcome 1 achieved}
|
|
70
|
+
- [ ] {Outcome 2 achieved}
|
|
71
|
+
- [ ] {No unintended side effects}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Guidance for Generator
|
|
75
|
+
|
|
76
|
+
- Keep the skill under 150 lines for simple skills
|
|
77
|
+
- The Instructions section is the heart — make it specific and actionable
|
|
78
|
+
- Do NOT add references/ or templates/ directories — this is a vanilla skill
|
|
79
|
+
- Do NOT add diagnostic output unless the skill performs multi-step work
|
|
80
|
+
- If the skill is `user-invocable: false`, it's consumed by other skills — describe the consumer interface
|
|
@@ -0,0 +1,353 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: create-subagent
|
|
3
|
+
description: Generates single-purpose Claude Code sub-agents for use via the Task tool. Use when creating dedicated sub-agents, scaffolding agent definitions, or generating agents with diagnostics and permissions setup.
|
|
4
|
+
user-invocable: true
|
|
5
|
+
argument-hint: "<description-or-name> [--doc <requirements-path>]"
|
|
6
|
+
skills:
|
|
7
|
+
- subagent-prompting
|
|
8
|
+
- anthropic-validator
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Create Sub-Agent
|
|
12
|
+
|
|
13
|
+
Generates a complete single-purpose Claude Code sub-agent from a description or requirements document. Conducts an adaptive interview to understand the agent's identity and mission, determines tool permissions and supporting configuration, spawns a Sonnet sub-agent to generate the agent file, validates with anthropic-validator, and presents the scaffold with architectural decisions.
|
|
14
|
+
|
|
15
|
+
Sub-agents are invoked via `Task(subagent_type=...)` and run in a forked context. They perform a single focused task and return results. They **cannot** spawn other sub-agents — pipeline orchestration belongs in skills, not agents.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## When to Use This Skill
|
|
20
|
+
|
|
21
|
+
**Load this skill when the user request matches ANY of these patterns:**
|
|
22
|
+
|
|
23
|
+
| Trigger Pattern | Example User Request |
|
|
24
|
+
|-----------------|---------------------|
|
|
25
|
+
| Sub-agent creation | "Create a sub-agent for X", "Make an agent for X" |
|
|
26
|
+
| Agent scaffolding | "Scaffold an agent", "Set up a new agent" |
|
|
27
|
+
| Agent generation | "Generate an agent that does X" |
|
|
28
|
+
| Dedicated worker | "Create a dedicated agent for this sub-agent role" |
|
|
29
|
+
| Task tool agent | "I need an agent I can invoke via Task tool" |
|
|
30
|
+
|
|
31
|
+
**DO NOT use for:**
|
|
32
|
+
- Creating pipeline orchestration (use `create-skill` — it generates the orchestrating skill + sub-agent files)
|
|
33
|
+
- Creating Agent Teams leads (use `create-skill` with the research template)
|
|
34
|
+
- Creating skills (use `create-skill`)
|
|
35
|
+
- Editing existing agents (edit directly)
|
|
36
|
+
- Debugging agent issues (use `issue-debugging`)
|
|
37
|
+
- Validating existing agents (use `anthropic-validator`)
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Dependencies
|
|
42
|
+
|
|
43
|
+
| Category | Files | Requirement | When to Load |
|
|
44
|
+
|----------|-------|-------------|--------------|
|
|
45
|
+
| **Decision framework** | `references/decision-framework.md` | **REQUIRED** | Load at Stage 0 for interview + classification |
|
|
46
|
+
| **Agent conventions** | `references/agent-conventions.md` | **REQUIRED** | Include in Stage 2 generator prompt |
|
|
47
|
+
| **Content guidance** | `references/content-guidance.md` | **REQUIRED** | Include in Stage 2 generator prompt |
|
|
48
|
+
| **Agent template** | `references/template-single-agent.md` | **REQUIRED** | Load at Stage 2 |
|
|
49
|
+
| **Diagnostic template** | `templates/diagnostic-output.yaml` | **REQUIRED** | Use at Stage 6 |
|
|
50
|
+
| **Subagent prompting** | `subagent-prompting` skill | **REQUIRED** | Load at Stage 0 for 4-part prompt template |
|
|
51
|
+
|
|
52
|
+
**Fallback behavior:**
|
|
53
|
+
- If content-guidance is missing: Proceed without it, note in diagnostics (output quality will be lower)
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Usage
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
/create-subagent <description-or-name>
|
|
61
|
+
/create-subagent --doc <requirements-document>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**Arguments:**
|
|
65
|
+
- `<description-or-name>` — Free-text description of the desired agent, or an agent name to start from
|
|
66
|
+
- `--doc <path>` — Path to a requirements document. Extracts interview answers from it instead of asking fresh.
|
|
67
|
+
|
|
68
|
+
**Examples:**
|
|
69
|
+
- `/create-subagent a code security reviewer that checks for OWASP vulnerabilities` — Start from description
|
|
70
|
+
- `/create-subagent --doc plans/task-briefs/P4.4-implementer.md` — Start from requirements doc
|
|
71
|
+
- `/create-subagent market-analyst` — Start from a name
|
|
72
|
+
|
|
73
|
+
---
|
|
74
|
+
|
|
75
|
+
## Mandatory Execution Checklist (BINDING)
|
|
76
|
+
|
|
77
|
+
**Every item below is mandatory. No deviations. No substitutions. No skipping.**
|
|
78
|
+
|
|
79
|
+
This skill uses a 6-stage pipeline. You are the orchestrator. Follow every item in order. Do NOT return to the user until all applicable items are checked.
|
|
80
|
+
|
|
81
|
+
- [ ] **Stage 0 — Pre-Flight**: Arguments parsed (description, name, or --doc)
|
|
82
|
+
- [ ] **Stage 0 — Pre-Flight**: Decision framework, agent conventions, and content guidance loaded
|
|
83
|
+
- [ ] **Stage 0 — Pre-Flight**: Adaptive interview conducted (1-2 rounds via AskUserQuestion)
|
|
84
|
+
- [ ] **Stage 0 — Pre-Flight**: Routing check completed (pipeline/teams → redirect to create-skill and STOP, OR single → proceed)
|
|
85
|
+
- [ ] **Stage 1 — Classify**: Two decisions made (tool permissions, supporting configuration)
|
|
86
|
+
- [ ] **Stage 1 — Classify**: Classification presented to user and confirmed via AskUserQuestion
|
|
87
|
+
- [ ] **Stage 2 — Generate**: Sonnet sub-agent spawned via Task tool (you do NOT generate the file yourself)
|
|
88
|
+
- [ ] **Stage 2 — Generate**: Generated agent file verified to exist in working directory
|
|
89
|
+
- [ ] **Stage 2 — Generate**: Agent uses system-prompt register (identity statement, not task steps)
|
|
90
|
+
- [ ] **Stage 3 — Validate**: `/anthropic-validator` invoked via Skill tool (manual review is NOT a substitute)
|
|
91
|
+
- [ ] **Stage 3 — Validate**: Validator output read and findings counted
|
|
92
|
+
- [ ] **Stage 3 — Validate**: Manual checks completed (single-line description, system-prompt register, permissions section)
|
|
93
|
+
- [ ] **Stage 4 — Refine**: If validation found critical/high issues, Sonnet sub-agent spawned to fix (max 2 retries)
|
|
94
|
+
- [ ] **Stage 5 — Deploy**: Agent file deployed from working directory to `.claude/agents/`
|
|
95
|
+
- [ ] **Stage 5 — Deploy**: Working directory cleaned up
|
|
96
|
+
- [ ] **Stage 5 — Present**: Post-generation summary presented with architectural decisions
|
|
97
|
+
- [ ] **Stage 5 — Present**: Permissions setup steps communicated
|
|
98
|
+
- [ ] **Stage 5 — Present**: Next steps communicated (this is a scaffold, not production-ready output)
|
|
99
|
+
- [ ] **Stage 6 — Diagnostics**: Diagnostic YAML written to `$PROJECT_DIR/logs/diagnostics/`
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Pipeline
|
|
104
|
+
|
|
105
|
+
```fsharp
|
|
106
|
+
// create-subagent pipeline
|
|
107
|
+
PreFlight(args) // Stage 0: Orchestrator — parse input, interview, routing check
|
|
108
|
+
|> Classify(interview_answers) // Stage 1: Orchestrator — two independent decisions
|
|
109
|
+
|> Generate(classification, template, conventions) // Stage 2: Sonnet sub-agent — produce agent file
|
|
110
|
+
|> Validate(generated_output) // Stage 3: Orchestrator — run anthropic-validator
|
|
111
|
+
|> Refine(validator_findings) // Stage 4: Sonnet sub-agent (conditional, max 2 retries)
|
|
112
|
+
|> DeployAndPresent(working_dir, target_dir) // Stage 5: Orchestrator — deploy to target + post-generation summary
|
|
113
|
+
|> Diagnostics() // Stage 6: Orchestrator — write YAML
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## Stage Definitions
|
|
119
|
+
|
|
120
|
+
### Stage 0: Pre-Flight (Orchestrator)
|
|
121
|
+
|
|
122
|
+
```
|
|
123
|
+
Stage 0: Pre-Flight
|
|
124
|
+
├── Parse arguments (description, name, or --doc path)
|
|
125
|
+
├── Load references/decision-framework.md
|
|
126
|
+
├── Load references/agent-conventions.md
|
|
127
|
+
├── Load references/content-guidance.md
|
|
128
|
+
├── Load subagent-prompting skill
|
|
129
|
+
├── If --doc provided:
|
|
130
|
+
│ ├── Read the requirements document
|
|
131
|
+
│ ├── Extract answers to Q1-Q5 from the document
|
|
132
|
+
│ └── Present extracted answers to user for confirmation via AskUserQuestion
|
|
133
|
+
├── If no --doc:
|
|
134
|
+
│ └── AskUserQuestion: Present all 5 core questions from decision-framework.md
|
|
135
|
+
│ ├── Q1: What is this agent's identity and mission? (2-3 invocation examples)
|
|
136
|
+
│ ├── Q2: What tools does it need access to?
|
|
137
|
+
│ ├── Q3: Single focused task, or multiple stages/operations?
|
|
138
|
+
│ ├── Q4: Does it need structured diagnostic output?
|
|
139
|
+
│ └── Q5: Restricted permissions or full access?
|
|
140
|
+
├── If complexity detected in answers (Q3 = "multiple stages"):
|
|
141
|
+
│ └── AskUserQuestion: Follow-up questions per decision-framework.md
|
|
142
|
+
│ ├── Q6: Do stages depend on each other's output?
|
|
143
|
+
│ ├── Q7: Do workers need direct communication?
|
|
144
|
+
│ └── Q8-Q10: Additional context-specific follow-ups
|
|
145
|
+
├── ROUTING CHECK (after all interview answers received):
|
|
146
|
+
│ ├── If Q3 = "multiple stages" AND (Q6 = "dependent" OR Q7 = "direct comms"):
|
|
147
|
+
│ │ └── STOP PIPELINE. Present redirect message to user:
|
|
148
|
+
│ │ "This use case requires a pipeline skill that orchestrates multiple sub-agents.
|
|
149
|
+
│ │ Sub-agents are single-purpose — they can't spawn other sub-agents.
|
|
150
|
+
│ │
|
|
151
|
+
│ │ Use /create-skill instead. It will generate:
|
|
152
|
+
│ │ - An orchestrating skill (SKILL.md) with pipeline stages
|
|
153
|
+
│ │ - Dedicated sub-agent files (.claude/agents/*.md) for each stage
|
|
154
|
+
│ │
|
|
155
|
+
│ │ The generated sub-agents will have deterministic behavior locked into their
|
|
156
|
+
│ │ system prompts, and the orchestrating skill handles sequencing, error handling,
|
|
157
|
+
│ │ and synthesis."
|
|
158
|
+
│ │ Do NOT proceed to Stage 1. Return to user.
|
|
159
|
+
│ └── Otherwise: Continue to Stage 1
|
|
160
|
+
├── Determine agent name (from input or derived from description)
|
|
161
|
+
│ └── Target: .claude/agents/{agent-name}.md
|
|
162
|
+
├── Set working directory: tmp/create-subagent/{agent-name}/
|
|
163
|
+
│ └── All generation and refinement happens here to avoid .claude/ edit approval storms
|
|
164
|
+
│ Files are deployed to the target directory only after validation passes (Stage 5)
|
|
165
|
+
└── Token budget check (warn if >30% consumed)
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
**Interview behavior**: Maximum 2 AskUserQuestion rounds. Present Q1-Q5 together in round 1. Follow-ups (if needed) in round 2. Do NOT ask questions one at a time.
|
|
169
|
+
|
|
170
|
+
### Stage 1: Classify (Orchestrator)
|
|
171
|
+
|
|
172
|
+
Apply the two-decision classification from `references/decision-framework.md`:
|
|
173
|
+
|
|
174
|
+
```
|
|
175
|
+
Stage 1: Classify
|
|
176
|
+
├── Decision A: Tool Permissions
|
|
177
|
+
│ ├── Full access → no tools: list in frontmatter (inherits all)
|
|
178
|
+
│ ├── Restricted → tools: [specific list] in frontmatter
|
|
179
|
+
│ ├── If Write/Edit needed → include quality gate guidance in protocol
|
|
180
|
+
│ └── If Bash needed → include allowed/forbidden command lists in protocol
|
|
181
|
+
├── Decision B: Supporting Configuration
|
|
182
|
+
│ ├── Always: Permissions Setup section
|
|
183
|
+
│ ├── If diagnostics needed (Q4 = yes): diagnostic output section + schema
|
|
184
|
+
│ └── If diagnostics needed: subagent-output-templating in skills: dependency
|
|
185
|
+
└── Present classification to user via AskUserQuestion:
|
|
186
|
+
├── "Tool permissions: {full/restricted: [list]} — {reason}"
|
|
187
|
+
├── "Configuration: {list} — {reason}"
|
|
188
|
+
└── "Proceed with generation? [Yes / Adjust]"
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
**MANDATORY**: Wait for user confirmation before proceeding to Stage 2. If user selects "Adjust", re-classify with their feedback.
|
|
192
|
+
|
|
193
|
+
### Stage 2: Generate (Sonnet sub-agent)
|
|
194
|
+
|
|
195
|
+
```
|
|
196
|
+
Stage 2: Generate
|
|
197
|
+
├── Read references/template-single-agent.md
|
|
198
|
+
├── Construct prompt using 4-part template (GOAL/CONSTRAINTS/CONTEXT/OUTPUT):
|
|
199
|
+
│ ├── GOAL: Generate a complete, structurally correct single-purpose sub-agent
|
|
200
|
+
│ │ definition. The agent must use system-prompt register and include all
|
|
201
|
+
│ │ required sections (Pre-Flight, Mission, Protocol, Output, Permissions).
|
|
202
|
+
│ ├── CONSTRAINTS:
|
|
203
|
+
│ │ ├── Write in SYSTEM-PROMPT REGISTER — WHO the agent IS, not WHAT to do
|
|
204
|
+
│ │ ├── Open with identity statement: "You are a..."
|
|
205
|
+
│ │ ├── Use present tense for behavioral descriptions
|
|
206
|
+
│ │ ├── Description MUST be a single line (multi-line breaks discovery)
|
|
207
|
+
│ │ ├── Description MUST use role-based trigger framing
|
|
208
|
+
│ │ ├── Include Pre-Flight Gate with MUST/MUST NOT (binding language)
|
|
209
|
+
│ │ ├── Include DO/DO NOT mission section
|
|
210
|
+
│ │ ├── Include Tool Usage Constraints for every tool in frontmatter
|
|
211
|
+
│ │ ├── Include Permissions Setup section (tool permissions unsolved per #10093)
|
|
212
|
+
│ │ ├── Do NOT add unnecessary files (no README, CHANGELOG, LICENSE)
|
|
213
|
+
│ │ ├── Do NOT use emojis in generated content
|
|
214
|
+
│ │ └── Keep agent under 250 lines
|
|
215
|
+
│ ├── CONTEXT:
|
|
216
|
+
│ │ ├── Classification from Stage 1 (both decisions)
|
|
217
|
+
│ │ ├── User's interview answers (identity, mission, tools from Q1-Q5)
|
|
218
|
+
│ │ ├── Template: references/template-single-agent.md
|
|
219
|
+
│ │ ├── Agent conventions: references/agent-conventions.md
|
|
220
|
+
│ │ ├── Content guidance: references/content-guidance.md
|
|
221
|
+
│ │ ├── Instruction: "Read 1-2 existing agents from the codebase for structural
|
|
222
|
+
│ │ │ reference (use Glob to find .claude/agents/*.md)"
|
|
223
|
+
│ │ ├── Target output path: .claude/agents/{agent-name}.md (final deployment location)
|
|
224
|
+
│ │ └── Working directory: tmp/create-subagent/{agent-name}/
|
|
225
|
+
│ └── OUTPUT:
|
|
226
|
+
│ ├── Write agent file to {working-directory}/{agent-name}.md
|
|
227
|
+
│ └── Return summary: file path with line count
|
|
228
|
+
├── Spawn: Task(description="Generate agent file", subagent_type="general-purpose",
|
|
229
|
+
│ model="sonnet", prompt=...)
|
|
230
|
+
├── Read generator output (file path + summary)
|
|
231
|
+
└── Verify file was created (Read {working-directory}/{agent-name}.md)
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
### Stage 3: Validate (Orchestrator)
|
|
235
|
+
|
|
236
|
+
```
|
|
237
|
+
Stage 3: Validate
|
|
238
|
+
├── FIRST: Invoke /anthropic-validator (this is the PRIMARY validation — NOT optional)
|
|
239
|
+
│ ├── Use the Skill tool: Skill(skill="anthropic-validator", args="{working-directory}/{agent-name}.md")
|
|
240
|
+
│ ├── Do NOT substitute manual review for this step
|
|
241
|
+
│ └── Do NOT proceed past this node until the Skill tool has been invoked
|
|
242
|
+
├── Read validator output
|
|
243
|
+
├── Check for critical/high findings:
|
|
244
|
+
│ ├── 0 critical AND 0 high → proceed to Stage 5 (skip Stage 4)
|
|
245
|
+
│ └── Any critical or high → proceed to Stage 4 (refine)
|
|
246
|
+
├── THEN: Manual checks (these supplement the validator, they do NOT replace it)
|
|
247
|
+
│ ├── Check description is single-line (read agent file, verify no multiline description)
|
|
248
|
+
│ ├── Check system-prompt register (body opens with identity, not task steps)
|
|
249
|
+
│ └── Check Permissions Setup section exists
|
|
250
|
+
└── Stage 3 exit gate:
|
|
251
|
+
├── [ ] /anthropic-validator was invoked via the Skill tool (not manual review)
|
|
252
|
+
├── [ ] Validator output was read and findings counted
|
|
253
|
+
└── If either is unchecked, Stage 3 is NOT complete — go back and invoke the validator
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
### Stage 4: Refine (Sonnet sub-agent, conditional, max 2 retries)
|
|
257
|
+
|
|
258
|
+
This stage only runs if Stage 3 found critical or high issues.
|
|
259
|
+
|
|
260
|
+
```
|
|
261
|
+
Stage 4: Refine (attempt {N} of 2)
|
|
262
|
+
├── Construct prompt using 4-part template:
|
|
263
|
+
│ ├── GOAL: Fix all critical and high findings from anthropic-validator
|
|
264
|
+
│ ├── CONSTRAINTS:
|
|
265
|
+
│ │ ├── Only fix the specific issues identified — do not restructure
|
|
266
|
+
│ │ ├── Preserve the existing agent content and identity
|
|
267
|
+
│ │ ├── Description must remain single-line
|
|
268
|
+
│ │ └── Must remain in system-prompt register
|
|
269
|
+
│ ├── CONTEXT:
|
|
270
|
+
│ │ ├── Validator findings (critical and high items with descriptions)
|
|
271
|
+
│ │ ├── Current generated file (read from {working-directory}/{agent-name}.md)
|
|
272
|
+
│ │ └── Agent conventions: references/agent-conventions.md
|
|
273
|
+
│ └── OUTPUT: Edit file at {working-directory}/{agent-name}.md to fix findings
|
|
274
|
+
├── Spawn: Task(description="Fix validator findings", subagent_type="general-purpose",
|
|
275
|
+
│ model="sonnet", prompt=...)
|
|
276
|
+
├── Re-run Stage 3 (validate)
|
|
277
|
+
├── If still failing after 2 retries:
|
|
278
|
+
│ └── Proceed to Stage 5 with caveats noted
|
|
279
|
+
└── Token budget check
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
### Stage 5: Deploy & Present (Orchestrator)
|
|
283
|
+
|
|
284
|
+
```
|
|
285
|
+
Stage 5: Deploy & Present
|
|
286
|
+
├── Deploy: Move {working-directory}/{agent-name}.md to .claude/agents/{agent-name}.md
|
|
287
|
+
│ ├── This is the ONLY point where the file is written to .claude/
|
|
288
|
+
│ └── Clean up: Remove {working-directory}/ after successful copy
|
|
289
|
+
├── Read generated agent file from .claude/agents/{agent-name}.md for summary
|
|
290
|
+
├── Present to user:
|
|
291
|
+
│ ├── "Generated agent at: .claude/agents/{agent-name}.md"
|
|
292
|
+
│ ├── "Lines: {count}"
|
|
293
|
+
│ ├── "Architectural decisions:"
|
|
294
|
+
│ │ ├── "Tool permissions: {full/restricted: [list]} — {reason}"
|
|
295
|
+
│ │ └── "Configuration: {list} — {reason}"
|
|
296
|
+
│ ├── "Validation: {pass/fail with details}"
|
|
297
|
+
│ ├── If caveats: "Unresolved issues: {list}"
|
|
298
|
+
│ ├── "Permissions to configure:"
|
|
299
|
+
│ │ └── {List tool permissions that must be added to settings.json}
|
|
300
|
+
│ └── "Next steps:"
|
|
301
|
+
│ ├── "1. Review and customize the identity and expertise sections"
|
|
302
|
+
│ ├── "2. Adjust tool permissions in .claude/settings.json"
|
|
303
|
+
│ ├── "3. Test by invoking via Task tool: Task(subagent_type=\"{name}\", prompt=\"...\")"
|
|
304
|
+
│ ├── "4. Add project-specific protocol steps as needed"
|
|
305
|
+
│ └── "5. Configure Stop hook if diagnostic output is needed"
|
|
306
|
+
└── Note: This is a scaffold, not production-ready output (generate-and-customize contract)
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
### Stage 6: Diagnostics (REQUIRED)
|
|
310
|
+
|
|
311
|
+
**MANDATORY**: Write diagnostic output after every invocation. This cannot be skipped.
|
|
312
|
+
|
|
313
|
+
```
|
|
314
|
+
Stage 6: Diagnostics
|
|
315
|
+
├── Write to: $PROJECT_DIR/logs/diagnostics/create-subagent-{YYYYMMDD-HHMMSS}.yaml
|
|
316
|
+
│ └── Use templates/diagnostic-output.yaml schema
|
|
317
|
+
└── Include:
|
|
318
|
+
├── Input: description/name/doc path
|
|
319
|
+
├── Interview: questions asked, rounds completed
|
|
320
|
+
├── Routing: redirected (true/false), reason if redirected
|
|
321
|
+
├── Classification: both decisions
|
|
322
|
+
├── Generation: file created, line count, model used
|
|
323
|
+
├── Validation: pass/fail, findings count, retry count
|
|
324
|
+
└── Outcome: success/partial/failure/redirected
|
|
325
|
+
```
|
|
326
|
+
|
|
327
|
+
---
|
|
328
|
+
|
|
329
|
+
## Error Handling
|
|
330
|
+
|
|
331
|
+
| Scenario | Action |
|
|
332
|
+
|----------|--------|
|
|
333
|
+
| Generator sub-agent returns empty output | Re-spawn once with reinforced instructions. If still empty, STOP: "Generation failed. Please try with a more detailed description." |
|
|
334
|
+
| anthropic-validator finds critical issues | Stage 4 retry (max 2). After 2 retries, present with caveats. |
|
|
335
|
+
| anthropic-validator unavailable | Skip validation, note in diagnostics, warn user: "Validation skipped — run /anthropic-validator manually." |
|
|
336
|
+
| Interview answers are ambiguous | Ask 1-2 follow-up questions (max 2 AskUserQuestion rounds total). |
|
|
337
|
+
| Pipeline/teams detected in interview | STOP pipeline. Redirect to `/create-skill` with guidance message. Write diagnostic with outcome: redirected. |
|
|
338
|
+
| Token budget exceeded | Stop at current stage, present partial output with explanation. |
|
|
339
|
+
| Agent file already exists at target path | AskUserQuestion: "Agent {name} already exists at .claude/agents/{name}.md. Overwrite / Choose different name / Cancel?" |
|
|
340
|
+
| Working directory already exists | Silently remove and recreate tmp/create-subagent/{agent-name}/ (working dirs are ephemeral) |
|
|
341
|
+
| User rejects classification | Re-classify with user's feedback. Max 2 classification rounds. |
|
|
342
|
+
| Generated agent uses task-instruction register | Stage 4 refine with specific instruction to rewrite in system-prompt register. |
|
|
343
|
+
|
|
344
|
+
---
|
|
345
|
+
|
|
346
|
+
## Token Budget Management
|
|
347
|
+
|
|
348
|
+
| Checkpoint | Threshold | Action |
|
|
349
|
+
|------------|-----------|--------|
|
|
350
|
+
| After Pre-Flight | >30% consumed | Warn: "Remaining budget may limit validation and refinement." |
|
|
351
|
+
| After Generate | >55% consumed | Warn: "Approaching budget. Validation + refinement may be limited." |
|
|
352
|
+
| After Validate | >65% consumed | Skip refinement if needed, present as-is with caveats. |
|
|
353
|
+
|