Skip to content
Development
Skill

/ops-safety

当用户执行系统级命令(sysctl、iptables、systemctl、Docker 配置、数据库 DDL)或进行服务器运维操作时触发。提供运维安全规范。

From plugin
cc-use-exp
1k38 skills18 commands
Install
$ npx -y skills add doccker/cc-use-exp --skill ops-safety --agent claude-code

How it fires

How this skill gets triggered: by you, by Claude, or both.

  • Fires itselfAuto-invocation. Claude auto-loads it when your prompt matches the work.Auto-invocation is when the right skill fires by itself at the right moment, driven by a FLOW.md router and a hook, instead of you invoking it by name. It is the difference between a skill being installed and a skill actually getting used.Read the full definition →
  • You can call itInvoke it directly when you want it.
  • Slash command/ops-safety

Context preview

The summary Claude sees to decide when to auto-load this skill.

当用户执行系统级命令(sysctl、iptables、systemctl、Docker 配置、数据库 DDL)或进行服务器运维操作时触发。提供运维安全规范。

SKILL.md

ops-safety.SKILL.md
name: ops-safety
description: 当用户执行系统级命令(sysctl、iptables、systemctl、Docker 配置、数据库 DDL)或进行服务器运维操作时触发。提供运维安全规范。

运维安全规则

> 防止因不完整的操作导致系统故障。

---

1. 系统级命令规则

在给出任何系统级命令(sysctl、firewalld、iptables、内核参数、systemctl 等)之前,必须先说明:

| 项目 | 说明 | |------|------| | **影响范围** | 这个命令会影响什么(网络、Docker、服务等) | | **风险等级** | 高/中/低 | | **回滚方案** | 完整的回滚步骤,包括所有依赖服务的重启 | | **需要重启的服务** | 明确列出 |

命令说明模板

## 命令说明

**命令**: sudo sysctl -p /etc/sysctl.d/99-xxx.conf

**影响范围**:
- 内核网络参数
- 可能影响 Docker 容器网络
- 可能影响 Cloudflare 连接

**风险等级**: 高

**回滚方案**:
1. sudo rm -f /etc/sysctl.d/99-xxx.conf
2. sudo sysctl --system
3. sudo systemctl restart docker
4. docker-compose up -d
5. curl -I http://127.0.0.1:80  # 验证

**是否确认执行?**

---

2. 回滚方案要求

回滚方案必须包含以下步骤,缺一不可:

| 步骤 | 说明 | 示例 | |------|------|------| | 1. 恢复配置 | 删除或还原配置文件 | `rm -f /etc/sysctl.d/99-xxx.conf` | | 2. 重载配置 | 重新加载系统配置 | `sysctl --system` | | 3. 重启服务 | 重启所有受影响的服务 | `systemctl restart docker` | | 4. 恢复应用 | 重启依赖的应用 | `docker-compose up -d` | | 5. 验证恢复 | 确认服务正常 | `curl -I http://127.0.0.1:80` |

---

3. 问题排查原则

不扩散问题

如果 A 配置导致问题:

  • ✅ 先彻底恢复 A
  • ❌ 不要去改 B、C、D

最小改动原则

  • 只修改必要的配置
  • 一次只改一个变量
  • 改完验证后再进行下一步

不动正常配置

  • 用户明确说某配置正常,不要建议修改
  • 不要"顺手"优化其他配置

---

4. 特定场景规则

Cloudflare + 服务器

当用户使用 Cloudflare 代理时:

| 禁止操作 | 原因 | |---------|------| | 随意修改内核网络参数 | 可能导致 Cloudflare 连接异常 | | 随意修改 DNS 记录 | 影响 CDN 解析 | | 随意修改 SSL/TLS 设置 | 可能导致证书验证失败 |

Docker 相关

修改以下配置后,必须提示重启 Docker:

  • 内核网络参数(sysctl)
  • iptables / firewalld 规则
  • Docker daemon 配置

数据库操作

执行以下操作前必须提示备份:

  • 表结构修改(ALTER TABLE)
  • 批量数据更新(UPDATE/DELETE 无 WHERE 或影响大量数据)
  • 数据库迁移

---

5. 禁止行为

| 禁止 | 说明 | |------|------| | ❌ 问题未解决时改其他配置 | 不要扩散问题 | | ❌ 不完整的回滚方案 | 必须包含服务重启步骤 | | ❌ 无风险说明的系统命令 | 必须先说明再执行 | | ❌ 未经确认执行高风险命令 | 必须等用户确认 | | ❌ 同时修改多个配置 | 一次一个,验证后再下一个 |

---

6. 风险等级定义

| 等级 | 定义 | 示例 | |------|------|------| | **高** | 可能导致服务中断、数据丢失 | 内核参数、防火墙、数据库DDL | | **中** | 可能影响部分功能 | 应用配置、环境变量 | | **低** | 影响范围小,易回滚 | 日志级别、非核心配置 |

Read more
Ships withcc-use-exp

保留你熟悉的 CLI/IDE,让 Claude Code、Gemini CLI、Codex、Cursor、GitHub Copilot 开箱即用 按费力度从低到高,用最少操作获得最大帮助 不是提示词集合,而是一套可维护的 AI 协作配置系统。

Get the whole plugin

Other skills on cc-use-exp.