Skip to content
Skills Library
Security · Analysis

safe-network-diagnostics

/safe-network-diagnostics

当任务涉及网络连通性排查、本地代理客户端状态检查、DNS解析测试、端口探测或接口请求报错诊断时使用。固化用户代理严格只读红线与安全只读诊断命令规范。

Licence
MIT
Last repository change
13.11.2026

Assessment and security

96/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability21 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
1
Scripts
0
HTML comments
0
URLs in SKILL.md
1
Deprecation

No signals detected. Repository changed on 13.11.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What it does and when to use it

当任务涉及网络连通性排查、本地代理客户端状态检查、DNS解析测试、端口探测或接口请求报错诊断时使用。固化用户代理严格只读红线与安全只读诊断命令规范。

Original author description

当任务涉及网络连通性排查、本地代理客户端状态检查、DNS解析测试、端口探测或接口请求报错诊断时使用。固化用户代理严格只读红线与安全只读诊断命令规范。

How it works

  1. 1. 绝对红线:未经当次明确许可,严禁任何写/停操作
  2. 2. 标准只读网络诊断 SOP
  3. 3. 确需变更时的唯一合规路径
Original SKILL.md headings · 95 lines, 332 words
SKILL.md preview
---
name: safe-network-diagnostics
description: 当任务涉及网络连通性排查、本地代理客户端状态检查、DNS解析测试、端口探测或接口请求报错诊断时使用。固化用户代理严格只读红线与安全只读诊断命令规范。
---

# 安全网络与代理只读诊断规范(safe-network-diagnostics)

> 权威来源:继承自 [`~/.gemini/GEMINI.md`](../../../../GEMINI.md)「用户代理与网络配置:未经许可一律只读」全局红线。命令行底层硬拦截位于 [`~/.gemini/config/scripts/pretool_guard.ps1`](../../../scripts/pretool_guard.ps1)(Windows)与 [`~/.gemini/config/scripts/pretool_guard.cjs`](../../../scripts/pretool_guard.cjs)(macOS / Linux)。

## 1. 绝对红线:未经当次明确许可,严禁任何写/停操作

未经用户**当次明确许可**,严禁执行任何停止、禁用、重启、卸载用户代理或更改网络配置的操作,包括但不限于:

1. **严禁结束代理客户端进程**:
   - 严禁使用 `taskkill` / `tskill` / `kill` / `pkill` / `killall` / `Stop-Process` / `wmic` / `osascript ... quit` 针对以下目标:`clash`、`verge`、`mihomo`、`sing-box`、`v2ray`、`xray`、`neko`、`shadowsocks`、`hysteria`、`surge`、`stash` 等一切代理核心与 GUI 进程。
2. **严禁停止或删除相关代理/TUN 服务**:
   - Windows:严禁执行 `sc stop`、`net stop`、`Stop-Service`、`sc delete` 等命令;
   - macOS / Linux:严禁执行 `launchctl bootout/unload/remove/stop`、`systemctl stop/disable/mask` 等影响代理或虚拟网卡守护进程的命令。
3. **严禁破坏性网络层操作**:
   - Windows:严禁执行 `netsh wlan disconnect`、`Disable-NetAdapter`、`ipconfig /release`、`rasdial /d`、`route delete`;
   - macOS / Linux:严禁执行 `ifconfig ... down`、`ip link set ... down`、`ipconfig set`、`nmcli ... off/down`、`route delete/flush/change`、`pfctl -d/-F`。
4. **严禁修改系统代理设置**:
   - Windows:严禁通过 `reg add` / `Set-ItemProperty` 修改 `HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings`(`ProxyEnable` / `ProxyServer`),严禁执行 `netsh winhttp set proxy`;
   - macOS:严禁执行 `networksetup -setwebproxy` / `-setsecurewebproxy` / `-setsocksfirewallproxy` / `-set*state` 或通过 `scutil` 写入代理配置。

---

## 2. 标准只读网络诊断 SOP

排查网络故障、代理连通性或接口超时问题时,**只允许使用只读命令与只读参数**:

### 2.1 检查系统代理配置(只读)
```bash
# [Windows] 查询当前用户级系统代理注册表与 WinHTTP 代理设置
reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable
reg query "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer
netsh winhttp show proxy

# [macOS] 查询系统动态代理状态与 Wi-Fi 代理配置
scutil --proxy
networksetup -getwebproxy Wi-Fi
networksetup -getsecurewebproxy Wi-Fi
networksetup -getsocksfirewallproxy Wi-Fi

# [Linux / 通用] 查询当前 Shell 代理环境变量
env | grep -i proxy
```

