Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Directory structure and conventions for building Claude Code plugins (from the official Anthropic claude-code repo).
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
examples/advanced-plugin.md
1# Advanced Plugin Example23A complex, enterprise-grade plugin with MCP integration and advanced organization.45## Directory Structure67```8enterprise-devops/9├── .claude-plugin/10│ └── plugin.json11├── commands/12│ ├── ci/13│ │ ├── build.md14│ │ ├── test.md15│ │ └── deploy.md16│ ├── monitoring/17│ │ ├── status.md18│ │ └── logs.md19│ └── admin/20│ ├── configure.md21│ └── manage.md22├── agents/23│ ├── orchestration/24│ │ ├── deployment-orchestrator.md25│ │ └── rollback-manager.md26│ └── specialized/27│ ├── kubernetes-expert.md28│ ├── terraform-expert.md29│ └── security-auditor.md30├── skills/31│ ├── kubernetes-ops/32│ │ ├── SKILL.md33│ │ ├── references/34│ │ │ ├── deployment-patterns.md35│ │ │ ├── troubleshooting.md36│ │ │ └── security.md37│ │ ├── examples/38│ │ │ ├── basic-deployment.yaml39│ │ │ ├── stateful-set.yaml40│ │ │ └── ingress-config.yaml41│ │ └── scripts/42│ │ ├── validate-manifest.sh43│ │ └── health-check.sh44│ ├── terraform-iac/45│ │ ├── SKILL.md46│ │ ├── references/47│ │ │ └── best-practices.md48│ │ └── examples/49│ │ └── module-template/50│ └── ci-cd-pipelines/51│ ├── SKILL.md52│ └── references/53│ └── pipeline-patterns.md54├── hooks/55│ ├── hooks.json56│ └── scripts/57│ ├── security/58│ │ ├── scan-secrets.sh59│ │ ├── validate-permissions.sh60│ │ └── audit-changes.sh61│ ├── quality/62│ │ ├── check-config.sh63│ │ └── verify-tests.sh64│ └── workflow/65│ ├── notify-team.sh66│ └── update-status.sh67├── .mcp.json68├── servers/69│ ├── kubernetes-mcp/70│ │ ├── index.js71│ │ ├── package.json72│ │ └── lib/73│ ├── terraform-mcp/74│ │ ├── main.py75│ │ └── requirements.txt76│ └── github-actions-mcp/77│ ├── server.js78│ └── package.json79├── lib/80│ ├── core/81│ │ ├── logger.js82│ │ ├── config.js83│ │ └── auth.js84│ ├── integrations/85│ │ ├── slack.js86│ │ ├── pagerduty.js87│ │ └── datadog.js88│ └── utils/89│ ├── retry.js90│ └── validation.js91└── config/92├── environments/93│ ├── production.json94│ ├── staging.json95│ └── development.json96└── templates/97├── deployment.yaml98└── service.yaml99```100101## File Contents102103### .claude-plugin/plugin.json104105```json106{107"name": "enterprise-devops",108"version": "2.3.1",109"description": "Comprehensive DevOps automation for enterprise CI/CD pipelines, infrastructure management, and monitoring",110"author": {111"name": "DevOps Platform Team",112"email": "[email protected]",113"url": "https://company.com/teams/devops"114},115"homepage": "https://docs.company.com/plugins/devops",116"repository": {117"type": "git",118"url": "https://github.com/company/devops-plugin.git"119},120"license": "Apache-2.0",121"keywords": [122"devops",123"ci-cd",124"kubernetes",125"terraform",126"automation",127"infrastructure",128"deployment",129"monitoring"130],131"commands": [132"./commands/ci",133"./commands/monitoring",134"./commands/admin"135],136"agents": [137"./agents/orchestration",138"./agents/specialized"139],140"hooks": "./hooks/hooks.json",141"mcpServers": "./.mcp.json"142}143```144145### .mcp.json146147```json148{149"mcpServers": {150"kubernetes": {151"command": "node",152"args": ["${CLAUDE_PLUGIN_ROOT}/servers/kubernetes-mcp/index.js"],153"env": {154"KUBECONFIG": "${KUBECONFIG}",155"K8S_NAMESPACE": "${K8S_NAMESPACE:-default}"156}157},158"terraform": {159"command": "python",160"args": ["${CLAUDE_PLUGIN_ROOT}/servers/terraform-mcp/main.py"],161"env": {162"TF_STATE_BUCKET": "${TF_STATE_BUCKET}",163"AWS_REGION": "${AWS_REGION}"164}165},166"github-actions": {167"command": "node",168"args": ["${CLAUDE_PLUGIN_ROOT}/servers/github-actions-mcp/server.js"],169"env": {170"GITHUB_TOKEN": "${GITHUB_TOKEN}",171"GITHUB_ORG": "${GITHUB_ORG}"172}173}174}175}176```177178### commands/ci/build.md179180```markdown181---182name: build183description: Trigger and monitor CI build pipeline184---185186# Build Command187188Trigger CI/CD build pipeline and monitor progress in real-time.189190## Process1911921. **Validation**: Check prerequisites193- Verify branch status194- Check for uncommitted changes195- Validate configuration files1961972. **Trigger**: Start build via MCP server198\`\`\`javascript199// Uses github-actions MCP server200const build = await tools.github_actions_trigger_workflow({201workflow: 'build.yml',202ref: currentBranch203})204\`\`\`2052063. **Monitor**: Track build progress207- Display real-time logs208- Show test results as they complete209- Alert on failures2102114. **Report**: Summarize results212- Build status213- Test coverage214- Performance metrics215- Deploy readiness216217## Integration218219After successful build:220- Offer to deploy to staging221- Suggest performance optimizations222- Generate deployment checklist223```224225### agents/orchestration/deployment-orchestrator.md226227```markdown228---229description: Orchestrates complex multi-environment deployments with rollback capabilities and health monitoring230capabilities:231- Plan and execute multi-stage deployments232- Coordinate service dependencies233- Monitor deployment health234- Execute automated rollbacks235- Manage deployment approvals236---237238# Deployment Orchestrator Agent239240Specialized agent for orchestrating complex deployments across multiple environments.241242## Expertise243244- **Deployment strategies**: Blue-green, canary, rolling updates245- **Dependency management**: Service startup ordering, dependency injection246- **Health monitoring**: Service health checks, metric validation247- **Rollback automation**: Automatic rollback on failure detection248- **Approval workflows**: Multi-stage approval processes249250## Orchestration Process2512521. **Planning Phase**253- Analyze deployment requirements254- Identify service dependencies255- Generate deployment plan256- Calculate rollback strategy2572582. **Validation Phase**259- Verify environment readiness260- Check resource availability261- Validate configurations262- Run pre-deployment tests2632643. **Execution Phase**265- Deploy services in dependency order266- Monitor health after each stage267- Validate metrics and logs268- Proceed to next stage on success2692704. **Verification Phase**271- Run smoke tests272- Validate service integration273- Check performance metrics274- Confirm deployment success2752765. **Rollback Phase** (if needed)277- Detect failure conditions278- Execute rollback plan279- Restore previous state280- Notify stakeholders281282## MCP Integration283284Uses multiple MCP servers:285- `kubernetes`: Deploy and manage containers286- `terraform`: Provision infrastructure287- `github-actions`: Trigger deployment pipelines288289## Monitoring Integration290291Integrates with monitoring tools via lib:292\`\`\`javascript293const { DatadogClient } = require('${CLAUDE_PLUGIN_ROOT}/lib/integrations/datadog')294const metrics = await DatadogClient.getMetrics(service, timeRange)295\`\`\`296297## Notification Integration298299Sends updates via Slack and PagerDuty:300\`\`\`javascript301const { SlackClient } = require('${CLAUDE_PLUGIN_ROOT}/lib/integrations/slack')302await SlackClient.notify({303channel: '#deployments',304message: 'Deployment started',305metadata: deploymentPlan306})307\`\`\`308```309310### skills/kubernetes-ops/SKILL.md311312```markdown313---314name: Kubernetes Operations315description: This skill should be used when deploying to Kubernetes, managing K8s resources, troubleshooting cluster issues, configuring ingress/services, scaling deployments, or working with Kubernetes manifests. Provides comprehensive Kubernetes operational knowledge and best practices.316version: 2.0.0317---318319# Kubernetes Operations320321Comprehensive operational knowledge for managing Kubernetes clusters and workloads.322323## Overview324325Manage Kubernetes infrastructure effectively through:326- Deployment strategies and patterns327- Resource configuration and optimization328- Troubleshooting and debugging329- Security best practices330- Performance tuning331332## Core Concepts333334### Resource Management335336**Deployments**: Use for stateless applications337- Rolling updates for zero-downtime deployments338- Rollback capabilities for failed deployments339- Replica management for scaling340341**StatefulSets**: Use for stateful applications342- Stable network identities343- Persistent storage344- Ordered deployment and scaling345346**DaemonSets**: Use for node-level services347- Log collectors348- Monitoring agents349- Network plugins350351### Configuration352353**ConfigMaps**: Store non-sensitive configuration354- Environment-specific settings355- Application configuration files356- Feature flags357358**Secrets**: Store sensitive data359- API keys and tokens360- Database credentials361- TLS certificates362363Use external secret management (Vault, AWS Secrets Manager) for production.364365### Networking366367**Services**: Expose applications internally368- ClusterIP for internal communication369- NodePort for external access (non-production)370- LoadBalancer for external access (production)371372**Ingress**: HTTP/HTTPS routing373- Path-based routing374- Host-based routing375- TLS termination376- Load balancing377378## Deployment Strategies379380### Rolling Update381382Default strategy, gradual replacement:383\`\`\`yaml384strategy:385type: RollingUpdate386rollingUpdate:387maxSurge: 1388maxUnavailable: 0389\`\`\`390391**When to use**: Standard deployments, minor updates392393### Recreate394395Stop all pods, then create new ones:396\`\`\`yaml397strategy:398type: Recreate399\`\`\`400401**When to use**: Stateful apps that can't run multiple versions402403### Blue-Green404405Run two complete environments, switch traffic:4061. Deploy new version (green)4072. Test green environment4083. Switch traffic to green4094. Keep blue for quick rollback410411**When to use**: Critical services, need instant rollback412413### Canary414415Gradually roll out to subset of users:4161. Deploy canary version (10% traffic)4172. Monitor metrics and errors4183. Increase traffic gradually4194. Complete rollout or rollback420421**When to use**: High-risk changes, want gradual validation422423## Resource Configuration424425### Resource Requests and Limits426427Always set for production workloads:428\`\`\`yaml429resources:430requests:431memory: "256Mi"432cpu: "250m"433limits:434memory: "512Mi"435cpu: "500m"436\`\`\`437438**Requests**: Guaranteed resources439**Limits**: Maximum allowed resources440441### Health Checks442443Essential for reliability:444\`\`\`yaml445livenessProbe:446httpGet:447path: /health448port: 8080449initialDelaySeconds: 30450periodSeconds: 10451452readinessProbe:453httpGet:454path: /ready455port: 8080456initialDelaySeconds: 5457periodSeconds: 5458\`\`\`459460**Liveness**: Restart unhealthy pods461**Readiness**: Remove unready pods from service462463## Troubleshooting464465### Common Issues4664671. **Pods not starting**468- Check: `kubectl describe pod <name>`469- Look for: Image pull errors, resource constraints470- Fix: Verify image name, increase resources4714722. **Service not reachable**473- Check: `kubectl get svc`, `kubectl get endpoints`474- Look for: No endpoints, wrong selector475- Fix: Verify pod labels match service selector4764773. **High memory usage**478- Check: `kubectl top pods`479- Look for: Pods near memory limit480- Fix: Increase limits, optimize application4814824. **Frequent restarts**483- Check: `kubectl get pods`, `kubectl logs <name>`484- Look for: Liveness probe failures, OOMKilled485- Fix: Adjust health checks, increase memory486487### Debugging Commands488489Get pod details:490\`\`\`bash491kubectl describe pod <name>492kubectl logs <name>493kubectl logs <name> --previous # logs from crashed container494\`\`\`495496Execute commands in pod:497\`\`\`bash498kubectl exec -it <name> -- /bin/sh499kubectl exec <name> -- env500\`\`\`501502Check resource usage:503\`\`\`bash504kubectl top nodes505kubectl top pods506\`\`\`507508## Security Best Practices509510### Pod Security511512- Run as non-root user513- Use read-only root filesystem514- Drop unnecessary capabilities515- Use security contexts516517Example:518\`\`\`yaml519securityContext:520runAsNonRoot: true521runAsUser: 1000522readOnlyRootFilesystem: true523capabilities:524drop:525- ALL526\`\`\`527528### Network Policies529530Restrict pod communication:531\`\`\`yaml532apiVersion: networking.k8s.io/v1533kind: NetworkPolicy534metadata:535name: api-allow536spec:537podSelector:538matchLabels:539app: api540ingress:541- from:542- podSelector:543matchLabels:544app: frontend545\`\`\`546547### Secrets Management548549- Never commit secrets to git550- Use external secret managers551- Rotate secrets regularly552- Limit secret access with RBAC553554## Performance Optimization555556### Resource Tuning5575581. **Start conservative**: Set low limits initially5592. **Monitor usage**: Track actual resource consumption5603. **Adjust gradually**: Increase based on metrics5614. **Set appropriate requests**: Match typical usage5625. **Set safe limits**: 2x requests for headroom563564### Horizontal Pod Autoscaling565566Automatically scale based on metrics:567\`\`\`yaml568apiVersion: autoscaling/v2569kind: HorizontalPodAutoscaler570metadata:571name: api-hpa572spec:573scaleTargetRef:574apiVersion: apps/v1575kind: Deployment576name: api577minReplicas: 2578maxReplicas: 10579metrics:580- type: Resource581resource:582name: cpu583target:584type: Utilization585averageUtilization: 70586\`\`\`587588## MCP Server Integration589590This skill works with the kubernetes MCP server for operations:591592**List pods**:593\`\`\`javascript594const pods = await tools.k8s_list_pods({ namespace: 'default' })595\`\`\`596597**Get pod logs**:598\`\`\`javascript599const logs = await tools.k8s_get_logs({ pod: 'api-xyz', container: 'app' })600\`\`\`601602**Apply manifests**:603\`\`\`javascript604const result = await tools.k8s_apply_manifest({ file: 'deployment.yaml' })605\`\`\`606607## Detailed References608609For in-depth information:610- **Deployment patterns**: `references/deployment-patterns.md`611- **Troubleshooting guide**: `references/troubleshooting.md`612- **Security hardening**: `references/security.md`613614## Example Manifests615616For copy-paste examples:617- **Basic deployment**: `examples/basic-deployment.yaml`618- **StatefulSet**: `examples/stateful-set.yaml`619- **Ingress config**: `examples/ingress-config.yaml`620621## Validation Scripts622623For manifest validation:624\`\`\`bash625bash ${CLAUDE_PLUGIN_ROOT}/skills/kubernetes-ops/scripts/validate-manifest.sh deployment.yaml626\`\`\`627```628629### hooks/hooks.json630631```json632{633"PreToolUse": [634{635"matcher": "Write|Edit",636"hooks": [637{638"type": "command",639"command": "bash ${CLAUDE_PLUGIN_ROOT}/hooks/scripts/security/scan-secrets.sh",640"timeout": 30641}642]643},644{645"matcher": "Bash",646"hooks": [647{648"type": "prompt",649"prompt": "Evaluate if this bash command is safe for production environment. Check for destructive operations, missing safeguards, and potential security issues. Commands should be idempotent and reversible.",650"timeout": 20651}652]653}654],655"PostToolUse": [656{657"matcher": "Bash",658"hooks": [659{660"type": "command",661"command": "bash ${CLAUDE_PLUGIN_ROOT}/hooks/scripts/workflow/update-status.sh",662"timeout": 15663}664]665}666],667"Stop": [668{669"matcher": ".*",670"hooks": [671{672"type": "command",673"command": "bash ${CLAUDE_PLUGIN_ROOT}/hooks/scripts/quality/check-config.sh",674"timeout": 45675},676{677"type": "command",678"command": "bash ${CLAUDE_PLUGIN_ROOT}/hooks/scripts/workflow/notify-team.sh",679"timeout": 30680}681]682}683],684"SessionStart": [685{686"matcher": ".*",687"hooks": [688{689"type": "command",690"command": "bash ${CLAUDE_PLUGIN_ROOT}/hooks/scripts/security/validate-permissions.sh",691"timeout": 20692}693]694}695]696}697```698699## Key Features700701### Multi-Level Organization702703**Commands**: Organized by function (CI, monitoring, admin)704**Agents**: Separated by role (orchestration vs. specialized)705**Skills**: Rich resources (references, examples, scripts)706707### MCP Integration708709Three custom MCP servers:710- **Kubernetes**: Cluster operations711- **Terraform**: Infrastructure provisioning712- **GitHub Actions**: CI/CD automation713714### Shared Libraries715716Reusable code in `lib/`:717- **Core**: Common utilities (logging, config, auth)718- **Integrations**: External services (Slack, Datadog)719- **Utils**: Helper functions (retry, validation)720721### Configuration Management722723Environment-specific configs in `config/`:724- **Environments**: Per-environment settings725- **Templates**: Reusable deployment templates726727### Security Automation728729Multiple security hooks:730- Secret scanning before writes731- Permission validation on session start732- Configuration auditing on completion733734### Monitoring Integration735736Built-in monitoring via lib integrations:737- Datadog for metrics738- PagerDuty for alerts739- Slack for notifications740741## Use Cases7427431. **Multi-environment deployments**: Orchestrated rollouts across dev/staging/prod7442. **Infrastructure as code**: Terraform automation with state management7453. **CI/CD automation**: Build, test, deploy pipelines7464. **Monitoring and observability**: Integrated metrics and alerting7475. **Security enforcement**: Automated security scanning and validation7486. **Team collaboration**: Slack notifications and status updates749750## When to Use This Pattern751752- Large-scale enterprise deployments753- Multiple environment management754- Complex CI/CD workflows755- Integrated monitoring requirements756- Security-critical infrastructure757- Team collaboration needs758759## Scaling Considerations760761- **Performance**: Separate MCP servers for parallel operations762- **Organization**: Multi-level directories for scalability763- **Maintainability**: Shared libraries reduce duplication764- **Flexibility**: Environment configs enable customization765- **Security**: Layered security hooks and validation766