Catalog
affaan-m/safety-guard

affaan-m

safety-guard

Guard against destructive operations with three modes: Careful intercepts dangerous commands (rm -rf, git push --force, DROP TABLE) for confirmation, Freeze locks writes to one directory, and Guard combines both. Advisory: the agent applies these rules itself; no hook ships with it. Use when working on production systems, running agents autonomously, restricting edits to a directory, or during migrations, deploys, and data changes.

NewUpdated Oct 25, 2026

Safety Guard — Prevent Destructive Operations

When to Use

  • When working on production systems
  • When agents are running autonomously (full-auto mode)
  • When you want to restrict edits to a specific directory
  • During sensitive operations (migrations, deploys, data changes)

How It Works

Three modes of protection. They are instructions the agent follows, not enforced blocks (see Enforcement).

Mode 1: Careful Mode

Before it runs a destructive command, the agent stops and warns:

Watched patterns:
- rm -rf (especially /, ~, or project root)
- git push --force
- git reset --hard
- git checkout . (discard all changes)
- DROP TABLE / DROP DATABASE
- docker system prune
- kubectl delete
- chmod 777
- sudo rm
- npm publish (accidental publishes)
- Any command with --no-verify

When detected: shows what the command does, asks for confirmation, suggests safer alternative.

Mode 2: Freeze Mode

Locks file edits to a specific directory tree, for example: "freeze edits to src/components/".

The agent does not Write/Edit outside src/components/, and explains why when a change would need it. Useful when you want an agent to focus on one area without touching unrelated code.

Mode 3: Guard Mode (Careful + Freeze combined)

Both protections active, for example: "guard mode, write only to src/api/, read anything".

The agent can read anything but only writes to src/api/, and asks before any destructive command.

Unlock

Tell the agent to stop applying the rules.

Enforcement

This skill is advisory. ECC ships no /safety-guard command and no hook for it, so nothing blocks a tool call that breaks these rules. For blocking that does not depend on the agent, use Claude Code permission deny rules (for example Bash(rm -rf *)) or a PreToolUse hook.

Integration

  • Enable by default for codex -a never sessions
  • Pair with observability risk scoring in ECC 2.0
Files1
1 files · 1.0 KB

Select a file to preview

Overall Score

77/100

Grade

B

Good

Grades are signals, not a certification. Always review a skill yourself before use.

Safety

82

Quality

74

Clarity

82

Completeness

67

Summary

Safety Guard is an instruction set that guides AI agents to intercept and warn about destructive operations before execution. It offers three modes (Careful, Freeze, Guard) that implement patterns for command interception, directory-scoped write restrictions, and combined protections. The skill is deliberately advisory—it documents rules the agent follows, not enforced blocks, and explicitly defers to external enforcement mechanisms like Claude Code permission rules and PreToolUse hooks.

Static Analysis Findings

3 findings

Patterns detected by deterministic static analysis before AI scoring. Hover over any finding code for detailed information and remediation guidance.

Destructive Operation
SEC-001Recursive Deletion3x in 1 fileMax: B

Recursive deletion pattern (rm -rf)

SKILL.mdrm -rf3x
SEC-002Privilege Escalation

Privilege escalation (sudo)

SKILL.mdsudo r
SEC-003File Permission Modification

File permission modification (chmod)

SKILL.mdchmod 777

Detected Capabilities

command interception pattern matchingagent instruction following (not execution blocking)warning and confirmation promptsfilesystem scope restrictionread-all write-restricted mode

Trigger Keywords

Phrases that agents use to match this skill to user intent.

prevent destructive commandsproduction system protectionautonomous agent guarddirectory write lockgit push safetycareful modefreeze edits

Risk Signals

INFO

References rm -rf in destructive patterns list (Mode 1)

SKILL.md, Mode 1 section
INFO

References sudo rm in destructive patterns list (Mode 1)

SKILL.md, Mode 1 section
INFO

References chmod 777 in destructive patterns list (Mode 1)

SKILL.md, Mode 1 section
INFO

Explicitly states this skill is advisory with no enforcement hook

SKILL.md, Enforcement section
INFO

Defers enforcement to Claude Code permission rules and PreToolUse hooks

SKILL.md, Enforcement section

Referenced Domains

External domains referenced in skill content, detected by static analysis.

code.claude.com

Use Cases

  • Protect production systems from accidental destructive commands during autonomous agent runs
  • Restrict agent edits to a single directory tree while running other tasks
  • Combine command interception with directory restrictions during sensitive operations like deployments or data migrations
  • Provide guardrails for full-auto agent sessions that need confirmation before dangerous git, docker, or database commands
  • Educate agents on safer command patterns and alternatives to destructive operations

Quality Notes

  • Skill is deliberately descriptive, not prescriptive—it documents patterns for agent awareness, not code execution
  • Clear three-mode structure (Careful, Freeze, Guard) with well-defined use cases for each
  • Honest about limitations: explicitly states this is advisory and recommends external enforcement (permission rules, PreToolUse hooks)
  • Excellent scope boundaries: acknowledges this is instruction-based, not tool-based
  • Watched patterns list is comprehensive and includes real-world destructive commands
  • Integration section lacks concrete implementation examples (e.g., how to enable 'by default for codex -a never sessions')
  • References ECC and Claude Code documentation for external enforcement—appropriate deference to complementary systems
  • Missing concrete example prompts showing how agent should respond when destructive pattern detected
Model: claude-haiku-4-5-20251001Analyzed: Oct 25, 2026

Reviews

Add this skill to your library to leave a review.

No reviews yet

Be the first to share your experience.

Version History

  1. v3.0

    Contract changed: description

    ✦ AIReframes as advisory instructions the agent follows, not enforced blocks; removes PreToolUse hook implementation details and logging.

    triggering2026-10-25

    LATEST
  2. v2.0

    Contract changed: description

    ✦ AIExpands skill scope to describe three operational modes (Careful, Freeze, Guard) with PreToolUse hooks and broadens use cases.

    triggering2026-09-27

    View This Version
  3. v1.2

    Content updated

    ✦ AINo behavioral changes detected.

    2026-07-14

    View This Version
  4. v1.1

    Content updated

    ✦ AIAdds LICENSE file.

    2026-04-20

    View This Version
  5. v1.0

    2026-04-12

    View This VersionInitial version

Use affaan-m/safety-guard in your dev environment

Command Palette

Search for a command to run...