4.7 KiB
Testing Workflow
A step-by-step guide to testing plugins locally during development.
Overview
Testing plugins locally uses a dev marketplace that points to your working plugin directory. This allows you to:
- Test changes without publishing
- Iterate quickly
- Validate before distribution
Setup: One-Time
1. Create Dev Marketplace Structure
# From your project root
mkdir -p dev-marketplace/.claude-plugin
2. Create marketplace.json
Create dev-marketplace/.claude-plugin/marketplace.json:
{
"name": "dev-marketplace",
"owner": {
"name": "Developer"
},
"metadata": {
"description": "Local development marketplace",
"version": "0.1.0"
},
"plugins": [
{
"name": "my-plugin",
"description": "Plugin under development",
"source": "../plugins/my-plugin"
}
]
}
Key: source points to your plugin directory (relative path from marketplace).
3. Add Marketplace to Claude Code
claude
/plugin marketplace add ./dev-marketplace
Verify:
/plugin marketplace list
You should see dev-marketplace listed.
Iteration Loop
Install Plugin
/plugin install my-plugin@dev-marketplace
Test Commands
/my-plugin:command-name args
Or test via /help to see if commands appear.
Make Changes
Edit your plugin files (commands, skills, etc.).
Reinstall
/plugin uninstall my-plugin@dev-marketplace
/plugin install my-plugin@dev-marketplace
Note: You must uninstall/reinstall to pick up changes.
Repeat
Continue the edit → reinstall → test cycle.
Validation
Before each test cycle, validate your plugin:
/plugin-development:validate
This checks:
plugin.jsonexists and is valid JSON- Component directories exist
- Paths are correct
- No common mistakes
Debugging
Plugin Not Loading
- Check
plugin.jsonexists at.claude-plugin/plugin.json - Verify JSON syntax:
cat .claude-plugin/plugin.json | jq . - Check paths are relative:
./commands/not/absolute/path/
Commands Not Showing
- Verify
commandsfield inplugin.jsonpoints to./commands/ - Check command files have
.mdextension - Verify frontmatter has
descriptionfield - Reinstall the plugin
Hooks Not Running
- Check
hooksfield inplugin.jsonpoints to correct path - Verify
hooks.jsonis valid JSON - Make scripts executable:
chmod +x scripts/*.sh - Test script directly:
./scripts/validate-plugin.sh - Use
claude --debugto see hook execution
Skills Not Triggering
- Check
skillsfield inplugin.json(if specified) - Verify
SKILL.mdhas frontmatter withnameanddescription - Ensure
namematches directory name (lowercase, hyphenated) - Check
descriptionincludes clear trigger conditions
Advanced: Debug Mode
Run Claude Code in debug mode to see detailed plugin loading:
claude --debug
This shows:
- Plugin registration
- Component discovery
- Hook execution
- Tool usage
Look for errors related to your plugin in the output.
Multiple Plugins
You can test multiple plugins from one dev marketplace:
{
"plugins": [
{
"name": "plugin-one",
"source": "../plugins/plugin-one"
},
{
"name": "plugin-two",
"source": "../plugins/plugin-two"
}
]
}
Install each separately:
/plugin install plugin-one@dev-marketplace
/plugin install plugin-two@dev-marketplace
Clean Up
Uninstall Plugin
/plugin uninstall my-plugin@dev-marketplace
Remove Marketplace
/plugin marketplace remove dev-marketplace
Best Practices
- Validate first: Always run
/plugin-development:validatebefore testing - Small changes: Test incrementally, don't make many changes at once
- Check logs: Use
--debugwhen troubleshooting - Script testing: Test hook scripts directly before adding to hooks.json
- Clean installs: Uninstall fully before reinstalling to avoid cache issues
Troubleshooting Checklist
□ plugin.json exists and is valid JSON
□ All paths are relative (start with ./)
□ Component directories exist (commands/, etc.)
□ Command files have .md extension
□ Scripts are executable (chmod +x)
□ marketplace.json plugin name matches plugin.json name
□ Reinstalled after making changes
Example Session
# One-time setup
mkdir -p dev-marketplace/.claude-plugin
# ... create marketplace.json ...
/plugin marketplace add ./dev-marketplace
# Development loop
/plugin install my-plugin@dev-marketplace
/my-plugin:test-command
# Make changes to plugin files...
/plugin-development:validate
/plugin uninstall my-plugin@dev-marketplace
/plugin install my-plugin@dev-marketplace
/my-plugin:test-command
# Repeat...