Agent skill

Optimize Network

by majiayu000 in majiayu000/spellbook

Safely diagnose and improve local network speed, latency, jitter, DNS, Wi-Fi, Ethernet, macOS network services, and bufferbloat.

MITAuto-check: notes

Install Optimize Network

skills CLI
$ npx skills add majiayu000/spellbook --skill optimize-network -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install majiayu000/spellbook optimize-network --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/majiayu000/spellbook.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/optimize-network .claude/skills/optimize-network && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
optimize-network
GitHub stars
287
Token cost
~2.8k tokens
SKILL.md length
1,191 words
Files
3 (incl. scripts)
Skills in repo
97
Repo updated
First seen
Licence
MIT

At a glance

Safely diagnose and improve local network speed, latency, jitter, DNS, Wi-Fi, Ethernet, macOS network services, and bufferbloat.

  • Works in 5 steps: Preflight → Baseline → Diagnose Top Bottlenecks → …
  • The user asks to optimize internet/network speed
  • SKILL.md covers Safety Contract, Routing Decision, Evidence Hierarchy and Workflow, plus 4 more sections
  • Runs Shell scripts from its folder; calls curl

What it does

Optimize Network is an agent skill from majiayu000/spellbook. Safely diagnose and improve local network speed, latency, jitter, DNS, Wi-Fi, Ethernet, macOS network services, and bufferbloat. Use this skill whenever the user asks to optimize internet/network speed, make the network faster, diagnose slow Wi-Fi, latency, packet loss, DNS delay, unstable Codex/AI tool connectivity, or asks about the viral Codex network optimization workflow. Always protect VPN/proxy tools such as Clash Verge, Mihomo, Shadowrocket, Tailscale, V2Ray, Surge, and corporate VPNs; do not modify or…

Its SKILL.md is about 2.8k tokens, which your agent loads only when the skill is triggered. The skill folder holds 4 other files, including scripts (for example `evals/evals.json` and `scripts/macos_network_snapshot.sh`).

It works with macOS. The repository describes itself as: Cross-runtime skills for Claude Code, Codex, and multi-agent workflows. The licence is MIT.

When your agent uses it

  • The user asks to optimize internet/network speed
  • Make the network faster
  • Diagnose slow Wi-Fi
  • Unstable Codex/AI tool connectivity

Example prompts

  • “/optimize-network”

Requirements

  • A Bash shell
  • Pre-approved tools (allowed-tools): Bash

Workflow steps

5 steps, taken from the step headings in SKILL.md.

  1. Preflight
  2. Baseline
  3. Diagnose Top Bottlenecks
  4. Safe Optimization Menu
  5. Verify

What it can do on your machine

Read from SKILL.md and the folder at commit ed52af7. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Bash

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships 1 file in scripts/ (Shell), which the agent can run.

    Shell commands in SKILL.md call:

    • curl

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use curl, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Optimize Network loads about 2.8k tokens when it runs. Until then it costs about 151 tokens; SKILL.md has 1,191 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~151
When it runs · the whole SKILL.md, loaded when a task matches
~2.8k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check: notes

