Hooks Automation

Automates pre/post-operation hooks, session management, and memory coordination for Claude Code workflows.

11|Updated Jan 20, 2026
One-click install
npx skills add https://github.com/ishandutta2007/claude-agent-orchestration --skill hooks-automation-ishandutta2007
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Hooks Automation
Source: https://github.com/ishandutta2007/claude-agent-orchestration/tree/main/.claude/skills/hooks-automation
Command: npx skills add https://github.com/ishandutta2007/claude-agent-orchestration --skill hooks-automation-ishandutta2007

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires claude-flow.

What problem does it solve? Manually validating edits, formatting code, tracking sessions, and coordinating multiple AI agents is repetitive and error-prone. This Skill automates those tasks through configurable hooks that run before and after Claude Code operations, keeping code quality consistent and agent memory synchronized. ## Core Features & Use Cases - Pre/Post-Operation Hooks: Validate syntax, assign agents, auto-format code, and train neural patterns around every edit, bash command, task, or search. - Session & Memory Coordination: Persist session state, restore context across sessions, and synchronize shared memory namespaces between swarm agents via MCP tools. - Git Integration: Wire hooks into pre-commit, post-commit, and pre-push Git stages for automated quality gates and metrics export. - Use Case: A team running a multi-agent refactor configures post-edit hooks so every modified file is auto-formatted, stored in coordination memory, and used to train patterns, while a session-end hook exports metrics and a summary report. ## Quick Start Set up the hooks system by running npx claude-flow init --hooks and then ask the assistant to configure pre-edit and post-edit hooks in .claude/settings.json for automatic formatting and memory storage.

Frequently Asked Questions about Hooks Automation

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

FAQPage Schema
How do I set up hooks in Claude Code with claude-flow?

Run npx claude-flow init --hooks to generate a .claude/settings.json with pre-configured hooks and command documentation. You can then customize PreToolUse and PostToolUse matchers to trigger commands like npx claude-flow hook pre-edit or post-edit.

How to auto-format code after every edit in Claude Code?

Add a PostToolUse hook matching Write, Edit, and MultiEdit that runs npx claude-flow hook post-edit with the --auto-format flag. It applies language-specific formatters such as Prettier, Black, or gofmt and can also store the edit in memory.

Does claude-flow hooks work with MCP servers?

Yes, hooks integrate with MCP tools such as claude-flow, ruv-swarm, and flow-nexus. Hooks like mcp-initialized, agent-spawned, and neural-trained persist swarm configuration, update agent rosters, and export trained patterns through MCP calls.

Can I use claude-flow hooks with Git pre-commit checks?

Yes, you can add hook commands to .git/hooks/pre-commit or use husky. The typical pattern runs pre-edit validation on staged files, auto-formats them, executes tests, and blocks the commit if validation fails.

Why are my Claude Code hooks not executing?

Check that .claude/settings.json has valid syntax, the matcher patterns match your tool names, and the claude-flow CLI is in your PATH. Enable debug mode with CLAUDE_FLOW_DEBUG=true and inspect logs under .claude-flow/logs to diagnose failures.

What are the limitations of hook-based automation?

Hooks should stay lightweight, ideally under 100ms, or they slow down the editing flow. Heavy operations should run asynchronously, and timeouts must be configured to prevent hanging operations from blocking Claude Code.