[FEATURE]
Preflight Checklist
- [x] I have searched existing requests and this feature hasn't been requested yet
- [x] This is a single feature request (not multiple features)
Problem Statement
When debugging plugins with hooks (like plannotator's PermissionRequest hook), developers need to verify hooks are properly installed, wired to events, and executing correctly in the Claude Code environment. Currently, this requires running through full workflows:
- Enter plan mode
- Wait for agent exploration (1-2 minutes)
- Create a complete plan
- Finally trigger the relevant hook (e.g.,
ExitPlanMode)
This makes simple integration checks (e.g., "is my hook callable?", "is PATH correct?", "are permissions set?") take 30-60 minutes instead of seconds, creating massive friction for plugin development.
Proposed Solution
Add a /test-hook <hook-name> slash command that directly triggers a specific hook with mock data, showing output/errors immediately.
Usage:
/test-hook ExitPlanMode
/test-hook PermissionRequest
/test-hook SessionStart
Ideal UX:
- Type
/test-hook PermissionRequest→ instantly fires the hook with minimal mock event data - See stdout/stderr output, JSON input/output, and any errors (e.g., "PATH not found", "script failed")
- Optional:
--data '{...}'for custom event payloads - Works in any Claude Code session without entering plan mode or other workflows
Alternative Solutions
Current methods (test script logic but not full integration):
- Manual:
echo '{"tool_name":"test"}' | ./hook.sh - Debug:
claude --debug(verbose logs only during real workflows) - Validate: Run scripts independently before wiring
Alternative Solutions
- Prompt Claude: "Enter plan mode and immediately exit - testing hooks" (reduces wait to ~10-20s but unreliable)
- No built-in way to trigger event-specific hooks (PermissionRequest, ExitPlanMode) in isolation
Priority
High - Significant impact on productivity
Feature Category
CLI commands and flags
Use Case Example
Use Case Example
Scenario: Debugging plannotator plugin installation (took ~1 hour currently):
- Without feature: Enter plan mode → wait 1-2min exploration → create plan → ExitPlanMode fires PermissionRequest → fails ("CLI not installed"). Install CLI → restart Claude → repeat full flow → fails ("PATH wrong"). Fix PATH → restart → repeat full flow → finally works.
- With
/test-hook:
/test-hook PermissionRequest
# Output: Error: "plannotator CLI not found in PATH"
# Fix: npm i -g plannotator
/test-hook PermissionRequest
# Output: Error: "Permission denied: chmod +x"
# Fix: chmod permissions
/test-hook PermissionRequest
# Output: Success: "Permission approved for Bash echo test"
Total time: 30 seconds vs. 1 hour. Enables rapid iteration on plugin hooks.
Additional Context
_No response_
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