mirror of
https://github.com/anthropics/claude-code.git
synced 2025-11-28 08:40:27 +08:00
Adds the plugin-dev plugin to public marketplace. A comprehensive toolkit for
developing Claude Code plugins with 7 expert skills, 3 AI-assisted agents, and
extensive documentation covering the complete plugin development lifecycle.
Key features:
- 7 skills: hook-development, mcp-integration, plugin-structure, plugin-settings,
command-development, agent-development, skill-development
- 3 agents: agent-creator (AI-assisted generation), plugin-validator (structure
validation), skill-reviewer (quality review)
- 1 command: /plugin-dev:create-plugin (guided 8-phase workflow)
- 10 utility scripts for validation and testing
- 21 reference docs with deep-dive guidance (~11k words)
- 9 working examples demonstrating best practices
Changes for public release:
- Replaced all references to internal repositories with "Claude Code"
- Updated MCP examples: internal.company.com → api.example.com
- Updated token variables: ${INTERNAL_TOKEN} → ${API_TOKEN}
- Reframed agent-creation-system-prompt as "proven in production"
- Preserved all ${CLAUDE_PLUGIN_ROOT} references (186 total)
- Preserved valuable test blocks in core modules
Validation:
- All 3 agents validated successfully with validate-agent.sh
- All JSON files validated with jq
- Zero internal references remaining
- 59 files migrated, 21,971 lines added
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
|
||
|---|---|---|
| .. | ||
| hook-linter.sh | ||
| README.md | ||
| test-hook.sh | ||
| validate-hook-schema.sh | ||
Hook Development Utility Scripts
These scripts help validate, test, and lint hook implementations before deployment.
validate-hook-schema.sh
Validates hooks.json configuration files for correct structure and common issues.
Usage:
./validate-hook-schema.sh path/to/hooks.json
Checks:
- Valid JSON syntax
- Required fields present
- Valid hook event names
- Proper hook types (command/prompt)
- Timeout values in valid ranges
- Hardcoded path detection
- Prompt hook event compatibility
Example:
cd my-plugin
./validate-hook-schema.sh hooks/hooks.json
test-hook.sh
Tests individual hook scripts with sample input before deploying to Claude Code.
Usage:
./test-hook.sh [options] <hook-script> <test-input.json>
Options:
-v, --verbose- Show detailed execution information-t, --timeout N- Set timeout in seconds (default: 60)--create-sample <event-type>- Generate sample test input
Example:
# Create sample test input
./test-hook.sh --create-sample PreToolUse > test-input.json
# Test a hook script
./test-hook.sh my-hook.sh test-input.json
# Test with verbose output and custom timeout
./test-hook.sh -v -t 30 my-hook.sh test-input.json
Features:
- Sets up proper environment variables (CLAUDE_PROJECT_DIR, CLAUDE_PLUGIN_ROOT)
- Measures execution time
- Validates output JSON
- Shows exit codes and their meanings
- Captures environment file output
hook-linter.sh
Checks hook scripts for common issues and best practices violations.
Usage:
./hook-linter.sh <hook-script.sh> [hook-script2.sh ...]
Checks:
- Shebang presence
set -euo pipefailusage- Stdin input reading
- Proper error handling
- Variable quoting (injection prevention)
- Exit code usage
- Hardcoded paths
- Long-running code detection
- Error output to stderr
- Input validation
Example:
# Lint single script
./hook-linter.sh ../examples/validate-write.sh
# Lint multiple scripts
./hook-linter.sh ../examples/*.sh
Typical Workflow
-
Write your hook script
vim my-plugin/scripts/my-hook.sh -
Lint the script
./hook-linter.sh my-plugin/scripts/my-hook.sh -
Create test input
./test-hook.sh --create-sample PreToolUse > test-input.json # Edit test-input.json as needed -
Test the hook
./test-hook.sh -v my-plugin/scripts/my-hook.sh test-input.json -
Add to hooks.json
# Edit my-plugin/hooks/hooks.json -
Validate configuration
./validate-hook-schema.sh my-plugin/hooks/hooks.json -
Test in Claude Code
claude --debug
Tips
- Always test hooks before deploying to avoid breaking user workflows
- Use verbose mode (
-v) to debug hook behavior - Check the linter output for security and best practice issues
- Validate hooks.json after any changes
- Create different test inputs for various scenarios (safe operations, dangerous operations, edge cases)
Common Issues
Hook doesn't execute
Check:
- Script has shebang (
#!/bin/bash) - Script is executable (
chmod +x) - Path in hooks.json is correct (use
${CLAUDE_PLUGIN_ROOT})
Hook times out
- Reduce timeout in hooks.json
- Optimize hook script performance
- Remove long-running operations
Hook fails silently
- Check exit codes (should be 0 or 2)
- Ensure errors go to stderr (
>&2) - Validate JSON output structure
Injection vulnerabilities
- Always quote variables:
"$variable" - Use
set -euo pipefail - Validate all input fields
- Run the linter to catch issues