hooks-builder

Configure Claude Code hooks for lifecycle automation with JSON-based I/O.

1|Updated Nov 24, 2025
One-click install
npx skills add https://github.com/bsamiee/Parametric_Portal --skill hooks-builder
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hooks-builder
Source: https://github.com/bsamiee/Parametric_Portal/tree/main/.claude/skills/hooks-builder
Command: npx skills add https://github.com/bsamiee/Parametric_Portal --skill hooks-builder

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill provides deterministic control over Claude's behavior at various lifecycle events, eliminating manual interventions and ensuring consistent, automated responses. It saves time by automating validation, formatting, and decision-making processes.

Core Features & Use Cases

  • Lifecycle Automation: Configure hooks for 10 agent lifecycle events (e.g., PreToolUse, PostToolUse, PermissionRequest, SessionStart) to automate actions.
  • Conditional Execution: Use matchers to filter which tool invocations or session events trigger specific hooks.
  • Agent Control: Implement command hooks for deterministic actions (validation, formatting) or prompt hooks for LLM-evaluated decisions.
  • Secure Scripting: Write Python 3.14+ hook scripts following strict functional and security-first design principles, ensuring reliable and safe automation.
  • Use Case: Implement a PreToolUse hook to automatically validate all Write tool calls against a security policy, blocking any attempts to modify sensitive files without explicit approval.

Quick Start

Use the hooks-builder skill to create a PreToolUse hook that validates tool inputs before execution, blocking any unsafe commands based on predefined patterns.

Frequently Asked Questions about hooks-builder

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

FAQPage Schema
How do I automate validation of Claude's tool calls before execution?

Lifecycle hooks enable deterministic automation by intercepting tool invocations at predefined events. Configure a PreToolUse hook with Python validation logic to block unsafe commands before Claude executes them, eliminating manual approval workflows.

What lifecycle events can I hook into for agent automation?

hooks-builder supports 10 agent lifecycle events including PreToolUse, PostToolUse, PermissionRequest, and SessionStart. Each hook type accepts command scripts for deterministic actions or prompt hooks for LLM-evaluated decisions, enabling control across the entire agent lifecycle.

Can I use conditional matchers to filter which tool calls trigger hooks?

Yes, matchers filter hook execution based on specific tool invocations or session events. This lets you apply validation, formatting, or approval logic selectively—for example, blocking only Write operations to sensitive files while allowing others.

How do I configure hooks in settings.json for reliable automation?

Define hooks in local, project, or user settings.json with JSON-based I/O specifying event type, matcher rules, and script path. hooks-builder handles exit-code semantics (block on 2, continue on 0), environment variables, timeout handling, and security constraints like shell=False.

What security constraints apply when writing Python hook scripts?

Hook scripts run with strict functional and security-first design: shell=False prevents shell injection, realpath checks validate file access, and typed enforcement ensures deterministic behavior. Python 3.14+ scripts execute in isolation with explicit permission boundaries.

Can hooks propagate context across multiple lifecycle events in a session?

Yes, hooks support context propagation across lifecycle events for session management and custom notifications. This enables stateful automation workflows where decisions made in one hook inform actions in subsequent hooks within the same session.