aiblueprint-cli 1.4.12 → 1.4.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/claude-code-config/scripts/.claude/commands/fix-on-my-computer.md +87 -0
  2. package/claude-code-config/scripts/command-validator/CLAUDE.md +112 -0
  3. package/claude-code-config/scripts/command-validator/src/__tests__/validator.test.ts +62 -111
  4. package/claude-code-config/scripts/command-validator/src/cli.ts +5 -3
  5. package/claude-code-config/scripts/command-validator/src/lib/security-rules.ts +3 -4
  6. package/claude-code-config/scripts/command-validator/src/lib/types.ts +1 -0
  7. package/claude-code-config/scripts/command-validator/src/lib/validator.ts +47 -317
  8. package/claude-code-config/scripts/statusline/CLAUDE.md +29 -7
  9. package/claude-code-config/scripts/statusline/README.md +89 -1
  10. package/claude-code-config/scripts/statusline/defaults.json +75 -0
  11. package/claude-code-config/scripts/statusline/src/index.ts +101 -24
  12. package/claude-code-config/scripts/statusline/src/lib/config-types.ts +100 -0
  13. package/claude-code-config/scripts/statusline/src/lib/config.ts +21 -0
  14. package/claude-code-config/scripts/statusline/src/lib/context.ts +32 -11
  15. package/claude-code-config/scripts/statusline/src/lib/formatters.ts +360 -22
  16. package/claude-code-config/scripts/statusline/src/lib/git.ts +100 -0
  17. package/claude-code-config/scripts/statusline/src/lib/render-pure.ts +177 -0
  18. package/claude-code-config/scripts/statusline/src/lib/types.ts +11 -0
  19. package/claude-code-config/scripts/statusline/statusline.config.json +93 -0
  20. package/claude-code-config/skills/claude-memory/SKILL.md +689 -0
  21. package/claude-code-config/skills/claude-memory/references/comprehensive-example.md +175 -0
  22. package/claude-code-config/skills/claude-memory/references/project-patterns.md +334 -0
  23. package/claude-code-config/skills/claude-memory/references/prompting-techniques.md +411 -0
  24. package/claude-code-config/skills/claude-memory/references/section-templates.md +347 -0
  25. package/claude-code-config/skills/create-slash-commands/SKILL.md +1110 -0
  26. package/claude-code-config/skills/create-slash-commands/references/arguments.md +273 -0
  27. package/claude-code-config/skills/create-slash-commands/references/patterns.md +947 -0
  28. package/claude-code-config/skills/create-slash-commands/references/prompt-examples.md +656 -0
  29. package/claude-code-config/skills/create-slash-commands/references/tool-restrictions.md +389 -0
  30. package/claude-code-config/skills/create-subagents/SKILL.md +425 -0
  31. package/claude-code-config/skills/create-subagents/references/context-management.md +567 -0
  32. package/claude-code-config/skills/create-subagents/references/debugging-agents.md +714 -0
  33. package/claude-code-config/skills/create-subagents/references/error-handling-and-recovery.md +502 -0
  34. package/claude-code-config/skills/create-subagents/references/evaluation-and-testing.md +374 -0
  35. package/claude-code-config/skills/create-subagents/references/orchestration-patterns.md +591 -0
  36. package/claude-code-config/skills/create-subagents/references/subagents.md +599 -0
  37. package/claude-code-config/skills/create-subagents/references/writing-subagent-prompts.md +513 -0
  38. package/package.json +1 -1
  39. package/claude-code-config/commands/apex.md +0 -109
  40. package/claude-code-config/commands/tasks/run-task.md +0 -220
  41. package/claude-code-config/commands/utils/watch-ci.md +0 -47
  42. package/claude-code-config/scripts/command-validator/biome.json +0 -29
  43. package/claude-code-config/scripts/command-validator/bun.lockb +0 -0
  44. package/claude-code-config/scripts/command-validator/package.json +0 -27
  45. package/claude-code-config/scripts/command-validator/vitest.config.ts +0 -7
  46. package/claude-code-config/scripts/hook-post-file.ts +0 -162
  47. package/claude-code-config/scripts/statusline/biome.json +0 -34
  48. package/claude-code-config/scripts/statusline/bun.lockb +0 -0
  49. package/claude-code-config/scripts/statusline/fixtures/test-input.json +0 -25
  50. package/claude-code-config/scripts/statusline/package.json +0 -19
  51. package/claude-code-config/scripts/statusline/statusline.config.ts +0 -25
  52. package/claude-code-config/scripts/statusline/test.ts +0 -20
  53. package/claude-code-config/scripts/validate-command.js +0 -712
  54. package/claude-code-config/scripts/validate-command.readme.md +0 -283
