Skip to content

Commit 3ac8d5b

Browse files
sjnimsclaude
andauthored
docs: align agent example format with official Claude Code documentation (#119)
## Summary - Aligns all `<example>` blocks in agent development documentation and agents with the official Claude Code documentation format - Updates template and examples in `triggering-examples.md` - Updates documented template format in `agent-creator.md` - Converts two-assistant-line examples to single-assistant-line format in all 3 agents ## Problem Fixes #117 The plugin's internal documentation and agents were using a two-assistant-line example format that differed from the official Claude Code documentation: | Aspect | Official Docs | This Plugin (Before) | |--------|---------------|---------------------| | Assistant lines | 1 (invocation only) | 2 (response + invocation) | | Commentary position | After invocation | Between responses | ## Solution Aligned all examples with the official format: - Single assistant line showing the agent invocation - Commentary positioned after the assistant line ### Files Changed | File | Changes | |------|---------| | `triggering-examples.md` | Updated format template and all example types (Type 2, 3, 4, Template Library) | | `agent-creator.md` | Updated documented template format | | `plugin-validator.md` | Converted Examples 1, 3, 4 to single-line format | | `skill-reviewer.md` | Converted Example 1 to single-line format | ### Alternatives Considered Documenting the intentional difference rather than aligning was considered, but alignment with official documentation was chosen for: 1. Consistency with official Claude Code patterns 2. Reduced cognitive load for users referencing both sources 3. Simpler format that's sufficient for demonstrating triggers ## Testing - [x] All modified files pass markdownlint - [x] Examples follow official format structure - [x] No broken references --- 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude <noreply@anthropic.com>
1 parent ba5cdb8 commit 3ac8d5b

4 files changed

Lines changed: 29 additions & 65 deletions

File tree

plugins/plugin-dev/agents/agent-creator.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ When a user describes what they want an agent to do, you will:
6969
6. **Craft Triggering Examples**: Create 2-4 `<example>` blocks showing:
7070
- Different phrasings for same intent
7171
- Both explicit and proactive triggering
72-
- Context, user message, assistant response, commentary
72+
- Context, user message, assistant invocation, commentary
7373
- Why the agent should trigger in each scenario
7474
- Show assistant using the Agent tool to launch the agent
7575

@@ -85,11 +85,10 @@ When a user describes what they want an agent to do, you will:
8585
<example>
8686
Context: [Situation that should trigger agent]
8787
user: "[User message]"
88-
assistant: "[Response before triggering]"
88+
assistant: "I'll use the [agent-name] agent to [what it does]."
8989
<commentary>
9090
[Why agent should trigger]
9191
</commentary>
92-
assistant: "I'll use the [agent-name] agent to [what it does]."
9392
</example>
9493
```
9594
- **System Prompt**: Create comprehensive instructions with:

plugins/plugin-dev/agents/plugin-validator.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@ description: Use this agent when the user asks to "validate my plugin", "check p
55
<example>
66
Context: User finished creating a new plugin
77
user: "I've created my first plugin with commands and hooks"
8-
assistant: "Great! Let me validate the plugin structure."
8+
assistant: "I'll use the plugin-validator agent to validate the plugin structure."
99
<commentary>
1010
Plugin created, proactively validate to catch issues early.
1111
</commentary>
12-
assistant: "I'll use the plugin-validator agent to check the plugin."
1312
</example>
1413

1514
<example>
@@ -24,21 +23,19 @@ Explicit validation request triggers the agent.
2423
<example>
2524
Context: User modified plugin.json
2625
user: "I've updated the plugin manifest"
27-
assistant: "Let me validate the changes."
26+
assistant: "I'll use the plugin-validator agent to validate the manifest changes."
2827
<commentary>
2928
Manifest modified, validate to ensure correctness.
3029
</commentary>
31-
assistant: "I'll use the plugin-validator agent to check the manifest."
3230
</example>
3331

3432
<example>
3533
Context: User created or modified a marketplace
3634
user: "I've set up a marketplace.json for my plugins"
37-
assistant: "Let me validate the marketplace structure."
35+
assistant: "I'll use the plugin-validator agent to validate the marketplace structure."
3836
<commentary>
3937
Marketplace created, validate schema and plugin entries.
4038
</commentary>
41-
assistant: "I'll use the plugin-validator agent to check the marketplace."
4239
</example>
4340

4441
model: inherit

plugins/plugin-dev/agents/skill-reviewer.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,10 @@ description: Use this agent when the user has created or modified a skill and ne
55
<example>
66
Context: User just created a new skill
77
user: "I've created a PDF processing skill"
8-
assistant: "Great! Let me review the skill quality."
8+
assistant: "I'll use the skill-reviewer agent to review the skill quality."
99
<commentary>
1010
Skill created, proactively trigger skill-reviewer to ensure it follows best practices.
1111
</commentary>
12-
assistant: "I'll use the skill-reviewer agent to review the skill."
1312
</example>
1413

1514
<example>

plugins/plugin-dev/skills/agent-development/references/triggering-examples.md

Lines changed: 23 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,16 @@ Complete guide to writing effective `<example>` blocks in agent descriptions for
44

55
## Example Block Format
66

7-
The standard format for triggering examples:
7+
The standard format for triggering examples (aligned with official Claude Code documentation):
88

99
```markdown
1010
<example>
1111
Context: [Describe the situation - what led to this interaction]
1212
user: "[Exact user message or request]"
13-
assistant: "[How Claude should respond before triggering]"
13+
assistant: "[How Claude invokes the agent - 'I'll use the [agent-name] agent to [action]']"
1414
<commentary>
1515
[Explanation of why this agent should be triggered in this scenario]
1616
</commentary>
17-
assistant: "[How Claude triggers the agent - usually 'I'll use the [agent-name] agent...']"
1817
</example>
1918
```
2019

@@ -58,23 +57,15 @@ Example 2: user: "Can you check this implementation?"
5857
Example 3: user: "Look over my changes"
5958
```
6059

61-
### Assistant Response (Before Triggering)
60+
### Assistant Response
6261

63-
**Purpose:** Show what Claude says before launching the agent
62+
**Purpose:** Show Claude invoking the agent
6463

6564
**Good responses:**
6665
```
67-
assistant: "I'll analyze your OAuth implementation."
68-
assistant: "Let me review that PR for you."
69-
assistant: "I'll investigate the test failure."
70-
```
71-
72-
**Proactive example:**
73-
```
74-
assistant: "Great! Now let me review the code quality."
75-
<commentary>
76-
Code was just written, proactively trigger review agent.
77-
</commentary>
66+
assistant: "I'll use the code-reviewer agent to analyze your OAuth implementation."
67+
assistant: "I'll use the pr-analyzer agent to review that PR for you."
68+
assistant: "I'll use the test-analyzer agent to investigate the test failure."
7869
```
7970

8071
### Commentary
@@ -104,22 +95,6 @@ test quality and coverage before continuing.
10495
</commentary>
10596
```
10697

107-
### Assistant Response (Triggering)
108-
109-
**Purpose:** Show how Claude invokes the agent
110-
111-
**Standard pattern:**
112-
```
113-
assistant: "I'll use the [agent-name] agent to [what it will do]."
114-
```
115-
116-
**Examples:**
117-
```
118-
assistant: "I'll use the code-reviewer agent to analyze the changes."
119-
assistant: "Let me use the test-generator agent to create comprehensive tests."
120-
assistant: "I'll use the security-analyzer agent to check for vulnerabilities."
121-
```
122-
12398
## Example Types
12499

125100
### Type 1: Explicit Request
@@ -145,12 +120,11 @@ Agent triggers after relevant work without explicit request:
145120
<example>
146121
Context: User just implemented database queries
147122
user: "I've added the user search functionality"
148-
assistant: "Great! Let me review it for security."
123+
assistant: "I'll use the security-analyzer agent to review the database code for security issues."
149124
<commentary>
150125
Database code written. Proactively trigger security-analyzer to check
151126
for SQL injection and other database security issues.
152127
</commentary>
153-
assistant: "I'll use the security-analyzer agent to check the database code."
154128
</example>
155129
```
156130

@@ -162,12 +136,10 @@ User implies need without stating it directly:
162136
<example>
163137
Context: User mentions code is hard to understand
164138
user: "This code is confusing and hard to follow"
165-
assistant: "I can help improve the code clarity."
139+
assistant: "I'll use the code-simplifier agent to refactor for better readability."
166140
<commentary>
167-
User indicates complexity issues. Trigger code-simplifier agent to refactor
168-
for better readability.
141+
User indicates complexity issues. Trigger code-simplifier agent to improve clarity.
169142
</commentary>
170-
assistant: "I'll use the code-simplifier agent to suggest improvements."
171143
</example>
172144
```
173145

@@ -179,12 +151,11 @@ Agent triggers based on prior tool usage:
179151
<example>
180152
Context: User made multiple edits to test files
181153
user: "I've updated all the tests"
182-
assistant: "Great! Let me verify test quality."
154+
assistant: "I'll use the test-quality-analyzer agent to verify the tests follow best practices."
183155
<commentary>
184156
Multiple Edit tools used on test files. Proactively trigger test-quality-analyzer
185157
to ensure tests follow best practices.
186158
</commentary>
187-
assistant: "I'll use the test-quality-analyzer agent to review the tests."
188159
</example>
189160
```
190161

@@ -215,17 +186,19 @@ user: "Look over these changes"
215186
<example>
216187
Context: User explicitly requests review
217188
user: "Review my code for issues"
218-
[...]
189+
assistant: "I'll use the code-reviewer agent to analyze the code."
190+
<commentary>
191+
Explicit review request triggers the agent.
192+
</commentary>
219193
</example>
220194

221195
<example>
222196
Context: After user writes code
223197
user: "I've implemented the feature"
224-
assistant: "Great! Now let me review it."
198+
assistant: "I'll use the code-reviewer agent to review the implementation."
225199
<commentary>
226-
Code written, proactively review.
200+
Code written, proactively review for quality and issues.
227201
</commentary>
228-
[...]
229202
</example>
230203
```
231204

@@ -267,9 +240,9 @@ assistant: "I'll use the code-reviewer agent."
267240
<example>
268241
Context: User just finished implementing authentication
269242
user: "Review my code"
270-
assistant: "I'll use the code-reviewer agent to analyze the auth implementation."
243+
assistant: "I'll use the code-reviewer agent to analyze the auth implementation for security and best practices."
271244
<commentary>
272-
Auth code written, review for security and best practices.
245+
Auth code written. Review for security and best practices.
273246
</commentary>
274247
</example>
275248
```
@@ -350,11 +323,10 @@ More than 6 makes description too long. Focus on most important scenarios.
350323
<example>
351324
Context: User just implemented a new feature
352325
user: "I've added the user registration feature"
353-
assistant: "Great! Let me review the code quality."
326+
assistant: "I'll use the code-reviewer agent to analyze the implementation."
354327
<commentary>
355328
Code written, proactively trigger code-reviewer agent.
356329
</commentary>
357-
assistant: "I'll use the code-reviewer agent to analyze the implementation."
358330
</example>
359331

360332
<example>
@@ -373,11 +345,10 @@ Explicit review request triggers the agent.
373345
<example>
374346
Context: User implemented functions without tests
375347
user: "I've added the data processing functions"
376-
assistant: "Great! Let me generate tests for these."
348+
assistant: "I'll use the test-generator agent to create comprehensive tests."
377349
<commentary>
378350
New code without tests, proactively trigger test-generator agent.
379351
</commentary>
380-
assistant: "I'll use the test-generator agent to create comprehensive tests."
381352
</example>
382353

383354
<example>
@@ -396,11 +367,10 @@ Direct test generation request triggers the agent.
396367
<example>
397368
Context: User added new API endpoints
398369
user: "I've implemented the REST API endpoints"
399-
assistant: "I'll document these endpoints."
370+
assistant: "I'll use the api-docs-writer agent to create comprehensive documentation."
400371
<commentary>
401372
New API code, proactively generate documentation.
402373
</commentary>
403-
assistant: "I'll use the api-docs-writer agent to create comprehensive documentation."
404374
</example>
405375

406376
<example>
@@ -419,11 +389,10 @@ Documentation request triggers the agent.
419389
<example>
420390
Context: User ready to commit changes
421391
user: "I'm ready to commit this code"
422-
assistant: "Let me validate it first."
392+
assistant: "I'll use the code-validator agent to check for issues before committing."
423393
<commentary>
424394
Before commit, proactively validate with validation-agent.
425395
</commentary>
426-
assistant: "I'll use the code-validator agent to check for issues."
427396
</example>
428397

429398
<example>

0 commit comments

Comments
 (0)