/hooks-plugin:hooks-permission-request-hook --strict to deny unknown commands, --category git|test|lint|build|gh|denyfrom hooks-plugin
Generates a PermissionRequest hook with auto-approve/deny rules as a safer alternative to --dangerouslySkipPermissions. Detects project stack and creates project-specific permission automation.
Ships in hooks-plugin. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description, though model invocation is off: only you can start it.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Generate a PermissionRequest hook that auto-approves safe operations, auto-denies dangerous ones, and passes everything else through for user decision. A safer, project-aware alternative to --dangerouslySkipPermissions.
| Use this skill when... | Use /hooks:hooks-configuration instead when... |
|---|---|
| You want auto-approve/deny rules for Claude Code permissions | Configuring other hook types (PreToolUse, Stop, SessionStart) |
Replacing --dangerouslySkipPermissions with targeted rules | Need general hooks knowledge or debugging |
| Setting up project-specific permission automation | Writing entirely custom hook logic from scratch |
| You need a test harness to validate approve/deny behavior | Understanding hook lifecycle events |
PermissionRequest HookAuto mode (Claude Code 2.1.83+) routes most approve/deny decisions through a classifier model. It overlaps with — but does not replace — a PermissionRequest hook. Choose this skill when you need any of:
Hooks coexist with auto mode — they fire alongside the classifier. See .claude/rules/auto-mode.md for the full auto-mode model and how it interacts with allow rules and subagents.
Detect project stack:
find . -maxdepth 1 \( -name 'package-lock.json' -o -name 'yarn.lock' -o -name 'pnpm-lock.yaml' -o -name 'bun.lockb' -o -name 'poetry.lock' -o -name 'uv.lock' -o -name 'Cargo.lock' -o -name 'go.sum' -o -name 'Gemfile.lock' \)find . -maxdepth 1 \( -name 'package.json' -o -name 'pyproject.toml' -o -name 'requirements.txt' -o -name 'Cargo.toml' -o -name 'go.mod' -o -name 'Gemfile' \)find . -path '*/.claude/settings.json' -maxdepth 3 -type ffind . -maxdepth 2 -type d -name 'scripts'jq --versionfind . -path '*/.claude/settings.json' -maxdepth 3 -exec jq -r '.hooks.PermissionRequest // empty' {} +Parse these from $ARGUMENTS:
| Flag | Default | Description |
|---|---|---|
--strict | off | Deny unrecognized Bash commands by default instead of passing through to user |
--category <name> | all | Include only specific rule categories. Repeatable. Values: git, test, lint, build, gh, deny |
Execute this workflow:
Identify languages and tooling from the values in Context.
Language detection:
| File Present | Language | Package Manager (from lockfile) |
|---|---|---|
package.json | Node.js | npm (package-lock.json), yarn (yarn.lock), pnpm (pnpm-lock.yaml), bun (bun.lockb) |
pyproject.toml / requirements.txt | Python | poetry (poetry.lock), uv (uv.lock), pip (fallback) |
Cargo.toml | Rust | cargo |
go.mod | Go | go modules |
Gemfile | Ruby | bundler |
Report detected stack to user before generating.
Create the script at scripts/permission-request.sh (or .claude/hooks/permission-request.sh if no scripts/ directory exists).
Use the Script Template from REFERENCE.md. Adapt it by:
{{ if ... }} markers)--category flags were provided{{ ... }})--strict is set, include the strict mode catch-all deny at the endCreate scripts/test-permission-hook.sh (or .claude/hooks/test-permission-hook.sh to match the hook location).
Use the Test Script Specification from REFERENCE.md. Include test cases only for detected stacks and selected categories. Remove all {{ ... }} template markers.
.claude/settings.jsonRead existing .claude/settings.json if it exists. Merge the PermissionRequest hook — preserve all existing configuration.
If a PermissionRequest hook already exists, ask the user whether to:
Configuration to merge:
{
"hooks": {
"PermissionRequest": [
{
"matcher": "",
"hooks": [
{
"type": "command",
"command": "bash \"$CLAUDE_PROJECT_DIR/scripts/permission-request.sh\"",
"timeout": 10
}
]
}
]
}
}
Use timeout: 10 (10 seconds). Use empty matcher "" to match all tools. Adjust path if script is in .claude/hooks/ instead of scripts/.
chmod +x <hook-path> <test-path>.claude/ directory if needed for settings.jsonAfter generating the hook:
scripts/permission-request.sh
scripts/test-permission-hook.sh
.claude/settings.json
--strict was NOT used, mention the flag for environments where unknown commands should be deniedCLAUDE_HOOKS_DISABLE_PERMISSION_REQUEST=1 to toggle the hook off temporarily"" catches all tools; suggest narrowing to "Bash" if only Bash commands need filtering| Field | Type | Description |
|---|---|---|
session_id | string | Current session ID |
tool_name | string | Tool being invoked (Bash, Write, Edit, Read, etc.) |
tool_input | object | Tool-specific input (.command for Bash, .file_path for Write/Edit) |
permission_type | string | Always "tool_use" |
description | string | Human-readable description of the operation |
| Decision | JSON | Effect |
|---|---|---|
| Approve | {"decision":"approve","reason":"..."} | Tool runs without user prompt |
| Deny | {"decision":"deny","reason":"..."} | Tool blocked, reason shown to Claude |
| Passthrough | Exit 0 with no output | User prompted as normal |
| Context | Approach |
|---|---|
| Quick setup, all categories | /hooks:permission-request-hook |
| Strict mode (deny unknown commands) | /hooks:permission-request-hook --strict |
| Only git and test rules | /hooks:permission-request-hook --category git --category test |
| Only deny rules (block dangerous ops) | /hooks:permission-request-hook --category deny |
| Test the hook manually | echo '{"tool_name":"Bash","tool_input":{"command":"git status"}}' | bash scripts/permission-request.sh |
| Disable hook temporarily | CLAUDE_HOOKS_DISABLE_PERMISSION_REQUEST=1 |
| Item | Value |
|---|---|
| Hook event | PermissionRequest |
| Script location | scripts/permission-request.sh or .claude/hooks/permission-request.sh |
| Test script | scripts/test-permission-hook.sh |
| Settings location | .claude/settings.json |
| Timeout | 10 seconds |
| Matcher | "" (all tools) |
| Toggle | CLAUDE_HOOKS_DISABLE_PERMISSION_REQUEST=1 |
| Decisions | approve, deny, passthrough (no output) |
| Categories | git, test, lint, build, gh, deny |
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub laurigates/claude-plugins --plugin hooks-plugin4 skills in this plugin
/hooks-configurationClaude Code hooks configuration and development. Use when the user mentions hooks, PreToolUse, PostToolUse, SessionStart, SubagentStart, PermissionRequest, or TaskCompleted./hooks-session-end-issue-hookConfigure a Stop hook that surfaces unfinished todos at session end. Use when you want deferred work automatically flagged for GitHub issue creation./hooks-session-start-hookCreate a SessionStart hook for Claude Code on the web. Use when setting up a repo so dependencies install and tests/linters run automatically on remote session start.Other plugins' skills for the same job