Hooks Automation

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

Updated Jul 16, 2026
One-click install
npx skills add https://github.com/optimaxin/Tredev_Gems --skill hooks-automation-optimaxin
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Hooks Automation
Source: https://github.com/optimaxin/Tredev_Gems/tree/main/.claude/skills/hooks-automation
Command: npx skills add https://github.com/optimaxin/Tredev_Gems --skill hooks-automation-optimaxin

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires claude-flow.

What problem does it solve? Manually coordinating agents, formatting code, tracking sessions, and persisting context across Claude Code operations is repetitive and error-prone. This Skill automates those tasks through configurable hooks that run before and after every operation. ## Core Features & Use Cases - Pre/Post-Operation Hooks: Validate syntax, auto-assign agents, format code, and train neural patterns around file edits, bash commands, tasks, and searches. - Session & Memory Management: Start, restore, and end sessions with state persistence, metrics export, and cross-agent memory synchronization via MCP tools. - Git Integration: Wire hooks into pre-commit, post-commit, and pre-push Git stages for automated quality gates. - Use Case: A team running multi-agent refactoring configures post-edit hooks so every file change is auto-formatted, stored in coordination memory, and used to train neural patterns, while session-end hooks export metrics and summaries. ## 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?

Run npx claude-flow init --hooks to generate a .claude/settings.json with pre-configured hooks and command documentation. You can then edit the PreToolUse and PostToolUse matchers to bind hook commands to specific tools like Edit, Bash, or Task.

How do I auto-format code after edits 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 context in memory.

Does claude-flow hooks work with MCP servers?

Yes, hooks integrate with MCP tools like claude-flow, ruv-swarm, and flow-nexus for memory storage, agent spawning, and neural training. MCP servers are optional; the core hook commands work with just the claude-flow CLI installed.

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 review the hook execution logs for details.

Can hooks block edits to protected files?

Yes, a pre-edit hook can return a JSON response with continue set to false to block the operation. You can configure a check-protected hook command so sensitive files like .env.production require manual approval before modification.