hooks-automation

Automate shell commands at Claude lifecycle events via configurable hook mappings.

1|Updated Mar 19, 2026
One-click install
npx skills add https://github.com/devs6186/claude-private-skills-agents-commands --skill hooks-automation-devs6186
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hooks-automation
Source: https://github.com/devs6186/claude-private-skills-agents-commands/tree/main/skills/hooks-automation
Command: npx skills add https://github.com/devs6186/claude-private-skills-agents-commands --skill hooks-automation-devs6186

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Claude sessions require repetitive setup to execute actions at key lifecycle moments. This skill provides a centralized, configurable system to automatically execute shell commands at predetermined hooks, ensuring consistency, safety, and efficiency across tool use.

Core Features & Use Cases

  • Hook types: PreToolUse, PostToolUse, UserPromptSubmit, SessionStart, SessionEnd, Stop, PreCompact, SubagentStart, TaskCompleted
  • Automatic guardrails: block dangerous inputs, scan for secrets, and sync memory
  • Practical patterns: auto-format on file write, memory synchronization, and session restoration

Quick Start

Enable this skill and customize the hook mappings in settings.json to automatically run hooks at PreToolUse, PostToolUse, SessionStart, and Stop during Claude sessions.

Frequently Asked Questions about hooks-automation

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

FAQPage Schema
How do I automate shell commands to run before or after Claude tool use?

You can automate shell commands by configuring hook mappings in a settings.json file to trigger actions at PreToolUse and PostToolUse lifecycle events during Claude sessions.

Can I block dangerous inputs and scan for secrets during Claude sessions?

Yes, you can establish automatic guardrails by mapping hook patterns to scan for secrets and block dangerous inputs before tool execution, ensuring safe operation across your workflow.

What is the best way to synchronize memory and restore sessions in Claude?

Memory synchronization and session restoration are achieved by wiring SessionStart and Stop hooks to shell actions, which automatically sync memory and restore previous session states.

Does Claude support auto-formatting code when a file write hook is triggered?

Yes, Claude supports auto-formatting by wiring a PostToolUse hook to trigger formatting shell commands automatically after file write events occur in the session.

What types of lifecycle hooks can I configure for Claude workflow automation?

You can configure multiple hook types including PreToolUse, PostToolUse, UserPromptSubmit, SessionStart, SessionEnd, Stop, PreCompact, SubagentStart, and TaskCompleted for repeatable automation.