Claude Code Plugins: Extend Your AI Coding Assistant with Custom Workflows

Master the Claude Code plugin system to extend functionality with custom commands, agents, MCP servers, and hooks. Learn how to install, create, and share plugins for enhanced development workflows.

ClaudeCode Guide Team
claude code pluginsMCP serverscustom commandsworkflow automationextensibility

TL;DR

Claude Code's plugin system allows developers to extend the AI assistant with reusable capabilities:

  • Slash Commands: Custom shortcuts for common tasks (e.g., /deploy, /test-all)
  • Agents: Specialized AI workflows for specific domains (e.g., security audits, performance optimization)
  • MCP Servers: Model Context Protocol integrations for external data sources
  • Hooks: Automated triggers that run at specific points in the workflow

Installation is simple: claude plugin install <plugin-name> or browse the plugin marketplace.

Create custom plugins for your team's specific workflows and share them via GitHub or the official marketplace.

This guide covers everything from installing your first plugin to building and distributing custom extensions.

What Are Claude Code Plugins?

Plugins are packaged collections of functionality that extend Claude Code's capabilities. Think of them as npm packages for AI workflows—reusable, shareable, and composable.

The Four Plugin Types

1. Slash Commands

# Built-in command
claude "run tests"

# Custom slash command (via plugin)
/test-all  # Runs unit, integration, and e2e tests with coverage

2. Agents

# Generic Claude Code
claude "review this code for security issues"

# Specialized security agent (via plugin)
/security-audit  # Runs specialized security analysis workflow

3. MCP Servers

# Without MCP
Claude: "I don't have access to your Jira tickets"

# With Jira MCP server plugin
Claude: Can query, update, and create Jira tickets directly

4. Hooks

# Manual workflow
1. Write code
2. Manually run linter
3. Manually run tests
4. Manually update docs

# With hooks plugin
1. Write code
2. Hooks automatically: lint, test, update docs

Installing Plugins from the Marketplace

Finding Plugins

Official Marketplace:

# Browse available plugins
claude plugin search

# Search for specific functionality
claude plugin search "testing"
claude plugin search "deployment"
claude plugin search "database"

Popular Plugins:

- claude-code-testing: Comprehensive testing workflows
- claude-code-deploy: Multi-platform deployment automation
- claude-code-security: Security audit and vulnerability scanning
- claude-code-docs: Auto-documentation generation
- claude-code-db: Database migration and query assistance

Installing a Plugin

# Install from marketplace
claude plugin install testing-suite

# Install from GitHub
claude plugin install https://github.com/user/claude-plugin-name

# Install specific version
claude plugin install testing-suite@2.1.0

# Install multiple plugins
claude plugin install testing-suite security-audit docs-generator

Plugin Configuration

After installation, some plugins require configuration:

# Configure plugin
claude plugin config testing-suite

# Example configuration prompts
? Test framework (jest/vitest/mocha): jest
? Coverage threshold: 80
? Run tests before commit: yes
? Generate coverage reports: yes

✓ Testing suite configured successfully

Managing Installed Plugins

# List installed plugins
claude plugin list

# Output:
# testing-suite (v2.1.0) - Comprehensive testing workflows
# security-audit (v1.5.2) - Security vulnerability scanning
# docs-generator (v3.0.1) - Auto-generate documentation

# Update plugins
claude plugin update testing-suite
claude plugin update --all

# Uninstall plugin
claude plugin uninstall docs-generator

# Disable temporarily (without uninstalling)
claude plugin disable security-audit
claude plugin enable security-audit

Using Installed Plugins

Slash Commands Plugin Example

Testing Suite Plugin provides custom commands:

# Run all tests with coverage
/test-all

# Run specific test type
/test-unit
/test-integration
/test-e2e

# Test specific file or directory
/test src/components/Button.test.tsx
/test src/api/

# Watch mode
/test-watch

# Generate coverage report
/test-coverage

Each command is a shortcut for complex Claude Code instructions:

# Instead of typing this every time:
claude "Run all unit tests using Jest with coverage enabled,
then run integration tests, and finally e2e tests using Playwright.
Generate an HTML coverage report and fail if coverage is below 80%."

# Just use:
/test-all

Agent Plugin Example

Security Audit Agent provides specialized security analysis:

# Run security audit
/security-audit

# Claude Code with security agent:
# 1. Scans for common vulnerabilities (SQL injection, XSS, etc.)
# 2. Checks dependencies for known CVEs
# 3. Analyzes authentication and authorization logic
# 4. Reviews cryptographic implementations
# 5. Generates detailed security report with remediation steps

The security agent uses specialized prompts and workflows that a general-purpose AI might miss.

MCP Server Plugin Example

Jira Integration MCP Server:

# Install Jira MCP plugin
claude plugin install jira-mcp-server

