SUB-AGENT ONLY: Use when spawned for read-only research - generates report file and outputs [AGENT_DONE] marker
/plugin marketplace add shikihane/polydev/plugin install polydev@polydev-marketplaceThis skill inherits all available tools. When active, it can use any tool Claude has access to.
Execute investigation tasks and generate structured reports.
Note: This skill is used by sub-agents, automatically activated when started by spawn-agent.sh.
You are a sub-agent started by the main agent via spawn-agent.sh.
You do NOT need to call any polydev scripts. Your responsibilities are:
The main agent detects your [AGENT_DONE] output via wait-for-pattern.sh.
When task is complete, output this exact format to terminal:
[AGENT_DONE]
report: <full path to report file>
timestamp: <ISO timestamp, e.g., 2025-01-05T10:30:00Z>
summary: <summary in 20 words or less>
Example:
[AGENT_DONE]
report: ./.agent-reports/auth-analysis.md
timestamp: 2025-01-05T10:30:00Z
summary: JWT auth, 3 middlewares, 2 security issues found
The main agent detects your completion via grep "\[AGENT_DONE\]".
# Investigation Report: <Topic>
Generated: <ISO timestamp>
## Summary
<3-5 sentences summarizing key findings - this is what the main agent sees first>
## Findings
### 1. <Finding Title>
<Detailed explanation>
**Key Code:**
```<language>
// path/to/file.ts:123
<relevant code snippet>
| File | Lines | Description |
|---|---|---|
src/auth/jwt.ts | 45-67 | JWT validation logic |
src/middleware/auth.ts | 12-34 | Auth middleware |
<Additional technical details, code snippets, references>
---
## Execution Flow
---
## Prohibited Actions
DO NOT wait for user input (you're running in background) DO NOT output lots of process info to terminal (wastes main agent's tokens) DO NOT forget to output [AGENT_DONE] marker DO NOT modify code (unless task explicitly requires) DO NOT call any polydev scripts (you are a sub-agent)
DO keep process info in your head or write to log DO write final results to report file DO output only key progress and completion marker to terminal DO structure report for quick scanning
---
## Terminal Output Example
Ideal terminal output should be very concise:
Starting investigation: Authentication mechanism analysis
Searching auth-related files... Found 12 related files
Analyzing key code...
Writing report...
Report generated: ./.agent-reports/auth-analysis.md
[AGENT_DONE] report: ./.agent-reports/auth-analysis.md timestamp: 2025-01-05T10:30:00Z summary: JWT auth, 3 middlewares, 2 security issues found
---
## Communication with Main Agent
There is no direct communication channel between you and the main agent. The only ways to communicate are:
1. **Report file** - Main agent reads your generated report
2. **[AGENT_DONE] marker** - Main agent detects your completion via terminal output
3. **summary field** - Main agent quickly decides if detailed reading is needed
Keep reports concise and structured so main agent can quickly extract key information.
---
## Rule Reflection (Check Before Completion)
**Trigger conditions** (all must be met):
1. Encountered **environment/compatibility/parameter usage** issue
2. Issue **will recur when new Agent executes**
3. You **have solved it** with a clear solution
**Action:** Write file to `.agent-memory/proposed-rules/<issue-summary>.md`
**Format:**
```markdown
# <Issue Summary>
## Problem
<Describe the issue and trigger conditions>
## Solution
<Specific solution>
## Example
\`\`\`bash
# Wrong approach
...
# Correct approach
...
\`\`\`
Do NOT trigger for:
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.