Testing Plugins¶
Learn how to test your plugins locally before submitting them to the marketplace.
Overview¶
Since plugins consist of Markdown and JSON files with no build step, testing focuses on:
- Structural validation - Correct directory layout and required files
- Content validation - Valid JSON, meaningful command definitions
- Functional testing - Commands and agents work as expected in Claude Code
- Automated validation - CI/CD checks run on every PR
Local Testing¶
Test a Single Plugin¶
Load only your plugin during development:
| Bash | |
|---|---|
This starts Claude Code with your plugin loaded. Test each command:
Test the Entire Marketplace¶
Load all plugins to verify there are no conflicts:
| Bash | |
|---|---|
Test from a Different Project¶
Verify your plugin works when loaded from an external project:
| Bash | |
|---|---|
Validation Commands¶
The core plugin provides built-in validation commands:
/check-commands¶
Validates all command Markdown files across plugins:
| Bash | |
|---|---|
Checks performed:
- YAML frontmatter present and valid
- Required fields defined (description)
- File is not empty
- Markdown structure is correct
- No broken internal links
/check-agents¶
Validates all agent definition files:
| Bash | |
|---|---|
Checks performed:
- YAML frontmatter present and valid
- Required fields (name, description)
- Color attribute is valid
- File is not empty
- Consistent structure
/run-ci¶
Runs CI-equivalent checks locally:
| Bash | |
|---|---|
This simulates the GitHub Actions validation pipeline on your local machine.
Manual Testing Checklist¶
Before submitting a PR, work through this checklist:
Plugin Structure¶
-
.claude-plugin/plugin.jsonexists and is valid JSON -
plugin.jsoncontainsnameandversionfields -
README.mdexists with sections and usage examples - All command files are in
commands/directory - All agent files are in
agents/directory (if applicable)
Commands¶
- Each command loads without errors
- Commands produce expected output
- Arguments are parsed correctly
- Error cases are handled gracefully
- Help text is clear and accurate
- Examples in documentation actually work
Agents¶
- Agents trigger on expected keywords (if auto-trigger)
- Agent responses match their defined expertise
- Agent communication style is consistent
- Agents handle edge cases appropriately
Documentation¶
- README describes all commands and agents
- Usage examples are correct and tested
- Installation instructions are accurate
- No broken links in documentation
Integration¶
- Plugin doesn't conflict with other plugins
- Command names don't collide with existing commands
- Agent names are unique across the marketplace
JSON Validation¶
Validate plugin.json syntax from the command line:
| Bash | |
|---|---|
Validate marketplace.json:
| Bash | |
|---|---|
Testing Strategies¶
Iterative Development¶
graph LR
A["Edit Command"] --> B["Load Plugin"]
B --> C["Test Command"]
C --> D{Works?}
D -->|No| A
D -->|Yes| E["Next Command"]
E --> A - Edit your command file
- Restart Claude Code with
--plugin-dir - Run the command
- Verify output
- Repeat
Edge Case Testing¶
Test your commands with:
- No arguments - Does it handle missing input gracefully?
- Invalid arguments - Does it provide helpful error messages?
- Large input - Does it work with extensive code or text?
- Empty repository - Does it work in a fresh git repository?
- Existing state - Does it handle pre-existing files or commits?
Cross-Plugin Testing¶
If your command references other plugins (e.g., /commit calling formatting tools):
| Bash | |
|---|---|
Debugging Tips¶
Command Not Found¶
If your command doesn't appear:
- Verify the file is in
commands/directory - Check the filename uses kebab-case (e.g.,
my-command.md) - Ensure YAML frontmatter is valid (check for syntax errors)
- Restart Claude Code after changes
Command Behaves Unexpectedly¶
- Review the Markdown instructions - Claude follows them literally
- Check for ambiguous instructions
- Add more specific step-by-step guidance
- Test the command prompt in isolation
Agent Not Triggering¶
- Verify trigger keywords in frontmatter
- Check that auto-trigger is configured correctly
- Test by explicitly referencing the agent
- Review keyword patterns for specificity
Continuous Integration¶
When you submit a PR, automated CI checks run on GitHub Actions. See the CI/CD Guide for details on what's validated automatically.
Key CI checks:
- JSON syntax validation
- Required fields verification
- Directory structure compliance
- README presence
- Markdown link validation
- Secret scanning
Related Resources¶
- Plugin Development - Create plugins
- CI/CD - Automated validation pipeline
- Best Practices - Quality guidelines
- Contributing - Submission process