English | 简体中文
Let your AI agent (Claude Code / Codex / OpenClaw, etc.) troubleshoot Wi-Fi like a network engineer: collect data read-only first, then pin down the root cause, then fix it with the smallest change, and prove the result with a like-for-like retest.
Good for: latency spikes in games or video calls, laggy remote desktop, full signal bars but slow speeds, occasional drops, or not knowing which channel and width to set on your router.
Send this to your AI agent (Claude Code / Codex / OpenClaw, etc.):
Follow https://raw.githubusercontent.com/zemul/wifi-optimizer/main/SKILL.md to troubleshoot and optimize my Wi-Fi
To keep it as a skill, ask the agent to save the file into its skills directory (e.g. ~/.claude/skills/wifi-optimizer/SKILL.md).
- Read-only diagnostics (macOS / Windows): the agent runs only built-in query commands and ping, installs nothing, and masks SSIDs, MAC/BSSIDs and IPs when quoting output.
- Segment by segment : test the wireless last hop (device ↔ gateway) first, then broadband, VPN/TUN proxies and DNS, instead of guessing at everything at once.
- Tail latency first : focus on gateway ping max, stddev, p95 and spike count, not the average.
- Cross-checks common root causes : off-channel hopping from AirDrop / Windows Nearby Sharing / Android Quick Share / screen casting and similar features causing a spike roughly every 0.5s (not just Apple), neighbors using 160MHz on channels 36-64, DFS radar channels, a router in "auto" mode that keeps 160MHz and skips the clean channel 149, a client card limited to 80MHz, VPN/TUN taking over routes, and more.
- Works without router access (campus, shared flat, office): gives fallbacks you can apply on your own machine.
- Before/after comparison : after a change, retest with the same commands and fill in a before/after table.
One real troubleshooting run (MacBook + Xiaomi router, 5GHz): the router's "auto" mode picked channel 48 at 160MHz, colliding with a strong -52 dBm 160MHz neighbor, while macOS AWDL periodically hopped to channel 149. Gateway ping showed a 50–92 ms spike roughly every 0.5s. After pinning the router to channel 149 · 80MHz, a like-for-like retest (40 gateway pings × 0.1s):
| Metric | Before (auto 48 · 160MHz) | After (fixed 149 · 80MHz) | Change |
|---|---|---|---|
| Gateway ping avg | 22.62 ms | 2.77 ms | ↓ 87.8% |
| Gateway ping max | 92.47 ms | 4.02 ms | ↓ 95.7% |
| Jitter (stddev) | 31.26 ms | 0.50 ms | ↓ 98.4% |
| Noise / SNR | -87 dBm / SNR 30 dB | -92 dBm / SNR 38 dB | SNR +8 dB |
Before: spectrum conflict and periodic latency spikes
Before vs. after
Your network will differ; this is a single real measurement, for reference only.
-
Diagnostic output contains real SSIDs, MAC/BSSIDs and IPs. The skill tells the agent to mask them when quoting (SSID →
<SSID-n>, MAC →xx:xx:xx:xx:xx:xx, gateway → 192.168.x.1). -
Before sharing anything publicly, check it again yourself and mask MACs and SSIDs.
-
Diagnostics are read-only : only query commands and ping; no system, adapter or router settings are changed.
-
Before any change (router settings, adapter properties,
sudo ifconfig awdl0 down, etc.) the skill requires the agent toexplain the impact and how to roll back, and get your explicit consent ; we suggest you run anything needing sudo or the router admin page yourself. -
Changing wireless settings can briefly drop your connection or knock 2.4GHz-only smart-home devices offline. Do it at a convenient time and note your original settings.
-
On campus or company networks, follow that network's rules.
-
Provided "as is" under the MIT License, without liability for any consequences of use.
If this saved you some debugging time, you can optionally buy me a coffee on Ko-fi.