Hooks Automation

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

1|1|Updated Nov 28, 2025
One-click install
npx skills add https://github.com/33may/robotics --skill hooks-automation-33may
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: Hooks Automation
Source: https://github.com/33may/robotics/tree/main/humanoid/.claude/skills/hooks-automation
Command: npx skills add https://github.com/33may/robotics --skill hooks-automation-33may

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires claude-flow.

What problem does it solve? Manually formatting code, tracking edits, restoring session context, and coordinating multiple agents in Claude Code workflows is repetitive and error-prone. This Skill automates those tasks through configurable hooks that run before and after operations. ## 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: Persist state across sessions, restore context, and synchronize shared memory across swarm agents via MCP tools. - Git Integration: Add pre-commit, post-commit, and pre-push quality gates with validation and metrics export. - 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 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 Claude 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 file with pre-configured hooks and default handlers. 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 such as claude-flow, ruv-swarm, and flow-nexus. Hooks internally call MCP tools like memory_usage and neural_train to coordinate agents, persist swarm configuration, and share learned patterns.

Why are my Claude Code hooks not executing?

Check that .claude/settings.json has valid syntax, the matcher patterns match the 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 so sensitive files like .env.production require manual approval before modification.