# Configure Jira credentials
claude plugin config jira-mcp-server
? Jira URL: https://yourcompany.atlassian.net
? API Token: [enter token]

# Now Claude can interact with Jira
claude "What are the open bugs assigned to me?"

Claude: "You have 3 open bugs:
- BUG-123: Login fails on Safari
- BUG-124: Payment processing timeout
- BUG-125: Email notifications not sending"

claude "Fix BUG-123 and update the ticket when done"

# Claude Code:
# 1. Fetches ticket details from Jira
# 2. Analyzes the bug
# 3. Implements fix
# 4. Runs tests
# 5. Updates Jira ticket with fix details and commit link

Hook Plugin Example

Pre-Commit Hooks Plugin:

# Install hooks plugin
claude plugin install pre-commit-hooks

# Configure which hooks to enable
claude plugin config pre-commit-hooks
? Enable linter: yes
? Enable type checker: yes
? Enable tests: yes
? Enable security scan: no (too slow for every commit)

# Now whenever Claude Code prepares a commit:
[Pre-commit Hook] Running linter... ✓
[Pre-commit Hook] Running TypeScript compiler... ✓
[Pre-commit Hook] Running tests... ✓
[Pre-commit Hook] All checks passed - proceeding with commit

Creating Custom Plugins

When to Create a Plugin

Consider creating a plugin when you:

  • Have repetitive workflows used across projects
  • Need specialized domain knowledge (e.g., compliance, specific industry standards)
  • Want to integrate with internal tools or APIs
  • Have team-specific conventions or processes

Plugin Structure

my-custom-plugin/
├── plugin.json          # Plugin metadata and configuration
├── commands/            # Slash commands
│   ├── deploy.md
│   └── rollback.md
├── agents/              # Specialized agents
│   └── performance-audit.md
├── mcp-servers/         # MCP server configurations
│   └── internal-api.json
├── hooks/               # Automated hooks
│   ├── pre-commit.sh
│   └── post-merge.sh
└── README.md            # Documentation

Creating a Slash Command Plugin

Example: Deployment Command

# Create plugin directory
mkdir -p my-deployment-plugin/commands

# Create plugin.json
cat > my-deployment-plugin/plugin.json << EOF
{
  "name": "deployment-automation",
  "version": "1.0.0",
  "description": "Automated deployment workflows for our platform",
  "author": "Your Team",
  "commands": {
    "deploy": "commands/deploy.md",
    "rollback": "commands/rollback.md",
    "deploy-status": "commands/status.md"
  }
}
EOF

# Create deploy command
cat > my-deployment-plugin/commands/deploy.md << 'EOF'
---
name: deploy
description: Deploy application to specified environment
arguments:
  - name: environment
    description: Target environment (staging/production)
    required: true
---

Deploy the application to {{environment}} using the following steps:

1. Run all tests to ensure code quality
2. Build the application for production
3. Run security scan on build artifacts
4. Push Docker image to registry
5. Update Kubernetes deployment
6. Run smoke tests on deployed application
7. Send deployment notification to Slack #deployments channel

Environment-specific configuration:
- Staging: k8s-staging cluster, no manual approval needed
- Production: k8s-prod cluster, requires manual approval before deployment

If any step fails, automatically rollback and notify team.
EOF

Using the Custom Command:

# Install locally
cd my-deployment-plugin
claude plugin install .

# Use the command
/deploy staging
/deploy production

Creating a Specialized Agent Plugin

Example: Performance Audit Agent

# Create agent definition
cat > my-plugin/agents/performance-audit.md << 'EOF'
---
name: performance-audit
description: Comprehensive performance analysis and optimization
model: claude-sonnet-4.5  # Use specific model
temperature: 0.3           # Lower temperature for consistent analysis
---

You are a performance optimization specialist. When analyzing code:

1. **Identify Performance Bottlenecks**
   - Database query efficiency (N+1 queries, missing indexes)
   - Memory leaks and excessive allocations
   - CPU-intensive operations in hot paths
   - Network request waterfall issues

2. **Analyze Metrics**
   - Time complexity of algorithms
   - Memory usage patterns
   - Bundle size and load times (frontend)
   - Database query execution plans

3. **Provide Specific Recommendations**
   - Code changes with before/after examples
   - Database index suggestions with DDL
   - Caching strategies with implementation
   - Lazy loading opportunities

4. **Benchmark Improvements**
   - Generate benchmark code
   - Project expected performance gains
   - Estimate resource savings

5. **Generate Report**
   - Executive summary
   - Detailed findings with severity ratings
   - Prioritized action items
   - Implementation timeline estimate

Always provide concrete, actionable recommendations with code examples.
EOF

Using the Performance Agent:

claude "Use performance-audit agent to analyze our API endpoints"

# The agent follows its specialized workflow for thorough analysis

