cc-dev-template 0.1.73 → 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 +1 -1
- package/src/commands/done.md +29 -2
- package/src/scripts/task-output-guard.js +4 -66
- package/src/skills/agent-browser/SKILL.md +0 -1
- package/src/skills/creating-agent-skills/references/create-step-1-understand.md +9 -0
- package/src/skills/creating-agent-skills/references/create-step-2-design.md +24 -0
- package/src/skills/creating-agent-skills/references/create-step-3-write.md +9 -0
- package/src/skills/creating-agent-skills/references/create-step-5-install.md +29 -5
- package/src/skills/creating-agent-skills/scripts/validate-skill.js +39 -13
- package/src/skills/creating-agent-skills/templates/router-skill.md +6 -51
- package/src/skills/creating-agent-skills/templates/simple-skill.md +0 -10
- package/src/skills/creating-sub-agents/SKILL.md +18 -0
- package/src/skills/creating-sub-agents/references/create-step-1-understand.md +46 -0
- package/src/skills/creating-sub-agents/references/create-step-2-design.md +181 -0
- package/src/skills/creating-sub-agents/references/create-step-3-write.md +154 -0
- package/src/skills/creating-sub-agents/references/create-step-4-review.md +67 -0
- package/src/skills/creating-sub-agents/references/create-step-5-install.md +76 -0
- package/src/skills/creating-sub-agents/references/fix-step-1-diagnose.md +99 -0
- package/src/skills/creating-sub-agents/references/fix-step-2-apply.md +77 -0
- package/src/skills/creating-sub-agents/references/fix-step-3-validate.md +52 -0
- package/src/skills/creating-sub-agents/references/principles.md +157 -0
- package/src/skills/creating-sub-agents/scripts/find-subagents.js +217 -0
- package/src/skills/creating-sub-agents/scripts/validate-subagent.js +336 -0
- package/src/skills/creating-sub-agents/templates/basic-subagent.md +21 -0
- package/src/skills/creating-sub-agents/templates/domain-specialist.md +52 -0
- package/src/skills/creating-sub-agents/templates/restricted-subagent.md +29 -0
package/package.json
CHANGED
package/src/commands/done.md
CHANGED
|
@@ -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.
|
|
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
|
-
**
|
|
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
|
|
12
|
-
*
|
|
13
|
-
*
|
|
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:
|
|
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
|
|
@@ -2,8 +2,17 @@
|
|
|
2
2
|
|
|
3
3
|
The skill's quality depends entirely on understanding the domain. Start a conversation with the user.
|
|
4
4
|
|
|
5
|
+
## Try It First
|
|
6
|
+
|
|
7
|
+
Before building a skill, the best approach is to do the task in a live conversation first. Iterate until Claude succeeds at the task, then extract the winning approach into the skill. This grounds the skill in something that actually worked rather than theoretical instructions.
|
|
8
|
+
|
|
9
|
+
Ask: "Have you already done this task successfully with Claude? Can you share that conversation or walk me through what worked?"
|
|
10
|
+
|
|
11
|
+
If the user has a working conversation, use it as the primary source material. If not, consider running the workflow live together before designing the skill.
|
|
12
|
+
|
|
5
13
|
## What To Uncover
|
|
6
14
|
|
|
15
|
+
- **2-3 concrete use cases** — specific scenarios where this skill would activate. What does the user want to accomplish?
|
|
7
16
|
- **The task** they want to standardize — what do they do repeatedly that they want encoded?
|
|
8
17
|
- **Domain knowledge** Claude does not naturally have — terminology, patterns, edge cases, gotchas
|
|
9
18
|
- **Why certain approaches work** — not just what the steps are, but the reasoning behind them
|
|
@@ -8,6 +8,7 @@ Based on what you learned in the conversation, design the skill's structure befo
|
|
|
8
8
|
- Prefer gerund form: `processing-pdfs`, `creating-reports`, `reviewing-code`
|
|
9
9
|
- Must match the directory name
|
|
10
10
|
- Max 64 characters
|
|
11
|
+
- Reserved prefixes: names starting with "claude" or "anthropic" are not allowed
|
|
11
12
|
|
|
12
13
|
## Determine the Skill Type
|
|
13
14
|
|
|
@@ -79,6 +80,12 @@ Every skill has YAML frontmatter. Required and optional fields:
|
|
|
79
80
|
| `context` | Set `fork` to run in an isolated sub-agent context |
|
|
80
81
|
| `agent` | Sub-agent type when `context: fork` is set (`Explore`, `Plan`, `general-purpose`, or custom) |
|
|
81
82
|
| `hooks` | Lifecycle hooks scoped to this skill |
|
|
83
|
+
| `compatibility` | Environment requirements — intended product, required system packages, network access needs (1-500 chars) |
|
|
84
|
+
|
|
85
|
+
### Security Restrictions
|
|
86
|
+
|
|
87
|
+
- No XML angle brackets (`<` or `>`) in frontmatter — frontmatter appears in Claude's system prompt
|
|
88
|
+
- Skill names starting with "claude" or "anthropic" are reserved
|
|
82
89
|
|
|
83
90
|
### String Substitutions Available in Skill Content
|
|
84
91
|
|
|
@@ -107,6 +114,8 @@ Combine into a description that:
|
|
|
107
114
|
|
|
108
115
|
**Key insight:** If the description explains too much about WHAT the skill does, Claude believes it already knows enough and will not activate. Keep it about WHEN.
|
|
109
116
|
|
|
117
|
+
**Negative triggers:** If the skill could over-trigger on related but wrong queries, add scope boundaries. Example: "Advanced data analysis for CSV files. Use for statistical modeling, regression, clustering. Do NOT use for simple data exploration or visualization."
|
|
118
|
+
|
|
110
119
|
### For User-Invoked Only Skills
|
|
111
120
|
|
|
112
121
|
The description just needs to tell the user what the skill does. Keep it minimal:
|
|
@@ -139,6 +148,8 @@ skill-name/
|
|
|
139
148
|
|
|
140
149
|
**When to add `templates/`:** Boilerplate files that get copied or modified by the agent.
|
|
141
150
|
|
|
151
|
+
**Do not add:** `README.md` inside the skill folder. All documentation goes in SKILL.md or `references/`.
|
|
152
|
+
|
|
142
153
|
## For Procedural Skills: Plan the Steps
|
|
143
154
|
|
|
144
155
|
List out the steps. Each step becomes one markdown file in `references/`. For each step, determine:
|
|
@@ -158,6 +169,19 @@ Present the design:
|
|
|
158
169
|
- File layout
|
|
159
170
|
- For procedural: the step breakdown
|
|
160
171
|
|
|
172
|
+
## Define Success Criteria
|
|
173
|
+
|
|
174
|
+
Before writing, establish how the user will know the skill is working:
|
|
175
|
+
|
|
176
|
+
- **Triggering**: Does it activate on relevant queries? (Aim for ~90% of intended triggers)
|
|
177
|
+
- **Precision**: Does it stay silent on unrelated queries?
|
|
178
|
+
- **Completeness**: Does the workflow complete without the user needing to redirect or clarify?
|
|
179
|
+
- **Consistency**: Do repeated runs produce structurally similar, quality results?
|
|
180
|
+
|
|
181
|
+
These are rough benchmarks, not precise thresholds. Ask the user: "What would a successful skill look like for you?"
|
|
182
|
+
|
|
183
|
+
## Confirm With the User
|
|
184
|
+
|
|
161
185
|
Ask: "Does this design look right?"
|
|
162
186
|
|
|
163
187
|
## Next Step
|
|
@@ -150,6 +150,15 @@ description: [third person, trigger phrases, WHEN not HOW]
|
|
|
150
150
|
|
|
151
151
|
Keep it minimal. Only include context that is needed at EVERY activation.
|
|
152
152
|
|
|
153
|
+
### Error Handling
|
|
154
|
+
|
|
155
|
+
If the skill involves tool calls, external services, or operations that can fail, include error handling guidance:
|
|
156
|
+
- Common failure modes and what to do about them
|
|
157
|
+
- MCP connection failures: verify server is connected, check authentication, test independently
|
|
158
|
+
- Validation failures: what to check, how to recover
|
|
159
|
+
|
|
160
|
+
For critical validations, bundle a script rather than relying on language instructions. Code is deterministic; language interpretation is not.
|
|
161
|
+
|
|
153
162
|
### MCP Tool References
|
|
154
163
|
|
|
155
164
|
When a skill uses MCP tools, use fully qualified names:
|
|
@@ -15,20 +15,44 @@ Copy the skill directory to the target location. Ensure all files are in place
|
|
|
15
15
|
|
|
16
16
|
## Test
|
|
17
17
|
|
|
18
|
-
Guide the user through testing:
|
|
18
|
+
Guide the user through structured testing:
|
|
19
|
+
|
|
20
|
+
### 1. Triggering Tests
|
|
21
|
+
|
|
22
|
+
Verify the skill loads at the right times.
|
|
23
|
+
|
|
24
|
+
**Should trigger** — test 3-5 phrases that should activate the skill:
|
|
25
|
+
- The obvious request (e.g., "help me plan this sprint")
|
|
26
|
+
- A paraphrased version (e.g., "I need to set up sprint tasks")
|
|
27
|
+
- A domain-specific variant (e.g., "create Linear tickets for Q4")
|
|
28
|
+
|
|
29
|
+
**Should NOT trigger** — test 2-3 unrelated queries:
|
|
30
|
+
- A clearly unrelated request
|
|
31
|
+
- A request in a similar domain that a different skill should handle
|
|
32
|
+
|
|
33
|
+
If the skill under-triggers: add more trigger phrases and keywords to the description.
|
|
34
|
+
If the skill over-triggers: add negative scope boundaries or be more specific.
|
|
35
|
+
|
|
36
|
+
### 2. Functional Tests
|
|
37
|
+
|
|
38
|
+
Verify the skill produces correct output:
|
|
19
39
|
|
|
20
40
|
1. Start a new Claude Code session (or restart the current one)
|
|
21
41
|
2. Test explicit invocation: type `/skill-name`
|
|
22
42
|
3. Test autonomous activation: say one of the trigger phrases from the description
|
|
23
|
-
4.
|
|
43
|
+
4. Run through the full workflow — does it complete without the user needing to redirect or clarify?
|
|
44
|
+
5. For skills with tool calls: verify calls succeed and outputs are correct
|
|
24
45
|
|
|
25
|
-
|
|
46
|
+
### 3. Iteration
|
|
26
47
|
|
|
27
|
-
|
|
48
|
+
If testing reveals issues, iterate immediately:
|
|
28
49
|
|
|
29
|
-
- Instructions wrong? Go back to the write step.
|
|
50
|
+
- Instructions unclear or wrong? Go back to the write step.
|
|
30
51
|
- Structure wrong? Go back to the design step.
|
|
31
52
|
- Domain knowledge missing? Go back to the understand step.
|
|
53
|
+
- Description under/over-triggers? Adjust the description and retest.
|
|
54
|
+
|
|
55
|
+
The job is not done until the skill works.
|
|
32
56
|
|
|
33
57
|
## Completion
|
|
34
58
|
|
|
@@ -118,6 +118,12 @@ if (!frontmatter.valid) {
|
|
|
118
118
|
addFinding('STRUCTURE', 'error',
|
|
119
119
|
`Name exceeds 64 characters (${frontmatter.data.name.length})`);
|
|
120
120
|
}
|
|
121
|
+
|
|
122
|
+
// Check reserved name prefixes
|
|
123
|
+
if (frontmatter.data.name.startsWith('claude') || frontmatter.data.name.startsWith('anthropic')) {
|
|
124
|
+
addFinding('STRUCTURE', 'error',
|
|
125
|
+
`Name "${frontmatter.data.name}" uses a reserved prefix ("claude" or "anthropic")`);
|
|
126
|
+
}
|
|
121
127
|
}
|
|
122
128
|
|
|
123
129
|
if (!frontmatter.data.description) {
|
|
@@ -153,6 +159,14 @@ if (!frontmatter.valid) {
|
|
|
153
159
|
'Long description without trigger phrases may reduce activation reliability');
|
|
154
160
|
}
|
|
155
161
|
}
|
|
162
|
+
|
|
163
|
+
// Check for XML angle brackets in frontmatter
|
|
164
|
+
if (frontmatter.raw && /[<>]/.test(frontmatter.raw)) {
|
|
165
|
+
addFinding('STRUCTURE', 'error',
|
|
166
|
+
'Frontmatter contains XML angle brackets (< >) — these are forbidden as frontmatter appears in system prompt',
|
|
167
|
+
null,
|
|
168
|
+
'Remove all < and > characters from frontmatter values');
|
|
169
|
+
}
|
|
156
170
|
}
|
|
157
171
|
|
|
158
172
|
// Check 3: Second person violations
|
|
@@ -162,8 +176,7 @@ const secondPersonPatterns = [
|
|
|
162
176
|
/\byou need\b/gi,
|
|
163
177
|
/\byou might\b/gi,
|
|
164
178
|
/\byou will\b/gi,
|
|
165
|
-
/\byou must\b/gi
|
|
166
|
-
/\byour\b/gi
|
|
179
|
+
/\byou must\b/gi
|
|
167
180
|
];
|
|
168
181
|
|
|
169
182
|
let secondPersonCount = 0;
|
|
@@ -229,26 +242,39 @@ if (negativeCount > 3) {
|
|
|
229
242
|
'Use positive framing: "Don\'t do X" → "Do Y instead"');
|
|
230
243
|
}
|
|
231
244
|
|
|
232
|
-
// Check 5:
|
|
245
|
+
// Check 5: Forbidden files
|
|
246
|
+
const readmePath = path.join(resolvedPath, 'README.md');
|
|
247
|
+
if (fs.existsSync(readmePath)) {
|
|
248
|
+
addFinding('STRUCTURE', 'warning',
|
|
249
|
+
'Skill folder contains README.md — all documentation should be in SKILL.md or references/',
|
|
250
|
+
null,
|
|
251
|
+
'Move README.md content into SKILL.md or references/ and delete README.md');
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
// Check 6: Body size
|
|
233
255
|
const wordCount = body.split(/\s+/).filter(w => w.length > 0).length;
|
|
234
256
|
const lineCount = body.split('\n').length;
|
|
235
257
|
|
|
236
258
|
if (wordCount > 5000) {
|
|
237
259
|
addFinding('SIZE', 'error',
|
|
238
|
-
`SKILL.md body is ${wordCount} words -
|
|
260
|
+
`SKILL.md body is ${wordCount} words - exceeds 5,000 word limit`,
|
|
239
261
|
null,
|
|
240
262
|
'Move detailed content to references/ directory');
|
|
241
|
-
} else if (wordCount >
|
|
263
|
+
} else if (wordCount > 2000) {
|
|
242
264
|
addFinding('SIZE', 'warning',
|
|
243
|
-
`SKILL.md body is ${wordCount} words -
|
|
265
|
+
`SKILL.md body is ${wordCount} words - consider moving content to references/`,
|
|
244
266
|
null,
|
|
245
|
-
'
|
|
246
|
-
}
|
|
247
|
-
|
|
248
|
-
|
|
267
|
+
'Keep SKILL.md focused; move detailed content to references/ directory');
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
if (lineCount > 300) {
|
|
271
|
+
addFinding('SIZE', 'warning',
|
|
272
|
+
`SKILL.md body is ${lineCount} lines - exceeds 300 line target for informational skills (150 for routers)`,
|
|
273
|
+
null,
|
|
274
|
+
'Move content to references/ to stay within size targets');
|
|
249
275
|
}
|
|
250
276
|
|
|
251
|
-
// Check
|
|
277
|
+
// Check 7: Progressive disclosure
|
|
252
278
|
const hasReferences = fs.existsSync(path.join(resolvedPath, 'references'));
|
|
253
279
|
const hasScripts = fs.existsSync(path.join(resolvedPath, 'scripts'));
|
|
254
280
|
|
|
@@ -259,7 +285,7 @@ if (wordCount > 2000 && !hasReferences) {
|
|
|
259
285
|
'Create references/ and move detailed content there');
|
|
260
286
|
}
|
|
261
287
|
|
|
262
|
-
// Check
|
|
288
|
+
// Check 8: Reference integrity
|
|
263
289
|
const referencePaths = body.match(/`references\/[^`]+`|references\/[\w.-]+/g) || [];
|
|
264
290
|
const scriptPaths = body.match(/`scripts\/[^`]+`|scripts\/[\w.-]+/g) || [];
|
|
265
291
|
|
|
@@ -283,7 +309,7 @@ for (const ref of scriptPaths) {
|
|
|
283
309
|
}
|
|
284
310
|
}
|
|
285
311
|
|
|
286
|
-
// Check
|
|
312
|
+
// Check 9: Unreferenced resources
|
|
287
313
|
if (hasReferences) {
|
|
288
314
|
const refDir = path.join(resolvedPath, 'references');
|
|
289
315
|
const refFiles = fs.readdirSync(refDir);
|
|
@@ -7,55 +7,10 @@ description: {{What it does}} Use when {{trigger conditions}}.
|
|
|
7
7
|
|
|
8
8
|
## What To Do Now
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
Ask the user what they need.
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
**Wait for response before proceeding.**
|
|
18
|
-
|
|
19
|
-
## Route to Workflow
|
|
20
|
-
|
|
21
|
-
| Response | Action |
|
|
22
|
-
|----------|--------|
|
|
23
|
-
| 1, "{{keywords}}" | Read `references/{{first-workflow}}.md` |
|
|
24
|
-
| 2, "{{keywords}}" | Read `references/{{second-workflow}}.md` |
|
|
25
|
-
| 3, "{{keywords}}" | Read `references/{{third-workflow}}.md` |
|
|
26
|
-
|
|
27
|
-
After reading the workflow, follow it exactly.
|
|
28
|
-
|
|
29
|
-
## Essential Principles
|
|
30
|
-
|
|
31
|
-
{{Principles that ALWAYS apply, regardless of which workflow runs}}
|
|
32
|
-
|
|
33
|
-
### 1. {{First principle}}
|
|
34
|
-
|
|
35
|
-
{{Explanation}}
|
|
36
|
-
|
|
37
|
-
### 2. {{Second principle}}
|
|
38
|
-
|
|
39
|
-
{{Explanation}}
|
|
40
|
-
|
|
41
|
-
### 3. {{Third principle}}
|
|
42
|
-
|
|
43
|
-
{{Explanation}}
|
|
44
|
-
|
|
45
|
-
## Quick Reference
|
|
46
|
-
|
|
47
|
-
{{Brief reference information always useful to have visible}}
|
|
48
|
-
|
|
49
|
-
## Resources
|
|
50
|
-
|
|
51
|
-
**References** (in `references/`):
|
|
52
|
-
- {{reference-1.md}} - {{purpose}}
|
|
53
|
-
- {{reference-2.md}} - {{purpose}}
|
|
54
|
-
|
|
55
|
-
**Workflows** (in `references/`):
|
|
56
|
-
|
|
57
|
-
| Workflow | Purpose |
|
|
58
|
-
|----------|---------|
|
|
59
|
-
| {{first-workflow}}.md | {{purpose}} |
|
|
60
|
-
| {{second-workflow}}.md | {{purpose}} |
|
|
61
|
-
| {{third-workflow}}.md | {{purpose}} |
|
|
12
|
+
| Intent | Action |
|
|
13
|
+
|--------|--------|
|
|
14
|
+
| {{First option}} | Read `references/{{first-workflow}}.md` |
|
|
15
|
+
| {{Second option}} | Read `references/{{second-workflow}}.md` |
|
|
16
|
+
| {{Third option}} | Read `references/{{third-workflow}}.md` |
|
|
@@ -22,13 +22,3 @@ description: {{What it does}} Use when {{trigger conditions}}.
|
|
|
22
22
|
### Step 3: {{Third action}}
|
|
23
23
|
|
|
24
24
|
{{Instructions for step 3}}
|
|
25
|
-
|
|
26
|
-
## Completion Checklist
|
|
27
|
-
|
|
28
|
-
{{Skill name}} is complete when:
|
|
29
|
-
|
|
30
|
-
```
|
|
31
|
-
- [ ] {{First success criterion}}
|
|
32
|
-
- [ ] {{Second success criterion}}
|
|
33
|
-
- [ ] {{Third success criterion}}
|
|
34
|
-
```
|
|
@@ -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`.
|