Build domain-specific tools and connect to external systems
Skills let you package domain-specific instructions with example files — invoked on demand with /skill-name. MCP (Model Context Protocol) connects Claude to external tools like databases and APIs. Together they form your AI extension layer.
Create the skills directory structure
cd my-full-app
mkdir -p .claude/skills
# Prepare to build your first skill
Directory structure created
Build a skill that teaches Claude your team's Java testing patterns. Document patterns in a skill file and make it invocable with /java-testing.
---
description: Generate Java tests following team conventions
allowed-tools: [Read, Write, Edit, Bash, Grep, Glob]
hooks:
PreToolUse:
- matcher: Write
body: "Verify test naming convention before writing"
---
# Java Testing Skill
## When to use
- Writing new unit tests
- Creating integration tests with Testcontainers
- Testing Kafka consumers/producers
Apply to: $ARGUMENTS
## Instructions
1. Use @Nested classes to group related tests
2. Follow naming: should{Action}When{Condition}
3. Use AssertJ for ALL assertions (not JUnit assertions)
4. Integration tests use @Testcontainers annotation
## Reference Examples
@src/test/java/com/example/ExampleUnitTest.java
@src/test/java/com/example/ExampleIntegrationIT.java
## DO NOT
- Do not use assertEquals (use AssertJ assertThat)
- Do not write tests without @DisplayName
- Do not mock repositories in integration tests
.claude/
skills/
java-testing.md # Skill file (frontmatter + instructions)
java-testing/ # Supporting files directory
unit-test-template.java # Template files for the skill
it-test-template.java # More templates
code-review.md # Another skill
refactor.md # Another skill
hooks/ # Hook scripts directory
pre-write-check.sh # Runs before Write tool
post-test-notify.sh # Runs after test execution
Skill File Format:
1. Frontmatter (description, allowed-tools, optional flags)
2. Body (instructions, @path imports)
3. $ARGUMENTS placeholder for parameters
Dynamic Context Injection:
!./mvnw dependency:tree # Inject command output as context
!cat build.gradle # Works with any shell command
Use in skill body for live project data
Portable Skills:
${CLAUDE_SKILL_DIR} # References the skill's own directory
Use in SKILL.md to reference local templates/files portably
Invoke with:
/java-testing MerchantService
/claude-api # Built-in skill for Claude API & Anthropic SDK
/loop 5m check deploy status # Bundled skill for recurring prompts
Install a plugin:
claude plugin add <plugin-name>
/plugin <name> # Invoke a plugin skill
/reload-plugins # Apply pending plugin changes without restart
Plugin Manifest:
.claude-plugin/plugin.json # Plugin manifest file format
Plugin Sources:
npm, git, local, git-subdir # git-subdir points to a subdirectory in a git repo
Ecosystem Scale (Feb 2026):
270+ plugins, 739 agent skills, 1298 standalone skills
Plugin Trust:
Per-server approval dialog for MCP servers
pluginTrustMessage in managed settings for org-custom trust context
Options in frontmatter:
description: ... # Required
allowed-tools: [Read, Write] # Restrict tool access
disable-model-invocation: true # Only model can invoke (not user-invocable)
user-invocable: true # User can invoke via /skill-name (default)
context: fork # Run in isolated subagent context
agent: Explore # Specify which subagent type (Explore, etc.)
hooks: { PreToolUse: [...] } # Skill-scoped hooks (command + prompt + MCP tool types)
Skill Arguments:
$ARGUMENTS # All arguments as a single string
$ARGUMENTS[0], $ARGUMENTS[1] # Positional args by index
$1, $2, $3 # Shorthand positional args
${CLAUDE_SESSION_ID} # Current session ID
Conditional Rules Files (.claude/rules/*.md):
paths: ["src/test/**"] # Only load when working on matching files
Use frontmatter to scope rules to specific parts of the codebase
Hook Events (17 total):
PreToolUse / PostToolUse # Before/after tool execution
PostToolUseFailure # When a tool execution fails
SessionStart / SessionEnd # Session lifecycle
UserPromptSubmit # When user submits a prompt
PermissionRequest # When a permission is requested
Notification # On notification events
SubagentStart / SubagentStop # Subagent lifecycle (agent teams)
Stop # When agent stops
TeammateIdle # When a teammate becomes idle
TaskCompleted # When a task completes
PreCompact # Before context compaction
ConfigChange # When settings change
WorktreeCreate / WorktreeRemove # Agent team worktree lifecycle
InstructionsLoaded # When CLAUDE.md or .claude/rules/*.md are loaded
Hook Types:
Shell command hooks # Run a shell command, inspect stdout/stderr
HTTP hooks # POST JSON to a URL and receive JSON responses
Prompt hooks # LLM-based evaluation instead of shell scripts
MCP tool hooks # Hooks that invoke MCP tools
Scheduled Tasks:
/loop 5m check deploy status # Recurring prompts at intervals
CronCreate / CronList / CronDelete # Programmatic scheduling tools
Session-scoped with 3-day expiry # Tasks auto-expire after 3 days