You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: plugins/plugin-dev/skills/agent-development/SKILL.md
+32-10Lines changed: 32 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
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.
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", "disallowedTools", "block tools", "agent denylist", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
> **Important:** Agents use `tools` while Skills use `allowed-tools`. The field names differ between component types. For skill tool restrictions, see the `skill-development` skill.
253
253
254
+
### disallowedTools (optional)
255
+
256
+
Denylist complement to `tools`. Block specific tools while allowing all others:
| `tools` | Allowlist | Few tools needed, restrict to minimum |
269
+
| `disallowedTools` | Denylist | Most tools needed, block specific risks |
270
+
271
+
**Best practice:** Prefer `tools` (allowlist) for tighter security. Use `disallowedTools` when an agent needs broad access but specific tools are dangerous.
272
+
273
+
> **Note:** Use one or the other. If both are specified, behavior is undefined.
274
+
254
275
### skills (optional)
255
276
256
277
Load specific skills into the agent's context:
@@ -470,15 +491,16 @@ Ensure system prompt is complete:
> **Note:** Agents use `tools` to restrict tool access. Skills use `allowed-tools` for the same purpose. The field names differ between component types.
Copy file name to clipboardExpand all lines: plugins/plugin-dev/skills/command-development/SKILL.md
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -406,6 +406,10 @@ This is intentional. When skill content loads into Claude's context, `[BANG]` fo
406
406
- Gather project/repository state
407
407
- Build context-aware workflows
408
408
409
+
### Load-Time Injection vs Runtime Execution
410
+
411
+
The `[BANG]` syntax performs **load-time context injection**: commands execute when the skill or command is loaded, and their output becomes static text in the prompt Claude receives. This is different from Claude choosing to run commands at runtime via the Bash tool. Use `[BANG]` for gathering context (git status, environment variables, config files) that informs Claude's starting state, not for actions Claude should perform during the task.
412
+
409
413
**Implementation details:**
410
414
For advanced patterns, environment-specific configurations, and plugin integration, see `references/plugin-features-reference.md`
Copy file name to clipboardExpand all lines: plugins/plugin-dev/skills/hook-development/SKILL.md
+40-1Lines changed: 40 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
name: hook-development
3
-
description: This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PermissionRequest, PostToolUse, PostToolUseFailure, Stop, SubagentStop, SubagentStart, Setup, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.
3
+
description: This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", "scoped hooks", "frontmatter hooks", "hook in skill", "hook in agent", "agent hook type", or mentions hook events (PreToolUse, PermissionRequest, PostToolUse, PostToolUseFailure, Stop, SubagentStop, SubagentStart, Setup, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.
4
4
---
5
5
6
6
# Hook Development for Claude Code Plugins
@@ -59,6 +59,22 @@ Execute bash commands for deterministic checks:
59
59
- External tool integrations
60
60
- Performance-critical checks
61
61
62
+
### Agent Hooks
63
+
64
+
Use an LLM agent for complex, multi-step verification that requires tool access:
65
+
66
+
```json
67
+
{
68
+
"type": "agent",
69
+
"prompt": "Verify all generated code has tests and passes linting",
70
+
"timeout": 120
71
+
}
72
+
```
73
+
74
+
**Supported events:** Stop, SubagentStop
75
+
76
+
Agent hooks spawn a subagent that can use tools (Read, Bash, etc.) for thorough verification — useful when prompt hooks lack sufficient context or tool access. See `references/advanced.md` for patterns.
77
+
62
78
## Hook Configuration Formats
63
79
64
80
### Plugin hooks.json Format
@@ -507,6 +523,29 @@ In plugins, define hooks in `hooks/hooks.json` using the **plugin wrapper format
507
523
508
524
**Note:** Plugin hooks use the `{"hooks": {...}}` wrapper format, not the direct settings format. Plugin hooks merge with user's hooks and run in parallel.
509
525
526
+
## Scoped Hooks in Skill/Agent Frontmatter
527
+
528
+
Beyond `hooks.json` (global) and settings (user-level), hooks can be defined directly in skill or agent YAML frontmatter. Scoped hooks activate only when that component is in use:
**Supported events in frontmatter:**`PreToolUse`, `PostToolUse`, `Stop`
544
+
545
+
Scoped hooks use the same event/matcher/hook structure but are lifecycle-bound — they activate when the skill loads and deactivate when it completes. This is ideal for skill-specific validation without affecting other workflows.
546
+
547
+
See `references/advanced.md` for detailed syntax and comparison with `hooks.json`.
Copy file name to clipboardExpand all lines: plugins/plugin-dev/skills/hook-development/references/advanced.md
+140Lines changed: 140 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -481,6 +481,146 @@ if [ ! -f "$file_path" ]; then
481
481
fi
482
482
```
483
483
484
+
## Scoped Hooks in Skill/Agent Frontmatter
485
+
486
+
Hooks can be defined directly in skill or agent YAML frontmatter, scoping them to activate only when that component is in use.
487
+
488
+
### Concept
489
+
490
+
Unlike `hooks.json` (global, always active when plugin enabled) or settings hooks (user-level), scoped hooks are lifecycle-bound to a specific skill or agent. They activate when the component loads and deactivate when it completes.
491
+
492
+
### Format
493
+
494
+
The `hooks` field in frontmatter uses the same event/matcher/hook structure as `hooks.json`:
495
+
496
+
```yaml
497
+
---
498
+
name: secure-writer
499
+
description: Write files with safety validation...
prompt: 'Verify all generated code has tests. Return {"decision": "stop"} if satisfied or {"decision": "continue", "reason": "missing tests"} if not.'
564
+
```
565
+
566
+
## Agent Hook Type
567
+
568
+
The `agent` hook type spawns a subagent for complex, multi-step verification workflows that require tool access.
569
+
570
+
### Concept
571
+
572
+
While `command` hooks execute bash scripts and `prompt` hooks evaluate a single LLM prompt, `agent` hooks create a full subagent that can use tools (Read, Bash, Grep, etc.) to perform thorough verification. This is the most powerful but most expensive hook type.
573
+
574
+
### Configuration
575
+
576
+
```json
577
+
{
578
+
"type": "agent",
579
+
"prompt": "Verify that all generated code has tests and passes linting. Check each modified file.",
580
+
"timeout": 120
581
+
}
582
+
```
583
+
584
+
### Supported Events
585
+
586
+
Agent hooks are supported on **Stop** and **SubagentStop** events only. They aren't suitable for PreToolUse (too slow) or session-level events.
- You need to run commands and analyze their output
600
+
- Single-prompt evaluation is insufficient
601
+
- Completion criteria are complex and multi-faceted
602
+
603
+
### Example: Comprehensive Completion Check
604
+
605
+
```json
606
+
{
607
+
"Stop": [
608
+
{
609
+
"matcher": "*",
610
+
"hooks": [
611
+
{
612
+
"type": "agent",
613
+
"prompt": "Before approving task completion, verify: 1) All modified files have corresponding tests, 2) Tests pass (run them), 3) No linting errors exist. Report findings and return approve/block decision.",
614
+
"timeout": 120
615
+
}
616
+
]
617
+
}
618
+
]
619
+
}
620
+
```
621
+
622
+
The agent will autonomously read files, run tests, check linting, and make a comprehensive decision about whether to allow the main agent to stop.
623
+
484
624
## Conclusion
485
625
486
626
Advanced hook patterns enable sophisticated automation while maintaining reliability and performance. Use these techniques when basic hooks are insufficient, but always prioritize simplicity and maintainability.
Copy file name to clipboardExpand all lines: plugins/plugin-dev/skills/mcp-integration/SKILL.md
+26-1Lines changed: 26 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
name: mcp-integration
3
-
description: This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context Protocol", "connect external service", mentions "${CLAUDE_PLUGIN_ROOT} with MCP", discusses MCP server types (SSE, stdio, HTTP, WebSocket), or asks to "find MCP server", "discover MCP servers", "what MCP servers exist", "recommend MCP server for [service]". Provides comprehensive guidance for integrating Model Context Protocol servers into Claude Code plugins for external tool and service integration.
3
+
description: This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context Protocol", "connect external service", mentions "${CLAUDE_PLUGIN_ROOT} with MCP", discusses MCP server types (SSE, stdio, HTTP, WebSocket), or asks to "find MCP server", "discover MCP servers", "what MCP servers exist", "recommend MCP server for [service]", "MCP prompts", "MCP prompts as commands", "tool search", "tool search threshold". Provides comprehensive guidance for integrating Model Context Protocol servers into Claude Code plugins for external tool and service integration.
4
4
---
5
5
6
6
# MCP Integration for Claude Code Plugins
@@ -261,6 +261,21 @@ Claude will fetch the resource content and include it in context.
MCP servers can expose **prompts** that appear as slash commands in Claude Code:
267
+
268
+
**Format:**`/mcp__servername__promptname`
269
+
270
+
**Example:**
271
+
272
+
- Server `github` exposes prompt `create-pr`
273
+
- Available as: `/mcp__github__create-pr`
274
+
275
+
MCP prompts appear alongside regular commands in the `/` menu. They accept arguments and execute the server's prompt template with Claude. This enables MCP servers to provide guided workflows beyond simple tool calls.
276
+
277
+
**Plugin design note:** If your MCP server exposes prompts, document their names and expected arguments in your plugin README so users can discover them.
278
+
264
279
## Tool Search
265
280
266
281
For MCP servers with many tools, use Tool Search to find relevant tools:
@@ -277,6 +292,16 @@ For MCP servers with many tools, use Tool Search to find relevant tools:
277
292
2. Search by natural language or partial names
278
293
3. Get filtered list of matching tools
279
294
295
+
### Auto-Enable Behavior
296
+
297
+
Tool Search activates automatically when MCP servers collectively provide more tools than fit efficiently in Claude's context window (default threshold: 10% of context). Instead of loading all tool descriptions upfront, Claude searches for relevant tools on-demand.
298
+
299
+
**Plugin design implications:**
300
+
301
+
-**Many-tool servers**: Tools may not be immediately visible; use descriptive tool names and descriptions
302
+
-**Documentation**: Note tool search behavior in README if your server provides 20+ tools
303
+
-**Environment control**: `ENABLE_TOOL_SEARCH=auto:5` (custom 5% threshold) or `ENABLE_TOOL_SEARCH=false` (disable)
304
+
280
305
This feature is automatic - just ask Claude about available tools or describe what you want to do.
Follow these patterns for robust MCP tool integration in your plugin commands and agents.
588
+
589
+
## MCP Prompts as Commands
590
+
591
+
Beyond tools and resources, MCP servers can expose **prompts** — pre-defined instruction templates that appear as slash commands in Claude Code.
592
+
593
+
### How Prompts Work
594
+
595
+
When an MCP server declares prompts via the MCP protocol, Claude Code automatically registers them as slash commands:
596
+
597
+
-**Format:**`/mcp__servername__promptname`
598
+
-**Discovery:** Prompts appear in the `/` autocomplete menu alongside regular commands
599
+
-**Arguments:** Prompts can accept arguments defined by the server's prompt schema
600
+
601
+
### Integration with Plugin Commands
602
+
603
+
If your plugin bundles an MCP server that exposes prompts, those prompts become available when the plugin is installed. This provides another mechanism for guided workflows:
604
+
605
+
```markdown
606
+
# Example: Plugin README documenting MCP prompts
607
+
608
+
## Available MCP Prompts
609
+
610
+
After installing this plugin, the following MCP prompts are available:
611
+
612
+
-`/mcp__myserver__create-report` - Generate a structured report
613
+
-`/mcp__myserver__analyze-data` - Run data analysis with guided inputs
**Tip:** MCP prompts are ideal when the workflow logic lives on the server side and may change independently of the plugin. Plugin commands are better when you want full control over the prompt content.
0 commit comments