clash-routes

clash-routes is a skill for Claude Code from majiayu000/spellbook. It costs 67 tokens per session (1,438 once invoked), scanned A, original, MIT.

A command-line tool that shows which proxy route a selected computer process is using. Mihomo is the proxy engine behind some Clash clients.

In plain words
What is it for?
Use it to inspect active connections for processes such as Claude or Chrome, see their matching rules, and identify the proxy route they follow.
Why use it?
It removes guesswork when checking whether an application is connected through the expected subscription or proxy chain.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: positional $N argument; mentions Codex; mentions Gemini CLI.

Good fit Use it to inspect active connections for processes such as Claude or Chrome, see their matching rules, and identify the proxy route they follow.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/majiayu000/spellbook/clash-routes
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add majiayu000/spellbook --skill clash-routes
Clone the repo
git clone --depth 1 https://github.com/majiayu000/spellbook

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for clash-routes

README.md
[![agentmods](https://agentmods.dev/badge/skills/majiayu000/spellbook/clash-routes/github.svg)](https://agentmods.dev/skills/majiayu000/spellbook/clash-routes)
Your own site
<a href="https://agentmods.dev/skills/majiayu000/spellbook/clash-routes"><img src="https://agentmods.dev/badge/skills/majiayu000/spellbook/clash-routes/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for clash-routes

Your own site · 80×15
<a href="https://agentmods.dev/skills/majiayu000/spellbook/clash-routes"><img src="https://agentmods.dev/badge/skills/majiayu000/spellbook/clash-routes.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 67 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,438 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector warn 7 Sept 2026
SkillSpector: 1 finding, up to high

These are SkillSpector’s own severities. On a checked sample its high-severity flags on skills were ~96% false positives — a documented command, a public API, a “never do X” rule — so we show them as a caution to read, not a verdict. Why →

  • high Supply Chain · line 50
    Remote code is downloaded and executed. This bypasses code review and could introduce malicious code.
    Fix: Avoid downloading and executing remote scripts. Use trusted packages from PyPI/npm. If remote fetch is required, verify checksums and use HTTPS.
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00067 $0.01438
Opus 5 $0.00034 $0.00719
Sonnet 5 $0.00013 $0.00288
Haiku 4.5 $0.00007 $0.00144

Measured 7d ago against content hash 04c9aadc1807, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

clash-routes scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

if curl --fail --silent --show-error \
skills/clash-routes/SKILL.md · 140 lines

How it starts

The opening of the file, as written. The whole thing — 140 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Clash 线路查看工具

查看本机当前活跃连接,确认指定进程命中的规则、策略组与真实出口。不接受 SSH 参数;远程机器应先通过 Tailscale SSH 登录,再在目标机器执行同一只读流程。

用户传入的参数:$ARGUMENTS。没有参数时列出所有活跃连接。诊断 Gemini、ChatGPT 或浏览器流量时,先不加过滤获取实际 metadata.process,再使用观察到的进程名;不要假定它们属于 claude

获取凭证

读取 Clash Verge 配置,但不要打印 secret:

SECRET=$(grep '^secret:' "$HOME/Library/Application Support/io.github.clash-verge-rev.clash-verge-rev/clash-verge.yaml" 2>/dev/null | awk '{print $2}')
[ -z "$SECRET" ] && SECRET=$(grep '^secret:' "$HOME/.config/clash/config.yaml" 2>/dev/null | awk '{print $2}')
[ -n "$SECRET" ] && echo "API secret: configured" || echo "API secret: not configured"

查询与回退

请求成功才采用该 endpoint。/tmp socket 存在但失效时继续尝试 /var/tmp,最后尝试配置的 HTTP controller。所有 endpoint 都失败时明确报错,不返回空数据。

request_connections() {
  for socket_path in \
    /tmp/verge/verge-mihomo.sock \
    /var/tmp/verge/verge-mihomo.sock
  do
    [ -S "$socket_path" ] || continue
    if curl --fail --silent --show-error \
      --unix-socket "$socket_path" \
      "http://localhost/connections" \
      -H "Authorization: Bearer $SECRET"
    then
      return 0
    fi
  done

  controller=$(grep '^external-controller:' "$HOME/Library/Application Support/io.github.clash-verge-rev.clash-verge-rev/clash-verge.yaml" 2>/dev/null | awk '{print $2}' | tr -d "'\"")
  [ -n "$controller" ] || controller="127.0.0.1:9090"
  curl --fail --silent --show-error \
    "http://$controller/connections" \
    -H "Authorization: Bearer $SECRET"
}

if ! DATA=$(request_connections); then
  echo "无法从 Mihomo Unix socket 或 HTTP controller 获取连接数据" >&2
  exit 1
fi

if ! printf '%s' "$DATA" | python3 -c 'import json, sys; value=json.load(sys.stdin); assert isinstance(value.get("connections"), list)' 2>/dev/null; then
  echo "Mihomo 返回了无效的 connections JSON" >&2
  exit 1
fi

解析并展示

通过环境变量传递过滤值,避免把用户输入插进 Python 源码:

printf '%s' "$DATA" | FILTER="$ARGUMENTS" python3 -c '
import json
import os
import sys
from collections import defaultdict

data = json.load(sys.stdin)
process_filter = os.environ.get("FILTER", "").strip().lower()
results = []

for connection in data.get("connections", []):
    metadata = connection.get("metadata", {})
    process = metadata.get("process", "unknown")
    if process_filter and process_filter not in process.lower():
        continue
    host = metadata.get("host", "") or metadata.get("destinationIP", "")
    port = metadata.get("destinationPort", "")
    rule = connection.get("rule", "")
    payload = connection.get("rulePayload", "")
    if payload:
        rule += "/" + payload
    chains = connection.get("chains", [])
    chain_text = " → ".join(reversed(chains)) if chains else "DIRECT"
    results.append({
        "process": process,
        "host": f"{host}:{port}" if port else host,
        "rule": rule,
        "chain": chain_text,
    })

grouped = defaultdict(list)
for result in results:
    grouped[result["process"]].append(result)

if not grouped:
    target = process_filter or "任何进程"
    print(f"未找到 {target} 的活跃连接")
    raise SystemExit(0)

for process, connections in sorted(grouped.items()):
    print(f"\n进程: {process} ({len(connections)} 个连接)")
    route_stats = defaultdict(lambda: {"count": 0, "hosts": set()})
    for connection in connections:
        key = "{} → {}".format(connection["rule"], connection["chain"])
        route_stats[key]["count"] += 1
        route_stats[key]["hosts"].add(connection["host"])
    for route, info in sorted(route_stats.items(), key=lambda item: -item[1]["count"]):
        hosts = sorted(info["hosts"])
        shown = ", ".join(hosts[:5])
        suffix = f" ... (+{len(hosts) - 5})" if len(hosts) > 5 else ""
        print(f"  线路: {route}")
        print("  连接数: {}".format(info["count"]))
        print(f"  目标: {shown}{suffix}")
'

Read the full file on GitHub · 140 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago Changed · -67 lines · +12 tokens per session 04c9aadc1807
  2. 11d ago First seen · 207 lines · 55 tokens per session scan A d90cf2edb93e

Subscribe to this mod's changes

clash-routes is a skill published in the GitHub repository majiayu000/spellbook (278 stars, last pushed today), licensed MIT. It adds 67 tokens to every session and 1,438 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

pneuma-session

Instructions for renaming an active Pneuma session and replacing its default preview with a useful title and summary. A Pneuma session is one work area inside a larger project.

pandazki/pneuma-skills · 127 tokens

session-handoff

Use when the user wants to hand off, transfer, pause, or continue the current session in a new session or with another agent — asks for a "session handoff", a "prompt para a próxima sessão", to "continuar de onde paramos", or invokes /session-handoff; also when context is running low and in-flight work must survive a…

will-pagane/claude-superdev-harness · 91 tokens

aenv

Use when the user wants to set up, switch between, or manage aenv namespaces — named bundles of CLAUDE.md, skills, MCP entries, and other AI-coding-harness config — in a project OR globally across $HOME. Triggers include aenv … mentioned directly, "switch namespace/profile", "activate/deactivate", "create/snapshot a…

Blevene/aenv · 176 tokens

cao-session-management

Interact with CAO (CLI Agent Orchestrator) — launch multi-agent sessions, check status, send follow-up instructions, unblock stuck terminals, or shut down sessions. Use when working with CAO sessions in any capacity.

awslabs/cli-agent-orchestrator · 49 tokens

mulmoterminal-keys

Bind keyboard shortcuts and fix keyboard/clipboard behaviour in MulmoTerminal. Writes keymap, which Settings cannot set at all — its Keyboard shortcuts section is read-only, listing every action bound or not plus a send row. Explains copyOnSelect, questionPaneEnabled and terminalSubmit, which have their own Settings…

receptron/mulmoterminal · 289 tokens

tokf-discover

Find missed token savings by scanning AI coding session files for commands that ran without tokf filtering.

mpecan/tokf · 24 tokens