safety-guard

Intercepts destructive shell commands and restricts file edits during autonomous agent sessions.

1|Updated Oct 11, 2025
One-click install
npx skills add https://github.com/ibytechaos/claude --skill safety-guard-ibytechaos
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: safety-guard
Source: https://github.com/ibytechaos/claude/tree/main/plugins/everything-claude-code/skills/safety-guard
Command: npx skills add https://github.com/ibytechaos/claude --skill safety-guard-ibytechaos

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Autonomous agents and production work carry the risk of destructive operations like rm -rf, force pushes, or dropped tables. This Skill intercepts dangerous commands before execution and confines file edits to approved directories. ## Core Features & Use Cases - Careful Mode: Detects destructive patterns (rm -rf, git push --force, DROP TABLE, kubectl delete, chmod 777) and asks for confirmation with safer alternatives. - Freeze Mode: Locks Write/Edit operations to a specific directory tree so agents cannot touch unrelated code. - Guard Mode: Combines both protections for maximum safety during full-auto agent runs, with all blocked actions logged to ~/.claude/safety-guard.log. - Use Case: Before letting an agent run autonomously on a production repository, activate Guard Mode scoped to src/api/ so the agent can read everything but only write to that directory while destructive commands are blocked everywhere. ## Quick Start Enable safety guard in guard mode restricted to the src/api directory before running this agent autonomously.

Frequently Asked Questions about safety-guard

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

FAQPage Schema
How do I prevent an AI agent from running destructive commands?

Activate Careful Mode, which intercepts dangerous patterns like rm -rf, git push --force, and DROP TABLE before execution. It shows what the command does, asks for confirmation, and suggests a safer alternative.

How to restrict Claude Code edits to a specific directory?

Use Freeze Mode with a command like /safety-guard freeze src/components/. Any Write or Edit outside that directory tree is blocked with an explanation, keeping the agent focused on one area.

What commands does safety-guard block?

It watches for rm -rf on sensitive paths, git push --force, git reset --hard, git checkout ., DROP TABLE/DATABASE, docker system prune, kubectl delete, chmod 777, sudo rm, npm publish, and any command using --no-verify.

Does safety-guard work with autonomous agent sessions?

Yes, Guard Mode is designed for full-auto sessions, combining command interception with directory write restrictions. It is recommended for codex -a never sessions and logs all blocked actions to ~/.claude/safety-guard.log.

How do I turn off safety-guard protections?

Run /safety-guard off to unlock all active modes. This removes both the destructive command interception and any directory-scoped write restrictions.