new-hook

Scaffold Claude Code hook scripts and register them in settings.json.

2|1|Updated Mar 24, 2026
One-click install
npx skills add https://github.com/enbiyagoral/.claude --skill new-hook-enbiyagoral
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: new-hook
Source: https://github.com/enbiyagoral/.claude/tree/main/.claude/skills/new-hook
Command: npx skills add https://github.com/enbiyagoral/.claude --skill new-hook-enbiyagoral

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Creating new Claude Code hooks and wiring them into settings.json is a manual, error-prone process; this skill provides a scaffold to quickly generate a deterministic shell-script hook and register it with Claude Code's event-driven workflow.

Core Features & Use Cases

  • Scaffold a ready-to-use hook named <hook-name> that runs as a script under .claude/hooks/scripts/
  • Automatically update .claude/settings.json to register the hook for a chosen event (PreToolUse, PostToolUse, Stop, SessionStart)
  • Enforce deterministic behavior with a standard script template that reads input from stdin and provides guardrails, enabling repeatable hooks across sessions Use cases include automating pre/post tool validations, session-start initialization, or stop-time cleanup tasks across Claude Code sessions.

Quick Start

Create a new hook named <hook-name>, wire it into .claude/settings.json, and place its script under .claude/hooks/scripts/.

Frequently Asked Questions about new-hook

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add a deterministic hook to Claude Code for tool interactions?

Adding a deterministic Claude Code hook involves scaffolding a shell script and registering it within settings.json. This automates creating a stub script under .claude/hooks/scripts/ and updates the configuration to trigger deterministic behavior for specific tool events.

What events can I attach a hook script to in Claude Code?

Claude Code hooks can be attached to PreToolUse, PostToolUse, Stop, and SessionStart events. Wiring a script to these events enables deterministic pre/post tool validations, session-start initialization, or stop-time cleanup tasks across active sessions.

How do I register a new hook script in settings.json without manual errors?

Registering a hook script in settings.json without manual errors requires automating the scaffolding and wiring process. This generates a standard script template that reads input from stdin with guardrails, ensuring repeatable and error-free hook configuration updates.

Can I automate pre-tool validation checks for Claude Code sessions?

Automating pre-tool validation checks for Claude Code sessions is possible by registering a deterministic hook for the PreToolUse event. This creates a guardrail script that runs automatically before tool execution, enforcing consistent validation rules across sessions.

Do I need to manually edit settings.json to configure Claude Code hooks?

Manually editing settings.json to configure Claude Code hooks is not required when using an automated scaffolding process. The configuration file is updated automatically when a new hook is generated, eliminating the error-prone manual wiring steps.

Why do my manually created Claude Code hooks fail during tool interactions?

Manually created Claude Code hooks often fail due to missing stdin input parsing or absent guardrails within the script. Using an automated scaffold ensures a standard template with proper input handling is applied, preventing inconsistent execution across tool events.