safety-guard

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

Updated Mar 18, 2026
One-click install
npx skills add https://github.com/freedom909/real-estate-saas --skill safety-guard-freedom909
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: safety-guard
Source: https://github.com/freedom909/real-estate-saas/tree/main/.trae/skills/safety-guard
Command: npx skills add https://github.com/freedom909/real-estate-saas --skill safety-guard-freedom909

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Autonomous agents and production work carry the risk of accidental destructive operations like force pushes, recursive deletions, or unintended file edits outside a target area. This Skill intercepts those dangerous actions before they execute, preventing data loss and unintended system changes. ## Core Features & Use Cases - Careful Mode: Detects destructive command patterns (rm -rf, git push --force, DROP TABLE, kubectl delete, and more) and asks for confirmation with a safer alternative before execution. - Freeze Mode: Locks all Write/Edit operations to a specific directory tree, blocking changes outside the allowed scope. - Guard Mode: Combines both protections for maximum safety when agents run in full-auto mode, with all blocked actions logged to a safety log file. - Use Case: When running an agent autonomously on a production codebase, enable Guard Mode scoped to src/api/ so the agent can read anything but only modify that directory, while destructive shell commands are blocked everywhere. ## Quick Start Ask the agent to enable safety guard in guard mode restricted to the src/api directory before starting the autonomous refactoring session.

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?▼

Enable Careful Mode, which intercepts destructive patterns like rm -rf, git push --force, git reset --hard, DROP TABLE, and kubectl delete before execution. When detected, it explains what the command does, asks for confirmation, and suggests a safer alternative.

How to restrict agent file edits to a specific directory?▼

Use Freeze Mode with a command like /safety-guard freeze src/components/ to lock all Write and Edit operations to that directory tree. Any attempted edit outside the allowed path is blocked with an explanation.

What commands does the safety guard block?▼

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

Can I combine command blocking and directory restrictions together?▼

Yes, Guard Mode activates both Careful and Freeze protections simultaneously. For example, /safety-guard guard --dir src/api/ --allow-read-all lets agents read anything but write only to src/api/ while destructive commands are blocked everywhere.

How do I turn off the safety guard protection?▼

Run /safety-guard off to unlock all active protections. This disables command interception and directory restrictions, returning the agent to normal unrestricted operation.