Creating an MCP Server Plugin

Example: Internal API MCP Server

# Create MCP server configuration
cat > my-plugin/mcp-servers/internal-api.json << 'EOF'
{
  "name": "internal-api",
  "description": "Access to internal company APIs",
  "command": "node",
  "args": ["./servers/internal-api.js"],
  "env": {
    "API_URL": "https://internal-api.company.com",
    "API_TOKEN": "${INTERNAL_API_TOKEN}"
  }
}
EOF

# Create MCP server implementation
cat > my-plugin/servers/internal-api.js << 'EOF'
#!/usr/bin/env node
const { MCPServer } = require('@anthropic-ai/mcp-sdk');

const server = new MCPServer({
  name: 'internal-api',
  version: '1.0.0'
});

// Define available tools
server.addTool({
  name: 'search_employees',
  description: 'Search employee directory',
  parameters: {
    query: { type: 'string', description: 'Search query' }
  },
  handler: async ({ query }) => {
    const response = await fetch(
      `${process.env.API_URL}/employees/search?q=${query}`,
      {
        headers: {
          'Authorization': `Bearer ${process.env.API_TOKEN}`
        }
      }
    );
    return response.json();
  }
});

server.addTool({
  name: 'get_project_info',
  description: 'Get project information',
  parameters: {
    project_id: { type: 'string', description: 'Project ID' }
  },
  handler: async ({ project_id }) => {
    const response = await fetch(
      `${process.env.API_URL}/projects/${project_id}`,
      {
        headers: {
          'Authorization': `Bearer ${process.env.API_TOKEN}`
        }
      }
    );
    return response.json();
  }
});

server.listen();
EOF

Using the Internal API MCP Server:

# Set environment variable
export INTERNAL_API_TOKEN="your-token"

# Install plugin
claude plugin install ./my-plugin

# Now Claude can access internal APIs
claude "Who is working on the payment-service project?"

# Claude uses the MCP server to query internal APIs

Creating Hooks Plugin

Example: Code Quality Hooks

# Create pre-commit hook
cat > my-plugin/hooks/pre-commit.sh << 'EOF'
#!/bin/bash

echo "Running pre-commit hooks..."

# Run linter
echo "Linting..."
npm run lint
if [ $? -ne 0 ]; then
  echo "❌ Linting failed"
  exit 1
fi

# Run type checker
echo "Type checking..."
npm run type-check
if [ $? -ne 0 ]; then
  echo "❌ Type checking failed"
  exit 1
fi

# Run tests
echo "Testing..."
npm run test
if [ $? -ne 0 ]; then
  echo "❌ Tests failed"
  exit 1
fi

echo "✅ All pre-commit checks passed"
EOF

chmod +x my-plugin/hooks/pre-commit.sh

# Configure in plugin.json
cat > my-plugin/plugin.json << 'EOF'
{
  "name": "code-quality-hooks",
  "version": "1.0.0",
  "hooks": {
    "pre-commit": "hooks/pre-commit.sh",
    "post-merge": "hooks/post-merge.sh"
  }
}
EOF

Publishing Plugins

Publishing to GitHub

# Create plugin repository
git init
git add .
git commit -m "Initial plugin release"
git remote add origin https://github.com/youruser/claude-plugin-name
git push -u origin main

# Tag release
git tag v1.0.0
git push --tags

# Others can now install
claude plugin install https://github.com/youruser/claude-plugin-name

Publishing to Official Marketplace

# Login to Claude Code registry
claude plugin login

# Publish plugin
cd my-plugin
claude plugin publish

# Publishing checklist:
# ✓ plugin.json with all required fields
# ✓ README.md with documentation
# ✓ LICENSE file
# ✓ Version follows semver
# ✓ All commands/agents tested
# ✓ Security review passed (for MCP servers)

# Plugin is now available
# Others can install with:
claude plugin install deployment-automation

Best Practices for Plugin Development

1. Clear Documentation

# Plugin README Template

