hooks

Implement deterministic lifecycle hooks to enforce operational rules during agent execution.

25|3|Updated Jul 14, 2026
One-click install
npx skills add https://github.com/nimadorostkar/Claude-Skills-collection --skill hooks-nimadorostkar
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hooks
Source: https://github.com/nimadorostkar/Claude-Skills-collection/tree/main/skills/agent-tooling/hooks
Command: npx skills add https://github.com/nimadorostkar/Claude-Skills-collection --skill hooks-nimadorostkar

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This skill solves the issue of AI agents forgetting critical constraints or instructions by moving enforcement from soft prompts to hard, deterministic lifecycle hooks.

Core Features & Use Cases

  • Deterministic Enforcement: Automatically validates, formats, or blocks actions based on specific triggers like file edits or tool calls.
  • Safety Guardrails: Prevents dangerous operations, such as destructive shell commands, by intercepting them before execution.
  • Use Case: Automatically run a Prettier format command every time a file is saved to ensure consistent code style without requiring the model to remember to do so.

Quick Start

Configure a post-tool hook to automatically format all TypeScript files after every edit operation.

Frequently Asked Questions about hooks

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

FAQPage Schema
How do I enforce deterministic safety constraints during AI agent execution?

To prevent destructive shell commands, lifecycle hooks intercept tool-use events before execution and validate them against safety guardrails, blocking any dangerous operations automatically before they run.

How do I automatically format code files after an AI agent edits them?

You can automatically format code files by configuring a post-tool lifecycle hook to trigger formatting commands, like running Prettier on TypeScript files, immediately after every edit operation without relying on the model to remember.

How do lifecycle hooks work for validating tool inputs and outputs?

Lifecycle hooks work by integrating with the agent's hook system to intercept tool-use events, validating the inputs and outputs against specific triggers like file edits or shell commands to ensure consistent formatting and linting.

Can I block unauthorized commands automatically without using soft prompts?

Yes, you can block unauthorized commands by moving enforcement from soft prompts to hard, deterministic lifecycle hooks that validate actions based on specific triggers and intercept dangerous operations before execution.

What are the limitations of using lifecycle hooks for agent safety enforcement?

The primary limitation of lifecycle hooks is that they require integration with the agent's underlying hook system to reliably intercept and validate tool inputs and outputs, meaning they cannot function without this native architectural support.