aiblueprint-cli 1.4.97 → 1.4.98
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/agents-config/skills/hooks-manager/SKILL.md +53 -0
- package/agents-config/skills/hooks-manager/agents/openai.yaml +7 -0
- package/agents-config/skills/hooks-manager/assets/codex-icon.svg +5 -0
- package/agents-config/skills/hooks-manager/references/command-vs-prompt.md +12 -0
- package/agents-config/skills/hooks-manager/references/examples.md +15 -0
- package/agents-config/skills/hooks-manager/references/hook-types.md +13 -0
- package/agents-config/skills/hooks-manager/references/input-output-schemas.md +11 -0
- package/agents-config/skills/hooks-manager/references/matchers.md +9 -0
- package/agents-config/skills/hooks-manager/references/troubleshooting.md +10 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -146,6 +146,7 @@ npx skills add Melvynx/aiblueprint --skill skill-manager
|
|
|
146
146
|
| `create-pr` | Auto-generated pull requests |
|
|
147
147
|
| `fix-pr-comments` | Resolve PR review comments |
|
|
148
148
|
| `grill-me` | Stress-test a plan with focused questions |
|
|
149
|
+
| `hooks-manager` | Create and debug Claude Code hooks |
|
|
149
150
|
| `merge` | Context-aware branch merging |
|
|
150
151
|
| `environments-manager` | Set up per-worktree agent environments |
|
|
151
152
|
| `oneshot` | Implement one focused change quickly |
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: hooks-manager
|
|
3
|
+
description: Create, edit, configure, and debug Claude Code hooks. Use when working with hooks, event listeners, command validation, automated workflows, notifications, or hook events such as PreToolUse, PostToolUse, Stop, SessionStart, and UserPromptSubmit.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Hooks Manager
|
|
7
|
+
|
|
8
|
+
Configure Claude Code hooks as event-driven commands or prompts. Use hooks for validation, logging, formatting, notifications, context injection, and bounded completion checks.
|
|
9
|
+
|
|
10
|
+
## Quick workflow
|
|
11
|
+
|
|
12
|
+
1. Identify the scope: project `.claude/hooks.json` or user `~/.claude/hooks.json`.
|
|
13
|
+
2. Select the event (`PreToolUse`, `PostToolUse`, `UserPromptSubmit`, `Stop`, `SubagentStop`, `SessionStart`, `SessionEnd`, `PreCompact`, or `Notification`).
|
|
14
|
+
3. Choose a command hook for deterministic shell logic, or a prompt hook when natural-language reasoning is required.
|
|
15
|
+
4. Add a regex matcher for the tools that should trigger it.
|
|
16
|
+
5. Validate the JSON with `jq` and test with `claude --debug`.
|
|
17
|
+
|
|
18
|
+
## Hook shape
|
|
19
|
+
|
|
20
|
+
```json
|
|
21
|
+
{
|
|
22
|
+
"hooks": {
|
|
23
|
+
"PreToolUse": [
|
|
24
|
+
{
|
|
25
|
+
"matcher": "Bash",
|
|
26
|
+
"hooks": [
|
|
27
|
+
{ "type": "command", "command": "./.claude/hooks/check.sh", "timeout": 30000 }
|
|
28
|
+
]
|
|
29
|
+
}
|
|
30
|
+
]
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Command hooks receive JSON on stdin and may return JSON on stdout. Prompt hooks receive `#$ARGUMENTS` and should return a structured decision. Blocking hooks use `{"decision":"block","reason":"..."}`; non-blocking hooks may return a `systemMessage`.
|
|
36
|
+
|
|
37
|
+
## Safety requirements
|
|
38
|
+
|
|
39
|
+
- Check `stop_hook_active` in `Stop` and `SubagentStop` hooks to prevent recursive blocking.
|
|
40
|
+
- Set reasonable timeouts, especially for external commands.
|
|
41
|
+
- Use `$CLAUDE_PROJECT_DIR` or another trusted absolute path for scripts.
|
|
42
|
+
- Validate hook JSON with `jq` before relying on it.
|
|
43
|
+
- Keep blocking rules selective so normal work is not accidentally interrupted.
|
|
44
|
+
- Ensure referenced scripts are executable.
|
|
45
|
+
|
|
46
|
+
## References
|
|
47
|
+
|
|
48
|
+
- `references/hook-types.md`: events, input/output, and blocking behavior.
|
|
49
|
+
- `references/command-vs-prompt.md`: choose command versus prompt hooks.
|
|
50
|
+
- `references/matchers.md`: regex and MCP matcher patterns.
|
|
51
|
+
- `references/input-output-schemas.md`: event schemas and response fields.
|
|
52
|
+
- `references/examples.md`: notifications, logging, formatting, tests, and safety examples.
|
|
53
|
+
- `references/troubleshooting.md`: debug, JSON, matcher, permission, and timeout checks.
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
interface:
|
|
2
|
+
display_name: "Hooks Manager"
|
|
3
|
+
short_description: "Create, edit, configure, and debug Claude Code hooks"
|
|
4
|
+
icon_small: "./assets/codex-icon.svg"
|
|
5
|
+
icon_large: "./assets/codex-icon.svg"
|
|
6
|
+
brand_color: "#868259"
|
|
7
|
+
default_prompt: "Use $hooks-manager to help with this task."
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg role="img" aria-label="hooks-manager skill icon" width="64" height="64" viewBox="0 0 64 64" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<rect width="64" height="64" rx="16" fill="#868259"/>
|
|
3
|
+
<path d="M20 22h24v6H20v-6Zm0 14h16v6H20v-6Zm0 14h24v6H20v-6Z" fill="#fff"/>
|
|
4
|
+
<circle cx="44" cy="39" r="7" fill="#868259" stroke="#fff" stroke-width="4"/>
|
|
5
|
+
</svg>
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
# Command vs Prompt Hooks
|
|
2
|
+
|
|
3
|
+
Use command hooks for deterministic, fast work: file checks, regex validation, formatters, linters, logs, and notifications. They receive JSON through stdin and may emit JSON through stdout.
|
|
4
|
+
|
|
5
|
+
Use prompt hooks when the decision requires semantic or natural-language reasoning. They are slower and consume model/API budget. Include `#$ARGUMENTS` and specify the exact JSON response shape.
|
|
6
|
+
|
|
7
|
+
```json
|
|
8
|
+
{
|
|
9
|
+
"type": "prompt",
|
|
10
|
+
"prompt": "Evaluate this change: #$ARGUMENTS\nReturn {\"decision\":\"approve\" or \"block\",\"reason\":\"...\"}"
|
|
11
|
+
}
|
|
12
|
+
```
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Hook Examples
|
|
2
|
+
|
|
3
|
+
Log Bash commands:
|
|
4
|
+
|
|
5
|
+
```json
|
|
6
|
+
{"type":"command","command":"jq -r '.tool_input.command' >> ~/.claude/bash-log.txt"}
|
|
7
|
+
```
|
|
8
|
+
|
|
9
|
+
Format files after edits:
|
|
10
|
+
|
|
11
|
+
```json
|
|
12
|
+
{"type":"command","command":"prettier --write \"$CLAUDE_PROJECT_DIR\"","timeout":10000}
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Block destructive commands with a `PreToolUse` prompt hook, or run a test-checking command on `Stop`. Keep examples scoped to the project and validate the resulting JSON with `jq`.
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Hook Types and Events
|
|
2
|
+
|
|
3
|
+
| Event | Fires | Can block? |
|
|
4
|
+
| --- | --- | --- |
|
|
5
|
+
| `PreToolUse` | Before a tool runs | Yes |
|
|
6
|
+
| `PostToolUse` | After a tool completes | No |
|
|
7
|
+
| `UserPromptSubmit` | When the user submits a prompt | Yes |
|
|
8
|
+
| `Stop` / `SubagentStop` | Before an agent stops | Yes |
|
|
9
|
+
| `SessionStart` / `SessionEnd` | At session boundaries | No |
|
|
10
|
+
| `PreCompact` | Before context compaction | Yes |
|
|
11
|
+
| `Notification` | When Claude needs input | No |
|
|
12
|
+
|
|
13
|
+
Blocking responses should include `decision: "block"` and a useful `reason`. Stop hooks must honor `stop_hook_active` to avoid infinite loops.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# Input and Output Schemas
|
|
2
|
+
|
|
3
|
+
Common hook input includes `session_id`, `transcript_path`, `cwd`, `permission_mode`, and `hook_event_name`. Tool events also include `tool_name` and `tool_input`; prompt submission includes `prompt`.
|
|
4
|
+
|
|
5
|
+
Blocking output:
|
|
6
|
+
|
|
7
|
+
```json
|
|
8
|
+
{"decision":"block","reason":"Explain what must change"}
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Non-blocking output may include `systemMessage` and `suppressOutput`. `PreToolUse` may additionally return `permissionDecision` and `updatedInput`. `Stop` may return `continue: true` and should not block when `stop_hook_active` is true.
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Matchers
|
|
2
|
+
|
|
3
|
+
Matchers are JavaScript regular expressions tested against the tool name. Use `Bash` for one tool, `Write|Edit` for alternatives, `^Bash` for a tool family, `mcp__.*` for all MCP tools, and `mcp__github__.*` for one MCP server. Omitting `matcher` matches every tool for that event.
|
|
4
|
+
|
|
5
|
+
Patterns are case-sensitive. Validate uncertain patterns in isolation:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
node -e "console.log(/Bash/.test('Bash'))"
|
|
9
|
+
```
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
# Troubleshooting
|
|
2
|
+
|
|
3
|
+
1. Run `claude --debug` and confirm the event and matcher were found.
|
|
4
|
+
2. Check the config location: `.claude/hooks.json`, `~/.claude/hooks.json`, or the plugin hook file.
|
|
5
|
+
3. Validate syntax with `jq . .claude/hooks.json`.
|
|
6
|
+
4. Confirm matcher case and regex escaping; `bash` does not match `Bash`.
|
|
7
|
+
5. Run command hooks directly with representative JSON on stdin.
|
|
8
|
+
6. Check script permissions, dependencies such as `jq`, trusted paths, and timeout values.
|
|
9
|
+
|
|
10
|
+
If a Stop hook blocks repeatedly, inspect `stop_hook_active` and return an allow/no-decision response when it is true.
|