hooks-system

Implement lifecycle hooks for Claude Code workflows with validation and security.

7|4|Updated Feb 26, 2026
One-click install
npx skills add https://github.com/MadAppGang/magus --skill hooks-system
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: hooks-system
Source: https://github.com/MadAppGang/magus/tree/main/plugins/multimodel/skills/hooks-system
Command: npx skills add https://github.com/MadAppGang/magus --skill hooks-system

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pypdf, pdfplumber, pdf2image, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill provides comprehensive patterns and templates for implementing lifecycle hooks in Claude Code, enabling advanced automation, validation, security, and metrics tracking within AI workflows.

Core Features & Use Cases

  • Lifecycle Hooks: Define actions for PreToolUse, PostToolUse, UserPromptSubmit, SessionStart, Stop, SubagentStop, and Notification events.
  • Automation & Validation: Automatically format code, run tests, and validate file writes or commands before execution.
  • Security: Implement guardrails against dangerous commands and sensitive file modifications.
  • Metrics & Analysis: Track tool usage, analyze prompt complexity, and evaluate session completion.
  • Use Case: Automatically format code after every write operation, block attempts to write to .env files, and run relevant unit tests before a file is saved, ensuring code quality and security.

Quick Start

Configure your .claude/settings.json to automatically format code after every file write operation.

Frequently Asked Questions about hooks-system

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

FAQPage Schema
How do I automate code formatting and validation before tool execution in Claude Code?

You can automate code formatting and validation by configuring lifecycle hooks like PreToolUse and PostToolUse in your settings. This Skill provides templates to automatically format code after file writes and validate commands before execution.

Can I block writes to sensitive files like .env using Claude Code hooks?

Yes, you can block sensitive file modifications by implementing security guardrails via lifecycle hooks. This Skill enables you to enforce policies that prevent dangerous commands and restrict writes to files like .env.

What lifecycle events are available for workflow automation in Claude Code?

Available lifecycle events for workflow automation include PreToolUse, PostToolUse, UserPromptSubmit, SessionStart, Stop, SubagentStop, and Notification. This Skill defines actions for each event to facilitate event-driven automation.

How do I track tool usage and prompt complexity metrics in AI workflows?

You track tool usage and prompt complexity by implementing lifecycle hooks for metrics and analysis. This Skill provides a framework to evaluate session completion and analyze prompt complexity within your AI development environment.

Does Claude Code support running unit tests automatically before a file is saved?

Yes, Claude Code supports running unit tests automatically before a file is saved by using PreToolUse lifecycle hooks. This Skill provides patterns to trigger relevant tests and validate file writes during your workflow.