sequant 1.11.0 → 1.12.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/README.md +86 -2
- package/dist/src/lib/ac-linter.d.ts +116 -0
- package/dist/src/lib/ac-linter.js +304 -0
- package/dist/src/lib/plugin-version-sync.d.ts +26 -0
- package/dist/src/lib/plugin-version-sync.js +91 -0
- package/dist/src/lib/project-name.d.ts +40 -0
- package/dist/src/lib/project-name.js +191 -0
- package/dist/src/lib/semgrep.d.ts +136 -0
- package/dist/src/lib/semgrep.js +406 -0
- package/dist/src/lib/stacks.d.ts +14 -0
- package/dist/src/lib/stacks.js +159 -0
- package/dist/src/lib/templates.js +9 -3
- package/package.json +1 -1
- package/templates/hooks/pre-tool.sh +6 -0
- package/templates/memory/constitution.md +1 -5
- package/templates/skills/_shared/references/prompt-templates.md +350 -0
- package/templates/skills/_shared/references/subagent-types.md +131 -0
- package/templates/skills/exec/SKILL.md +82 -0
- package/templates/skills/fullsolve/SKILL.md +19 -2
- package/templates/skills/loop/SKILL.md +3 -1
- package/templates/skills/qa/SKILL.md +79 -9
- package/templates/skills/qa/references/quality-gates.md +85 -1
- package/templates/skills/qa/references/semgrep-rules.md +207 -0
- package/templates/skills/qa/scripts/quality-checks.sh +54 -0
- package/templates/skills/spec/SKILL.md +215 -4
|
@@ -0,0 +1,350 @@
|
|
|
1
|
+
# Sub-Agent Prompt Templates
|
|
2
|
+
|
|
3
|
+
Reference for task-specific prompt templates when spawning sub-agents via the `Task` tool during parallel execution.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
When spawning sub-agents for implementation tasks, use these templates to provide structured, task-specific guidance. Templates include:
|
|
8
|
+
- Task-specific requirements and constraints
|
|
9
|
+
- Best practices for that task type
|
|
10
|
+
- Expected deliverables and reporting format
|
|
11
|
+
|
|
12
|
+
## Template Selection
|
|
13
|
+
|
|
14
|
+
### Automatic Selection (Keywords)
|
|
15
|
+
|
|
16
|
+
The template is selected based on keywords in the task description:
|
|
17
|
+
|
|
18
|
+
| Keywords | Template |
|
|
19
|
+
|----------|----------|
|
|
20
|
+
| `component`, `Component`, `React` | [Component Template](#component-template) |
|
|
21
|
+
| `type`, `interface`, `types/` | [Type Definition Template](#type-definition-template) |
|
|
22
|
+
| `CLI`, `command`, `script`, `bin/` | [CLI/Script Template](#cliscript-template) |
|
|
23
|
+
| `test`, `spec`, `.test.` | [Test Template](#test-template) |
|
|
24
|
+
| `refactor`, `restructure`, `migrate` | [Refactor Template](#refactor-template) |
|
|
25
|
+
| (none matched) | [Generic Template](#generic-template) |
|
|
26
|
+
|
|
27
|
+
### Explicit Annotation Override
|
|
28
|
+
|
|
29
|
+
You can force a specific template using the `[template: X]` annotation at the start of the task:
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
[template: component] Create UserCard in components/admin/
|
|
33
|
+
[template: cli] Add export command to scripts/
|
|
34
|
+
[template: type] Define MetricEvent interface
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
**Annotation takes precedence** over keyword detection.
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Task Templates
|
|
42
|
+
|
|
43
|
+
### Component Template
|
|
44
|
+
|
|
45
|
+
**Use for:** React components, UI elements, admin panels
|
|
46
|
+
|
|
47
|
+
```markdown
|
|
48
|
+
## Task: Create React Component
|
|
49
|
+
|
|
50
|
+
**Component:** [name]
|
|
51
|
+
**Location:** [path]
|
|
52
|
+
|
|
53
|
+
**Requirements:**
|
|
54
|
+
- [ ] TypeScript with proper prop types (interface or type)
|
|
55
|
+
- [ ] Follow existing component patterns in the codebase
|
|
56
|
+
- [ ] Include displayName for debugging: `Component.displayName = 'ComponentName'`
|
|
57
|
+
- [ ] No inline styles - use existing CSS/Tailwind patterns
|
|
58
|
+
- [ ] Export component as named export
|
|
59
|
+
|
|
60
|
+
**Best Practices:**
|
|
61
|
+
- Check `components/` for similar components to follow patterns
|
|
62
|
+
- Use existing hooks from `lib/hooks/` if applicable
|
|
63
|
+
- Prefer composition over prop drilling
|
|
64
|
+
- Keep components focused - single responsibility
|
|
65
|
+
|
|
66
|
+
**Constraints:**
|
|
67
|
+
- Working directory: [worktree path]
|
|
68
|
+
- Do NOT create test files (handled separately)
|
|
69
|
+
- Do NOT add new dependencies without explicit approval
|
|
70
|
+
|
|
71
|
+
**Deliverable:**
|
|
72
|
+
Report: files created, component name, props interface
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
### Type Definition Template
|
|
78
|
+
|
|
79
|
+
**Use for:** TypeScript types, interfaces, enums, type utilities
|
|
80
|
+
|
|
81
|
+
```markdown
|
|
82
|
+
## Task: Create Type Definitions
|
|
83
|
+
|
|
84
|
+
**File:** [path]
|
|
85
|
+
**Types needed:** [list]
|
|
86
|
+
|
|
87
|
+
**Requirements:**
|
|
88
|
+
- [ ] Export all types (no internal-only types)
|
|
89
|
+
- [ ] Use strict types - avoid `any`, prefer `unknown` if needed
|
|
90
|
+
- [ ] Add JSDoc comments for complex types explaining purpose
|
|
91
|
+
- [ ] Match database schema if types represent DB entities
|
|
92
|
+
- [ ] Use consistent naming: `PascalCase` for types/interfaces
|
|
93
|
+
|
|
94
|
+
**Best Practices:**
|
|
95
|
+
- Check `types/` for existing type patterns
|
|
96
|
+
- Prefer interfaces for object shapes (extendable)
|
|
97
|
+
- Use type aliases for unions, intersections, utilities
|
|
98
|
+
- Export from index file if creating new type module
|
|
99
|
+
|
|
100
|
+
**Constraints:**
|
|
101
|
+
- Working directory: [worktree path]
|
|
102
|
+
- Verify types compile: `npx tsc --noEmit [file]`
|
|
103
|
+
|
|
104
|
+
**Deliverable:**
|
|
105
|
+
Report: types created, file path, any dependencies on other types
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
### CLI/Script Template
|
|
111
|
+
|
|
112
|
+
**Use for:** CLI commands, scripts, automation tools
|
|
113
|
+
|
|
114
|
+
```markdown
|
|
115
|
+
## Task: Implement CLI Command/Script
|
|
116
|
+
|
|
117
|
+
**Command:** [name]
|
|
118
|
+
**File:** [path]
|
|
119
|
+
|
|
120
|
+
**Requirements:**
|
|
121
|
+
- [ ] Use commander.js patterns from existing commands (if CLI)
|
|
122
|
+
- [ ] Include descriptive --help text
|
|
123
|
+
- [ ] Handle errors gracefully with appropriate exit codes
|
|
124
|
+
- [ ] Add to command index if this is a new CLI command
|
|
125
|
+
- [ ] Support both programmatic and CLI usage if applicable
|
|
126
|
+
|
|
127
|
+
**Best Practices:**
|
|
128
|
+
- Check `scripts/` or `src/cli/` for existing patterns
|
|
129
|
+
- Use `process.exit(0)` for success, `process.exit(1)` for errors
|
|
130
|
+
- Log errors to stderr: `console.error()`
|
|
131
|
+
- Provide progress feedback for long-running operations
|
|
132
|
+
|
|
133
|
+
**Constraints:**
|
|
134
|
+
- Working directory: [worktree path]
|
|
135
|
+
- Scripts should be executable: `chmod +x [file]`
|
|
136
|
+
- Add shebang for shell scripts: `#!/usr/bin/env bash` or `#!/usr/bin/env node`
|
|
137
|
+
|
|
138
|
+
**Deliverable:**
|
|
139
|
+
Report: script created, command usage, exit codes
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
### Test Template
|
|
145
|
+
|
|
146
|
+
**Use for:** Unit tests, integration tests, test utilities
|
|
147
|
+
|
|
148
|
+
```markdown
|
|
149
|
+
## Task: Create Tests
|
|
150
|
+
|
|
151
|
+
**Test file:** [path]
|
|
152
|
+
**Testing:** [component/module being tested]
|
|
153
|
+
|
|
154
|
+
**Requirements:**
|
|
155
|
+
- [ ] Use existing test framework patterns (vitest/jest)
|
|
156
|
+
- [ ] Include setup and teardown if needed
|
|
157
|
+
- [ ] Test both success and error cases
|
|
158
|
+
- [ ] Use descriptive test names: `it('should X when Y')`
|
|
159
|
+
- [ ] Mock external dependencies appropriately
|
|
160
|
+
|
|
161
|
+
**Best Practices:**
|
|
162
|
+
- Check `__tests__/` or `*.test.ts` files for patterns
|
|
163
|
+
- Group related tests with `describe()` blocks
|
|
164
|
+
- Test behavior, not implementation details
|
|
165
|
+
- Aim for meaningful coverage, not 100% line coverage
|
|
166
|
+
|
|
167
|
+
**Constraints:**
|
|
168
|
+
- Working directory: [worktree path]
|
|
169
|
+
- Run tests after creation: `npm test [file]`
|
|
170
|
+
- Do NOT skip or disable existing tests
|
|
171
|
+
|
|
172
|
+
**Deliverable:**
|
|
173
|
+
Report: test file created, number of test cases, pass/fail status
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
### Refactor Template
|
|
179
|
+
|
|
180
|
+
**Use for:** Code restructuring, file reorganization, pattern migrations
|
|
181
|
+
|
|
182
|
+
```markdown
|
|
183
|
+
## Task: Refactor Code
|
|
184
|
+
|
|
185
|
+
**Target:** [file or module]
|
|
186
|
+
**Goal:** [what the refactor achieves]
|
|
187
|
+
|
|
188
|
+
**Requirements:**
|
|
189
|
+
- [ ] Preserve all existing functionality (no behavior changes)
|
|
190
|
+
- [ ] Maintain or improve type safety
|
|
191
|
+
- [ ] Update all imports/exports affected by moves
|
|
192
|
+
- [ ] Ensure tests still pass after refactor
|
|
193
|
+
|
|
194
|
+
**Best Practices:**
|
|
195
|
+
- Make incremental changes, verify after each step
|
|
196
|
+
- Use IDE rename features when available
|
|
197
|
+
- Update barrel exports (index.ts) if file locations change
|
|
198
|
+
- Check for circular dependencies after restructuring
|
|
199
|
+
|
|
200
|
+
**Constraints:**
|
|
201
|
+
- Working directory: [worktree path]
|
|
202
|
+
- Run full test suite after refactor: `npm test`
|
|
203
|
+
- Run type check: `npx tsc --noEmit`
|
|
204
|
+
|
|
205
|
+
**Deliverable:**
|
|
206
|
+
Report: files changed, imports updated, test results
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
### Generic Template
|
|
212
|
+
|
|
213
|
+
**Use for:** Tasks that don't fit other categories
|
|
214
|
+
|
|
215
|
+
```markdown
|
|
216
|
+
## Task: [Task Description]
|
|
217
|
+
|
|
218
|
+
**Goal:** [what needs to be accomplished]
|
|
219
|
+
**Files involved:** [expected files]
|
|
220
|
+
|
|
221
|
+
**Requirements:**
|
|
222
|
+
- [ ] Complete the task as specified
|
|
223
|
+
- [ ] Follow existing codebase patterns
|
|
224
|
+
- [ ] Maintain type safety
|
|
225
|
+
- [ ] Do not break existing functionality
|
|
226
|
+
|
|
227
|
+
**Constraints:**
|
|
228
|
+
- Working directory: [worktree path]
|
|
229
|
+
- Run relevant checks after completion
|
|
230
|
+
|
|
231
|
+
**Deliverable:**
|
|
232
|
+
Report: files created/modified, summary of changes
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
## Error Recovery Template
|
|
238
|
+
|
|
239
|
+
**Use for:** Retrying failed tasks with enhanced context
|
|
240
|
+
|
|
241
|
+
When a task fails, use this template to provide diagnostic context for the retry:
|
|
242
|
+
|
|
243
|
+
```markdown
|
|
244
|
+
## RETRY: Previous Attempt Failed
|
|
245
|
+
|
|
246
|
+
**Original Task:** [task description]
|
|
247
|
+
**Attempt:** [N] of [max]
|
|
248
|
+
**Previous Error:**
|
|
249
|
+
```
|
|
250
|
+
[error message from TaskOutput]
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
**Diagnosis Checklist:**
|
|
254
|
+
- [ ] Check imports are correct and files exist
|
|
255
|
+
- [ ] Verify file paths use the worktree directory
|
|
256
|
+
- [ ] Confirm types match expected signatures
|
|
257
|
+
- [ ] Look for typos in identifiers
|
|
258
|
+
- [ ] Check for missing dependencies
|
|
259
|
+
|
|
260
|
+
**Fix Strategy:**
|
|
261
|
+
1. Read the failing file to understand current state
|
|
262
|
+
2. Identify the specific error location (line number if available)
|
|
263
|
+
3. Apply minimal, targeted fix
|
|
264
|
+
4. Verify fix compiles: `npx tsc --noEmit [file]`
|
|
265
|
+
|
|
266
|
+
**Critical Constraints (re-emphasized):**
|
|
267
|
+
- You MUST use the worktree path: [worktree path]
|
|
268
|
+
- Do NOT edit files outside the worktree
|
|
269
|
+
- Complete the task with fewer tool calls than previous attempt
|
|
270
|
+
- If the same error occurs, report it clearly rather than retrying
|
|
271
|
+
|
|
272
|
+
**Deliverable:**
|
|
273
|
+
Report: fix applied, verification result, files changed
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
---
|
|
277
|
+
|
|
278
|
+
## Template Customization
|
|
279
|
+
|
|
280
|
+
### Adding New Templates
|
|
281
|
+
|
|
282
|
+
To add a custom template:
|
|
283
|
+
|
|
284
|
+
1. Define the template in this file following the structure above
|
|
285
|
+
2. Add keywords for automatic selection to the keyword table
|
|
286
|
+
3. Document the use case and best practices
|
|
287
|
+
|
|
288
|
+
### Overriding Templates
|
|
289
|
+
|
|
290
|
+
Projects can override templates by:
|
|
291
|
+
|
|
292
|
+
1. Creating `.claude/skills/_shared/references/prompt-templates.local.md`
|
|
293
|
+
2. Defining custom templates with the same headers
|
|
294
|
+
3. Local templates take precedence over defaults
|
|
295
|
+
|
|
296
|
+
### Template Variables
|
|
297
|
+
|
|
298
|
+
Templates support these placeholders:
|
|
299
|
+
|
|
300
|
+
| Variable | Description |
|
|
301
|
+
|----------|-------------|
|
|
302
|
+
| `[name]` | Component/module name from task |
|
|
303
|
+
| `[path]` | File path from task |
|
|
304
|
+
| `[worktree path]` | Current worktree directory |
|
|
305
|
+
| `[task description]` | Original task text |
|
|
306
|
+
|
|
307
|
+
---
|
|
308
|
+
|
|
309
|
+
## Usage Example
|
|
310
|
+
|
|
311
|
+
**Task:** "Create MetricsCard component in components/admin/metrics/"
|
|
312
|
+
|
|
313
|
+
**Keyword detected:** "component" → Component Template
|
|
314
|
+
|
|
315
|
+
**Rendered prompt:**
|
|
316
|
+
```markdown
|
|
317
|
+
## Task: Create React Component
|
|
318
|
+
|
|
319
|
+
**Component:** MetricsCard
|
|
320
|
+
**Location:** components/admin/metrics/MetricsCard.tsx
|
|
321
|
+
|
|
322
|
+
**Requirements:**
|
|
323
|
+
- [ ] TypeScript with proper prop types (interface or type)
|
|
324
|
+
- [ ] Follow existing component patterns in the codebase
|
|
325
|
+
- [ ] Include displayName for debugging: `MetricsCard.displayName = 'MetricsCard'`
|
|
326
|
+
- [ ] No inline styles - use existing CSS/Tailwind patterns
|
|
327
|
+
- [ ] Export component as named export
|
|
328
|
+
|
|
329
|
+
**Best Practices:**
|
|
330
|
+
- Check `components/` for similar components to follow patterns
|
|
331
|
+
- Use existing hooks from `lib/hooks/` if applicable
|
|
332
|
+
- Prefer composition over prop drilling
|
|
333
|
+
- Keep components focused - single responsibility
|
|
334
|
+
|
|
335
|
+
**Constraints:**
|
|
336
|
+
- Working directory: /path/to/worktrees/feature/123-metrics/
|
|
337
|
+
- Do NOT create test files (handled separately)
|
|
338
|
+
- Do NOT add new dependencies without explicit approval
|
|
339
|
+
|
|
340
|
+
**Deliverable:**
|
|
341
|
+
Report: files created, component name, props interface
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
---
|
|
345
|
+
|
|
346
|
+
## References
|
|
347
|
+
|
|
348
|
+
- [Subagent Types](./subagent-types.md) - Valid subagent types for Task tool
|
|
349
|
+
- `/exec` skill - Parallel execution documentation
|
|
350
|
+
- `/spec` skill - Parallel groups format
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# Claude Code Subagent Types
|
|
2
|
+
|
|
3
|
+
Reference for valid subagent types when spawning agents via the `Task` tool.
|
|
4
|
+
|
|
5
|
+
## Valid Types
|
|
6
|
+
|
|
7
|
+
Claude Code supports exactly **4 subagent types**:
|
|
8
|
+
|
|
9
|
+
| Type | Purpose | Tools Available |
|
|
10
|
+
|------|---------|-----------------|
|
|
11
|
+
| `Bash` | Command execution, git operations, terminal tasks | Bash only |
|
|
12
|
+
| `general-purpose` | Multi-step tasks needing file access + commands | All tools |
|
|
13
|
+
| `Explore` | Codebase exploration, file search, pattern finding | Read-only tools |
|
|
14
|
+
| `Plan` | Architecture planning, implementation design | Read-only tools |
|
|
15
|
+
|
|
16
|
+
## When to Use Each
|
|
17
|
+
|
|
18
|
+
### `Bash`
|
|
19
|
+
Best for: Single command execution, git operations, build commands
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
Task(subagent_type="Bash", prompt="Run npm test and report results")
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### `general-purpose`
|
|
26
|
+
Best for: Implementation tasks, quality checks, multi-file operations
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
Task(subagent_type="general-purpose",
|
|
30
|
+
prompt="Run type safety checks on the diff. Report: type issues, verdict.")
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
**Use cases:**
|
|
34
|
+
- Quality checks (type safety, security scan, scope analysis)
|
|
35
|
+
- Implementation tasks requiring edits
|
|
36
|
+
- Tasks needing both file reading and command execution
|
|
37
|
+
|
|
38
|
+
### `Explore`
|
|
39
|
+
Best for: Codebase search, pattern discovery, schema inspection
|
|
40
|
+
|
|
41
|
+
```
|
|
42
|
+
Task(subagent_type="Explore",
|
|
43
|
+
prompt="Find similar components in components/admin/. Report patterns.")
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
**Use cases:**
|
|
47
|
+
- Finding existing patterns before implementing new features
|
|
48
|
+
- Searching for file locations
|
|
49
|
+
- Understanding codebase structure
|
|
50
|
+
- Schema and database inspection
|
|
51
|
+
|
|
52
|
+
### `Plan`
|
|
53
|
+
Best for: Designing implementation approaches, architectural decisions
|
|
54
|
+
|
|
55
|
+
```
|
|
56
|
+
Task(subagent_type="Plan",
|
|
57
|
+
prompt="Design the implementation approach for adding user auth.")
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
**Use cases:**
|
|
61
|
+
- Creating implementation plans
|
|
62
|
+
- Evaluating architectural trade-offs
|
|
63
|
+
- Breaking down complex features
|
|
64
|
+
|
|
65
|
+
## Model Selection
|
|
66
|
+
|
|
67
|
+
| Model | When to Use | Cost |
|
|
68
|
+
|-------|-------------|------|
|
|
69
|
+
| `haiku` | Quick tasks, exploration, quality checks | Low |
|
|
70
|
+
| `sonnet` | Complex implementation, nuanced decisions | Medium |
|
|
71
|
+
| `opus` | Critical analysis, complex architecture | High |
|
|
72
|
+
|
|
73
|
+
**Default:** Use `haiku` unless the task requires deep reasoning.
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
Task(subagent_type="general-purpose",
|
|
77
|
+
model="haiku",
|
|
78
|
+
prompt="...")
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Common Patterns
|
|
82
|
+
|
|
83
|
+
### Parallel Quality Checks
|
|
84
|
+
```
|
|
85
|
+
Task(subagent_type="general-purpose", model="haiku",
|
|
86
|
+
prompt="Check type safety on diff vs main. Report issues count.")
|
|
87
|
+
|
|
88
|
+
Task(subagent_type="general-purpose", model="haiku",
|
|
89
|
+
prompt="Check for deleted tests in diff. Report count.")
|
|
90
|
+
|
|
91
|
+
Task(subagent_type="general-purpose", model="haiku",
|
|
92
|
+
prompt="Run security scan on changed files. Report findings.")
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Context Gathering (Spec Phase)
|
|
96
|
+
```
|
|
97
|
+
Task(subagent_type="Explore", model="haiku",
|
|
98
|
+
prompt="Find similar features in components/. Report patterns.")
|
|
99
|
+
|
|
100
|
+
Task(subagent_type="Explore", model="haiku",
|
|
101
|
+
prompt="Explore database schema for user tables. Report structure.")
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Background Execution
|
|
105
|
+
```
|
|
106
|
+
Task(subagent_type="general-purpose",
|
|
107
|
+
model="haiku",
|
|
108
|
+
run_in_background=true,
|
|
109
|
+
prompt="Implement the UserCard component...")
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Use `TaskOutput(task_id="...", block=true)` to wait for completion.
|
|
113
|
+
|
|
114
|
+
## Invalid Types (Do Not Use)
|
|
115
|
+
|
|
116
|
+
These types do **not exist** and will cause silent failures:
|
|
117
|
+
|
|
118
|
+
- ~~`quality-checker`~~ → Use `general-purpose`
|
|
119
|
+
- ~~`pattern-scout`~~ → Use `Explore`
|
|
120
|
+
- ~~`schema-inspector`~~ → Use `Explore`
|
|
121
|
+
- ~~`code-reviewer`~~ → Use `general-purpose`
|
|
122
|
+
- ~~`implementation`~~ → Use `general-purpose`
|
|
123
|
+
|
|
124
|
+
See issue #170 for context on this fix.
|
|
125
|
+
|
|
126
|
+
## References
|
|
127
|
+
|
|
128
|
+
- [Claude Code Task Tool Documentation](https://docs.anthropic.com/claude-code)
|
|
129
|
+
- [Prompt Templates](./prompt-templates.md) - Task-specific prompt templates for sub-agents
|
|
130
|
+
- `/exec` skill parallel execution: `templates/skills/exec/SKILL.md`
|
|
131
|
+
- `/qa` skill quality checks: `templates/skills/qa/SKILL.md`
|
|
@@ -497,6 +497,7 @@ Fall back to sequential execution (standard implementation loop).
|
|
|
497
497
|
- Run Prettier on all modified files after each group (agents skip auto-format)
|
|
498
498
|
- On any agent failure: stop remaining agents, log error, continue with sequential
|
|
499
499
|
- File locking prevents concurrent edits to the same file
|
|
500
|
+
- **Use prompt templates** for each agent — see [Section 4c](#4c-prompt-templates-for-sub-agents)
|
|
500
501
|
|
|
501
502
|
**Error Handling with Automatic Retry:**
|
|
502
503
|
|
|
@@ -536,6 +537,87 @@ Parse the agent's output text for these patterns to detect failures:
|
|
|
536
537
|
| `blocked by hook` | Operation was blocked by pre-tool hook |
|
|
537
538
|
| `I'm unable to` | Agent hit a blocking constraint |
|
|
538
539
|
|
|
540
|
+
### 4c. Prompt Templates for Sub-Agents
|
|
541
|
+
|
|
542
|
+
When spawning sub-agents for implementation tasks, use task-specific prompt templates for better results. See [prompt-templates.md](../_shared/references/prompt-templates.md) for the full reference.
|
|
543
|
+
|
|
544
|
+
**Template Selection:**
|
|
545
|
+
|
|
546
|
+
Templates are selected automatically based on keywords in the task description:
|
|
547
|
+
|
|
548
|
+
| Keywords | Template |
|
|
549
|
+
|----------|----------|
|
|
550
|
+
| `component`, `Component`, `React` | Component Template |
|
|
551
|
+
| `type`, `interface`, `types/` | Type Definition Template |
|
|
552
|
+
| `CLI`, `command`, `script`, `bin/` | CLI/Script Template |
|
|
553
|
+
| `test`, `spec`, `.test.` | Test Template |
|
|
554
|
+
| `refactor`, `restructure`, `migrate` | Refactor Template |
|
|
555
|
+
| (none matched) | Generic Template |
|
|
556
|
+
|
|
557
|
+
**Explicit Override:**
|
|
558
|
+
|
|
559
|
+
Use `[template: X]` annotation to force a specific template:
|
|
560
|
+
|
|
561
|
+
```
|
|
562
|
+
[template: component] Create UserCard in components/admin/
|
|
563
|
+
[template: cli] Add export command to scripts/
|
|
564
|
+
```
|
|
565
|
+
|
|
566
|
+
**Example with Template:**
|
|
567
|
+
|
|
568
|
+
Instead of a generic prompt:
|
|
569
|
+
```
|
|
570
|
+
Task(subagent_type="general-purpose",
|
|
571
|
+
model="haiku",
|
|
572
|
+
prompt="Create MetricsCard component in components/admin/")
|
|
573
|
+
```
|
|
574
|
+
|
|
575
|
+
Use a structured template prompt:
|
|
576
|
+
```
|
|
577
|
+
Task(subagent_type="general-purpose",
|
|
578
|
+
model="haiku",
|
|
579
|
+
prompt="## Task: Create React Component
|
|
580
|
+
|
|
581
|
+
**Component:** MetricsCard
|
|
582
|
+
**Location:** components/admin/metrics/MetricsCard.tsx
|
|
583
|
+
|
|
584
|
+
**Requirements:**
|
|
585
|
+
- [ ] TypeScript with proper prop types
|
|
586
|
+
- [ ] Follow existing component patterns
|
|
587
|
+
- [ ] Include displayName for debugging
|
|
588
|
+
- [ ] No inline styles
|
|
589
|
+
|
|
590
|
+
**Constraints:**
|
|
591
|
+
- Working directory: [worktree path]
|
|
592
|
+
- Do NOT create test files
|
|
593
|
+
|
|
594
|
+
**Deliverable:**
|
|
595
|
+
Report: files created, component name, props interface")
|
|
596
|
+
```
|
|
597
|
+
|
|
598
|
+
**Error Recovery with Enhanced Context:**
|
|
599
|
+
|
|
600
|
+
When retrying a failed agent, use the error recovery template from [prompt-templates.md](../_shared/references/prompt-templates.md#error-recovery-template):
|
|
601
|
+
|
|
602
|
+
```markdown
|
|
603
|
+
## RETRY: Previous Attempt Failed
|
|
604
|
+
|
|
605
|
+
**Original Task:** [task]
|
|
606
|
+
**Previous Error:** [error from TaskOutput]
|
|
607
|
+
|
|
608
|
+
**Diagnosis Checklist:**
|
|
609
|
+
- [ ] Check imports are correct
|
|
610
|
+
- [ ] Verify file paths use worktree directory
|
|
611
|
+
- [ ] Confirm types match expected signatures
|
|
612
|
+
- [ ] Look for typos in identifiers
|
|
613
|
+
|
|
614
|
+
**Fix Strategy:**
|
|
615
|
+
1. Read the failing file
|
|
616
|
+
2. Identify the specific error location
|
|
617
|
+
3. Apply minimal fix
|
|
618
|
+
4. Verify fix compiles
|
|
619
|
+
```
|
|
620
|
+
|
|
539
621
|
## Implementation Quality Standards
|
|
540
622
|
|
|
541
623
|
Before each commit, self-check against these standards:
|
|
@@ -328,7 +328,16 @@ while qa_iteration < 2:
|
|
|
328
328
|
if verdict == "READY_FOR_MERGE":
|
|
329
329
|
break
|
|
330
330
|
|
|
331
|
-
|
|
331
|
+
if verdict == "AC_MET_BUT_NOT_A_PLUS":
|
|
332
|
+
# Good enough, proceed with notes
|
|
333
|
+
break
|
|
334
|
+
|
|
335
|
+
if verdict == "NEEDS_VERIFICATION":
|
|
336
|
+
# ACs are met but pending external verification
|
|
337
|
+
# Proceed to PR - verification can happen post-PR
|
|
338
|
+
break
|
|
339
|
+
|
|
340
|
+
# Parse issues (AC_NOT_MET)
|
|
332
341
|
issues = parse_qa_issues()
|
|
333
342
|
|
|
334
343
|
# Fix each issue
|
|
@@ -430,6 +439,13 @@ Track iterations to prevent infinite loops:
|
|
|
430
439
|
- QA verdict: `AC_MET_BUT_NOT_A_PLUS`
|
|
431
440
|
- PR created with notes
|
|
432
441
|
|
|
442
|
+
**Pending Verification:**
|
|
443
|
+
|
|
444
|
+
- All AC met or pending
|
|
445
|
+
- External verification required (CI, manual test)
|
|
446
|
+
- QA verdict: `NEEDS_VERIFICATION`
|
|
447
|
+
- PR created, verification can happen post-PR
|
|
448
|
+
|
|
433
449
|
**Failure (manual intervention needed):**
|
|
434
450
|
- Max iterations reached on test or QA loop
|
|
435
451
|
- Blockers discovered
|
|
@@ -584,7 +600,8 @@ Each issue gets its own worktree, PR, and quality validation.
|
|
|
584
600
|
- [ ] **AC Coverage** - Each AC marked MET/PARTIALLY_MET/NOT_MET
|
|
585
601
|
- [ ] **Quality Metrics** - Tests passed, build status, type issues
|
|
586
602
|
- [ ] **Iteration Summary** - Test loop and QA loop iteration counts
|
|
587
|
-
- [ ] **Final Verdict** - READY_FOR_MERGE, AC_MET_BUT_NOT_A_PLUS,
|
|
603
|
+
- [ ] **Final Verdict** - READY_FOR_MERGE, AC_MET_BUT_NOT_A_PLUS, NEEDS_VERIFICATION,
|
|
604
|
+
or AC_NOT_MET
|
|
588
605
|
- [ ] **PR Link** - Pull request URL (if created)
|
|
589
606
|
- [ ] **Final GitHub Comment** - Summary posted to issue
|
|
590
607
|
|
|
@@ -54,7 +54,8 @@ cat /tmp/claude-issue-<issue-number>.log
|
|
|
54
54
|
|
|
55
55
|
Parse the log to find:
|
|
56
56
|
- **Last phase executed:** `/test` or `/qa`
|
|
57
|
-
- **Verdict:** `READY_FOR_MERGE`, `
|
|
57
|
+
- **Verdict:** `READY_FOR_MERGE`, `AC_MET_BUT_NOT_A_PLUS`, `NEEDS_VERIFICATION`,
|
|
58
|
+
or `AC_NOT_MET`
|
|
58
59
|
- **Test results:** PASS/FAIL/BLOCKED counts
|
|
59
60
|
- **Issues to fix:** Numbered recommendations or bug descriptions
|
|
60
61
|
|
|
@@ -87,6 +88,7 @@ Extract:
|
|
|
87
88
|
|
|
88
89
|
**Exit loop if:**
|
|
89
90
|
- Verdict is `READY_FOR_MERGE` - Nothing to fix!
|
|
91
|
+
- Verdict is `NEEDS_VERIFICATION` - Pending external verification
|
|
90
92
|
- No actionable issues found
|
|
91
93
|
- Max iterations reached (3 by default)
|
|
92
94
|
|