The automated check noted patterns worth knowing about, such as sudo or a known installer.

  • NoteRuns commands with sudoSKILL.md:165
    sudo ifconfig awdl0 down
  • NoteRuns commands with sudoSKILL.md:167
    sudo ifconfig awdl0 up
  • NoteRuns commands with sudoSKILL.md:174
    Responder` restart needs confirmation if sudo is required:
  • NoteRuns commands with sudoSKILL.md:178
    sudo killall -HUP mDNSResponder
  • NotePre-approves every shell command (allowed-tools: Bash)SKILL.md
    allowed-tools: Bash

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); the scripts in this folder are not scanned.

SKILL.md

The full file from majiayu000/spellbook at commit ed52af7, republished under its MIT licence (© majiayu000). 1,191 words, ~2,807 tokens.

Download SKILL.mdSave it as .claude/skills/optimize-network/SKILL.md (or your agent's skills folder). This skill also uses 2 other files; get the full folder from GitHub.
name
optimize-network
description
Safely diagnose and improve local network speed, latency, jitter, DNS, Wi-Fi, Ethernet, macOS network services, and bufferbloat. Use this skill whenever the user asks to optimize internet/network speed, make the network faster, diagnose slow Wi-Fi, latency, packet loss, DNS delay, unstable Codex/AI tool connectivity, or asks about the viral Codex network optimization workflow. Always protect VPN/proxy tools such as Clash Verge, Mihomo, Shadowrocket, Tailscale, V2Ray, Surge, and corporate VPNs; do not modify or disable them unless the user explicitly asks for that specific change.
allowed-tools
Bash
metadata.argument-hint
[diagnose|optimize|report|skill] [target-domain]

Optimize Network

Use this skill to run a safe, evidence-first network optimization workflow. The default posture is read-only diagnosis, then small reversible experiments, then before/after verification. Never treat VPN, proxy, TUN, or routing tools as junk processes.

Safety Contract

Follow these rules before any command that could affect connectivity:

  • Intent lock: the goal is speed, latency, responsiveness, and stability, not cleaning network configuration.
  • Proxy/VPN protection: do not stop, restart, unload, delete, reconfigure, or bypass Clash, Mihomo, Shadowrocket, Tailscale, V2Ray, Surge, WireGuard, OpenVPN, corporate VPNs, or their TUN interfaces unless the user explicitly requests that exact operation.
  • Default read-only: diagnostics may run directly; changes require a short proposal with risk, rollback, and expected effect.
  • Reversible first: prefer temporary A/B tests, service reordering, DNS experiments, cache flushes, and user-confirmed app closure over deletion.
  • No silent degradation: if a change breaks access to AI tools, proxy, remote work, DNS, or LAN devices, revert it or report the blocker immediately.
  • No destructive cleanup: do not delete network locations, profiles, VPN configs, proxy configs, launch agents, routes, or firewall rules. If deletion looks useful, propose disable/dry-run first.
  • Sudo caution: any sudo, interface down/up, DHCP reset, route change, or network service disable must be confirmed by the user first.
  • Remote session caution: if the user may be connected through SSH, remote desktop, RustDesk, Tailscale, or VPN, ask before any change that could disconnect them.

Routing Decision

Choose one mode and state it briefly:

  • execute_direct: read-only diagnosis, report generation, or a user-approved reversible command.
  • plan_first: multi-step optimization, DNS change, service-order change, AWDL/AirDrop test, or anything that may affect connectivity.
  • clarify_first: OS is unknown, user is remote over the network, proxy/VPN ownership is unclear, or the requested change would modify VPN/proxy/TUN state.

Use these handoff fields in the report: goal, context, constraints, actions, evidence, decision, rollback, next step.

Evidence Hierarchy

Prefer fresh local measurements over assumptions:

  1. System route/proxy/DNS state: scutil --nwi, scutil --dns, scutil --proxy, route -n get default.
  2. Link quality: gateway ping, packet loss, Wi-Fi RSSI/noise/Tx Rate/channel, Ethernet state.
  3. Responsiveness: macOS networkQuality -v and, when available, speedtest-cli.
  4. DNS: repeated dig +tries=1 +time=2 +stats against relevant domains.
  5. Process/network load: nettop, lsof, Mihomo read-only connections API when present.
  6. Before/after comparison from the same commands, same route/proxy state, and close in time.

Do not claim improvement from a single noisy datapoint. Call out variance when results are mixed.

Workflow

1. Preflight

Identify the operating system and active path:

bash
uname -a
sw_vers 2>/dev/null || true
command -v networkQuality || true
command -v speedtest-cli || true
command -v speedtest || true
scutil --nwi 2>/dev/null || true
scutil --proxy 2>/dev/null || true

If macOS is detected, prefer the bundled read-only snapshot helper:

bash
~/.claude/skills/optimize-network/scripts/macos_network_snapshot.sh

Run the bandwidth/responsiveness portion only when the user is ready for a bandwidth-consuming test:

bash
RUN_NETWORKQUALITY=1 ~/.claude/skills/optimize-network/scripts/macos_network_snapshot.sh

If testing from a local Codex skill copy instead of an installed Spellbook copy, use the equivalent path under ~/.agents/skills/optimize-network/scripts/.

2. Baseline

Record:

  • OS, timestamp, active network service/interface, default gateway, route table summary.
  • Whether tests are direct or proxied. If system proxy/TUN is active, say that throughput and latency measure the proxy path.
  • networkQuality -v or speedtest-cli download/upload/latency.
  • Gateway ping and at least one regional public ping.
  • DNS servers and dig timing for user-relevant domains.
  • Wi-Fi channel, band, RSSI/noise, Tx Rate, and PHY mode when available.
  • Active proxy/VPN processes and read-only connection counts if relevant.
3. Diagnose Top Bottlenecks

Limit the finding list to the most likely 3-4 bottlenecks. Common categories:

  • Local link jitter: gateway ping spikes, Wi-Fi channel contention, AWDL/AirDrop/Handoff scanning, router CPU/load.
  • Bufferbloat: good bandwidth but high loaded latency in networkQuality.
  • DNS instability: repeated lookup variance or slow first query for domains the user actually uses.
  • Proxy path mismatch: speed tests or AI tools are routed through slow proxy groups or residential nodes.
  • Service order drift: unused adapters ahead of the active Wi-Fi/Ethernet service.
  • Background traffic: high network throughput from sync, browser, remote desktop, update, or chat apps.
  • MTU/path issues: large ping failure with DF set, packet loss to nearby destinations.

Separate confirmed facts from hypotheses.

Show full SKILL.md (555 more words)Show less
4. Safe Optimization Menu

Only apply a change after explaining risk and rollback.

DNS A/B test

Use when DNS lookup is repeatedly slow or inconsistent. Save current DNS first:

bash
networksetup -getdnsservers Wi-Fi

Candidate examples for China mainland networks: 223.5.5.5, 119.29.29.29, 114.114.114.114. Test by setting, flushing cache, repeating dig and curl -w, then keep only if it clearly improves results. Roll back with the saved DNS:

bash
networksetup -setdnsservers Wi-Fi <saved-dns...>
dscacheutil -flushcache

Network service order

Use when inactive adapters are above the real interface and route evidence suggests confusion. First show the current order:

bash
networksetup -listnetworkserviceorder

Propose the exact new order. Preserve VPN/proxy services and do not remove them. Apply only after confirmation:

bash
networksetup -ordernetworkservices "<primary>" "<secondary>" "<other-services...>"

Unused service disable

Use only for clearly unused physical/virtual adapters, and prefer disable over delete. Never disable VPN/proxy/TUN services by default. Show:

bash
networksetup -listallnetworkservices

Apply only after confirmation:

bash
networksetup -setnetworkserviceenabled "<service-name>" off

Rollback:

bash
networksetup -setnetworkserviceenabled "<service-name>" on

AWDL/AirDrop A/B test

Use when Wi-Fi signal is strong but gateway ping has periodic spikes. This may affect AirDrop, AirPlay, Handoff, Universal Control, and Apple Watch unlock. It usually requires sudo, so confirm first.

Test window:

bash
sudo ifconfig awdl0 down
ping -c 30 <gateway>
sudo ifconfig awdl0 up

Do not leave awdl0 down unless the user explicitly wants that tradeoff.

mDNS/DNS cache refresh

Use when local name resolution or stale DNS is suspected. dscacheutil -flushcache is low risk. mDNSResponder restart needs confirmation if sudo is required:

bash
dscacheutil -flushcache
sudo killall -HUP mDNSResponder

Background traffic

Report top talkers from nettop or lsof. Do not kill processes. Suggest the user pause sync/download/remote desktop apps or ask for confirmation before closing anything.

Bufferbloat / SQM

If loaded latency is high while bandwidth is adequate, local macOS tweaks are unlikely to fix the root cause. Recommend router-side SQM/CAKE/FQ-CoDel if available, with upload/download shaping at roughly 85-90% of measured stable throughput. Treat this as manual router work unless the user explicitly asks for router configuration.

Proxy path optimization

If Clash/Mihomo is active, inspect read-only state before proposing changes:

bash
curl -s --max-time 2 --unix-socket /tmp/verge/verge-mihomo.sock http://localhost/connections
curl -s --max-time 2 --unix-socket /tmp/verge/verge-mihomo.sock http://localhost/configs

Summarize only the fields needed for diagnosis. Do not paste raw /configs, full proxy definitions, provider URLs, auth material, or full connection host lists into a public report. Do not change proxy groups, TUN, rules, DNS hijack, or route exclusions from this skill unless the user explicitly asks. If a proxy-specific fix is needed and a clash-doctor or clash-routes skill exists, use that skill or hand off to it.

5. Verify

Repeat the baseline commands after each accepted change. Compare:

  • Download/upload capacity.
  • Idle latency and loaded latency/responsiveness.
  • Gateway ping min/avg/max/stddev and packet loss.
  • DNS query times for the same domains.
  • Route/proxy state to confirm VPN/proxy still works.
  • User-relevant app endpoint timing, such as chatgpt.com, api.openai.com, GitHub, package registries, or the user's work domains.

If results are mixed, revert the change unless the user prefers the tradeoff.

Report Template

Use this structure:

markdown
**Routing**
Mode: execute_direct | plan_first | clarify_first
Goal:
Constraints:

**Baseline**
- Path: direct | system proxy | TUN | unknown
- Download/upload:
- Idle latency:
- Loaded latency/responsiveness:
- Gateway ping:
- DNS:
- Wi-Fi/Ethernet:

**Findings**
1. [Evidence-backed bottleneck]
2. [Evidence-backed bottleneck]
3. [Evidence-backed bottleneck]

**Actions**
- Done:
- Skipped:
- Proposed:
- Rollback:

**After**
- Same metrics as baseline.
- Delta:

**Decision**
- Keep/revert/no change:
- Remaining risks:
- Next step:

Completion Checklist

Before finalizing, ensure:

  • The current proxy/VPN state was identified and preserved.
  • Every modification has a rollback command or was reverted.
  • Before/after metrics come from this session.
  • The report distinguishes local link, DNS, proxy path, router/SQM, and ISP causes.
  • No claim is based on an assumed tool output or an earlier run.

Test Prompts

Use these prompts when evaluating the skill manually:

  • "帮我安全优化 macOS 网络,Clash 和 Tailscale 绝对不能动。"
  • "我的 Wi-Fi 信号很好但 ping 路由器偶尔 100ms,帮我诊断,不要直接改配置。"
  • "把 Codex 网络优化流程跑一遍,输出 before/after 报告和可回滚建议。"

Structured eval cases live in evals/evals.json; use them when checking that proxy-safe routing, rollback language, and before/after evidence stay intact.

Version

v1.0 - 2026-05-24 - Initial proxy-safe Codex network optimization workflow based on the viral Codex network optimization pattern and local macOS/Clash diagnostic lessons.

© majiayu000, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 2 other files (scripts) in skills/optimize-network of majiayu000/spellbook.

  • SKILL.md
  • evals/evals.json
  • scripts/macos_network_snapshot.sh

Open the folder on GitHubat commit ed52af7

Compare with similar skills

Optimize Network next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Optimize Network compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Optimize Network this skillmajiayu000/spellbook287—~2.8kAutomated safety check: NotesMIT
Site ArchitectureAvdLee/RocketSimApp80411 repos~3.3kAutomated safety check: PassCustom licence
Engine Whats Newflutter/flutter179k—~978Automated safety check: PassBSD-3-Clause
macOS Spm App PackagingDimillian/Skills4k5 repos~1.2kAutomated safety check: PassMIT
Openclaw Live Updateropenclaw/openclaw392k—~3.7kAutomated safety check: PassMIT
Orca iOS Simulator Controlstablyai/orca88k1 repos~584Automated safety check: PassApache-2.0

Similar skills

  • Site Architecture

    AvdLee/RocketSimApp

    When the user wants to plan, map, or restructure their website's page hierarchy, navigation, URL structure, or internal linking.

    804 GitHub starsUsed in 11 repos~3.3k tokens
    Marketing & SEOAuto-check passed
  • Engine Whats New

    flutter/flutter

    Generates the "what's new" release summary and diff file for changes in the Flutter engine (//engine/src/flutter) between two releases (e.g., 3.47 vs 3.44).

    179k GitHub stars~978 tokensUpdated today
    MobileAuto-check passed
  • macOS Spm App Packaging

    Dimillian/Skills

    Scaffold, build, and package SwiftPM-based macOS apps without an Xcode project.

    4k GitHub starsUsed in 5 repos~1.2k tokens
    MobileAuto-check passed
  • Openclaw Live Updater

    openclaw/openclaw

    Maintain the canonical live OpenClaw main checkout, macOS LaunchAgent-managed Gateway, local macOS app, exact-head main CI, and recurring full release validation.

    392k GitHub stars~3.7k tokensUpdated today
    DevOps & CloudAuto-check passed
  • iOS Simulator control from inside Orca, with the live device view in Orca's emulator pane. Use when driving a booted Apple Simulator on macOS: taps, gestures…

    88k GitHub starsUsed in 1 repo~584 tokens
    MobileAuto-check passed
  • A catalog of recurring bug shapes in the Mole Mac cleaner, used to review safety-sensitive diffs for deletion safety, unbounded commands, shell traps and weak tests.

    70k GitHub stars~2k tokensUpdated today
    DevelopmentAuto-check passed

More from majiayu000/spellbook

All 97 skills in this repo
  • Skill Ecosystem Doctor

    majiayu000/spellbook

    Audits and repairs how coding-agent Skills are owned, copied and exposed across runtimes, from canonical sources to quarantine and retirement.

    287 GitHub stars~3k tokensUpdated today
    Auto-check passed
  • AGENTS.md Scaffold

    majiayu000/spellbook

    Scans a repository for real evidence and proposes, or on request writes, a small stack of root and scoped AGENTS.md files with validation commands and generated-file boundaries.

    287 GitHub stars~1.5k tokensUpdated today
    Auto-check passed
  • Product Demo Builder

    majiayu000/spellbook

    Plans, produces or diagnoses evidence-backed product demo videos: script, capture plan, pacing checks and verified final media built on real product behavior.

    287 GitHub stars~3.3k tokensUpdated today
    Auto-check passed
  • Flowguard Task Guard

    majiayu000/spellbook

    Single entry point that routes long or ambiguous agent tasks, checks live state, bounds autonomous loops and leaves a resumable handoff.

    287 GitHub stars~2.1k tokensUpdated today
    Auto-check passed
  • npm Supply Chain Check

    majiayu000/spellbook

    Scans a repository, its lockfiles and node_modules for known malicious npm package versions and install-time indicators, using a read-only Python scanner.

    287 GitHub stars~1.5k tokensUpdated today
    Auto-check passed
  • Product Manager Toolkit

    majiayu000/spellbook

    Product management helpers: a RICE scoring script, an interview transcript analyzer and PRD templates for prioritizing features, synthesizing research and writing requirements.

    287 GitHub stars~2.2k tokensUpdated today
    Auto-check passed

Works with

Questions about Optimize Network

What does Optimize Network do?

Safely diagnose and improve local network speed, latency, jitter, DNS, Wi-Fi, Ethernet, macOS network services, and bufferbloat. Optimize Network is an agent skill from majiayu000/spellbook. Safely diagnose and improve local network speed, latency, jitter, DNS, Wi-Fi, Ethernet, macOS network services, and bufferbloat.

When should I use Optimize Network?

Optimize Network fits situations like: the user asks to optimize internet/network speed; make the network faster; diagnose slow Wi-Fi; unstable Codex/AI tool connectivity.

How do I install Optimize Network in Claude Code?

Run `npx skills add majiayu000/spellbook --skill optimize-network -a claude-code`. Or copy the skill folder (skills/optimize-network in majiayu000/spellbook) into .claude/skills/optimize-network in your project. Claude Code loads it when a task matches its description.

How do I install Optimize Network in Codex?

Run `npx skills add majiayu000/spellbook --skill optimize-network -a codex`. Or copy the skill folder (skills/optimize-network in majiayu000/spellbook) into .agents/skills/optimize-network in your project. Codex loads it when a task matches its description.

Can I use Optimize Network in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add majiayu000/spellbook --skill optimize-network -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/optimize-network, .gemini/skills/optimize-network, .github/skills/optimize-network and .opencode/skills/optimize-network in your project.

What does Optimize Network need to run?

Going by SKILL.md and its folder, Optimize Network needs a shell for the scripts in its folder and the command-line tools its instructions call (curl). Our summary lists: A Bash shell. Its frontmatter pre-approves these tools: Bash.

Does Optimize Network access the network?

SKILL.md contains no URLs. Its commands use curl, which can reach the network depending on how they are called. This is read from the text; nothing was executed.

Is Optimize Network safe to install?

Our automated static check of SKILL.md found notes only (runs commands with sudo; pre-approves every shell command (allowed-tools: bash)), nothing it rates as a warning. It is not a guarantee. The check reads SKILL.md only: the scripts in the folder are not scanned, so read them before running anything.

What licence does Optimize Network use?

Optimize Network is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Optimize Network use?

About 2.8k tokens (SKILL.md is roughly 11k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Optimize Network?

Skills that share tags, products or a category with Optimize Network: Site Architecture (AvdLee/RocketSimApp, 804 stars), Engine Whats New (flutter/flutter, 179k stars), macOS Spm App Packaging (Dimillian/Skills, 4k stars) and Openclaw Live Updater (openclaw/openclaw, 392k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Optimize Network?

majiayu000 (a GitHub user) maintains it in majiayu000/spellbook, which has 287 GitHub stars. The repository holds 97 skills in this directory. The repository was last updated on October 8, 2026.

Source: majiayu000/spellbook on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.