security-hooks

Implement automated PreToolUse security hooks to guard AI agent operations.

4|1|Updated Jan 27, 2026
One-click install
npx skills add https://github.com/AreteDriver/ai-skills --skill security-hooks
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: security-hooks
Source: https://github.com/AreteDriver/ai-skills/tree/main/personas/claude-code/security-hooks
Command: npx skills add https://github.com/AreteDriver/ai-skills --skill security-hooks

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill establishes robust security guardrails for AI agents by implementing protective PreToolUse hooks that prevent sensitive file access, dangerous commands, and destructive operations.

Core Features & Use Cases

  • PreToolUse Guards: Blocks or prompts for confirmation before risky actions like modifying sensitive files, executing dangerous commands, or performing destructive Git operations.
  • Customizable Hooks: Provides 7 ready-to-deploy hook scripts for various security scenarios, including sensitive file protection, command injection prevention, and system path guarding.
  • Use Case: When an AI agent attempts to push a commit with --force, this skill will intercept the command, prompt the user for confirmation, and prevent the potentially destructive operation if not explicitly approved.

Quick Start

Configure your project's .claude/settings.json to include the block-sensitive-files.sh hook to prevent modifications to files like .env.

Frequently Asked Questions about security-hooks

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

FAQPage Schema
How do I prevent an AI agent from modifying sensitive files like .env?

You can prevent an AI agent from modifying sensitive files by configuring PreToolUse security hooks in your project's settings to block or prompt for confirmation before writes to credential files occur. This skill provides ready-to-deploy shell scripts for this exact scenario.

Can I intercept and block destructive Git commands like git push --force?

Yes, you can intercept destructive Git commands like git push --force by implementing PreToolUse guards. The hook intercepts the command execution, prompts the user for explicit confirmation, and prevents the operation if not approved.

How do I add guardrails to stop command injection in AI agent operations?

To add guardrails against command injection in AI agent operations, you deploy customizable hook scripts that intercept tool use requests. These scripts parse JSON inputs using jq and evaluate commands against security rules before allowing execution.

Do I need jq to configure PreToolUse hooks for AI security?

Yes, you need jq installed to configure these PreToolUse hooks, as the shell scripts rely on jq for JSON parsing to evaluate intercepted tool requests. You also need adherence to specific exit codes and JSON output contracts for decision-making.

What is the best way to prevent AI agents from modifying system paths?

The best way to prevent AI agents from modifying system paths is to implement automated PreToolUse security hooks that guard against destructive actions. This skill includes specific scripts designed to intercept and block system path modifications.

How many security hook scripts are included for AI agent guardrails?

The skill includes 7 ready-to-deploy hook scripts for AI agent guardrails, covering security scenarios like sensitive file protection, command injection prevention, destructive Git operation confirmation, and system path guarding.