Skip to content
Back to skills

Hooks Automation

BSecurity

Configure Claude Code hooks for automated coordination and learning

  • 812 stars
  • 0 votes
  • 0 copies
  • 1 view
  • Added September 6, 2026
ai-agentstypescriptpythonbashtestingapiperformancedocumentation

Works with

  • claude code
  • api

Security analysis

B81/100
  • highPerforms destructive filesystem operations
  • mediumInstalls packages at runtime which could introduce malicious dependencies

Pro shows the line behind each finding and how to fix it

Scanned September 6, 2026

npx -y skills add ruvnet/agentic-flow --skill hooks-automation --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Hooks Automation?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Hooks Automation
[![Security: B — Skills Directory](https://www.skillsdirectory.com/api/skills/ruvnet-hooks-automation-1ad4718f/badge)](https://www.skillsdirectory.com/skills/ruvnet-hooks-automation-1ad4718f)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: hooks-automation
description: Configure Claude Code hooks for automated coordination and learning
version: 1.0.0
invocable: true
author: agentic-flow
capabilities:
  - pre_edit_hooks
  - post_edit_hooks
  - session_management
  - metrics_tracking
---

# Hooks Automation Skill

Configure intelligent hooks for automated coordination, formatting, and learning.

## Available Hooks

### PreToolUse Hooks
Triggered before Claude Code tools execute.

```json
{
  "PreToolUse": [
    {
      "matcher": "Edit|Write|MultiEdit",
      "hooks": [{
        "type": "command",
        "command": "npx agentic-flow@alpha hooks pre-edit \"$TOOL_INPUT_file_path\""
      }]
    },
    {
      "matcher": "Bash",
      "hooks": [{
        "type": "command",
        "command": "npx agentic-flow@alpha hooks pre-command \"$TOOL_INPUT_command\""
      }]
    }
  ]
}
```

### PostToolUse Hooks
Triggered after successful tool execution.

```json
{
  "PostToolUse": [
    {
      "matcher": "Edit|Write|MultiEdit",
      "hooks": [{
        "type": "command",
        "command": "npx agentic-flow@alpha hooks post-edit \"$TOOL_INPUT_file_path\" --success"
      }]
    }
  ]
}
```

### Session Hooks
Triggered at session start/end.

```json
{
  "SessionStart": [{
    "hooks": [{
      "type": "command",
      "command": "npx agentic-flow@alpha hooks intelligence stats --json"
    }]
  }],
  "SessionEnd": [{
    "hooks": [{
      "type": "command",
      "command": "npx agentic-flow@alpha hooks metrics --session --json"
    }]
  }]
}
```

## Hook Commands

```bash
# Pre-edit: Check for patterns, validate
npx agentic-flow@alpha hooks pre-edit "src/api.ts"

# Post-edit: Format, learn pattern
npx agentic-flow@alpha hooks post-edit "src/api.ts" --success

# Pre-command: Validate safety
npx agentic-flow@alpha hooks pre-command "npm install"

# Post-command: Track result
npx agentic-flow@alpha hooks post-command "npm install"

# Intelligence routing
npx agentic-flow@alpha hooks route "implement OAuth"

# Session metrics
npx agentic-flow@alpha hooks metrics --session
```

## Automation Features

### Auto-Agent Assignment
Hooks automatically assign specialized agents based on file type:
- `.ts`, `.tsx` → TypeScript agent
- `.py` → Python agent
- `.md` → Documentation agent
- `test.*` → Testing agent

### Command Validation
Pre-command hooks validate for:
- Dangerous patterns (rm -rf, force push)
- Permission requirements
- Resource limits

### Pattern Learning
Post-edit hooks learn:
- Code patterns
- Successful solutions
- Error recovery strategies

### Metrics Tracking
Session hooks track:
- Token usage
- Tool invocations
- Success rates
- Performance metrics

## Configuration

Full hook configuration in `.claude/settings.json`:

```json
{
  "hooks": {
    "PreToolUse": [...],
    "PostToolUse": [...],
    "PostToolUseFailure": [...],
    "SessionStart": [...],
    "SessionEnd": [...],
    "UserPromptSubmit": [...],
    "Stop": [...]
  }
}
```

## Best Practices

1. **Keep hooks fast**: <100ms for interactive experience
2. **Use timeout**: Prevent hanging hooks
3. **Handle failures gracefully**: Use `|| true` for optional hooks
4. **Log metrics**: Track for optimization
5. **Test hooks**: Verify before deployment

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.