SKILL.md
Claude Code Plugin Architecture
Overview
Claude Code has a plugin system with 4 extension points: skills (auto-activating knowledge), commands (slash commands), agents (specialized sub-agents), and MCP servers (tool providers). This skill covers building all four.
Plugin Structure
my-plugin/
├── .claude-plugin/
│ └── plugin.json # Required: name, version, description, author
├── skills/
│ └── my-skill/
│ └── SKILL.md # Auto-activating skill
├── commands/
│ └── my-command.md # Slash command (/my-command)
├── agents/
│ └── my-agent.md # Custom agent
└── README.md
Building a Skill (SKILL.md)
---
name: my-skill
description: |
When to activate this skill. Include trigger phrases so Claude
knows when to use it. Be specific about the problem it solves.
allowed-tools: Read, Write, Edit, Bash(npm:*)
version: 1.0.0
author: Your Name <[email protected]>
license: MIT
compatible-with: claude-code
tags: [category, topic]
---
# Skill Title
## Overview
What this skill does and when to use it.
## Prerequisites
- Claude Code installed
- Understanding of Markdown and YAML frontmatter
- For MCP servers: Node.js 18+ and `@modelcontextprotocol/sdk`
## Instructions
Step-by-step instructions Claude follows when this skill activates.
### Step 1: Do the thing
Explain what to do with code examples.
## Output
What the user should expect when this skill runs.
## Error Handling
| Error | Cause | Solution |
|-------|-------|----------|
| ... | ... | ... |
Building a Slash Command
---
name: my-command
description: "Run my custom workflow"
user-invocable: true
argument-hint: "<file-path>"
allowed-tools: Read, Write, Edit, Bash(npm:*)
version: 1.0.0
---
# /my-command
When the user runs `/my-command <file-path>`, do the following:
1. Read the file at $ARGUMENTS
2. Analyze it for issues
3. Report findings
Building an Agent
---
name: my-agent
description: "Specialized agent for code review"
capabilities: ["code-review", "security-audit"]
model: sonnet
maxTurns: 10
---
# Code Review Agent
You are a code review specialist. When invoked:
1. Read the files provided
2. Check for security issues, code quality, and performance
3. Report findings with specific line references
