cc-dev-template 0.1.74 → 0.1.75

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-dev-template",
3
- "version": "0.1.74",
3
+ "version": "0.1.75",
4
4
  "description": "Structured AI-assisted development framework for Claude Code",
5
5
  "bin": {
6
6
  "cc-dev-template": "./bin/install.js"
@@ -49,11 +49,37 @@ Add to CLAUDE.md only high-value operational knowledge that can't be found by re
49
49
 
50
50
  Most sessions: add nothing.
51
51
 
52
- **4. Push**
52
+ **4. Reflect on session and update memory**
53
+
54
+ Review the full session for lessons worth preserving across conversations. Your memory directory persists between sessions — use it to build institutional knowledge.
55
+
56
+ What belongs in memory:
57
+ - Debugging breakthroughs — "X error was caused by Y, the fix is Z"
58
+ - Gotchas that wasted time — things you'd want to know next time
59
+ - Confirmed patterns — approaches that worked well (or didn't)
60
+ - Corrections — things you assumed wrong and now know better
61
+ - User preferences discovered through interaction (not stated in CLAUDE.md)
62
+
63
+ What does NOT belong:
64
+ - Anything already in CLAUDE.md (memory supplements it, doesn't duplicate it)
65
+ - Task-specific context (what you worked on today — that's in git and CURRENT_WORK.md)
66
+ - Obvious things discoverable by reading the code
67
+ - Speculative conclusions from a single observation
68
+
69
+ How to update:
70
+ - Read your existing MEMORY.md first — edit, don't just append
71
+ - Remove or correct entries that turned out wrong
72
+ - Keep MEMORY.md under 200 lines (it's injected into your system prompt)
73
+ - Use topic files (`debugging.md`, `patterns.md`) for detailed notes, link from MEMORY.md
74
+ - Organize by topic, not chronologically
75
+
76
+ Most sessions: a small edit or nothing. Occasionally: a meaningful addition. The bar is "would this save me real time or prevent a real mistake next session?"
77
+
78
+ **5. Push**
53
79
 
54
80
  Push your commits to the remote.
55
81
 
56
- **5. Report what was updated**
82
+ **6. Report what was updated**
57
83
 
58
84
  Summarize: commits made, CURRENT_WORK.md changes, any items removed/added.
59
85
 
@@ -64,3 +90,4 @@ Summarize: commits made, CURRENT_WORK.md changes, any items removed/added.
64
90
  | Git history | What was done | Every session |
65
91
  | CURRENT_WORK.md | What to do next | Every session (kept minimal) |
66
92
  | CLAUDE.md | How to work here | Rarely |
93
+ | Memory | What I've learned | When something non-obvious is discovered |
@@ -8,17 +8,14 @@
8
8
  * Each poll dumps the entire transcript (not a delta) into the orchestrator's
9
9
  * context, causing severe bloat with background agents.
10
10
  *
11
- * This hook intercepts TaskOutput calls, reads the output file directly,
12
- * extracts only the last few assistant messages, and returns those as the
13
- * deny reason. The orchestrator gets useful status without the full transcript.
11
+ * This hook intercepts TaskOutput calls and denies them with a brief message.
12
+ * The agent's output is already delivered via the Task tool's return value,
13
+ * so TaskOutput is redundant and would only duplicate content in context.
14
14
  */
15
15
 
16
16
  const fs = require('fs');
17
17
  const path = require('path');
18
18
 
19
- const MAX_ASSISTANT_MESSAGES = 3;
20
- const MAX_CHARS_PER_MESSAGE = 500;
21
-
22
19
  async function readStdin() {
23
20
  return new Promise((resolve) => {
24
21
  let data = '';
@@ -58,50 +55,6 @@ function findOutputFile(taskId, cwd) {
58
55
  return null;
59
56
  }
60
57
 
61
- /**
62
- * Parse JSONL output file and extract the last N assistant text messages.
63
- */
64
- function extractAssistantMessages(filePath) {
65
- try {
66
- const content = fs.readFileSync(filePath, 'utf8');
67
- const lines = content.trim().split('\n');
68
-
69
- const assistantMessages = [];
70
-
71
- for (const line of lines) {
72
- try {
73
- const entry = JSON.parse(line);
74
- if (entry.type !== 'assistant' || !entry.message) continue;
75
- if (entry.message.role !== 'assistant' || !entry.message.content) continue;
76
-
77
- // Extract text blocks only (skip tool_use blocks)
78
- const textParts = [];
79
- const contentArr = Array.isArray(entry.message.content)
80
- ? entry.message.content
81
- : [entry.message.content];
82
-
83
- for (const block of contentArr) {
84
- if (typeof block === 'string' && block.trim()) {
85
- textParts.push(block.trim());
86
- } else if (block.type === 'text' && block.text && block.text.trim()) {
87
- textParts.push(block.text.trim());
88
- }
89
- }
90
-
91
- if (textParts.length > 0) {
92
- assistantMessages.push(textParts.join('\n'));
93
- }
94
- } catch {
95
- // Skip malformed lines
96
- }
97
- }
98
-
99
- return assistantMessages.slice(-MAX_ASSISTANT_MESSAGES);
100
- } catch {
101
- return [];
102
- }
103
- }
104
-
105
58
  async function main() {
106
59
  const input = await readStdin();
107
60
  if (!input) process.exit(0);
@@ -119,26 +72,11 @@ async function main() {
119
72
  process.exit(0);
120
73
  }
121
74
 
122
- const messages = extractAssistantMessages(outputFile);
123
-
124
- let summary;
125
- if (messages.length === 0) {
126
- summary = `Agent ${taskId} is running but has no assistant messages yet. Wait for the blocking return instead of polling.`;
127
- } else {
128
- const trimmed = messages.map((msg, i) => {
129
- const truncated = msg.length > MAX_CHARS_PER_MESSAGE
130
- ? msg.slice(0, MAX_CHARS_PER_MESSAGE) + '...'
131
- : msg;
132
- return `[${i + 1}] ${truncated}`;
133
- });
134
- summary = `Last ${messages.length} assistant message(s) from agent ${taskId}:\n\n${trimmed.join('\n\n')}`;
135
- }
136
-
137
75
  const output = {
138
76
  hookSpecificOutput: {
139
77
  hookEventName: "PreToolUse",
140
78
  permissionDecision: "deny",
141
- permissionDecisionReason: summary
79
+ permissionDecisionReason: `TaskOutput blocked for agent ${taskId} — agent output is delivered via the Task tool return. Do not call TaskOutput; the result will arrive automatically.`
142
80
  }
143
81
  };
144
82
 
@@ -1,7 +1,6 @@
1
1
  ---
2
2
  name: agent-browser
3
3
  description: Browser automation CLI for AI agents. Use when the user needs to interact with websites, including navigating pages, filling forms, clicking buttons, taking screenshots, extracting data, testing web apps, or automating any browser task. Triggers include requests to "open a website", "fill out a form", "click a button", "take a screenshot", "scrape data from a page", "test this web app", "login to a site", "automate browser actions", or any task requiring programmatic web interaction.
4
- allowed-tools: Bash(agent-browser:*)
5
4
  ---
6
5
 
7
6
  # Browser Automation with agent-browser
@@ -0,0 +1,18 @@
1
+ ---
2
+ name: creating-sub-agents
3
+ description: Expert guidance for creating and managing Claude Code sub-agents. Use when the user asks to "create a sub-agent", "build a new agent", "fix a sub-agent", "audit agents", "review my agents", "update an agent", "modify an agent", or mentions sub-agent development, .claude/agents/ files, agent frontmatter, or agent delegation.
4
+ ---
5
+
6
+ # Creating Sub-Agents
7
+
8
+ ## What To Do Now
9
+
10
+ Ask the user what they need.
11
+
12
+ | Intent | Action |
13
+ |--------|--------|
14
+ | Create a new sub-agent | Read `references/create-step-1-understand.md` |
15
+ | Fix, improve, audit, or modify an existing sub-agent | Read `references/fix-step-1-diagnose.md` |
16
+
17
+ If the user says "audit my agents", that is the fix path.
18
+ If they mention a specific agent that needs changes, that is also the fix path.
@@ -0,0 +1,46 @@
1
+ # Step 1: Understand the Need
2
+
3
+ Determine what task the user wants to delegate to a sub-agent, and whether a sub-agent is the right tool.
4
+
5
+ ## Validate the Choice
6
+
7
+ Before designing a sub-agent, confirm it is the right approach. Ask:
8
+
9
+ - Does this task produce verbose output that would clutter the main conversation?
10
+ - Does the task benefit from tool restrictions or isolation?
11
+ - Is the work self-contained and returnable as a summary?
12
+ - Does the user want persistent memory across sessions for this task?
13
+
14
+ If the answer to all of these is no, a skill might be more appropriate. Suggest a skill if the task needs conversation history, branching workflows, or progressive disclosure.
15
+
16
+ ## What To Uncover
17
+
18
+ Have a conversation with the user to understand:
19
+
20
+ - **The task** — What specific job should this sub-agent do? Get concrete.
21
+ - **The trigger** — When should Claude delegate to this sub-agent? What signals it?
22
+ - **The output** — What should the sub-agent return? A summary? A fixed file? A report?
23
+ - **The tools** — Does it need to modify files, or just read them? Does it need Bash?
24
+ - **The scope** — Should this be available everywhere (user-level) or just this project?
25
+ - **Existing patterns** — Has the user already been doing this manually? What worked?
26
+
27
+ ## How To Have This Conversation
28
+
29
+ If the user already provided comprehensive context, verify understanding and move on. If the context is thin, ask one or two questions at a time.
30
+
31
+ Good questions:
32
+ - "Walk me through what you'd want this agent to do from start to finish."
33
+ - "What should it return when it's done?"
34
+ - "Does it need to modify files, or just analyze them?"
35
+ - "Should this work across all your projects, or just this one?"
36
+ - "Are there tools or services it needs access to?"
37
+
38
+ ## When To Move On
39
+
40
+ Move on when all of these are true:
41
+ - The task is clearly defined and self-contained
42
+ - The expected output format is understood
43
+ - Tool requirements are known
44
+ - The user confirms you understand their needs
45
+
46
+ Read `references/create-step-2-design.md`.
@@ -0,0 +1,181 @@
1
+ # Step 2: Design the Sub-Agent
2
+
3
+ Based on the conversation, design the sub-agent's configuration before writing anything.
4
+
5
+ ## Determine the Name
6
+
7
+ - Hyphen-case: lowercase letters, numbers, and hyphens only
8
+ - Descriptive of the role: `code-reviewer`, `test-runner`, `db-reader`
9
+ - Must be unique across all scopes the user cares about
10
+ - Max 64 characters
11
+
12
+ ## Choose the Scope
13
+
14
+ | Level | Path | When to use |
15
+ |-------|------|-------------|
16
+ | Project | `.claude/agents/` | Specific to this codebase, shareable via git |
17
+ | User | `~/.claude/agents/` | Available in all projects |
18
+ | Session | `--agents` CLI flag | One-off testing or automation scripts |
19
+
20
+ Project-level is ideal for team-shared sub-agents. User-level for personal workflow sub-agents.
21
+
22
+ ## Design the Frontmatter
23
+
24
+ ### Required Fields
25
+
26
+ | Field | Rules |
27
+ |-------|-------|
28
+ | `name` | Hyphen-case, unique, max 64 chars |
29
+ | `description` | When Claude should delegate to this sub-agent. Be specific. |
30
+
31
+ ### Tool Access
32
+
33
+ Decide the tool restriction strategy:
34
+
35
+ **Allowlist (recommended for restricted sub-agents):**
36
+ ```yaml
37
+ tools: Read, Grep, Glob, Bash
38
+ ```
39
+ Grants only the listed tools. Everything else is denied.
40
+
41
+ **Denylist (for slightly restricted sub-agents):**
42
+ ```yaml
43
+ disallowedTools: Write, Edit
44
+ ```
45
+ Inherits all tools from the main conversation, minus the listed ones.
46
+
47
+ **Full access (omit both fields):**
48
+ The sub-agent inherits all tools from the main conversation, including MCP tools.
49
+
50
+ Common tool sets:
51
+
52
+ | Role | Tools |
53
+ |------|-------|
54
+ | Read-only analyst | `Read, Grep, Glob` |
55
+ | Read-only with commands | `Read, Grep, Glob, Bash` |
56
+ | Code modifier | `Read, Grep, Glob, Edit, Write, Bash` |
57
+ | Full with LSP | `Read, Grep, Glob, Edit, Write, Bash, LSP` |
58
+
59
+ For fine-grained control (e.g., allow Bash but only for read-only SQL), use `hooks` with `PreToolUse` instead of tool restrictions.
60
+
61
+ ### Model Selection
62
+
63
+ | Value | When to use |
64
+ |-------|-------------|
65
+ | `haiku` | Fast, cheap tasks — exploration, simple analysis |
66
+ | `sonnet` | Balanced — code review, moderate analysis |
67
+ | `opus` | Complex reasoning — architectural decisions, nuanced review |
68
+ | `inherit` (default) | Match the main conversation's model |
69
+
70
+ Omitting `model` defaults to `inherit`.
71
+
72
+ ### Permission Mode
73
+
74
+ | Mode | Behavior | When to use |
75
+ |------|----------|-------------|
76
+ | `default` | Standard permission prompts | Most sub-agents |
77
+ | `acceptEdits` | Auto-accept file edits | Trusted code modifiers |
78
+ | `dontAsk` | Auto-deny prompts not pre-allowed | Background tasks |
79
+ | `bypassPermissions` | Skip all permission checks | Fully trusted automation |
80
+ | `plan` | Read-only exploration mode | Research sub-agents |
81
+
82
+ Use `default` unless there is a clear reason to change. `bypassPermissions` is dangerous — use only when the sub-agent's tools are already restricted.
83
+
84
+ ### Max Turns
85
+
86
+ Set `maxTurns` to limit how many agentic turns the sub-agent can take. Use for:
87
+ - Preventing runaway sub-agents
88
+ - Bounding cost on expensive models
89
+ - Ensuring quick responses for simple tasks
90
+
91
+ Omit for no limit (the sub-agent runs until it finishes or hits context limits).
92
+
93
+ ### Skills Preloading
94
+
95
+ List skills to inject into the sub-agent's context at startup:
96
+
97
+ ```yaml
98
+ skills:
99
+ - api-conventions
100
+ - error-handling-patterns
101
+ ```
102
+
103
+ Key facts about `skills`:
104
+ - The **full content** of each skill is injected — not just the description
105
+ - Sub-agents **do not inherit** any skills from the parent conversation
106
+ - Sub-agents **cannot invoke the Skill tool** — preloading is the only way to give them skill content
107
+ - `context: fork` on a preloaded skill is ignored — the content is injected as reference material, not executed as a task
108
+
109
+ Use skills preloading when the sub-agent needs domain knowledge, conventions, or patterns captured in existing skills.
110
+
111
+ ### MCP Servers
112
+
113
+ Grant access to MCP servers:
114
+
115
+ ```yaml
116
+ mcpServers:
117
+ - slack
118
+ - name: custom-db
119
+ command: npx
120
+ args: ["-y", "@my/db-server"]
121
+ ```
122
+
123
+ Each entry is either a server name (referencing an already-configured server) or an inline definition. MCP tools are unavailable in background sub-agents.
124
+
125
+ ### Memory
126
+
127
+ Enable persistent cross-session memory:
128
+
129
+ ```yaml
130
+ memory: project
131
+ ```
132
+
133
+ | Scope | Location | When to use |
134
+ |-------|----------|-------------|
135
+ | `user` | `~/.claude/agent-memory/<name>/` | Knowledge applies across all projects |
136
+ | `project` | `.claude/agent-memory/<name>/` | Project-specific, shareable via git |
137
+ | `local` | `.claude/agent-memory-local/<name>/` | Project-specific, private |
138
+
139
+ When enabled, the system auto-includes the first 200 lines of `MEMORY.md` and enables Read, Write, Edit for the memory directory. Include memory instructions in the system prompt.
140
+
141
+ ### Hooks
142
+
143
+ Define lifecycle hooks scoped to the sub-agent:
144
+
145
+ ```yaml
146
+ hooks:
147
+ PreToolUse:
148
+ - matcher: "Bash"
149
+ hooks:
150
+ - type: command
151
+ command: "./scripts/validate-command.sh"
152
+ PostToolUse:
153
+ - matcher: "Edit|Write"
154
+ hooks:
155
+ - type: command
156
+ command: "./scripts/run-linter.sh"
157
+ ```
158
+
159
+ Supported events in sub-agent frontmatter:
160
+ - `PreToolUse` — validate before tool execution
161
+ - `PostToolUse` — react after tool execution
162
+ - `Stop` — runs when the sub-agent finishes (converted to `SubagentStop` at runtime)
163
+
164
+ Hook commands receive JSON via stdin with the tool input. Exit code 2 blocks the operation.
165
+
166
+ ## Confirm With the User
167
+
168
+ Present the complete design:
169
+ - Name and scope
170
+ - Description
171
+ - Tool access strategy
172
+ - Model choice
173
+ - Permission mode
174
+ - Skills to preload (if any)
175
+ - Memory scope (if any)
176
+ - Hooks (if any)
177
+ - MCP servers (if any)
178
+
179
+ Ask: "Does this design look right?"
180
+
181
+ Read `references/create-step-3-write.md` after confirmation.
@@ -0,0 +1,154 @@
1
+ # Step 3: Write the System Prompt
2
+
3
+ Write the sub-agent's markdown file. The frontmatter provides configuration; the body IS the system prompt.
4
+
5
+ ## The Fundamental Difference From Skills
6
+
7
+ A skill's body is instructions Claude follows step-by-step. A sub-agent's body is a system prompt that shapes behavior for the entire execution. This changes what to include.
8
+
9
+ **Skills:** "Parse the file. Validate the schema. Output the result."
10
+ **Sub-agents:** "You are a schema validator. When invoked, analyze files for schema compliance and report violations by severity."
11
+
12
+ ## System Prompt Structure
13
+
14
+ Effective sub-agent prompts follow this general structure:
15
+
16
+ ### 1. Role Statement
17
+
18
+ One or two sentences establishing the sub-agent's identity and expertise.
19
+
20
+ ```markdown
21
+ You are a senior code reviewer ensuring high standards of code quality and security.
22
+ ```
23
+
24
+ Keep it concise. Do not write a paragraph about the sub-agent's background.
25
+
26
+ ### 2. Trigger Behavior
27
+
28
+ What the sub-agent does when invoked. Use a numbered list of concrete steps.
29
+
30
+ ```markdown
31
+ When invoked:
32
+ 1. Run git diff to see recent changes
33
+ 2. Focus on modified files
34
+ 3. Begin review immediately
35
+ ```
36
+
37
+ ### 3. Domain Knowledge
38
+
39
+ Include only what a fresh Claude instance would NOT know:
40
+ - Project-specific conventions
41
+ - Internal tool usage
42
+ - Non-obvious workflows
43
+ - Domain-specific terminology or patterns
44
+
45
+ Omit standard programming knowledge, common tool flags, and obvious best practices.
46
+
47
+ ### 4. Constraints and Boundaries
48
+
49
+ What the sub-agent should NOT do, stated positively:
50
+
51
+ ```markdown
52
+ Focus only on files within your domain's ownership zone.
53
+ Coordinate with the team lead for cross-domain changes.
54
+ ```
55
+
56
+ ### 5. Output Format
57
+
58
+ Define what the sub-agent returns. This is critical — without output guidance, sub-agents may return verbose dumps.
59
+
60
+ ```markdown
61
+ Return a structured review with:
62
+ - Critical issues (must fix)
63
+ - Warnings (should fix)
64
+ - Suggestions (consider improving)
65
+
66
+ Include specific code examples for each issue.
67
+ ```
68
+
69
+ For sub-agents used by automation or teams, enforce minimal output:
70
+ ```markdown
71
+ Return ONLY a status line. All details go in the task file.
72
+
73
+ Success: `Task complete: T005-feature.md`
74
+ Blocked: `Blocked: T005 - [one-line reason]`
75
+ ```
76
+
77
+ ## Writing Style
78
+
79
+ ### Imperative and Direct
80
+
81
+ State what to do, not what might be done.
82
+
83
+ | Vague | Direct |
84
+ |-------|--------|
85
+ | "You might want to check for..." | "Check for..." |
86
+ | "It could be helpful to..." | "Analyze..." |
87
+ | "Consider looking at..." | "Inspect..." |
88
+
89
+ ### Positive Framing
90
+
91
+ Tell the sub-agent what TO do.
92
+
93
+ | Negative | Positive |
94
+ |----------|----------|
95
+ | "Don't return verbose output" | "Return concise summaries" |
96
+ | "Avoid modifying files outside your domain" | "Only modify files within your domain" |
97
+ | "Never skip tests" | "Always run tests before reporting" |
98
+
99
+ ### Public vs Tribal Knowledge
100
+
101
+ Both the agent writing this and the agent executing it are Claude.
102
+
103
+ **Public knowledge — state WHAT, not HOW:**
104
+ - "Run the test suite" — not the exact test command with flags
105
+ - "Check for security vulnerabilities" — not a list of OWASP categories Claude already knows
106
+ - "Use git to find recent changes" — not the exact git diff command
107
+
108
+ **Tribal knowledge — include specifics:**
109
+ - "Run `make dev` to start the dev server (logs go to `.dev-logs/`)"
110
+ - "Auth requires Clerk test credentials: email `test+clerk_test@yourdomain.com`, code `424242`"
111
+ - "The event bus is async — always await dispatches or tests flake"
112
+
113
+ ### Size Guidance
114
+
115
+ Sub-agent prompts are single files. Target length depends on complexity:
116
+
117
+ | Complexity | Target |
118
+ |---|---|
119
+ | Simple focused task | 20-50 lines |
120
+ | Moderate with domain knowledge | 50-100 lines |
121
+ | Complex domain specialist | 100-200 lines |
122
+
123
+ Over 200 lines — consider whether the sub-agent's scope is too broad. Split into multiple sub-agents or use the `skills` frontmatter to offload domain knowledge into preloaded skills.
124
+
125
+ ## Memory Instructions
126
+
127
+ If memory is enabled, include instructions in the prompt:
128
+
129
+ ```markdown
130
+ **On startup, read your memory file at the memory directory.**
131
+ Update it when you learn patterns, conventions, or gotchas
132
+ that would help future sessions. Keep it under 100 lines.
133
+ Remove entries that are no longer accurate.
134
+ ```
135
+
136
+ ## Team Coordination Instructions
137
+
138
+ If this sub-agent will be part of agent teams, include team context:
139
+
140
+ ```markdown
141
+ You are part of a team coordinated by a team lead.
142
+ - Use SendMessage to communicate with teammates by name
143
+ - Mark tasks as completed via TaskUpdate when finished
144
+ - After completing a task, check TaskList for available work
145
+ - Only modify files within your domain's ownership zone
146
+ ```
147
+
148
+ ## Write the File
149
+
150
+ With these principles applied, write the complete `.md` file now:
151
+ 1. YAML frontmatter with all designed configuration
152
+ 2. System prompt body following the structure above
153
+
154
+ Read `references/create-step-4-review.md` when the file is written.
@@ -0,0 +1,67 @@
1
+ # Step 4: Review
2
+
3
+ Review the sub-agent file before proceeding. Fix issues now.
4
+
5
+ ## Public Knowledge Audit
6
+
7
+ Go through the system prompt and find each:
8
+ - Code block or CLI command
9
+ - API call or library usage
10
+ - Specific implementation detail
11
+
12
+ For EACH one, ask: "Would a fresh Claude instance know how to do this?"
13
+
14
+ - If yes: replace with a high-level instruction.
15
+ - If no: keep it — this is tribal knowledge and belongs in the prompt.
16
+
17
+ ## Self-Review Checklist
18
+
19
+ ### Frontmatter
20
+
21
+ - [ ] `name` is hyphen-case, matches intended filename (minus `.md`)
22
+ - [ ] `description` clearly states WHEN Claude should delegate to this sub-agent
23
+ - [ ] `tools` grants only what the sub-agent needs (not inheriting everything by default unless intentional)
24
+ - [ ] `model` is appropriate for the task complexity
25
+ - [ ] `permissionMode` is justified (default unless there's a reason otherwise)
26
+ - [ ] `skills` lists only skills that exist and that the sub-agent genuinely needs
27
+ - [ ] `memory` scope matches where the knowledge should persist
28
+ - [ ] No conflicting fields (`tools` and `disallowedTools` should not both be present)
29
+
30
+ ### System Prompt Quality
31
+
32
+ - [ ] Role statement is concise (1-2 sentences, not a paragraph)
33
+ - [ ] Clear trigger behavior — "When invoked, do X"
34
+ - [ ] Output format is explicitly defined
35
+ - [ ] Contains only tribal knowledge, not public knowledge Claude already has
36
+ - [ ] Constraints stated positively ("Only modify X" not "Don't modify Y")
37
+ - [ ] No second person ("You should check..." should be "Check...")
38
+ - [ ] No hedging ("Maybe consider..." should be "Analyze...")
39
+ - [ ] Size is appropriate (not over 200 lines for non-specialist agents)
40
+
41
+ ### Scope and Focus
42
+
43
+ - [ ] The sub-agent has ONE clear job
44
+ - [ ] The prompt doesn't contain branching workflows (use a skill for that)
45
+ - [ ] Tool access matches the job — a reviewer doesn't have Write access
46
+ - [ ] If memory is enabled, memory instructions are in the prompt
47
+
48
+ ### Integration
49
+
50
+ - [ ] Description doesn't overlap with existing sub-agents (check with find script)
51
+ - [ ] Name doesn't conflict with existing sub-agents at the same or higher scope
52
+ - [ ] If using `skills`, those skills exist at a location the sub-agent can access
53
+
54
+ ## Run Validation
55
+
56
+ ```bash
57
+ node ~/.claude/skills/creating-sub-agents/scripts/validate-subagent.js [agent-file-path]
58
+ ```
59
+
60
+ Handle results:
61
+ - **Errors:** Fix each one, re-run validation, repeat until passing
62
+ - **Warnings:** Evaluate and fix most of them
63
+ - **Info:** Review — may be acceptable
64
+
65
+ Only proceed when validation passes and self-review is clean.
66
+
67
+ Read `references/create-step-5-install.md` when review passes.