guard

GitHub

通过拦截危险命令和限制文件编辑范围,防止误删数据或代码。适用于关键系统操作、部署前检查及故障恢复场景,提供安全护栏以保障操作安全性。

skills/guard/SKILL.md Houseofmvps/ultraship

Trigger Scenarios

执行 rm -rf、DROP TABLE 等破坏性命令时 进行 git force-push 或 reset --hard 操作时 需要限制文件修改目录范围时 在关键系统或部署过程中工作

Install

npx skills add Houseofmvps/ultraship --skill guard -g -y
More Options

Use without installing

npx skills use Houseofmvps/ultraship@guard

指定 Agent (Claude Code)

npx skills add Houseofmvps/ultraship --skill guard -a claude-code -g -y

安装 repo 全部 skill

npx skills add Houseofmvps/ultraship --all -g -y

预览 repo 内 skill

npx skills add Houseofmvps/ultraship --list

SKILL.md

Frontmatter
{
    "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.",
    "allowed-tools": "Bash, Read",
    "argument-hint": "<directory-to-protect>"
}

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.

Version History

  • ed232cb Current 2026-07-24 16:15

Same Skill Collection

skills/a11y/SKILL.md
skills/architecture/SKILL.md
skills/brainstorming/SKILL.md
skills/canary/SKILL.md
skills/clone-patterns/SKILL.md
skills/code-review/SKILL.md
skills/compete/SKILL.md
skills/cost/SKILL.md
skills/demo/SKILL.md
skills/deploy/SKILL.md
skills/dispatching-parallel-agents/SKILL.md
skills/evals/SKILL.md
skills/executing-plans/SKILL.md
skills/finishing-a-development-branch/SKILL.md
skills/frontend-design/SKILL.md
skills/grow/SKILL.md
skills/index-fix/SKILL.md
skills/investigate/SKILL.md
skills/launch/SKILL.md
skills/learn/SKILL.md
skills/onboard/SKILL.md
skills/pentest/SKILL.md
skills/perf-audit/SKILL.md
skills/receiving-code-review/SKILL.md
skills/release/SKILL.md
skills/requesting-code-review/SKILL.md
skills/rescue/SKILL.md
skills/retro/SKILL.md
skills/revise-claude-md/SKILL.md
skills/security-audit/SKILL.md
skills/seo-audit/SKILL.md
skills/seo-strategy/SKILL.md
skills/ship-gate/SKILL.md
skills/sprint/SKILL.md
skills/staying-current/SKILL.md
skills/subagent-driven-development/SKILL.md
skills/systematic-debugging/SKILL.md
skills/test-driven-development/SKILL.md
skills/using-git-worktrees/SKILL.md
skills/using-ultraship/SKILL.md
skills/verification-before-completion/SKILL.md
skills/visual-diff/SKILL.md
skills/writing-plans/SKILL.md
skills/writing-skills/SKILL.md

Metadata

Files
0
Version
ed232cb
Hash
9ef3bbe4
Indexed
2026-07-24 16:15

inicio - Wiki
Copyright © 2011-2026 iteam. Current version is 2.155.2. UTC+08:00, 2026-08-16 20:11
浙ICP备14020137号-1 $mapa de visitantes$