mirror of
https://github.com/anthropics/claude-code.git
synced 2026-04-25 07:06:05 +00:00
feat: Add plugin-dev toolkit for comprehensive plugin development
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>
This commit is contained in:
65
plugins/plugin-dev/skills/plugin-settings/examples/read-settings-hook.sh
Executable file
65
plugins/plugin-dev/skills/plugin-settings/examples/read-settings-hook.sh
Executable file
@@ -0,0 +1,65 @@
|
||||
#!/bin/bash
|
||||
# Example hook that reads plugin settings from .claude/my-plugin.local.md
|
||||
# Demonstrates the complete pattern for settings-driven hook behavior
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
# Define settings file path
|
||||
SETTINGS_FILE=".claude/my-plugin.local.md"
|
||||
|
||||
# Quick exit if settings file doesn't exist
|
||||
if [[ ! -f "$SETTINGS_FILE" ]]; then
|
||||
# Plugin not configured - use defaults or skip
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Parse YAML frontmatter (everything between --- markers)
|
||||
FRONTMATTER=$(sed -n '/^---$/,/^---$/{ /^---$/d; p; }' "$SETTINGS_FILE")
|
||||
|
||||
# Extract configuration fields
|
||||
ENABLED=$(echo "$FRONTMATTER" | grep '^enabled:' | sed 's/enabled: *//' | sed 's/^"\(.*\)"$/\1/')
|
||||
STRICT_MODE=$(echo "$FRONTMATTER" | grep '^strict_mode:' | sed 's/strict_mode: *//' | sed 's/^"\(.*\)"$/\1/')
|
||||
MAX_SIZE=$(echo "$FRONTMATTER" | grep '^max_file_size:' | sed 's/max_file_size: *//')
|
||||
|
||||
# Quick exit if disabled
|
||||
if [[ "$ENABLED" != "true" ]]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Read hook input
|
||||
input=$(cat)
|
||||
file_path=$(echo "$input" | jq -r '.tool_input.file_path // empty')
|
||||
|
||||
# Apply configured validation
|
||||
if [[ "$STRICT_MODE" == "true" ]]; then
|
||||
# Strict mode: apply all checks
|
||||
if [[ "$file_path" == *".."* ]]; then
|
||||
echo '{"hookSpecificOutput": {"permissionDecision": "deny"}, "systemMessage": "Path traversal blocked (strict mode)"}' >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
if [[ "$file_path" == *".env"* ]] || [[ "$file_path" == *"secret"* ]]; then
|
||||
echo '{"hookSpecificOutput": {"permissionDecision": "deny"}, "systemMessage": "Sensitive file blocked (strict mode)"}' >&2
|
||||
exit 2
|
||||
fi
|
||||
else
|
||||
# Standard mode: basic checks only
|
||||
if [[ "$file_path" == "/etc/"* ]] || [[ "$file_path" == "/sys/"* ]]; then
|
||||
echo '{"hookSpecificOutput": {"permissionDecision": "deny"}, "systemMessage": "System path blocked"}' >&2
|
||||
exit 2
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check file size if configured
|
||||
if [[ -n "$MAX_SIZE" ]] && [[ "$MAX_SIZE" =~ ^[0-9]+$ ]]; then
|
||||
content=$(echo "$input" | jq -r '.tool_input.content // empty')
|
||||
content_size=${#content}
|
||||
|
||||
if [[ $content_size -gt $MAX_SIZE ]]; then
|
||||
echo '{"hookSpecificOutput": {"permissionDecision": "deny"}, "systemMessage": "File exceeds configured max size: '"$MAX_SIZE"' bytes"}' >&2
|
||||
exit 2
|
||||
fi
|
||||
fi
|
||||
|
||||
# All checks passed
|
||||
exit 0
|
||||
Reference in New Issue
Block a user