## Installation
\`\`\`bash
claude plugin install your-plugin-name
\`\`\`

## Configuration
Explain all configuration options

## Available Commands
List each command with examples

## Usage Examples
Show real-world scenarios

## Troubleshooting
Common issues and solutions

2. Semantic Versioning

v1.0.0 - Initial release
v1.1.0 - Add new commands (backward compatible)
v1.1.1 - Bug fixes (backward compatible)
v2.0.0 - Breaking changes (requires migration)

3. Error Handling

# In command definitions

If deployment fails:
1. Capture error details
2. Rollback to previous version
3. Notify team via Slack
4. Create incident ticket
5. Provide troubleshooting steps to user

4. Security Considerations

For MCP servers handling sensitive data:
✓ Use environment variables for credentials
✓ Never commit secrets to repository
✓ Implement rate limiting
✓ Validate all inputs
✓ Use HTTPS for all external communications
✓ Follow principle of least privilege for API access

5. Testing Plugins

# Test plugin locally before publishing
cd my-plugin
claude plugin install .
claude plugin test

# Run automated tests
npm run test

# Test each command
/deploy staging --dry-run
/security-audit --verbose

Multi-Step Workflow Plugin

# commands/full-feature-workflow.md

1. Create feature branch
2. Generate boilerplate code
3. Implement core functionality
4. Write unit tests (aim for >80% coverage)
5. Write integration tests
6. Update documentation
7. Run full test suite
8. Create pull request with template
9. Request review from relevant team members

Environment Management Plugin

# commands/env-setup.md

Based on project type, set up:

For Node.js:
- Install dependencies (npm install)
- Set up .env from .env.example
- Initialize database
- Run migrations
- Seed test data

For Python:
- Create virtual environment
- Install requirements
- Set up .env
- Run database migrations
- Initialize Redis/Celery if needed

Code Generation Plugin

# agents/api-generator.md

Generate REST API endpoint with:
1. Route definition
2. Controller with validation
3. Service layer logic
4. Database model/schema
5. Unit tests for each layer
6. Integration test for full endpoint
7. API documentation (OpenAPI/Swagger)
8. Postman collection entry

Plugin Marketplace Highlights

Essential Plugins for Every Developer

1. Testing Suite Enhanced

claude plugin install testing-suite-enhanced

# Provides:
- /test-watch-changed: Test only changed files
- /test-coverage-diff: Coverage diff vs main branch
- /test-flaky: Identify flaky tests
- /test-performance: Performance regression tests

2. Git Workflow Automation

claude plugin install git-flow

# Provides:
- /feature-start: Create feature branch with naming convention
- /hotfix: Fast-track critical bug fixes
- /release: Automated release process
- /merge-conflict-resolve: AI-assisted conflict resolution

3. Documentation Generator

claude plugin install docs-generator-pro

# Provides:
- /docs-api: Generate API documentation
- /docs-readme: Generate/update README
- /docs-contributing: Generate CONTRIBUTING.md
- /docs-architecture: Generate architecture diagrams

4. Database Assistant

claude plugin install db-assistant

# Provides:
- /migration-generate: Create migration from schema changes
- /migration-rollback: Safely rollback migrations
- /query-optimize: Analyze and optimize SQL queries
- /seed-generate: Generate seed data

5. Security Scanner

claude plugin install security-scanner-pro

# Provides:
- /security-scan: Full security audit
- /dependency-check: Check for vulnerable dependencies
- /secrets-scan: Scan for committed secrets
- /compliance-check: Check against security standards (OWASP, CWE)

Troubleshooting Common Plugin Issues

Plugin Installation Fails

# Error: Plugin not found

# Solutions:
1. Check plugin name spelling
2. Verify network connection
3. Try installing with full URL:
   claude plugin install https://github.com/user/plugin-name

# Error: Permission denied

# Solutions:
1. Check if you need sudo: sudo claude plugin install
2. Fix npm permissions: npm config set prefix ~/.npm-global
3. Reinstall Claude Code with proper permissions

Plugin Command Not Working

# Error: Unknown command /my-command

# Solutions:
1. Verify plugin is installed: claude plugin list
2. Reinstall plugin: claude plugin reinstall plugin-name
3. Check plugin.json defines the command correctly
4. Restart Claude Code: claude restart

MCP Server Connection Issues

# Error: MCP server not responding

# Solutions:
1. Check server process is running: ps aux | grep mcp
2. Verify environment variables are set
3. Check server logs: claude plugin logs mcp-server-name
4. Restart MCP server: claude plugin restart mcp-server-name
5. Check firewall/network settings

Hook Not Executing

# Hook defined but not running

# Solutions:
1. Ensure hook script is executable: chmod +x hooks/pre-commit.sh
2. Check hook is enabled: claude plugin config plugin-name
3. Verify hook trigger condition is met
4. Check hook logs: claude plugin logs plugin-name --hooks

Conclusion

The Claude Code plugin system transforms the AI coding assistant from a powerful tool into an extensible platform tailored to your exact needs.

Key Takeaways:

  • Install plugins to add functionality without coding: claude plugin install <name>
  • Create custom plugins for team-specific workflows and internal integrations
  • Share plugins via GitHub or the official marketplace
  • Combine plugins to build sophisticated automated workflows

Whether you need testing automation, deployment pipelines, security audits, or internal API integrations, there's likely a plugin available—or you can create one in minutes.

Start exploring the plugin marketplace today and discover how to supercharge your Claude Code experience.


Keywords: claude code plugins, MCP servers, custom commands, workflow automation, slash commands, AI extensibility, plugin marketplace, development tools, code automation, Claude Code customization