@kurokeita/add-skill 0.0.1-ci-fix-npm-publish.1
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.
Potentially problematic release.
This version of @kurokeita/add-skill might be problematic. Click here for more details.
- package/dist/bin/skills.js +12 -0
- package/dist/skills/agent-identifier/SKILL.md +431 -0
- package/dist/skills/agent-identifier/examples/agent-creation-prompt.md +247 -0
- package/dist/skills/agent-identifier/examples/complete-agent-examples.md +432 -0
- package/dist/skills/agent-identifier/references/agent-creation-system-prompt.md +215 -0
- package/dist/skills/agent-identifier/references/system-prompt-design.md +419 -0
- package/dist/skills/agent-identifier/references/triggering-examples.md +508 -0
- package/dist/skills/agent-identifier/scripts/validate-agent.sh +217 -0
- package/dist/skills/changelog-automation/SKILL.md +554 -0
- package/dist/skills/code-review-excellence/SKILL.md +525 -0
- package/dist/skills/component-refactoring/SKILL.md +492 -0
- package/dist/skills/component-refactoring/references/complexity-patterns.md +493 -0
- package/dist/skills/component-refactoring/references/component-splitting.md +477 -0
- package/dist/skills/component-refactoring/references/hook-extraction.md +317 -0
- package/dist/skills/context7-guidelines/SKILL.md +31 -0
- package/dist/skills/feature-design-assistant/SKILL.md +371 -0
- package/dist/skills/find-bugs/SKILL.md +75 -0
- package/dist/skills/frontend-design/SKILL.md +45 -0
- package/dist/skills/go-concurrency-patterns/SKILL.md +657 -0
- package/dist/skills/markdown-compliance/SKILL.md +103 -0
- package/dist/skills/react-native-async-patterns/SKILL.md +256 -0
- package/dist/skills/react-native-performance/SKILL.md +425 -0
- package/dist/skills/react-native-testing/SKILL.md +458 -0
- package/dist/skills/react-native-zustand-patterns/SKILL.md +343 -0
- package/dist/skills/serena-file-processing/SKILL.md +47 -0
- package/dist/skills/skill-creator/SKILL.md +385 -0
- package/dist/skills/skill-creator/scripts/init_skill.cjs +235 -0
- package/dist/skills/skill-creator/scripts/package_skill.cjs +84 -0
- package/dist/skills/skill-creator/scripts/validate_skill.cjs +127 -0
- package/dist/skills/skill-development/SKILL.md +676 -0
- package/dist/skills/skill-development/references/skill-creator-original.md +210 -0
- package/dist/skills/sql-optimization-patterns/SKILL.md +509 -0
- package/dist/skills/test-driven-development/SKILL.md +389 -0
- package/dist/skills/test-driven-development/testing-anti-patterns.md +316 -0
- package/dist/skills/vercel-react-best-practices/AGENTS.md +2410 -0
- package/dist/skills/vercel-react-best-practices/SKILL.md +127 -0
- package/dist/skills/vercel-react-best-practices/rules/advanced-event-handler-refs.md +55 -0
- package/dist/skills/vercel-react-best-practices/rules/advanced-use-latest.md +49 -0
- package/dist/skills/vercel-react-best-practices/rules/async-api-routes.md +38 -0
- package/dist/skills/vercel-react-best-practices/rules/async-defer-await.md +80 -0
- package/dist/skills/vercel-react-best-practices/rules/async-dependencies.md +36 -0
- package/dist/skills/vercel-react-best-practices/rules/async-parallel.md +28 -0
- package/dist/skills/vercel-react-best-practices/rules/async-suspense-boundaries.md +99 -0
- package/dist/skills/vercel-react-best-practices/rules/bundle-barrel-imports.md +59 -0
- package/dist/skills/vercel-react-best-practices/rules/bundle-conditional.md +31 -0
- package/dist/skills/vercel-react-best-practices/rules/bundle-defer-third-party.md +49 -0
- package/dist/skills/vercel-react-best-practices/rules/bundle-dynamic-imports.md +35 -0
- package/dist/skills/vercel-react-best-practices/rules/bundle-preload.md +50 -0
- package/dist/skills/vercel-react-best-practices/rules/client-event-listeners.md +74 -0
- package/dist/skills/vercel-react-best-practices/rules/client-localstorage-schema.md +71 -0
- package/dist/skills/vercel-react-best-practices/rules/client-passive-event-listeners.md +48 -0
- package/dist/skills/vercel-react-best-practices/rules/client-swr-dedup.md +56 -0
- package/dist/skills/vercel-react-best-practices/rules/js-batch-dom-css.md +82 -0
- package/dist/skills/vercel-react-best-practices/rules/js-cache-function-results.md +80 -0
- package/dist/skills/vercel-react-best-practices/rules/js-cache-property-access.md +28 -0
- package/dist/skills/vercel-react-best-practices/rules/js-cache-storage.md +70 -0
- package/dist/skills/vercel-react-best-practices/rules/js-combine-iterations.md +32 -0
- package/dist/skills/vercel-react-best-practices/rules/js-early-exit.md +50 -0
- package/dist/skills/vercel-react-best-practices/rules/js-hoist-regexp.md +45 -0
- package/dist/skills/vercel-react-best-practices/rules/js-index-maps.md +37 -0
- package/dist/skills/vercel-react-best-practices/rules/js-length-check-first.md +50 -0
- package/dist/skills/vercel-react-best-practices/rules/js-min-max-loop.md +82 -0
- package/dist/skills/vercel-react-best-practices/rules/js-set-map-lookups.md +24 -0
- package/dist/skills/vercel-react-best-practices/rules/js-tosorted-immutable.md +57 -0
- package/dist/skills/vercel-react-best-practices/rules/rendering-activity.md +26 -0
- package/dist/skills/vercel-react-best-practices/rules/rendering-animate-svg-wrapper.md +47 -0
- package/dist/skills/vercel-react-best-practices/rules/rendering-conditional-render.md +40 -0
- package/dist/skills/vercel-react-best-practices/rules/rendering-content-visibility.md +38 -0
- package/dist/skills/vercel-react-best-practices/rules/rendering-hoist-jsx.md +46 -0
- package/dist/skills/vercel-react-best-practices/rules/rendering-hydration-no-flicker.md +82 -0
- package/dist/skills/vercel-react-best-practices/rules/rendering-svg-precision.md +28 -0
- package/dist/skills/vercel-react-best-practices/rules/rerender-defer-reads.md +39 -0
- package/dist/skills/vercel-react-best-practices/rules/rerender-dependencies.md +45 -0
- package/dist/skills/vercel-react-best-practices/rules/rerender-derived-state.md +29 -0
- package/dist/skills/vercel-react-best-practices/rules/rerender-functional-setstate.md +74 -0
- package/dist/skills/vercel-react-best-practices/rules/rerender-lazy-state-init.md +58 -0
- package/dist/skills/vercel-react-best-practices/rules/rerender-memo.md +44 -0
- package/dist/skills/vercel-react-best-practices/rules/rerender-transitions.md +40 -0
- package/dist/skills/vercel-react-best-practices/rules/server-after-nonblocking.md +73 -0
- package/dist/skills/vercel-react-best-practices/rules/server-cache-lru.md +41 -0
- package/dist/skills/vercel-react-best-practices/rules/server-cache-react.md +76 -0
- package/dist/skills/vercel-react-best-practices/rules/server-parallel-fetching.md +83 -0
- package/dist/skills/vercel-react-best-practices/rules/server-serialization.md +38 -0
- package/dist/skills/web-design-guidelines/SKILL.md +40 -0
- package/dist/skills/workflow-patterns/SKILL.md +623 -0
- package/dist/src/commands/add.js +116 -0
- package/dist/src/commands/list.js +31 -0
- package/package.json +53 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
import { addSkill } from "../src/commands/add.js";
|
|
4
|
+
import { listSkills } from "../src/commands/list.js";
|
|
5
|
+
const program = new Command();
|
|
6
|
+
program.name("skills").description("CLI to manage AI skills").version("1.0.0");
|
|
7
|
+
program.command("list").description("List available skills").action(listSkills);
|
|
8
|
+
program
|
|
9
|
+
.command("add")
|
|
10
|
+
.description("Add skills to platforms (Interactive)")
|
|
11
|
+
.action(addSkill);
|
|
12
|
+
program.parse();
|
|
@@ -0,0 +1,431 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Agent Development
|
|
3
|
+
description: 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.
|
|
4
|
+
version: 0.1.0
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Agent Development for Claude Code Plugins
|
|
8
|
+
|
|
9
|
+
## Overview
|
|
10
|
+
|
|
11
|
+
Agents are autonomous subprocesses that handle complex, multi-step tasks independently. Understanding agent structure, triggering conditions, and system prompt design enables creating powerful autonomous capabilities.
|
|
12
|
+
|
|
13
|
+
**Key concepts:**
|
|
14
|
+
|
|
15
|
+
- Agents are FOR autonomous work, commands are FOR user-initiated actions
|
|
16
|
+
- Markdown file format with YAML frontmatter
|
|
17
|
+
- Triggering via description field with examples
|
|
18
|
+
- System prompt defines agent behavior
|
|
19
|
+
- Model and color customization
|
|
20
|
+
|
|
21
|
+
## Agent File Structure
|
|
22
|
+
|
|
23
|
+
### Complete Format
|
|
24
|
+
|
|
25
|
+
```markdown
|
|
26
|
+
---
|
|
27
|
+
name: agent-identifier
|
|
28
|
+
description: Use this agent when [triggering conditions]. Examples:
|
|
29
|
+
|
|
30
|
+
<example>
|
|
31
|
+
Context: [Situation description]
|
|
32
|
+
user: "[User request]"
|
|
33
|
+
assistant: "[How assistant should respond and use this agent]"
|
|
34
|
+
<commentary>
|
|
35
|
+
[Why this agent should be triggered]
|
|
36
|
+
</commentary>
|
|
37
|
+
</example>
|
|
38
|
+
|
|
39
|
+
<example>
|
|
40
|
+
[Additional example...]
|
|
41
|
+
</example>
|
|
42
|
+
|
|
43
|
+
model: inherit
|
|
44
|
+
color: blue
|
|
45
|
+
tools: ["Read", "Write", "Grep"]
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
You are [agent role description]...
|
|
49
|
+
|
|
50
|
+
**Your Core Responsibilities:**
|
|
51
|
+
1. [Responsibility 1]
|
|
52
|
+
2. [Responsibility 2]
|
|
53
|
+
|
|
54
|
+
**Analysis Process:**
|
|
55
|
+
[Step-by-step workflow]
|
|
56
|
+
|
|
57
|
+
**Output Format:**
|
|
58
|
+
[What to return]
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Frontmatter Fields
|
|
62
|
+
|
|
63
|
+
### name (required)
|
|
64
|
+
|
|
65
|
+
Agent identifier used for namespacing and invocation.
|
|
66
|
+
|
|
67
|
+
**Format:** lowercase, numbers, hyphens only
|
|
68
|
+
**Length:** 3-50 characters
|
|
69
|
+
**Pattern:** Must start and end with alphanumeric
|
|
70
|
+
|
|
71
|
+
**Good examples:**
|
|
72
|
+
|
|
73
|
+
- `code-reviewer`
|
|
74
|
+
- `test-generator`
|
|
75
|
+
- `api-docs-writer`
|
|
76
|
+
- `security-analyzer`
|
|
77
|
+
|
|
78
|
+
**Bad examples:**
|
|
79
|
+
|
|
80
|
+
- `helper` (too generic)
|
|
81
|
+
- `-agent-` (starts/ends with hyphen)
|
|
82
|
+
- `my_agent` (underscores not allowed)
|
|
83
|
+
- `ag` (too short, < 3 chars)
|
|
84
|
+
|
|
85
|
+
### description (required)
|
|
86
|
+
|
|
87
|
+
Defines when Claude should trigger this agent. **This is the most critical field.**
|
|
88
|
+
|
|
89
|
+
**Must include:**
|
|
90
|
+
|
|
91
|
+
1. Triggering conditions ("Use this agent when...")
|
|
92
|
+
2. Multiple `<example>` blocks showing usage
|
|
93
|
+
3. Context, user request, and assistant response in each example
|
|
94
|
+
4. `<commentary>` explaining why agent triggers
|
|
95
|
+
|
|
96
|
+
**Format:**
|
|
97
|
+
|
|
98
|
+
```
|
|
99
|
+
Use this agent when [conditions]. Examples:
|
|
100
|
+
|
|
101
|
+
<example>
|
|
102
|
+
Context: [Scenario description]
|
|
103
|
+
user: "[What user says]"
|
|
104
|
+
assistant: "[How Claude should respond]"
|
|
105
|
+
<commentary>
|
|
106
|
+
[Why this agent is appropriate]
|
|
107
|
+
</commentary>
|
|
108
|
+
</example>
|
|
109
|
+
|
|
110
|
+
[More examples...]
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
**Best practices:**
|
|
114
|
+
|
|
115
|
+
- Include 2-4 concrete examples
|
|
116
|
+
- Show proactive and reactive triggering
|
|
117
|
+
- Cover different phrasings of same intent
|
|
118
|
+
- Explain reasoning in commentary
|
|
119
|
+
- Be specific about when NOT to use the agent
|
|
120
|
+
|
|
121
|
+
### model (required)
|
|
122
|
+
|
|
123
|
+
Which model the agent should use.
|
|
124
|
+
|
|
125
|
+
**Options:**
|
|
126
|
+
|
|
127
|
+
- `inherit` - Use same model as parent (recommended)
|
|
128
|
+
- `sonnet` - Claude Sonnet (balanced)
|
|
129
|
+
- `opus` - Claude Opus (most capable, expensive)
|
|
130
|
+
- `haiku` - Claude Haiku (fast, cheap)
|
|
131
|
+
|
|
132
|
+
**Recommendation:** Use `inherit` unless agent needs specific model capabilities.
|
|
133
|
+
|
|
134
|
+
### color (required)
|
|
135
|
+
|
|
136
|
+
Visual identifier for agent in UI.
|
|
137
|
+
|
|
138
|
+
**Options:** `blue`, `cyan`, `green`, `yellow`, `magenta`, `red`
|
|
139
|
+
|
|
140
|
+
**Guidelines:**
|
|
141
|
+
|
|
142
|
+
- Choose distinct colors for different agents in same plugin
|
|
143
|
+
- Use consistent colors for similar agent types
|
|
144
|
+
- Blue/cyan: Analysis, review
|
|
145
|
+
- Green: Success-oriented tasks
|
|
146
|
+
- Yellow: Caution, validation
|
|
147
|
+
- Red: Critical, security
|
|
148
|
+
- Magenta: Creative, generation
|
|
149
|
+
|
|
150
|
+
### tools (optional)
|
|
151
|
+
|
|
152
|
+
Restrict agent to specific tools.
|
|
153
|
+
|
|
154
|
+
**Format:** Array of tool names
|
|
155
|
+
|
|
156
|
+
```yaml
|
|
157
|
+
tools: ["Read", "Write", "Grep", "Bash"]
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
**Default:** If omitted, agent has access to all tools
|
|
161
|
+
|
|
162
|
+
**Best practice:** Limit tools to minimum needed (principle of least privilege)
|
|
163
|
+
|
|
164
|
+
**Common tool sets:**
|
|
165
|
+
|
|
166
|
+
- Read-only analysis: `["Read", "Grep", "Glob"]`
|
|
167
|
+
- Code generation: `["Read", "Write", "Grep"]`
|
|
168
|
+
- Testing: `["Read", "Bash", "Grep"]`
|
|
169
|
+
- Full access: Omit field or use `["*"]`
|
|
170
|
+
|
|
171
|
+
## System Prompt Design
|
|
172
|
+
|
|
173
|
+
The markdown body becomes the agent's system prompt. Write in second person, addressing the agent directly.
|
|
174
|
+
|
|
175
|
+
### Structure
|
|
176
|
+
|
|
177
|
+
**Standard template:**
|
|
178
|
+
|
|
179
|
+
```markdown
|
|
180
|
+
You are [role] specializing in [domain].
|
|
181
|
+
|
|
182
|
+
**Your Core Responsibilities:**
|
|
183
|
+
1. [Primary responsibility]
|
|
184
|
+
2. [Secondary responsibility]
|
|
185
|
+
3. [Additional responsibilities...]
|
|
186
|
+
|
|
187
|
+
**Analysis Process:**
|
|
188
|
+
1. [Step one]
|
|
189
|
+
2. [Step two]
|
|
190
|
+
3. [Step three]
|
|
191
|
+
[...]
|
|
192
|
+
|
|
193
|
+
**Quality Standards:**
|
|
194
|
+
- [Standard 1]
|
|
195
|
+
- [Standard 2]
|
|
196
|
+
|
|
197
|
+
**Output Format:**
|
|
198
|
+
Provide results in this format:
|
|
199
|
+
- [What to include]
|
|
200
|
+
- [How to structure]
|
|
201
|
+
|
|
202
|
+
**Edge Cases:**
|
|
203
|
+
Handle these situations:
|
|
204
|
+
- [Edge case 1]: [How to handle]
|
|
205
|
+
- [Edge case 2]: [How to handle]
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
### Best Practices
|
|
209
|
+
|
|
210
|
+
✅ **DO:**
|
|
211
|
+
|
|
212
|
+
- Write in second person ("You are...", "You will...")
|
|
213
|
+
- Be specific about responsibilities
|
|
214
|
+
- Provide step-by-step process
|
|
215
|
+
- Define output format
|
|
216
|
+
- Include quality standards
|
|
217
|
+
- Address edge cases
|
|
218
|
+
- Keep under 10,000 characters
|
|
219
|
+
|
|
220
|
+
❌ **DON'T:**
|
|
221
|
+
|
|
222
|
+
- Write in first person ("I am...", "I will...")
|
|
223
|
+
- Be vague or generic
|
|
224
|
+
- Omit process steps
|
|
225
|
+
- Leave output format undefined
|
|
226
|
+
- Skip quality guidance
|
|
227
|
+
- Ignore error cases
|
|
228
|
+
|
|
229
|
+
## Creating Agents
|
|
230
|
+
|
|
231
|
+
### Method 1: AI-Assisted Generation
|
|
232
|
+
|
|
233
|
+
Use this prompt pattern (extracted from Claude Code):
|
|
234
|
+
|
|
235
|
+
```
|
|
236
|
+
Create an agent configuration based on this request: "[YOUR DESCRIPTION]"
|
|
237
|
+
|
|
238
|
+
Requirements:
|
|
239
|
+
1. Extract core intent and responsibilities
|
|
240
|
+
2. Design expert persona for the domain
|
|
241
|
+
3. Create comprehensive system prompt with:
|
|
242
|
+
- Clear behavioral boundaries
|
|
243
|
+
- Specific methodologies
|
|
244
|
+
- Edge case handling
|
|
245
|
+
- Output format
|
|
246
|
+
4. Create identifier (lowercase, hyphens, 3-50 chars)
|
|
247
|
+
5. Write description with triggering conditions
|
|
248
|
+
6. Include 2-3 <example> blocks showing when to use
|
|
249
|
+
|
|
250
|
+
Return JSON with:
|
|
251
|
+
{
|
|
252
|
+
"identifier": "agent-name",
|
|
253
|
+
"whenToUse": "Use this agent when... Examples: <example>...</example>",
|
|
254
|
+
"systemPrompt": "You are..."
|
|
255
|
+
}
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
Then convert to agent file format with frontmatter.
|
|
259
|
+
|
|
260
|
+
See `examples/agent-creation-prompt.md` for complete template.
|
|
261
|
+
|
|
262
|
+
### Method 2: Manual Creation
|
|
263
|
+
|
|
264
|
+
1. Choose agent identifier (3-50 chars, lowercase, hyphens)
|
|
265
|
+
2. Write description with examples
|
|
266
|
+
3. Select model (usually `inherit`)
|
|
267
|
+
4. Choose color for visual identification
|
|
268
|
+
5. Define tools (if restricting access)
|
|
269
|
+
6. Write system prompt with structure above
|
|
270
|
+
7. Save as `agents/agent-name.md`
|
|
271
|
+
|
|
272
|
+
## Validation Rules
|
|
273
|
+
|
|
274
|
+
### Identifier Validation
|
|
275
|
+
|
|
276
|
+
```
|
|
277
|
+
✅ Valid: code-reviewer, test-gen, api-analyzer-v2
|
|
278
|
+
❌ Invalid: ag (too short), -start (starts with hyphen), my_agent (underscore)
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
**Rules:**
|
|
282
|
+
|
|
283
|
+
- 3-50 characters
|
|
284
|
+
- Lowercase letters, numbers, hyphens only
|
|
285
|
+
- Must start and end with alphanumeric
|
|
286
|
+
- No underscores, spaces, or special characters
|
|
287
|
+
|
|
288
|
+
### Description Validation
|
|
289
|
+
|
|
290
|
+
**Length:** 10-5,000 characters
|
|
291
|
+
**Must include:** Triggering conditions and examples
|
|
292
|
+
**Best:** 200-1,000 characters with 2-4 examples
|
|
293
|
+
|
|
294
|
+
### System Prompt Validation
|
|
295
|
+
|
|
296
|
+
**Length:** 20-10,000 characters
|
|
297
|
+
**Best:** 500-3,000 characters
|
|
298
|
+
**Structure:** Clear responsibilities, process, output format
|
|
299
|
+
|
|
300
|
+
## Agent Organization
|
|
301
|
+
|
|
302
|
+
### Plugin Agents Directory
|
|
303
|
+
|
|
304
|
+
```
|
|
305
|
+
plugin-name/
|
|
306
|
+
└── agents/
|
|
307
|
+
├── analyzer.md
|
|
308
|
+
├── reviewer.md
|
|
309
|
+
└── generator.md
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
All `.md` files in `agents/` are auto-discovered.
|
|
313
|
+
|
|
314
|
+
### Namespacing
|
|
315
|
+
|
|
316
|
+
Agents are namespaced automatically:
|
|
317
|
+
|
|
318
|
+
- Single plugin: `agent-name`
|
|
319
|
+
- With subdirectories: `plugin:subdir:agent-name`
|
|
320
|
+
|
|
321
|
+
## Testing Agents
|
|
322
|
+
|
|
323
|
+
### Test Triggering
|
|
324
|
+
|
|
325
|
+
Create test scenarios to verify agent triggers correctly:
|
|
326
|
+
|
|
327
|
+
1. Write agent with specific triggering examples
|
|
328
|
+
2. Use similar phrasing to examples in test
|
|
329
|
+
3. Check Claude loads the agent
|
|
330
|
+
4. Verify agent provides expected functionality
|
|
331
|
+
|
|
332
|
+
### Test System Prompt
|
|
333
|
+
|
|
334
|
+
Ensure system prompt is complete:
|
|
335
|
+
|
|
336
|
+
1. Give agent typical task
|
|
337
|
+
2. Check it follows process steps
|
|
338
|
+
3. Verify output format is correct
|
|
339
|
+
4. Test edge cases mentioned in prompt
|
|
340
|
+
5. Confirm quality standards are met
|
|
341
|
+
|
|
342
|
+
## Quick Reference
|
|
343
|
+
|
|
344
|
+
### Minimal Agent
|
|
345
|
+
|
|
346
|
+
```markdown
|
|
347
|
+
---
|
|
348
|
+
name: simple-agent
|
|
349
|
+
description: Use this agent when... Examples: <example>...</example>
|
|
350
|
+
model: inherit
|
|
351
|
+
color: blue
|
|
352
|
+
---
|
|
353
|
+
|
|
354
|
+
You are an agent that [does X].
|
|
355
|
+
|
|
356
|
+
Process:
|
|
357
|
+
1. [Step 1]
|
|
358
|
+
2. [Step 2]
|
|
359
|
+
|
|
360
|
+
Output: [What to provide]
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
### Frontmatter Fields Summary
|
|
364
|
+
|
|
365
|
+
| Field | Required | Format | Example |
|
|
366
|
+
|-------|----------|--------|---------|
|
|
367
|
+
| name | Yes | lowercase-hyphens | code-reviewer |
|
|
368
|
+
| description | Yes | Text + examples | Use when... <example>... |
|
|
369
|
+
| model | Yes | inherit/sonnet/opus/haiku | inherit |
|
|
370
|
+
| color | Yes | Color name | blue |
|
|
371
|
+
| tools | No | Array of tool names | ["Read", "Grep"] |
|
|
372
|
+
|
|
373
|
+
### Best Practices
|
|
374
|
+
|
|
375
|
+
**DO:**
|
|
376
|
+
|
|
377
|
+
- ✅ Include 2-4 concrete examples in description
|
|
378
|
+
- ✅ Write specific triggering conditions
|
|
379
|
+
- ✅ Use `inherit` for model unless specific need
|
|
380
|
+
- ✅ Choose appropriate tools (least privilege)
|
|
381
|
+
- ✅ Write clear, structured system prompts
|
|
382
|
+
- ✅ Test agent triggering thoroughly
|
|
383
|
+
|
|
384
|
+
**DON'T:**
|
|
385
|
+
|
|
386
|
+
- ❌ Use generic descriptions without examples
|
|
387
|
+
- ❌ Omit triggering conditions
|
|
388
|
+
- ❌ Give all agents same color
|
|
389
|
+
- ❌ Grant unnecessary tool access
|
|
390
|
+
- ❌ Write vague system prompts
|
|
391
|
+
- ❌ Skip testing
|
|
392
|
+
|
|
393
|
+
## Additional Resources
|
|
394
|
+
|
|
395
|
+
### Reference Files
|
|
396
|
+
|
|
397
|
+
For detailed guidance, consult:
|
|
398
|
+
|
|
399
|
+
- **`references/system-prompt-design.md`** - Complete system prompt patterns
|
|
400
|
+
- **`references/triggering-examples.md`** - Example formats and best practices
|
|
401
|
+
- **`references/agent-creation-system-prompt.md`** - The exact prompt from Claude Code
|
|
402
|
+
|
|
403
|
+
### Example Files
|
|
404
|
+
|
|
405
|
+
Working examples in `examples/`:
|
|
406
|
+
|
|
407
|
+
- **`agent-creation-prompt.md`** - AI-assisted agent generation template
|
|
408
|
+
- **`complete-agent-examples.md`** - Full agent examples for different use cases
|
|
409
|
+
|
|
410
|
+
### Utility Scripts
|
|
411
|
+
|
|
412
|
+
Development tools in `scripts/`:
|
|
413
|
+
|
|
414
|
+
- **`validate-agent.sh`** - Validate agent file structure
|
|
415
|
+
- **`test-agent-trigger.sh`** - Test if agent triggers correctly
|
|
416
|
+
|
|
417
|
+
## Implementation Workflow
|
|
418
|
+
|
|
419
|
+
To create an agent for a plugin:
|
|
420
|
+
|
|
421
|
+
1. Define agent purpose and triggering conditions
|
|
422
|
+
2. Choose creation method (AI-assisted or manual)
|
|
423
|
+
3. Create `agents/agent-name.md` file
|
|
424
|
+
4. Write frontmatter with all required fields
|
|
425
|
+
5. Write system prompt following best practices
|
|
426
|
+
6. Include 2-4 triggering examples in description
|
|
427
|
+
7. Validate with `scripts/validate-agent.sh`
|
|
428
|
+
8. Test triggering with real scenarios
|
|
429
|
+
9. Document agent in plugin README
|
|
430
|
+
|
|
431
|
+
Focus on clear triggering conditions and comprehensive system prompts for autonomous operation.
|
|
@@ -0,0 +1,247 @@
|
|
|
1
|
+
# AI-Assisted Agent Generation Template
|
|
2
|
+
|
|
3
|
+
Use this template to generate agents using Claude with the agent creation system prompt.
|
|
4
|
+
|
|
5
|
+
## Usage Pattern
|
|
6
|
+
|
|
7
|
+
### Step 1: Describe Your Agent Need
|
|
8
|
+
|
|
9
|
+
Think about:
|
|
10
|
+
|
|
11
|
+
- What task should the agent handle?
|
|
12
|
+
- When should it be triggered?
|
|
13
|
+
- Should it be proactive or reactive?
|
|
14
|
+
- What are the key responsibilities?
|
|
15
|
+
|
|
16
|
+
### Step 2: Use the Generation Prompt
|
|
17
|
+
|
|
18
|
+
Send this to Claude (with the agent-creation-system-prompt loaded):
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
Create an agent configuration based on this request: "[YOUR DESCRIPTION]"
|
|
22
|
+
|
|
23
|
+
Return ONLY the JSON object, no other text.
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
**Replace [YOUR DESCRIPTION] with your agent requirements.**
|
|
27
|
+
|
|
28
|
+
### Step 3: Claude Returns JSON
|
|
29
|
+
|
|
30
|
+
Claude will return:
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"identifier": "agent-name",
|
|
35
|
+
"whenToUse": "Use this agent when... Examples: <example>...</example>",
|
|
36
|
+
"systemPrompt": "You are... **Your Core Responsibilities:**..."
|
|
37
|
+
}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Step 4: Convert to Agent File
|
|
41
|
+
|
|
42
|
+
Create `agents/[identifier].md`:
|
|
43
|
+
|
|
44
|
+
```markdown
|
|
45
|
+
---
|
|
46
|
+
name: [identifier from JSON]
|
|
47
|
+
description: [whenToUse from JSON]
|
|
48
|
+
model: inherit
|
|
49
|
+
color: [choose: blue/cyan/green/yellow/magenta/red]
|
|
50
|
+
tools: ["Read", "Write", "Grep"] # Optional: restrict tools
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
[systemPrompt from JSON]
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Example 1: Code Review Agent
|
|
57
|
+
|
|
58
|
+
**Your request:**
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
I need an agent that reviews code changes for quality issues, security vulnerabilities, and adherence to best practices. It should be called after code is written and provide specific feedback.
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**Claude generates:**
|
|
65
|
+
|
|
66
|
+
```json
|
|
67
|
+
{
|
|
68
|
+
"identifier": "code-quality-reviewer",
|
|
69
|
+
"whenToUse": "Use this agent when the user has written code and needs quality review, or explicitly asks to review code changes. Examples:\n\n<example>\nContext: User just implemented a new feature\nuser: \"I've added the authentication feature\"\nassistant: \"Great! Let me review the code quality.\"\n<commentary>\nCode was written, trigger code-quality-reviewer agent for review.\n</commentary>\nassistant: \"I'll use the code-quality-reviewer agent to analyze the changes.\"\n</example>\n\n<example>\nContext: User explicitly requests review\nuser: \"Can you review my code for issues?\"\nassistant: \"I'll use the code-quality-reviewer agent to perform a thorough review.\"\n<commentary>\nExplicit review request triggers the agent.\n</commentary>\n</example>",
|
|
70
|
+
"systemPrompt": "You are an expert code quality reviewer specializing in identifying issues in software implementations.\n\n**Your Core Responsibilities:**\n1. Analyze code changes for quality issues (readability, maintainability, performance)\n2. Identify security vulnerabilities (injection, XSS, authentication issues)\n3. Check adherence to project best practices and coding standards\n4. Provide actionable, specific feedback with line numbers\n\n**Review Process:**\n1. Read the code changes using available tools\n2. Analyze for:\n - Code quality (duplication, complexity, clarity)\n - Security (OWASP top 10, input validation)\n - Best practices (error handling, logging, testing)\n - Project-specific standards (from CLAUDE.md)\n3. Identify issues with severity (critical/major/minor)\n4. Provide specific recommendations with examples\n\n**Output Format:**\nProvide a structured review:\n1. Summary (2-3 sentences)\n2. Critical Issues (must fix)\n3. Major Issues (should fix)\n4. Minor Issues (nice to fix)\n5. Positive observations\n6. Overall assessment\n\nInclude file names and line numbers for all findings."
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
**You create:**
|
|
75
|
+
|
|
76
|
+
File: `agents/code-quality-reviewer.md`
|
|
77
|
+
|
|
78
|
+
```markdown
|
|
79
|
+
---
|
|
80
|
+
name: code-quality-reviewer
|
|
81
|
+
description: Use this agent when the user has written code and needs quality review, or explicitly asks to review code changes. Examples:
|
|
82
|
+
|
|
83
|
+
<example>
|
|
84
|
+
Context: User just implemented a new feature
|
|
85
|
+
user: "I've added the authentication feature"
|
|
86
|
+
assistant: "Great! Let me review the code quality."
|
|
87
|
+
<commentary>
|
|
88
|
+
Code was written, trigger code-quality-reviewer agent for review.
|
|
89
|
+
</commentary>
|
|
90
|
+
assistant: "I'll use the code-quality-reviewer agent to analyze the changes."
|
|
91
|
+
</example>
|
|
92
|
+
|
|
93
|
+
<example>
|
|
94
|
+
Context: User explicitly requests review
|
|
95
|
+
user: "Can you review my code for issues?"
|
|
96
|
+
assistant: "I'll use the code-quality-reviewer agent to perform a thorough review."
|
|
97
|
+
<commentary>
|
|
98
|
+
Explicit review request triggers the agent.
|
|
99
|
+
</commentary>
|
|
100
|
+
</example>
|
|
101
|
+
|
|
102
|
+
model: inherit
|
|
103
|
+
color: blue
|
|
104
|
+
tools: ["Read", "Grep", "Glob"]
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
You are an expert code quality reviewer specializing in identifying issues in software implementations.
|
|
108
|
+
|
|
109
|
+
**Your Core Responsibilities:**
|
|
110
|
+
1. Analyze code changes for quality issues (readability, maintainability, performance)
|
|
111
|
+
2. Identify security vulnerabilities (injection, XSS, authentication issues)
|
|
112
|
+
3. Check adherence to project best practices and coding standards
|
|
113
|
+
4. Provide actionable, specific feedback with line numbers
|
|
114
|
+
|
|
115
|
+
**Review Process:**
|
|
116
|
+
1. Read the code changes using available tools
|
|
117
|
+
2. Analyze for:
|
|
118
|
+
- Code quality (duplication, complexity, clarity)
|
|
119
|
+
- Security (OWASP top 10, input validation)
|
|
120
|
+
- Best practices (error handling, logging, testing)
|
|
121
|
+
- Project-specific standards (from CLAUDE.md)
|
|
122
|
+
3. Identify issues with severity (critical/major/minor)
|
|
123
|
+
4. Provide specific recommendations with examples
|
|
124
|
+
|
|
125
|
+
**Output Format:**
|
|
126
|
+
Provide a structured review:
|
|
127
|
+
1. Summary (2-3 sentences)
|
|
128
|
+
2. Critical Issues (must fix)
|
|
129
|
+
3. Major Issues (should fix)
|
|
130
|
+
4. Minor Issues (nice to fix)
|
|
131
|
+
5. Positive observations
|
|
132
|
+
6. Overall assessment
|
|
133
|
+
|
|
134
|
+
Include file names and line numbers for all findings.
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Example 2: Test Generation Agent
|
|
138
|
+
|
|
139
|
+
**Your request:**
|
|
140
|
+
|
|
141
|
+
```
|
|
142
|
+
Create an agent that generates unit tests for code. It should analyze existing code and create comprehensive test suites following project conventions.
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
**Claude generates:**
|
|
146
|
+
|
|
147
|
+
```json
|
|
148
|
+
{
|
|
149
|
+
"identifier": "test-generator",
|
|
150
|
+
"whenToUse": "Use this agent when the user asks to generate tests, needs test coverage, or has written code that needs testing. Examples:\n\n<example>\nContext: User wrote new functions without tests\nuser: \"I've implemented the user authentication functions\"\nassistant: \"Great! Let me generate tests for these functions.\"\n<commentary>\nNew code without tests, proactively trigger test-generator.\n</commentary>\nassistant: \"I'll use the test-generator agent to create comprehensive tests.\"\n</example>",
|
|
151
|
+
"systemPrompt": "You are an expert test engineer specializing in creating comprehensive unit tests...\n\n**Your Core Responsibilities:**\n1. Analyze code to understand behavior\n2. Generate test cases covering happy paths and edge cases\n3. Follow project testing conventions\n4. Ensure high code coverage\n\n**Test Generation Process:**\n1. Read target code\n2. Identify testable units (functions, classes, methods)\n3. Design test cases (inputs, expected outputs, edge cases)\n4. Generate tests following project patterns\n5. Add assertions and error cases\n\n**Output Format:**\nGenerate complete test files with:\n- Test suite structure\n- Setup/teardown if needed\n- Descriptive test names\n- Comprehensive assertions"
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
**You create:** `agents/test-generator.md` with the structure above.
|
|
156
|
+
|
|
157
|
+
## Example 3: Documentation Agent
|
|
158
|
+
|
|
159
|
+
**Your request:**
|
|
160
|
+
|
|
161
|
+
```
|
|
162
|
+
Build an agent that writes and updates API documentation. It should analyze code and generate clear, comprehensive docs.
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
**Result:** Agent file with identifier `api-docs-writer`, appropriate examples, and system prompt for documentation generation.
|
|
166
|
+
|
|
167
|
+
## Tips for Effective Agent Generation
|
|
168
|
+
|
|
169
|
+
### Be Specific in Your Request
|
|
170
|
+
|
|
171
|
+
**Vague:**
|
|
172
|
+
|
|
173
|
+
```
|
|
174
|
+
"I need an agent that helps with code"
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
**Specific:**
|
|
178
|
+
|
|
179
|
+
```
|
|
180
|
+
"I need an agent that reviews pull requests for type safety issues in TypeScript, checking for proper type annotations, avoiding 'any', and ensuring correct generic usage"
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
### Include Triggering Preferences
|
|
184
|
+
|
|
185
|
+
Tell Claude when the agent should activate:
|
|
186
|
+
|
|
187
|
+
```
|
|
188
|
+
"Create an agent that generates tests. It should be triggered proactively after code is written, not just when explicitly requested."
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
### Mention Project Context
|
|
192
|
+
|
|
193
|
+
```
|
|
194
|
+
"Create a code review agent. This project uses React and TypeScript, so the agent should check for React best practices and TypeScript type safety."
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Define Output Expectations
|
|
198
|
+
|
|
199
|
+
```
|
|
200
|
+
"Create an agent that analyzes performance. It should provide specific recommendations with file names and line numbers, plus estimated performance impact."
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
## Validation After Generation
|
|
204
|
+
|
|
205
|
+
Always validate generated agents:
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
# Validate structure
|
|
209
|
+
./scripts/validate-agent.sh agents/your-agent.md
|
|
210
|
+
|
|
211
|
+
# Check triggering works
|
|
212
|
+
# Test with scenarios from examples
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
## Iterating on Generated Agents
|
|
216
|
+
|
|
217
|
+
If generated agent needs improvement:
|
|
218
|
+
|
|
219
|
+
1. Identify what's missing or wrong
|
|
220
|
+
2. Manually edit the agent file
|
|
221
|
+
3. Focus on:
|
|
222
|
+
- Better examples in description
|
|
223
|
+
- More specific system prompt
|
|
224
|
+
- Clearer process steps
|
|
225
|
+
- Better output format definition
|
|
226
|
+
4. Re-validate
|
|
227
|
+
5. Test again
|
|
228
|
+
|
|
229
|
+
## Advantages of AI-Assisted Generation
|
|
230
|
+
|
|
231
|
+
- **Comprehensive**: Claude includes edge cases and quality checks
|
|
232
|
+
- **Consistent**: Follows proven patterns
|
|
233
|
+
- **Fast**: Seconds vs manual writing
|
|
234
|
+
- **Examples**: Auto-generates triggering examples
|
|
235
|
+
- **Complete**: Provides full system prompt structure
|
|
236
|
+
|
|
237
|
+
## When to Edit Manually
|
|
238
|
+
|
|
239
|
+
Edit generated agents when:
|
|
240
|
+
|
|
241
|
+
- Need very specific project patterns
|
|
242
|
+
- Require custom tool combinations
|
|
243
|
+
- Want unique persona or style
|
|
244
|
+
- Integrating with existing agents
|
|
245
|
+
- Need precise triggering conditions
|
|
246
|
+
|
|
247
|
+
Start with generation, then refine manually for best results.
|