agents-hooks_skill

This skill automates Claude Code workflows with event-driven hooks, enabling input validation, safe tool use, formatting, auditing, and CI/CD integration.
  • Python

42

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

3 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill vasilyu1983/ai-agents-public --skill agents-hooks

  • SKILL.md10.2 KB

Overview

This skill provides event-driven hooks for AI coding agents, focused on automating Claude Code or Codex CLI workflows using stdin JSON and decision-control responses. It defines hook events, input/output schemas, execution rules, and practical templates to guard, modify, or augment tool runs. Use it to enforce safety, run fast checks, and integrate agent runs into CI/CD pipelines.

How this skill works

Hooks are configured in a settings.json mapping events to command or prompt handlers. Each hook receives a JSON payload via stdin and runs as a normal user process with a 60s default timeout; matching hooks run in parallel and identical commands are deduplicated. PreToolUse hooks can return structured decision-control JSON (allow/deny/ask and updatedInput) and prompt hooks allow LLM-evaluated decisions for nuanced cases.

When to use it

  • Automating event-driven workflows for Claude Code or Codex CLI
  • Blocking or modifying dangerous shell/tool invocations (PreToolUse)
  • Formatting, auditing, or notifying after successful tool runs (PostToolUse)
  • Initializing runtime or repo state at session start or setup
  • Running tests or summaries when the agent stops

Best practices

  • Treat stdin JSON as untrusted input and validate it before use
  • Use absolute paths, quote variables, and avoid eval to prevent injection
  • Keep runtime preflight checks deterministic and fast (<1s target) and fail with clear remediation commands
  • Prefer command hooks for deterministic checks and prompt hooks for nuanced policy decisions
  • If strict ordering is required, wrap multiple steps in a single script rather than relying on parallel execution

Example use cases

  • PreToolUse guard that blocks destructive git or rm commands and suggests safer alternatives
  • PostToolUse formatter plus linter run on edited files before committing changes
  • SessionStart preflight that verifies required binaries and versions and prints remediation steps
  • Stop hook that runs test suite and writes a summary report to stdout for injection into the final context
  • Permission auto-allow rules for repetitive, low-risk command prefixes paired with deny rules for dangerous patterns

FAQ

Hooks exit 0 and write structured JSON to stdout under hookSpecificOutput; PreToolUse can return permissionDecision and updatedInput fields to allow/modify the tool run.

What happens if a hook fails or times out?

Exit code 2 blocks the action and shows stderr as the message; non-zero other than 2 is non-blocking and visible in verbose mode. Default timeout is 60s; handle failures with clear diagnostics.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational