home / skills / anton-abyzov / specweave / plugin-development

plugin-development skill

/plugins/specweave-plugin-dev/skills/plugin-development

This skill guides you in building production-ready Claude Code plugins with proper structure, YAML frontmatter, and robust commands and agents.

This is most likely a fork of the sw-plugin-development skill from openclaw
npx playbooks add skill anton-abyzov/specweave --skill plugin-development

Review the files below or copy the command above to add this skill to your agents.

Files (1)
SKILL.md
6.5 KB
---
name: plugin-development
description: Claude Code plugin development - plugin structure, slash commands, skills, sub-agents, YAML frontmatter. Use when creating plugins.
---

# Plugin Development Expert

Expert guidance for creating production-ready Claude Code plugins.

## Critical Structure Rules

**Directory Hierarchy**:
```
~/.claude/plugins/my-plugin/    ← Plugin root
├── .claude-plugin/
│   └── plugin.json            ← Manifest (REQUIRED)
├── commands/
│   └── command-name.md        ← Slash commands
├── skills/
│   └── skill-name/            ← MUST be subdirectory
│       └── SKILL.md           ← MUST be uppercase
└── agents/
    └── agent-name/
        └── AGENT.md
```

**Common Mistakes**:
```
# ❌ WRONG
skills/SKILL.md                # Missing subdirectory
skills/my-skill.md             # Wrong filename
skills/My-Skill/SKILL.md       # CamelCase not allowed

# ✅ CORRECT
skills/my-skill/SKILL.md       # kebab-case subdirectory + SKILL.md
```

## plugin.json Format

**Minimum Required**:
```json
{
  "name": "my-plugin",
  "description": "Clear description with activation keywords",
  "version": "1.0.0"
}
```

**Full Example**:
```json
{
  "name": "my-awesome-plugin",
  "description": "Expert cost optimization for AWS, Azure, GCP. Activates for reduce costs, cloud costs, finops, save money, cost analysis.",
  "version": "1.0.0",
  "author": {
    "name": "Your Name",
    "email": "[email protected]"
  },
  "homepage": "https://github.com/user/my-plugin",
  "repository": "https://github.com/user/my-plugin",
  "license": "MIT",
  "keywords": ["cost", "finops", "aws", "azure", "gcp"]
}
```

## Command Format (Slash Commands)

**Header Format** (CRITICAL):
```markdown
# /my-plugin:command-name
```

**Rules**:
- MUST start with `# /`
- Plugin name: `kebab-case`
- Command name: `kebab-case`
- NO YAML frontmatter (only skills use YAML)

**Full Template**:
```markdown
# /my-plugin:analyze-costs

Analyze cloud costs and provide optimization recommendations.

You are an expert FinOps engineer.

## Your Task

1. Collect cost data
2. Analyze usage patterns
3. Identify optimization opportunities
4. Generate report

### 1. Data Collection

\```bash
aws ce get-cost-and-usage --time-period...
\```

## Example Usage

**User**: "Analyze our AWS costs"

**Response**:
- Pulls Cost Explorer data
- Identifies $5K/month in savings
- Provides implementation plan

## When to Use

- Monthly cost reviews
- Budget overruns
- Pre-purchase planning
```

## Skill Format (Auto-Activating)

**YAML Frontmatter** (REQUIRED):
```yaml
---
name: cost-optimization
description: Expert cloud cost optimization for AWS, Azure, GCP. Covers FinOps, reserved instances, spot instances, right-sizing, storage optimization. Activates for reduce costs, save money, cloud costs, aws costs, finops, cost optimization, budget overrun, expensive bill.
---
```

**Activation Keywords**:
```yaml
# ✅ GOOD: Specific, varied keywords
description: Expert Python optimization. Activates for python performance, optimize python code, speed up python, profiling, cProfile, pypy, numba.

# ❌ BAD: Too generic
description: Python expert.

# ❌ BAD: No activation keywords
description: Expert Python optimization covering performance tuning.
```

**Full Template**:
```markdown
---
name: my-skill
description: Expert [domain] covering [topics]. Activates for keyword1, keyword2, phrase3, action4.
---

# Skill Title

You are an expert [role] with deep knowledge of [domain].

## Core Expertise

### 1. Topic Area

Content here...

### 2. Code Examples

\```typescript
// Working examples
\```

## Best Practices

- Practice 1
- Practice 2

You are ready to help with [domain]!
```

## Agent Format (Sub-Agents)

**File Location**:
```
agents/agent-name/AGENT.md
```

**Template**:
```markdown
---
name: specialist-agent
description: Specialized agent for [specific task]
---

# Agent Title

You are a specialized agent for [purpose].

## Capabilities

1. Capability 1
2. Capability 2

## Workflow

1. Analyze input
2. Execute specialized task
3. Return results
```

**Invocation**:
```typescript
Task({
  subagent_type: "plugin-name:folder-name:yaml-name",
  prompt: "Task description"
});

// Example
Task({
  subagent_type: "my-plugin:specialist-agent:specialist-agent",
  prompt: "Analyze this code for security vulnerabilities"
});
```

