Best Practices¶
Follow these guidelines to create high-quality plugins that are easy to use, maintain, and extend.
Plugin Design¶
Keep Plugins Focused¶
Each plugin should have a clear, well-defined purpose. Don't create "kitchen sink" plugins that try to do everything.
Follow Semantic Versioning¶
Use SemVer for all plugin versions:
| Change | Version Bump | Example |
|---|---|---|
| Breaking changes | Major | 1.0.0 → 2.0.0 |
| New features (backwards compatible) | Minor | 1.0.0 → 1.1.0 |
| Bug fixes | Patch | 1.0.0 → 1.0.1 |
Update versions in both plugin.json and marketplace.json simultaneously.
Provide Complete READMEs¶
Every plugin README should include:
- Title and description - What the plugin does
- Commands overview - Table of all available commands
- Installation - How to enable the plugin
- Usage examples - Real-world scenarios
- Configuration - Any required setup (e.g., MCP servers)
Command Design¶
Use Clear, Action-Oriented Names¶
Commands should be verbs in kebab-case:
| ✅ Good | ❌ Bad |
|---|---|
commit | git-stuff |
create-pr | pr |
check-commands | validator |
create-prd | prd |
Keep Commands Focused¶
Each command should do one thing well. If a command does too much, split it into multiple commands.
Write Clear Instructions¶
Claude follows your command instructions literally. Be specific:
Define Allowed Tools¶
Use YAML frontmatter to restrict which tools a command can use:
| YAML | |
|---|---|
This prevents commands from performing unintended operations.
Support Arguments¶
For commands that accept input, define arguments clearly:
And reference them in the instructions with $ARGUMENTS.
Agent Design¶
Define Clear Expertise¶
Each agent should have a well-defined domain of expertise:
| ✅ Focused | ❌ Too Broad |
|---|---|
| Java development expert | General programming helper |
| Code review specialist | Everything reviewer |
| Markdown formatting | Document processor |
Use Appropriate Colors¶
Follow the color convention for agent types:
| Color | Domain |
|---|---|
blue | Development/coding |
green | Testing/quality |
purple | Architecture/design |
orange | Education/learning |
red | Security/critical |
Include Interaction Examples¶
Show how the agent should respond in different scenarios:
| Markdown | |
|---|---|
Documentation¶
Use References for Details¶
Keep command files concise by moving detailed documentation to references/:
| Text Only | |
|---|---|
Link from commands to references:
| Markdown | |
|---|---|
Write for Your Audience¶
| Audience | Write in | Example |
|---|---|---|
| Users | Simple, task-oriented language | "Run /commit to create a commit" |
| Developers | Technical, detailed language | "The YAML frontmatter defines the tool permissions scope" |
| Contributors | Process-oriented language | "Fork the repo, create a feature branch, submit a PR" |
Keep Documentation in Sync¶
When you modify a command, update:
- The command file itself
- The plugin README
- Related reference files
- Marketplace description (if scope changed)
Security¶
Never Hardcode Secrets¶
| YAML | |
|---|---|
Restrict Tool Access¶
Only grant tools that a command actually needs:
| YAML | |
|---|---|
Ask Before Destructive Operations¶
Commands should confirm before performing irreversible actions:
| Markdown | |
|---|---|
User Experience¶
Provide Sensible Defaults¶
Commands should work with minimal input:
| Bash | |
|---|---|
Give Clear Feedback¶
Commands should inform users about what's happening:
| Markdown | |
|---|---|
Handle Errors Gracefully¶
Performance¶
Keep Prompts Concise¶
Long command files consume more tokens. Structure them efficiently:
- Use bullet points instead of paragraphs
- Reference details in
references/instead of inlining - Avoid repeating information
Use Skills for Complex Logic¶
For commands with significant logic (formatters, validators), consider using Skills with Python scripts:
| Text Only | |
|---|---|
Benefits:
- Faster execution
- Lower token consumption
- Reusable across plugins
Naming Conventions¶
Files¶
| Component | Convention | Example |
|---|---|---|
| Command files | kebab-case | create-pr.md |
| Agent files | kebab-case | java-tutor.md |
| Plugin directories | kebab-case | git-workflow/ |
| Reference directories | kebab-case | commit-types.md |
Identifiers¶
| Component | Convention | Example |
|---|---|---|
| Plugin name | kebab-case | "name": "git-workflow" |
| Command name | kebab-case | "name": "create-pr" |
| Agent name | kebab-case | "name": "java-tutor" |
| Branch names | type/description | feature/add-dark-mode |
Commit Messages¶
Follow the Emoji Conventional Commits format:
| Text Only | |
|---|---|
Checklist Before Submission¶
- Plugin has a clear, focused purpose
-
plugin.jsonis valid with all required fields - Version follows semantic versioning
- README is comprehensive with usage examples
- All commands have YAML frontmatter
- Commands have
allowed-toolsdefined - Agent colors follow the convention
- No secrets or credentials in any file
- Tested locally with
claude --plugin-dir -
/check-commandsand/check-agentspass - Marketplace entry updated (if new plugin)
- CHANGELOG updated
Related Resources¶
- Plugin Development - Create plugins
- Testing - Test your plugins
- CI/CD - Automated validation
- Contributing - Submission process
- Conventional Commits - Commit format reference