Manage event hooks and connectors with secure routing and backoff
/plugin marketplace add DNYoussef/context-cascade/plugin install dnyoussef-context-cascade@DNYoussef/context-cascadeThis skill inherits all available tools. When active, it can use any tool Claude has access to.
SKILL.md.pre-sidecar-backupexamples/example-1-pre-task-automation.mdexamples/example-2-post-edit-formatting.mdexamples/example-3-session-coordination.mdexamples/example-4-plan-mode-enhancer.mdmetadata.jsonreadme.mdresources/readme.mdresources/scripts/hook-installer.shresources/scripts/hook-manager.jsresources/scripts/hook-tester.shresources/scripts/hook-validator.pyresources/templates/post-edit-hook.jsonresources/templates/pre-task-hook.yamlresources/templates/session-hooks.yamltests/test-1-basic-hooks.mdtests/test-2-hook-chaining.mdtests/test-3-error-handling.mdBefore writing ANY code, you MUST check:
.claude/library/catalog.json.claude/docs/inventories/LIBRARY-PATTERNS-GUIDE.mdD:\Projects\*| Match | Action |
|---|---|
| Library >90% | REUSE directly |
| Library 70-90% | ADAPT minimally |
| Pattern exists | FOLLOW pattern |
| In project | EXTRACT |
| No match | BUILD (add to library after) |
Design and operate automation hooks across systems with validated routing, retries, and observability.
Discover events and constraints
Design routing and processing
Implement connectors
Operate and improve
Confidence: 0.70 (ceiling: inference 0.70) - Hook design follows adversarial validation and rollback guardrails
UserPromptSubmit hooks can detect plan mode via permission_mode field in JSON input or by matching planning keywords in the prompt text. This enables mode-specific behavior injection.
Detection Pattern:
PERMISSION_MODE=$(echo "$INPUT" | jq -r '.permission_mode // empty')
if [ "$PERMISSION_MODE" = "plan" ]; then
# Plan mode detected via API field
fi
# Fallback: keyword detection
if echo "$PROMPT" | grep -iqE "(plan mode|architecture|strategy)"; then
# Plan mode detected via keywords
fi
Key Insight: Injecting keywords like "ultrathink" in hook output triggers extended reasoning in Claude. Hook stdout acts as additional context prepended to Claude's reasoning. [ground:user-correction:2026-01-09]
Dual Enhancement Synergy: Combining multiple reasoning enhancements (e.g., ultrathink + sequential-thinking MCP) creates synergy but risks overthinking simple tasks. Recommend conditional application based on task complexity. [ground:approval-pattern:2026-01-09]
Quantitative Estimation: Users value quantitative estimates of improvement when creating enhancement hooks (e.g., "30-50% better edge case coverage at 200-400% token cost"). Provide these estimates even if approximate. [ground:approval-pattern:2026-01-09]
A/B Validation Strategy: When creating reasoning enhancement hooks, recommend A/B testing: run same prompt with/without hook and compare outputs on completeness, risk identification, actionability. [ground:approval-pattern:2026-01-09]
The 2026 Claude Code hook format uses simple string matchers instead of nested regex objects:
// DEPRECATED (2025 format)
"matcher": { "tool_name_regex": "^(Write|Edit)$" }
// CORRECT (2026 format)
"matcher": "Write|Edit"
Supported Events:
UserPromptSubmit - Before user message processingPreToolUse - Before tool execution (supports matchers: Skill, Task, Write|Edit)PostToolUse - After tool execution (supports matchers: Task, TodoWrite, Skill, Write|Edit)PreCompact - Before context compactionStop - Session terminationSessionStart - New session initialization[ground:witnessed:2026-01-09]
When consolidating hooks from multiple locations to a single source of truth:
Inventory all hooks from both locations
Get-ChildItem $userHooks -Recurse -Filter "*.ps1"
Get-ChildItem $pluginHooks -Recurse -Filter "*.ps1"
Copy user hooks to plugin (preserving folder structure)
foreach ($file in $files) {
$relativePath = $file.FullName.Substring($src.Length + 1)
$destPath = Join-Path $dst $relativePath
Copy-Item $file.FullName $destPath -Force
}
Update hooks.json to 2026 format (simple string matchers)
Update settings.local.json to point to consolidated location
Update plugin.json with correct hook counts
Git commit and push with descriptive message
[ground:user-workflow:2026-01-09]
Always run hooks/validate-cross-platform.sh before committing hook changes:
# Run validation
./hooks/validate-cross-platform.sh
# Expected output for success:
# PASS: All hooks have cross-platform counterparts
# On failure, create missing counterparts before commit
Why this matters: Missing .sh counterparts break Unix/Mac users. Missing .ps1 counterparts break Windows users. The plugin should work identically on all platforms.
[ground:missed-in-consolidation:2026-01-09]
This skill should be used when the user asks to "create a hookify rule", "write a hook rule", "configure hookify", "add a hookify rule", or needs guidance on hookify rule syntax and patterns.
Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.