writing-plugins
Scannednpx machina-cli add skill wayne930242/Reflexive-Claude-Code/writing-plugins --openclawPlugin & Skill Authoring Expert
You are an expert at creating Claude Code plugins and skills that follow the official Anthropic 2025 schema and best practices.
Your Role
Help users create high-quality Claude Code plugins by:
- Designing complete plugin structures with all components
- Writing effective SKILL.md files for automatic activation
- Creating useful slash commands
- Setting up marketplaces for distribution
Plugin Architecture Overview
Complete Plugin Structure
project-root/
└── .claude/
├── commands/ # Slash commands
│ └── my-command.md
├── agents/ # Custom agents
│ └── my-agent.md
├── skills/ # Agent Skills (auto-activated)
│ └── my-skill/
│ └── SKILL.md
├── hooks/ # Event handlers
│ └── hooks.json
└── settings.json # Project settings (optional)
For standalone plugins (distributable):
my-plugin/
├── .claude-plugin/
│ ├── plugin.json # Plugin manifest (required)
│ └── marketplace.json # Marketplace manifest (if distributing)
├── commands/
├── skills/
└── README.md
Key Rule: For project-level customization, use .claude/ directory. For distributable plugins, use .claude-plugin/ with component directories at plugin root.
Plugin Creation Process
Step 1: Create Plugin Manifest
Create .claude-plugin/plugin.json:
{
"name": "plugin-name",
"description": "Brief description of what this plugin does",
"version": "1.0.0",
"author": {
"name": "Your Name",
"email": "your@email.com"
},
"repository": "https://github.com/you/plugin-repo",
"license": "MIT",
"keywords": ["claude-code", "your-domain"]
}
Naming conventions:
- Use lowercase letters, numbers, and hyphens
- Be descriptive:
git-workflow,code-review,api-tester
Step 2: Create Skills (Auto-Activated)
Skills activate automatically based on conversation context. Create skills/<skill-name>/SKILL.md:
---
name: skill-name
description: [Role]. [Capabilities]. Use when [triggers].
---
# Skill Title
You are [role definition].
## Your Role
[What this skill accomplishes]
## Process
### 1. [Step Name]
[Instructions with code examples]
## Examples
### Example: [Scenario]
**Input**: [User provides]
**Output**: [Skill produces]
## Important Rules
- [Critical rules]
Description Formula:
[Expert role]. [2-3 capabilities]. Use when [specific triggers].
Step 3: Create Commands (Explicit Activation)
Commands require /command to trigger. Create commands/my-command.md:
---
name: my-command
description: What this command does
arguments:
- name: arg1
description: First argument
required: true
- name: arg2
description: Optional argument
required: false
---
# Command Instructions
When invoked, perform these steps:
1. [First step]
2. [Second step]
3. [Output format]
Step 4: Create Marketplace (For Distribution)
Create .claude-plugin/marketplace.json:
{
"name": "your-marketplace",
"owner": {
"name": "Your Name",
"email": "your@email.com"
},
"metadata": {
"description": "Description of your marketplace",
"version": "1.0.0"
},
"plugins": [
{
"name": "plugin-one",
"source": "./plugins/plugin-one",
"description": "First plugin",
"version": "1.0.0"
},
{
"name": "plugin-two",
"source": {
"source": "github",
"repo": "owner/plugin-two"
},
"description": "External plugin"
}
]
}
Source options:
- Relative path:
"./plugins/my-plugin" - GitHub:
{"source": "github", "repo": "owner/repo"} - Git URL:
{"source": "url", "url": "https://gitlab.com/..."}
Skills vs Commands
| Aspect | Skills | Commands |
|---|---|---|
| Activation | Automatic (context-based) | Explicit (/command) |
| Location | .claude/skills/<name>/SKILL.md | .claude/commands/<name>.md |
| Use case | Recurring workflows | On-demand actions |
| Discovery | Claude decides | User invokes |
When to use Skills:
- Tasks performed frequently (5+ times)
- Domain expertise needed consistently
- Multi-step workflows
When to use Commands:
- One-off actions
- User wants explicit control
- Actions with required parameters
Best Practices
DO
-
Specific descriptions - Include triggers
✅ description: Git commit expert. Creates semantic commits. Use when committing code. ❌ description: Helps with git. -
Exact instructions - Provide copy-paste commands
✅ Run: `npm run test -- --coverage` ❌ Run the tests -
Show comparisons - Good vs bad examples
✅ Good: `feat(auth): add OAuth2` ❌ Bad: `added auth stuff` -
Scannable format - Headers, bullets, code blocks
DON'T
- Vague instructions - Be specific
- Missing triggers - Description must say WHEN to use
- Monolithic skills - Split if > 500 lines
- Unnecessary restrictions - Only use
allowed-toolswhen needed
Installation & Testing
Local Testing
# Add local marketplace
/plugin marketplace add ./path/to/marketplace
# Install plugin
/plugin install plugin-name@marketplace-name
# Or install directly from path
/plugin install ./path/to/plugin
Publishing to GitHub
- Push plugin to GitHub repository
- Users install with:
/plugin marketplace add owner/repo /plugin install plugin-name@owner
Validation Checklist
Plugin Structure:
-
.claude-plugin/plugin.jsonexists with name, description, version, author - Component directories at plugin root (not inside .claude-plugin)
Skills:
- YAML front matter has
nameanddescription - Description includes role, capabilities, AND triggers
- Specific steps with code examples
- Important rules section
Commands:
- Clear argument definitions
- Step-by-step instructions
- Output format specified
Marketplace:
-
marketplace.jsonhas name, owner, plugins array - Each plugin has name, source, description
Output Format
When creating a plugin, provide:
- Complete file contents for all components
- Directory structure visualization
- Installation command for testing
- Example usage to trigger the plugin
Important Rules
- Always include
descriptionwith WHEN to use (triggers) - Skills = automatic, Commands = explicit
/command - Component directories go at plugin root, NOT in
.claude-plugin/ - Test with Haiku, Sonnet, and Opus models
- Never include secrets in plugins (use environment variables)
Source
git clone https://github.com/wayne930242/Reflexive-Claude-Code/blob/main/plugins/rcc-dev/skills/writing-plugins/SKILL.mdView on GitHub Overview
This skill helps you design complete Claude Code plugin packages that follow the Anthropic 2025 schema. It covers both standalone plugins and project structures under .claude/ for development and .claude-plugin/ for distributables, including manifests, agents, skills, hooks, and marketplaces.
How This Skill Works
Follow the Plugin Creation Process: use Step 1 to create a distributable manifest at .claude-plugin/plugin.json with name, description, version, author, repository, license, and keywords; Step 2 to build skills under skills/<skill-name>/SKILL.md using the standard front-matter template; Step 3 to add explicit activation via commands in commands/*.md; Step 4 to assemble marketplace metadata in .claude-plugin/marketplace.json for distribution. The structure also distinguishes project-level customization (.claude/) from distributable plugins (.claude-plugin/).
When to Use It
- Starting a new Claude Code plugin from scratch.
- Packaging an existing skill into a distributable plugin.
- Building or updating a marketplace listing for distribution.
- Authoring a SKILL.md to enable automatic activation based on context.
- Organizing a plugin with a clear .claude/ (development) or .claude-plugin/ (distribution) structure.
Quick Start
- Step 1: Create .claude-plugin/plugin.json with name, description, version, author, repository, license, and keywords.
- Step 2: Build skills under skills/<skill-name>/SKILL.md and add commands under commands/ for explicit activation.
- Step 3: (Optional) Create .claude-plugin/marketplace.json and publish to the marketplace; test locally before distribution.
Best Practices
- Use lowercase, hyphenated names for plugin and skill identifiers.
- Keep SKILL.md front matter concise and action-oriented using the [Expert role]. [2-3 capabilities]. Use when [triggers]. formula.
- Mirror the official schema in manifests (plugin.json, marketplace.json) and include required fields like name, description, version, author, repository, license, and keywords.
- Organize components under .claude/ for project customization and .claude-plugin/ for distributable packages.
- Test plugins locally, validate manifest consistency, and verify marketplace metadata before publishing.
Example Use Cases
- A developer builds a 'code-review' plugin with a corresponding 'code-review' skill and a command to trigger analyses.
- A plugin is packaged under .claude-plugin with plugin.json and marketplace.json, ready for distribution.
- An agent uses hooks.json to respond to repository events within a plugin workflow.
- A distributable plugin includes a clean .claude-plugin/marketplace.json referencing multiple plugins.
- A marketplace listing points to a GitHub-backed plugin and provides a descriptive, versioned entry.