@@ -0,0 +1,599 @@
1
+ <file_format>
2
+ Subagent file structure:
3
+
4
+ ```markdown
5
+ ---
6
+ name: your-subagent-name
7
+ description: Description of when this subagent should be invoked
8
+ tools: tool1, tool2, tool3 # Optional - inherits all tools if omitted
9
+ model: sonnet # Optional - specify model alias or 'inherit'
10
+ ---
11
+
12
+ <role>
13
+ Your subagent's system prompt using pure XML structure. This defines the subagent's role, capabilities, and approach.
14
+ </role>
15
+
16
+ <constraints>
17
+ Hard rules using NEVER/MUST/ALWAYS for critical boundaries.
18
+ </constraints>
19
+
20
+ <workflow>
21
+ Step-by-step process for consistency.
22
+ </workflow>
23
+ ```
24
+
25
+ **Critical**: Use pure XML structure in the body. Remove ALL markdown headings (##, ###). Keep markdown formatting within content (bold, lists, code blocks).
26
+
27
+ <configuration_fields>
28
+ | Field | Required | Description |
29
+ |-------|----------|-------------|
30
+ | `name` | Yes | Unique identifier using lowercase letters and hyphens |
31
+ | `description` | Yes | Natural language description of purpose. Include when Claude should invoke this. |
32
+ | `tools` | No | Comma-separated list. If omitted, inherits all tools from main thread |
33
+ | `model` | No | `sonnet`, `opus`, `haiku`, or `inherit`. If omitted, uses default subagent model |
34
+ </configuration_fields>
35
+ </file_format>
36
+
37
+ <storage_locations>
38
+ | Type | Location | Scope | Priority |
39
+ |------|----------|-------|----------|
40
+ | **Project** | `.claude/agents/` | Current project only | Highest |
41
+ | **User** | `~/.claude/agents/` | All projects | Lower |
42
+ | **CLI** | `--agents` flag | Current session | Medium |
43
+ | **Plugin** | Plugin's `agents/` dir | All projects | Lowest |
44
+
45
+ When subagent names conflict, higher priority takes precedence.
46
+ </storage_locations>
47
+
48
+ <execution_model>
49
+ <black_box_model>
50
+ Subagents execute in isolated contexts without user interaction.
51
+
52
+ **Key characteristics:**
53
+ - Subagent receives input parameters from main chat
54
+ - Subagent runs autonomously using available tools
55
+ - Subagent returns final output/report to main chat
56
+ - User only sees final result, not intermediate steps
57
+
58
+ **This means:**
59
+ - ✅ Subagents can use Read, Write, Edit, Bash, Grep, Glob, WebSearch, WebFetch
60
+ - ✅ Subagents can access MCP servers (non-interactive tools)
61
+ - ✅ Subagents can make decisions based on their prompt and available data
62
+ - ❌ **Subagents CANNOT use AskUserQuestion**
63
+ - ❌ **Subagents CANNOT present options and wait for user selection**
64
+ - ❌ **Subagents CANNOT request confirmations or clarifications from user**
65
+ - ❌ **User does not see subagent's tool calls or intermediate reasoning**
66
+ </black_box_model>
67
+
68
+ <workflow_implications>
69
+ **When designing subagent workflows:**
70
+
71
+ Keep user interaction in main chat:
72
+ ```markdown
73
+ # ❌ WRONG - Subagent cannot do this
74
+ ---
75
+ name: requirement-gatherer
76
+ description: Gathers requirements from user
77
+ tools: AskUserQuestion # This won't work!
78
+ ---
79
+
80
+ You ask the user questions to gather requirements...
81
+ ```
82
+
83
+ ```markdown
84
+ # ✅ CORRECT - Main chat handles interaction
85
+ Main chat: Uses AskUserQuestion to gather requirements
86
+
87
+ Launch subagent: Uses requirements to research/build (no interaction)
88
+
89
+ Main chat: Present subagent results to user
90
+ ```
91
+ </workflow_implications>
92
+ </execution_model>
93
+
94
+ <tool_configuration>
95
+ <inherit_all_tools>
96
+ Omit the `tools` field to inherit all tools from main thread:
97
+
98
+ ```yaml
99
+ ---
100
+ name: code-reviewer
101
+ description: Reviews code for quality and security
102
+ ---
103
+ ```
104
+
105
+ Subagent has access to all tools, including MCP tools.
106
+ </inherit_all_tools>
107
+
108
+ <specific_tools>
109
+ Specify tools as comma-separated list for granular control:
110
+
111
+ ```yaml
112
+ ---
113
+ name: read-only-analyzer
114
+ description: Analyzes code without making changes
115
+ tools: Read, Grep, Glob
116
+ ---
117
+ ```
118
+
119
+ Use `/agents` command to see full list of available tools.
120
+ </specific_tools>
121
+ </tool_configuration>
122
+
123
+ <model_selection>
124
+ <model_capabilities>
125
+ **Sonnet 4.5** (`sonnet`):
126
+ - "Best model in the world for agents" (Anthropic)
127
+ - Exceptional at agentic tasks: 64% problem-solving on coding benchmarks
128
+ - SWE-bench Verified: 49.0%
129
+ - **Use for**: Planning, complex reasoning, validation, critical decisions
130
+
131
+ **Haiku 4.5** (`haiku`):
132
+ - "Near-frontier performance" - 90% of Sonnet 4.5's capabilities
133
+ - SWE-bench Verified: 73.3% (one of world's best coding models)
134
+ - Fastest and most cost-efficient
135
+ - **Use for**: Task execution, simple transformations, high-volume processing
136
+
137
+ **Opus** (`opus`):
138
+ - Highest performance on evaluation benchmarks
139
+ - Most capable but slowest and most expensive
140
+ - **Use for**: Highest-stakes decisions, most complex reasoning
141
+
142
+ **Inherit** (`inherit`):
143
+ - Uses same model as main conversation
144
+ - **Use for**: Ensuring consistent capabilities throughout session
145
+ </model_capabilities>
146
+
147
+ <orchestration_strategy>
148
+ **Sonnet + Haiku orchestration pattern** (optimal cost/performance):
149
+
150
+ ```markdown
151
+ 1. Sonnet 4.5 (Coordinator):
152
+ - Creates plan
153
+ - Breaks task into subtasks
154
+ - Identifies parallelizable work
155
+
156
+ 2. Multiple Haiku 4.5 instances (Workers):
157
+ - Execute subtasks in parallel
158
+ - Fast and cost-efficient
159
+ - 90% of Sonnet's capability for execution
160
+
161
+ 3. Sonnet 4.5 (Validator):
162
+ - Integrates results
163
+ - Validates output quality
164
+ - Ensures coherence
165
+ ```
166
+
167
+ **Benefit**: Use expensive Sonnet only for planning and validation, cheap Haiku for execution.
168
+ </orchestration_strategy>
169
+
170
+ <decision_framework>
171
+ **When to use each model**:
172
+
173
+ | Task Type | Recommended Model | Rationale |
174
+ |-----------|------------------|-----------|
175
+ | Simple validation | Haiku | Fast, cheap, sufficient capability |
176
+ | Code execution | Haiku | 73.3% SWE-bench, very fast |
177
+ | Complex analysis | Sonnet | Superior reasoning, worth the cost |
178
+ | Multi-step planning | Sonnet | Best for breaking down complexity |
179
+ | Quality validation | Sonnet | Critical checkpoint, needs intelligence |
180
+ | Batch processing | Haiku | Cost efficiency for high volume |
181
+ | Critical security | Sonnet | High stakes require best model |
182
+ | Output synthesis | Sonnet | Ensuring coherence across inputs |
183
+ </decision_framework>
184
+ </model_selection>
185
+
186
+ <invocation>
187
+ <automatic>
188
+ Claude automatically selects subagents based on:
189
+ - Task description in user's request
190
+ - `description` field in subagent configuration
191
+ - Current context
192
+ </automatic>
193
+
194
+ <explicit>
195
+ Users can explicitly request a subagent:
196
+
197
+ ```
198
+ > Use the code-reviewer subagent to check my recent changes
199
+ > Have the test-runner subagent fix the failing tests
200
+ ```
201
+ </explicit>
202
+ </invocation>
203
+
204
+ <management>
205
+ <using_agents_command>
206
+ **Recommended**: Use `/agents` command for interactive management:
207
+ - View all available subagents (built-in, user, project, plugin)
208
+ - Create new subagents with guided setup
209
+ - Edit existing subagents and their tool access
210
+ - Delete custom subagents
211
+ - See which subagents take priority when names conflict
212
+ </using_agents_command>
213
+
214
+ <direct_file_management>
215
+ **Alternative**: Edit subagent files directly:
216
+ - Project: `.claude/agents/subagent-name.md`
217
+ - User: `~/.claude/agents/subagent-name.md`
218
+
219
+ Follow the file format specified above (YAML frontmatter + system prompt).
220
+ </direct_file_management>
221
+
222
+ <cli_based_configuration>
223
+ **Temporary**: Define subagents via CLI for session-specific use:
224
+
225
+ ```bash
226
+ claude --agents '{
227
+ "code-reviewer": {
228
+ "description": "Expert code reviewer. Use proactively after code changes.",
229
+ "prompt": "You are a senior code reviewer. Focus on quality, security, and best practices.",
230
+ "tools": ["Read", "Grep", "Glob", "Bash"],
231
+ "model": "sonnet"
232
+ }
233
+ }'
234
+ ```
235
+
236
+ Useful for testing configurations before saving them.
237
+ </cli_based_configuration>
238
+ </management>
239
+
240
+ <example_subagents>
241
+ <test_writer>
242
+ ```markdown
243
+ ---
244
+ name: test-writer
245
+ description: Creates comprehensive test suites. Use when new code needs tests or test coverage is insufficient.
246
+ tools: Read, Write, Grep, Glob, Bash
247
+ model: sonnet
248
+ ---
249
+
250
+ <role>
251
+ You are a test automation specialist creating thorough, maintainable test suites.
252
+ </role>
253
+
254
+ <workflow>
255
+ 1. Analyze the code to understand functionality
256
+ 2. Identify test cases (happy path, edge cases, error conditions)
257
+ 3. Write tests using the project's testing framework
258
+ 4. Run tests to verify they pass
259
+ </workflow>
260
+
261
+ <test_quality_criteria>
262
+ - Test one behavior per test
263
+ - Use descriptive test names
264
+ - Follow AAA pattern (Arrange, Act, Assert)
265
+ - Include edge cases and error conditions
266
+ - Avoid test interdependencies
267
+ </test_quality_criteria>
268
+ ```
269
+ </test_writer>
270
+
271
+ <debugger>
272
+ ```markdown
273
+ ---
274
+ name: debugger
275
+ description: Investigates and fixes bugs. Use when errors occur or behavior is unexpected.
276
+ tools: Read, Edit, Bash, Grep, Glob
277
+ model: sonnet
278
+ ---
279
+
280
+ <role>
281
+ You are a debugging specialist skilled at root cause analysis and systematic problem-solving.
282
+ </role>
283
+
284
+ <workflow>
285
+ 1. **Reproduce**: Understand and reproduce the issue
286
+ 2. **Isolate**: Identify the failing component
287
+ 3. **Analyze**: Examine code, logs, and stack traces
288
+ 4. **Hypothesize**: Form theories about the cause
289
+ 5. **Test**: Verify hypotheses systematically
290
+ 6. **Fix**: Implement and verify the solution
291
+ </workflow>
292
+
293
+ <debugging_techniques>
294
+ - Add logging/print statements to trace execution
295
+ - Use binary search to isolate the problem
296
+ - Check assumptions (inputs, state, environment)
297
+ - Review recent changes that might have introduced the bug
298
+ - Verify fix doesn't break other functionality
299
+ </debugging_techniques>
300
+ ```
301
+ </debugger>
302
+ </example_subagents>
303
+
304
+ <tool_security>
305
+ <core_principle>
306
+ **"Permission sprawl is the fastest path to unsafe autonomy."** - Anthropic
307
+
308
+ Treat tool access like production IAM: start from deny-all, allowlist only what's needed.
309
+ </core_principle>
310
+
311
+ <why_it_matters>
312
+ **Security risks of over-permissioning**:
313
+ - Agent could modify wrong code (production instead of tests)
314
+ - Agent could run dangerous commands (rm -rf, data deletion)
315
+ - Agent could expose protected information
316
+ - Agent could skip critical steps (linting, testing, validation)
317
+
318
+ **Example vulnerability**:
319
+ ```markdown
320
+ ❌ Bad: Agent drafting sales email has full access to all tools
321
+ Risk: Could access revenue dashboard data, customer financial info
322
+
323
+ ✅ Good: Agent drafting sales email has Read access to Salesforce only
324
+ Scope: Can draft email, cannot access sensitive financial data
325
+ ```
326
+ </why_it_matters>
327
+
328
+ <permission_patterns>
329
+ **Tool access patterns by trust level**:
330
+
331
+ **Trusted data processing**:
332
+ - Full tool access appropriate
333
+ - Working with user's own code
334
+ - Example: refactoring user's codebase
335
+
336
+ **Untrusted data processing**:
337
+ - Restricted tool access essential
338
+ - Processing external inputs
339
+ - Example: analyzing third-party API responses
340
+ - Limit: Read-only tools, no execution
341
+ </permission_patterns>
342
+
343
+ <audit_checklist>
344
+ **Tool access audit**:
345
+ - [ ] Does this subagent need Write/Edit, or is Read sufficient?
346
+ - [ ] Should it execute code (Bash), or just analyze?
347
+ - [ ] Are all granted tools necessary for the task?
348
+ - [ ] What's the worst-case misuse scenario?
349
+ - [ ] Can we restrict further without blocking legitimate use?
350
+
351
+ **Default**: Grant minimum necessary. Add tools only when lack of access blocks task.
352
+ </audit_checklist>
353
+ </tool_security>
354
+
355
+ <prompt_caching>
356
+ <benefits>
357
+ Prompt caching for frequently-invoked subagents:
358
+ - **90% cost reduction** on cached tokens
359
+ - **85% latency reduction** for cache hits
360
+ - Cached content: ~10% cost of uncached tokens
361
+ - Cache TTL: 5 minutes (default) or 1 hour (extended)
362
+ </benefits>
363
+
364
+ <cache_structure>
365
+ **Structure prompts for caching**:
366
+
367
+ ```markdown
368
+ ---
369
+ name: security-reviewer
370
+ description: ...
371
+ tools: ...
372
+ model: sonnet
373
+ ---
374
+
375
+ [CACHEABLE SECTION - Stable content]
376
+ <role>
377
+ You are a senior security engineer...
378
+ </role>
379
+
380
+ <focus_areas>
381
+ - SQL injection
382
+ - XSS attacks
383
+ ...
384
+ </focus_areas>
385
+
386
+ <workflow>
387
+ 1. Read modified files
388
+ 2. Identify risks
389
+ ...
390
+ </workflow>
391
+
392
+ <severity_ratings>
393
+ ...
394
+ </severity_ratings>
395
+
396
+ --- [CACHE BREAKPOINT] ---
397
+
398
+ [VARIABLE SECTION - Task-specific content]
399
+ Current task: {dynamic context}
400
+ Recent changes: {varies per invocation}
401
+ ```
402
+
403
+ **Principle**: Stable instructions at beginning (cached), variable context at end (fresh).
404
+ </cache_structure>
405
+
406
+ <when_to_use>
407
+ **Best candidates for caching**:
408
+ - Frequently-invoked subagents (multiple times per session)
409
+ - Large, stable prompts (extensive guidelines, examples)
410
+ - Consistent tool definitions across invocations
411
+ - Long-running sessions with repeated subagent use
412
+
413
+ **Not beneficial**:
414
+ - Rarely-used subagents (once per session)
415
+ - Prompts that change frequently
416
+ - Very short prompts (caching overhead > benefit)
417
+ </when_to_use>
418
+
419
+ <cache_management>
420
+ **Cache lifecycle**:
421
+ - First invocation: Writes to cache (25% cost premium)
422
+ - Subsequent invocations: 90% cheaper on cached portion
423
+ - Cache refreshes on each use (extends TTL)
424
+ - Expires after 5 minutes of non-use (or 1 hour for extended TTL)
425
+
426
+ **Invalidation triggers**:
427
+ - Subagent prompt modified
428
+ - Tool definitions changed
429
+ - Cache TTL expires
430
+ </cache_management>
431
+ </prompt_caching>
432
+
433
+ <background_execution>
434
+ <overview>
435
+ The Task tool supports `run_in_background` parameter to launch agents asynchronously. This enables parallel execution of multiple agents while the main conversation continues.
436
+ </overview>
437
+
438
+ <task_tool_parameters>
439
+ **Task tool input for background execution:**
440
+
441
+ | Parameter | Type | Required | Description |
442
+ |-----------|------|----------|-------------|
443
+ | `description` | string | Yes | Short (3-5 word) description of the task |
444
+ | `prompt` | string | Yes | The task for the agent to perform |
445
+ | `subagent_type` | string | Yes | Type of specialized agent to use |
446
+ | `run_in_background` | boolean | No | Set `true` to run asynchronously |
447
+ | `resume` | string | No | Agent ID to resume from previous execution |
448
+ | `model` | string | No | Override model: `sonnet`, `opus`, `haiku` |
449
+ </task_tool_parameters>
450
+
451
+ <taskoutput_tool>
452
+ **Retrieving results from background agents:**
453
+
454
+ Use `TaskOutput` tool to get results from running or completed tasks:
455
+
456
+ | Parameter | Type | Default | Description |
457
+ |-----------|------|---------|-------------|
458
+ | `task_id` | string | Required | The agent ID from Task tool |
459
+ | `block` | boolean | `true` | Wait for completion or check status |
460
+ | `timeout` | number | `30000` | Max wait time in ms (max: 600000) |
461
+
462
+ **Example workflow:**
463
+ ```
464
+ Step 1: Launch background agent
465
+ Task tool:
466
+ - description: "Security review"
467
+ - prompt: "Review authentication code..."
468
+ - subagent_type: "security-reviewer"
469
+ - run_in_background: true
470
+ → Returns: agent_id: "abc123"
471
+
472
+ Step 2: Continue with other work...
473
+
474
+ Step 3: Retrieve results
475
+ TaskOutput tool:
476
+ - task_id: "abc123"
477
+ - block: true
478
+ → Returns: Agent's final output
479
+ ```
480
+ </taskoutput_tool>
481
+
482
+ <parallel_execution_patterns>
483
+ **Pattern 1: Parallel Analysis**
484
+ Launch multiple independent agents, then collect results:
485
+
486
+ ```
487
+ # Single message with multiple Task calls
488
+ Task 1: code-reviewer (background)
489
+ Task 2: security-scanner (background)
490
+ Task 3: test-analyzer (background)
491
+
492
+ # Later: collect all results
493
+ TaskOutput for each agent_id
494
+ ```
495
+
496
+ **Pattern 2: Fan-out / Fan-in**
497
+ ```
498
+ 1. Main agent breaks work into subtasks
499
+ 2. Launch Haiku workers in parallel (background)
500
+ 3. Collect all results
501
+ 4. Main agent synthesizes findings
502
+ ```
503
+
504
+ **Pattern 3: Long-running with Progress Check**
505
+ ```
506
+ 1. Launch long-running agent (background)
507
+ 2. Periodically check status (block: false)
508
+ 3. Continue other work while waiting
509
+ 4. Get final results when ready
510
+ ```
511
+ </parallel_execution_patterns>
512
+
513
+ <best_use_cases>
514
+ **When to use background execution:**
515
+
516
+ ✅ **Good candidates:**
517
+ - Security audits across multiple files
518
+ - Comprehensive code reviews
519
+ - Documentation generation
520
+ - Test coverage analysis
521
+ - Multi-file refactoring analysis
522
+ - Research tasks (API docs, library exploration)
523
+
524
+ ❌ **Not recommended:**
525
+ - Quick single-file operations
526
+ - Tasks with sequential dependencies
527
+ - Operations needing immediate results
528
+ - Simple validation checks
529
+ </best_use_cases>
530
+
531
+ <resume_capability>
532
+ **Resuming agents:**
533
+
534
+ Agents preserve full context when resumed:
535
+
536
+ ```
537
+ Task tool:
538
+ - description: "Continue analysis"
539
+ - prompt: "Please continue..."
540
+ - subagent_type: "security-reviewer"
541
+ - resume: "abc123" # Previous agent_id
542
+ ```
543
+
544
+ **Use cases for resuming:**
545
+ - Agent hit context limit, needs to continue
546
+ - Follow-up work on previous analysis
547
+ - Iterative refinement of agent output
548
+ </resume_capability>
549
+ </background_execution>
550
+
551
+ <best_practices>
552
+ <be_specific>
553
+ Create task-specific subagents, not generic helpers.
554
+
555
+ ❌ Bad: "You are a helpful assistant"
556
+ ✅ Good: "You are a React performance optimizer specializing in hooks and memoization"
557
+ </be_specific>
558
+
559
+ <clear_triggers>
560
+ Make the `description` clear about when to invoke:
561
+
562
+ ❌ Bad: "Helps with code"
563
+ ✅ Good: "Reviews code for security vulnerabilities. Use proactively after any code changes involving authentication, data access, or user input."
564
+ </clear_triggers>
565
+
566
+ <focused_tools>
567
+ Grant only the tools needed for the task (least privilege):
568
+
569
+ - Read-only analysis: `Read, Grep, Glob`
570
+ - Code modification: `Read, Edit, Bash, Grep`
571
+ - Test running: `Read, Write, Bash`
572
+
573
+ **Security note**: Over-permissioning is primary risk vector. Start minimal, add only when necessary.
574
+ </focused_tools>
575
+
576
+ <structured_prompts>
577
+ Use XML tags to structure the system prompt for clarity:
578
+
579
+ ```markdown
580
+ <role>
581
+ You are a senior security engineer specializing in web application security.
582
+ </role>
583
+
584
+ <focus_areas>
585
+ - SQL injection
586
+ - XSS attacks
587
+ - CSRF vulnerabilities
588
+ - Authentication/authorization flaws
589
+ </focus_areas>
590
+
591
+ <workflow>
592
+ 1. Analyze code changes
593
+ 2. Identify security risks
594
+ 3. Provide specific remediation
595
+ 4. Rate severity
596
+ </workflow>
597
+ ```
598
+ </structured_prompts>
599
+ </best_practices>