Skip to content
Development
Skill

/guard

Safety guardrails — blocks destructive commands (rm -rf, DROP TABLE, force-push, git reset --hard) and optionally restricts file edits to a specific directory. Use when working on critical systems or when you want extra protection.

From plugin
ultraship
12345 skills13 agents16 commands3 hooks
+1

Claude Code

$ npx -y skills add Houseofmvps/ultraship --skill guard --agent claude-code

SKILL.md

guard.SKILL.md
name: guard
description: Safety guardrails — blocks destructive commands (rm -rf, DROP TABLE, force-push, git reset --hard) and optionally restricts file edits to a specific directory. Use when working on critical systems or when you want extra protection.
argument-hint: "<directory-to-protect>"
allowed-tools: Bash, Read

Guard — Safety Guardrails

Guard protects you from accidental destructive actions by intercepting dangerous commands before they execute. It uses Claude Code's PreToolUse hooks to catch risky patterns in real-time.

**Announce at start:** "I'm activating Guard — destructive commands will be blocked until you explicitly approve them."

What Guard Blocks

Destructive Bash Commands

  • `rm -rf` / `rm -r` on important directories
  • `DROP TABLE` / `DROP DATABASE` / `TRUNCATE`
  • `git push --force` / `git push -f` (to main/master)
  • `git reset --hard`
  • `git checkout .` / `git restore .` (discard all changes)
  • `git clean -f` / `git clean -fd`
  • `git branch -D` (force delete branch)
  • `kubectl delete` (Kubernetes resource deletion)
  • `docker system prune` / `docker volume rm`
  • `:> file` / `> file` (truncate files)

File Edit Restrictions (Optional)

When the user specifies a directory to freeze to, Guard blocks edits outside that directory:

User: "Only edit files in src/api/"
→ Guard blocks Edit/Write calls to any path not under src/api/

How It Works

Guard installs PreToolUse hooks that run BEFORE Claude executes Bash, Edit, or Write tools:

1. **Bash hook** — Scans the command string for destructive patterns. If matched, outputs a warning and blocks execution. 2. **Edit/Write hook** — If a freeze directory is set, checks that the target file is within the allowed path.

The hooks are defined in this skill's configuration and activate when the skill is loaded.

Usage

Activate full protection

Just invoke `/guard` — destructive command blocking is immediate.

Set a directory freeze

Tell Claude which directory to restrict edits to:

"Only edit files in packages/api/"
"Freeze edits to src/components/"

Guard will write the freeze path to `.ultraship/guard-freeze.txt` and enforce it on all Edit/Write operations.

Remove freeze

"Unfreeze" or "Remove edit restrictions"

Override a blocked command

If Guard blocks something you actually need to run, explicitly confirm:

"Yes, I want to force-push to main"
"Confirmed: drop the users table"

Guard will allow explicitly confirmed destructive actions.

Integration with Other Skills

  • **`/investigate`** — Guard pairs well with investigation. No accidental fixes while diagnosing.
  • **`/deploy`** — Guard prevents accidental force-pushes during deployment.
  • **`/rescue`** — During incidents, Guard ensures rollback commands are deliberate.

Key Principles

1. **Block by default, allow on confirmation.** Better to stop and ask than to destroy. 2. **No silent failures.** Always explain what was blocked and why. 3. **The user is sovereign.** Explicit confirmation overrides any guard. 4. **Minimal friction for safe operations.** Guard only triggers on genuinely dangerous patterns.

Read more
@houseofmvps
Ships withultraship

"ULTRASHIP" Claude Code plugin — 39 skills, 33 tools, 11 agents for ship-ready workflows: planning, review, pentesting, safety guardrails, canary monitoring, SEO/AI-readiness check, penetration testing, code review, competitive analysis, incident response. 1 dependency. 180 tests. MIT.

12345 skills13 agents2 MCP
Get the whole plugin

Stars on GitHub

Momentum

stars in total
123
Star history of Houseofmvps/ultraship on GitHub, a chart by star-history.com

Other skills on ultraship.

a11y

a11y

Accessibility audit + auto-fix (WCAG 2.2 A/AA). Scans built/static HTML for screen-reader, keyboard, and structure failures,…

architecture

architecture

Living Architecture Map — auto-generate Mermaid diagrams of your codebase. Use when user wants to visualize architecture,…

brainstorming

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, or modifying behavior.…

canary

canary

Post-deploy canary monitoring — checks site health, detects regressions, monitors for errors after deployment. Use after…

clone-patterns

clone-patterns

Learn From the Best — analyze patterns from any codebase and apply them to yours. Use when user wants to adopt best practices…

code-review

code-review

Code review with principal-engineer-level depth. Reviews for correctness, performance, security, maintainability, and…

More skills from other plugins.

brainstorming
Auto-invoked

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…

@obra@obraInstall Skill
ask-matt

ask-matt

Ask which skill or flow fits your situation. A router over the skills in this repo.

skills2w309k
@mattpocock@mattpocockInstall Skill
accessibility
Auto-invoked

accessibility

Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels,…

ecc2w293k
@affaan-m@affaan-mInstall Skill
compiler-commit

compiler-commit

Use when you want to verify compiler changes and commit with the correct convention. Runs tests, lint, and format, then commits…

react5d252k
@facebook@facebookInstall Skill

Questions about guard.

Which coding agents can use guard?
guard installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.