safe-mode

仓库创建 2026年2月2日最近提交 4 小时前SkillHot 收录 28 天前
▸ 精选理由

能在会话中主动防护危险命令,适合高风险改动场景。

▸ 风险提示

误拦正常命令可能中断工作流,需要谨慎配置。

这个 Skill 做什么

提供三种安全模式,用于阻止或限制 AI 执行破坏性操作。

在 AI 编码会话里加三档防护:cautious(危险命令只警告)、lockdown(编辑限制到指定目录)、clear(移除限制)。通过 Claude Code 钩子拦截 Bash/Edit/Write 类操作,防止误删或破坏性变更。这个保护按需开启,作为项目全局告警的补充,能在敏感操作前多一层阻止。

▸ 展开 SKILL.md 英文原文

Prevent destructive operations using Claude Code hooks. Three modes — cautious (warn on dangerous commands), lockdown (restrict edits to one directory), and clear (remove restrictions). Uses PreToolUse matchers for Bash, Edit, and Write.

开发编程安全防护危险命令拦截目录限制Claude Code通用
2.8k
Stars
266
Forks
40
仓库内 Skill
+161
7 日增星
安装 / 使用
给你的 Agent 一句话(通用)
帮我安装这个 skill:https://raw.githubusercontent.com/rohitg00/pro-workflow/main/skills/safe-mode/SKILL.md
或 curl 直取 SKILL.md
curl -fsSL "https://raw.githubusercontent.com/rohitg00/pro-workflow/main/skills/safe-mode/SKILL.md"
SKILL.MD 节选查看完整文件 ↗
# Safe Mode

Three levels of protection against destructive operations during AI coding sessions.

> **Note:** These hooks are skill-scoped — they only activate when you invoke `/safe-mode`. The global `permission-request.js` hook in hooks.json provides always-on alerting for dangerous commands. Safe-mode adds opt-in blocking and directory restrictions on top of that.

## Modes

### Cautious Mode

```text
/safe-mode cautious
```

Intercepts Bash commands before execution. Warns on dangerous patterns but does not block — the user decides.

**Flagged patterns:**

| Pattern | Risk |
|---------|------|
| `rm -rf` / `rm -r` | Recursive deletion |
| `DROP TABLE` / `DROP DATABASE` | SQL data loss |
via SKILL·HOT · 数据来自 GitHub 公开信息 · 原文版权归作者所有