### 2.2 检查本地代理端口监听状态(只读)
```bash
# [Windows] 查看常见代理端口(如 7890, 7897, 1080, 10808, 2080 等)是否在监听
netstat -ano | grep -E "LISTENING" | grep -E ":(7890|7897|1080|10808|2080)\b"

# [macOS] 查看常见代理端口监听进程
lsof -nP -iTCP -sTCP:LISTEN | grep -E ":(7890|7897|1080|10808|2080)\b"

# [Linux] 查看常见代理端口监听套接字
ss -tulnp | grep -E ":(7890|7897|1080|10808|2080)\b"
```

### 2.3 HTTP/HTTPS 连通性探测(严格限制 GET / HEAD)
- **注意**:`curl` 本身支持上传与写请求,不能凭程序名当作只读保证;诊断时**仅限 `GET` / `HEAD` 类读取**,并加上超时控制(`-m` / `--connect-timeout`):
```bash
# 只读探测响应头与状态码(跨平台通用)
curl -I -s -m 5 https://www.google.com | head -n 5
```

### 2.4 DNS 与基础网卡/路由查询(只读)
```bash
# [Windows]
nslookup <domain>
ping -n 3 <host>
netsh interface ip show config

# [macOS]
scutil --dns
nslookup <domain>
ping -c 3 <host>
ifconfig

# [Linux]
nslookup <domain>
ping -c 3 <host>
ip addr
ip route
```

### 2.5 鉴别大体积工具调用导致的“假性流中断”
若报错为 `The stream was interrupted` 或 `stream idle timeout`,排查网络前先检查上一步是否正在发起大体积 `write_file`(如单次写入 >2,500 字的长篇小说、大文档或大文件)。Antigravity 的 `BidiGenerateContent` 流在服务端生成 Tool Call JSON 参数时采用整包缓冲,参数全部拼装完成前流处于 0 字节静默;当单次写入过大导致后台缓冲耗时超过 90~120s 时,会被网关或客户端空闲超时直接掐断——**这属于单次工具输出块过大,并非用户代理或网络故障**。遇到此类情况直接改用 `write_file` + `Append: true` 分块(单次 ≤1,500–2,000 字)写入即可,无需探测或重启代理。

---

## 3. 确需变更时的唯一合规路径

如果诊断结论证实**确实需要重启代理或修改网络配置**:
1. **立即停止自动执行**;
2. 向用户清晰说明:**要执行什么操作、为什么需要做、会产生什么影响**;
3. 等待用户当次明确批准后再执行,或直接提供命令请用户在自己的终端手动执行。

Versions

The database has no other skills named safe-network-diagnostics.

Database snapshot: 13.11.2026 · package version 4e13b28c5ba4 (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 95network-operations
    Use when working with IPs, ports, firewall rules, routing, or diagnosing network connectivity issues
  • 100esp32-dns-failure-diagnostics
    Use when reviewing or implementing esp32 dns failure diagnostics on an ESP32 target., including target-specific constraints and repeatable validation steps.
  • 100network-diagnostics
    Network connectivity and latency diagnostics. Use when tracing routes, comparing ping latency across endpoints, or inspecting local socket/port usage.
  • 100privacy-fortress
    系统审计并加固 Windows、macOS、Linux、Android 和 iOS 的网络隐私与最小信息暴露面。覆盖 30 项防护台账、Mihomo/Clash 或 sing-box 网关、TUN 与规则顺序、DoH-over-proxy、DNS/IPv6/UDP/WebRTC 泄漏、exe/MSIX fail-closed、浏览器分边、Android Always-on/锁死/分应用、iOS On Demand/includeAllNetworks 边界、上游可见性、回退与巡检。Use when the user asks for privacy…
  • 100esp32-fault-injection-network
    Use when reviewing or implementing esp32 fault injection network on an ESP32 target.
  • 100network-troubleshooting
    Systematic, safety-first diagnosis of developer network failures such as connection refused, DNS resolution errors, TLS certificate problems, proxy failures, and package registry timeouts. Use when a command fails with a network-shaped error (curl, npm, pip, git, docker), when a…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.