Skip to content

Commit 0bf8a76

Browse files
sjnimsclaude
andauthored
docs: address 20 documentation gaps from claude-docs audit (#203)
## Summary Comprehensive audit of the official Claude Code documentation (`claude-docs`) against plugin-dev skills identified 20 gaps — topics relevant to plugin developers that were missing or insufficiently covered. This PR addresses all of them. - **5 new reference files** (~5,400 words total) - **9 modified files** (~1,400 lines added) - **6 SKILL.md description updates** with new trigger phrases - **0 markdownlint errors**, all files prettier-formatted ### Phase 1: Inline additions to existing skills (gaps 1–8) - **skill-development**: `model` field, scoped `hooks` in frontmatter, visibility budget (`SLASH_COMMAND_TOOL_CHAR_BUDGET`) - **hook-development**: Scoped hooks in skill/agent frontmatter, `agent` hook type - **agent-development**: `disallowedTools` field (denylist complement to `tools`) - **mcp-integration**: MCP prompts as commands (`/mcp__server__prompt`), tool search auto-enable behavior - **command-development**: Load-time injection vs runtime execution clarification ### Phase 2: New reference docs for cross-cutting topics (gaps 9–11) - `plugin-structure/references/headless-ci-mode.md` — Plugin behavior in `claude -p` and CI pipelines - `plugin-structure/references/github-actions.md` — Integration with `claude-code-action@v1` - `plugin-settings/references/memory-rules-system.md` — CLAUDE.md imports, `.claude/rules/`, priority hierarchy ### Phase 3: Consolidated lower-priority gaps (gaps 12–20) - `plugin-structure/references/advanced-topics.md` — Keybindings plugin context, status line integration, Claude as MCP server, `@` resource syntax, agent hook type details, auto-update behavior, plugin caching, CLI management commands, installation scopes ### Phase 4: Description trigger phrase updates All 6 modified SKILL.md files have updated `description` frontmatter with trigger phrases for the new content. ## Test plan - [x] `markdownlint-cli2 '**/*.md'` — 87 files, 0 errors - [x] `prettier --check '**/*.md'` — all files formatted - [x] `rg '!\x60' plugins/plugin-dev/skills/ --glob '*.md'` — no literal `!` backtick violations - [x] All SKILL.md files under 3,000 words (range: 1,701–2,508) - [x] All 5 new reference files exist and are referenced from parent SKILL.md - [ ] CI passes - [ ] Verify plugin loads: `claude --plugin-dir plugins/plugin-dev` 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent c26d5ae commit 0bf8a76

File tree

14 files changed

+1400
-15
lines changed

14 files changed

+1400
-15
lines changed

plugins/plugin-dev/skills/agent-development/SKILL.md

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
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.
44
---
55

66
# Agent Development for Claude Code Plugins
@@ -251,6 +251,27 @@ tools: Read, Write, Grep, Bash
251251

252252
> **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.
253253

254+
### disallowedTools (optional)
255+
256+
Denylist complement to `tools`. Block specific tools while allowing all others:
257+
258+
```yaml
259+
disallowedTools: Bash, Write
260+
```
261+
262+
**Format:** Comma-separated tool names
263+
264+
**Default:** No tools blocked
265+
266+
| Field | Approach | Use When |
267+
| ----------------- | --------- | --------------------------------------- |
268+
| `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+
254275
### skills (optional)
255276

256277
Load specific skills into the agent's context:
@@ -470,15 +491,16 @@ Ensure system prompt is complete:
470491

471492
### Frontmatter Fields Summary
472493

473-
| Field | Required | Format | Example |
474-
| -------------- | -------- | -------------------------- | ------------------------ |
475-
| name | Yes | lowercase-hyphens | code-reviewer |
476-
| description | Yes | Text + examples | Use when... <example>... |
477-
| model | Yes | inherit/sonnet/opus/haiku | inherit |
478-
| color | Yes | Color name | blue |
479-
| tools | No | Comma-separated tool names | Read, Grep |
480-
| skills | No | Array of skill names | [testing, security] |
481-
| permissionMode | No | Permission mode string | acceptEdits |
494+
| Field | Required | Format | Example |
495+
| --------------- | -------- | -------------------------- | ------------------------ |
496+
| name | Yes | lowercase-hyphens | code-reviewer |
497+
| description | Yes | Text + examples | Use when... <example>... |
498+
| model | Yes | inherit/sonnet/opus/haiku | inherit |
499+
| color | Yes | Color name | blue |
500+
| tools | No | Comma-separated tool names | Read, Grep |
501+
| disallowedTools | No | Comma-separated tool names | Bash, Write |
502+
| skills | No | Array of skill names | [testing, security] |
503+
| permissionMode | No | Permission mode string | acceptEdits |
482504

483505
> **Note:** Agents use `tools` to restrict tool access. Skills use `allowed-tools` for the same purpose. The field names differ between component types.
484506

plugins/plugin-dev/skills/command-development/SKILL.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -406,6 +406,10 @@ This is intentional. When skill content loads into Claude's context, `[BANG]` fo
406406
- Gather project/repository state
407407
- Build context-aware workflows
408408

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+
409413
**Implementation details:**
410414
For advanced patterns, environment-specific configurations, and plugin integration, see `references/plugin-features-reference.md`
411415

plugins/plugin-dev/skills/hook-development/SKILL.md

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
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.
44
---
55

66
# Hook Development for Claude Code Plugins
@@ -59,6 +59,22 @@ Execute bash commands for deterministic checks:
5959
- External tool integrations
6060
- Performance-critical checks
6161

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+
6278
## Hook Configuration Formats
6379

6480
### Plugin hooks.json Format
@@ -507,6 +523,29 @@ In plugins, define hooks in `hooks/hooks.json` using the **plugin wrapper format
507523

508524
**Note:** Plugin hooks use the `{"hooks": {...}}` wrapper format, not the direct settings format. Plugin hooks merge with user's hooks and run in parallel.
509525

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:
529+
530+
```yaml
531+
---
532+
name: validated-writer
533+
description: Write files with safety checks...
534+
hooks:
535+
PreToolUse:
536+
- matcher: Write
537+
hooks:
538+
- type: command
539+
command: "${CLAUDE_PLUGIN_ROOT}/scripts/validate-write.sh"
540+
---
541+
```
542+
543+
**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`.
548+
510549
## Matchers
511550

512551
### Tool Name Matching

plugins/plugin-dev/skills/hook-development/references/advanced.md

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,146 @@ if [ ! -f "$file_path" ]; then
481481
fi
482482
```
483483

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...
500+
hooks:
501+
PreToolUse:
502+
- matcher: Write
503+
hooks:
504+
- type: command
505+
command: "${CLAUDE_PLUGIN_ROOT}/scripts/validate-write.sh"
506+
timeout: 10
507+
PostToolUse:
508+
- matcher: Write
509+
hooks:
510+
- type: command
511+
command: "${CLAUDE_PLUGIN_ROOT}/scripts/post-write-check.sh"
512+
---
513+
```
514+
515+
### Supported Events
516+
517+
Only a subset of hook events apply in frontmatter scope:
518+
519+
| Event | Purpose in Frontmatter |
520+
| ------------- | -------------------------------------------------------------------------------------------------- |
521+
| `PreToolUse` | Validate or block tool calls during skill execution |
522+
| `PostToolUse` | Run checks after tool execution during skill use |
523+
| `Stop` | Verify completion criteria before skill/agent finishes (auto-converted to SubagentStop for agents) |
524+
525+
Session-level events (`SessionStart`, `UserPromptSubmit`, `Notification`, etc.) don't apply — they operate at a different lifecycle scope.
526+
527+
### Comparison with hooks.json
528+
529+
| Aspect | `hooks.json` | Frontmatter `hooks` |
530+
| -------------- | ------------------------------------------ | --------------------------------------------------- |
531+
| Scope | Global (always active when plugin enabled) | Component-specific (active only during use) |
532+
| Events | All 11+ hook events | PreToolUse, PostToolUse, Stop |
533+
| Location | `hooks/hooks.json` file | YAML frontmatter in SKILL.md or agent .md |
534+
| Merge behavior | Merges with user/project hooks | Merges with global hooks during component lifecycle |
535+
536+
### Use Cases
537+
538+
- **Skill-specific validation:** A "database writer" skill that validates SQL before execution
539+
- **Restricted workflows:** A "deploy" skill that checks branch and test status before allowing Bash commands
540+
- **Quality gates:** A "code generator" skill that runs linting after every Write operation
541+
- **Agent safety:** An autonomous agent that validates all Bash commands before execution
542+
543+
### Both Hook Types Work
544+
545+
**Command hook** (deterministic script execution):
546+
547+
```yaml
548+
hooks:
549+
PreToolUse:
550+
- matcher: Bash
551+
hooks:
552+
- type: command
553+
command: "${CLAUDE_PLUGIN_ROOT}/scripts/check-safety.sh"
554+
```
555+
556+
**Prompt hook** (LLM evaluation):
557+
558+
```yaml
559+
hooks:
560+
Stop:
561+
- hooks:
562+
- type: prompt
563+
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.
587+
588+
### When to Use Agent Hooks
589+
590+
| Hook Type | Speed | Capability | Best For |
591+
| --------- | --------------- | --------------------- | --------------------------------------------- |
592+
| `command` | Fast (~1-5s) | Bash scripts only | Deterministic checks, file validation |
593+
| `prompt` | Medium (~5-15s) | Single LLM evaluation | Context-aware decisions, flexible logic |
594+
| `agent` | Slow (~30-120s) | Multi-step with tools | Comprehensive verification, multi-file checks |
595+
596+
Use agent hooks when:
597+
598+
- Verification requires reading multiple files
599+
- 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+
484624
## Conclusion
485625

486626
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.

plugins/plugin-dev/skills/mcp-integration/SKILL.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
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.
44
---
55

66
# MCP Integration for Claude Code Plugins
@@ -261,6 +261,21 @@ Claude will fetch the resource content and include it in context.
261261
- **https://** - HTTP resources
262262
- **Custom protocols** - Server-specific (postgres://, s3://, etc.)
263263

264+
## MCP Prompts as Commands
265+
266+
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+
264279
## Tool Search
265280

266281
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:
277292
2. Search by natural language or partial names
278293
3. Get filtered list of matching tools
279294

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+
280305
This feature is automatic - just ask Claude about available tools or describe what you want to do.
281306

282307
### Using MCP Tools in Commands

plugins/plugin-dev/skills/mcp-integration/references/tool-usage.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -585,3 +585,39 @@ Effective MCP tool usage requires:
585585
6. **Testing thoroughly** before deployment
586586

587587
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
614+
```
615+
616+
### When to Use MCP Prompts vs Plugin Commands
617+
618+
| Approach | Best For |
619+
| --- | --- |
620+
| MCP prompts | Server-defined workflows, dynamic templates from external services |
621+
| Plugin commands | Static workflows, plugin-specific logic, complex prompt composition |
622+
623+
**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

Comments
 (0)