## Testing Workflow

**1. Install Plugin**:
```bash
cp -r my-plugin ~/.claude/plugins/
# OR
claude plugin add github:username/my-plugin
```

**2. Restart Claude Code**:
```bash
# Required after:
- Adding new plugin
- Modifying plugin.json
- Adding/removing commands
- Changing YAML frontmatter
```

**3. Test Commands**:
```bash
# Type "/" in Claude Code
# Verify command appears: /my-plugin:command-name
# Execute command
# Verify behavior
```

**4. Test Skills**:
```bash
# Ask trigger question: "How do I reduce costs?"
# Verify skill activates
# Check response uses skill knowledge
```

**5. Check Logs**:
```bash
tail -f ~/.claude/logs/claude.log | grep my-plugin

# Expected:
# ✅ "Loaded plugin: my-plugin"
# ✅ "Registered command: /my-plugin:analyze"
# ✅ "Registered skill: cost-optimization"

# Errors:
# ❌ "Failed to parse plugin.json"
# ❌ "YAML parsing error in SKILL.md"
# ❌ "Command header malformed"
```

## Common Issues

**Issue: Skill not activating**
```
Checklist:
1. ✅ YAML frontmatter present? (---...---)
2. ✅ Activation keywords in description?
3. ✅ SKILL.md in subdirectory? (skills/name/SKILL.md)
4. ✅ File named SKILL.md (uppercase)?
5. ✅ Claude Code restarted?
```

**Issue: Command not found**
```
Checklist:
1. ✅ Header format: # /plugin-name:command-name
2. ✅ File in commands/ directory?
3. ✅ Plugin name matches plugin.json?
4. ✅ Claude Code restarted?
```

**Issue: YAML parsing error**
```
Common causes:
- Unclosed quotes: description: "Missing end
- Invalid characters: name: my_skill (use hyphens)
- Missing closing ---
- Incorrect indentation
```

## Best Practices

**Naming**:
- Plugin: `my-awesome-plugin` (kebab-case)
- Commands: `analyze-costs` (kebab-case)
- Skills: `cost-optimization` (kebab-case)
- NO underscores, NO CamelCase

**Activation Keywords**:
- Include 5-10 trigger keywords
- Mix specific terms and common phrases
- Think about what users will ask
- Test with real questions

**Documentation**:
- Clear "Your Task" section
- Code examples with syntax highlighting
- "Example Usage" section
- "When to Use" section

**Performance**:
- Keep SKILL.md under 50KB
- Optimize command prompts
- Avoid expensive operations

Create production-ready Claude Code plugins!

Overview

This skill provides a practical guide for building production-ready Claude Code plugins with TypeScript. It enforces required directory layout, manifest format, slash command structure, skill frontmatter, and sub-agent conventions. Use it to avoid common pitfalls and speed up testing and deployment.

How this skill works

The skill inspects plugin structure, manifest (plugin.json), command files, skill documents with YAML frontmatter, and agent definitions. It validates naming conventions, activation keywords, and restart/testing steps, and highlights common parsing or registration errors to fix. It also documents invocation patterns for sub-agents and the recommended testing workflow.

When to use it

  • Creating a new Claude Code plugin from scratch
  • Adding or updating slash commands or skills
  • Implementing specialized sub-agents for tasks
  • Testing plugin registration and activation in Claude Code
  • Troubleshooting command/skill parsing or activation problems

Best practices

  • Follow kebab-case for plugin, command, skill, and agent names; avoid underscores and CamelCase
  • Provide clear activation keywords (5–10 varied, specific phrases) in YAML frontmatter for skills
  • Include a minimal plugin.json with name, description (activation keywords), and version; add author/homepage/repo when available
  • Keep skill documents concise (<50KB) and include clear task, examples, and usage sections
  • Restart Claude Code after changing plugin.json, adding/removing commands, or editing frontmatter
  • Test commands by typing "/" and verify logs for successful registration

Example use cases

  • Add a cost-optimization skill that activates for phrases like “reduce costs” or “cloud costs”
  • Create a /my-plugin:analyze-costs slash command that collects and analyzes cloud billing data
  • Implement a specialist sub-agent to run security analysis and be invoked via Task({ subagent_type: ... })
  • Iterate on plugin.json keywords and test activation by asking trigger questions in Claude Code
  • Diagnose a YAML parsing error causing a skill to fail activation and fix unclosed quotes or missing delimiters

FAQ

What minimum fields are required in plugin.json?

Include name, description with activation keywords, and version; author and repository are optional but recommended.

Why is my skill not activating?

Common causes: missing YAML frontmatter, absent activation keywords, wrong file placement, incorrect filename casing, or failing to restart Claude Code.

How do I invoke a sub-agent from code?

Call Task with subagent_type formatted as plugin-name:folder-name:yaml-name and provide a prompt describing the work to perform.