Use Cases ~13 min read

Slow Cursor or GitHub? Clash Routing Tips for AI Coding and npm in 2026

AI coding workflows in 2026 still lean on the same boring backbone: GitHub for repos and CI signals, npm (or compatible clients) for JavaScript packages, and editors such as Cursor that orchestrate both. When the path to those services is long or congested, blame often lands on “the model,” but the fix is frequently network policy—specifically Clash split routing that sends developer domains through a stable outbound while keeping domestic CDNs and local mirrors on DIRECT. This article stays concrete: how capture layers work, which hostnames matter, how registry choices interact with rules, and how to connect the dots to system proxy or TUN without hand-wavy AI marketing.

Clash Editorial Team Clash · Split routing · Cursor · GitHub · npm · AI coding

What actually feels slow (and what is not “AI slowness”)

Cursor and similar editors spend most of their wall-clock time waiting on networks you already know by name. A large git clone from GitHub saturates bandwidth differently than a chat completion request; npm install opens many parallel TLS sessions to the registry and to tarball hosts; Copilot-class features may call home to separate API endpoints that share nothing with your package mirror. Treating those flows as one blob—“turn VPN on”—wastes latency and breaks split-intelligence setups where domestic content should stay direct.

Clash shines when you translate that mental model into rules: ordered matches that steer github.com, objects.githubusercontent.com, registry.npmjs.org, and optional regional mirrors to the right proxy-groups. The goal is not philosophical commentary on AI programming; it is predictable TCP behavior while you iterate. If your editor feels responsive but pulls time out on every save because Git push hangs, you are looking at routing, not model temperature.

System proxy versus TUN: what each layer catches

On desktop OSes, “using Clash” usually starts with a system proxy toggle. Browsers and many GUI apps honor it immediately. Developer tooling is messier: Node, Git, SSH, and some Electron surfaces ignore the OS proxy unless configured separately. That is why power users graduate to TUN (virtual adapter) modes that pull traffic into Clash without asking every binary to understand HTTP_PROXY.

The trade-off is responsibility. System proxy is gentle—fewer moving parts, easier rollback. TUN is closer to “full stack capture” for terminals and long-lived daemons, but it interacts with DNS, corporate VPNs, and local services; you should read the full story in our Clash Verge Rev TUN mode guide before you flip switches on a work laptop. For Windows and macOS first-time installs, pair this article with the Clash Verge Rev Windows setup guide so Service Mode prerequisites make sense before you chase npm through a tunnel.

Workload System proxy TUN (typical)
Chrome / Edge Usually immediate Optional
Cursor (Electron) Often OK; verify updates Broader coverage
Git / npm / pnpm CLI Needs env or git config Cleaner default
SSH over port 22 to GitHub Not HTTP; separate path Often captured

Reality check: TUN does not replace understanding Git remotes. If you use SSH URLs, ensure your SSH client’s traffic is actually traversing the path you think—keys, ProxyCommand, and corporate split tunnels still matter.

GitHub-oriented domain buckets you should know

GitHub is not a single IP fairy tale. HTML browsing hits github.com; raw file downloads and release assets frequently touch raw.githubusercontent.com, objects.githubusercontent.com, and CDN hostnames that change over time. API automation uses api.github.com; Git LFS adds another set of endpoints. Community rule providers often bundle “GitHub” as a category, but when you hand-roll minimal additions, think in buckets: web UI, Git HTTPS, API, large-object storage.

A maintainable pattern is to place high-confidence DOMAIN-SUFFIX entries for github.com and githubusercontent.com ahead of overly broad keyword rules that might catch unrelated hosts. If you rely on remote rulesets, read the maintenance story in our ACL4SSR vs Loyalsoldier comparison before stacking providers you cannot explain—developer workflows punish stale GEOIP maps more than casual browsing does.

# Illustrative rule lines — adapt group names to your profile
DOMAIN-SUFFIX,github.com,YourProxyGroup
DOMAIN-SUFFIX,githubusercontent.com,YourProxyGroup
DOMAIN-SUFFIX,github.io,YourProxyGroup

npm: registry URL, tarballs, mirrors, and split decisions

Package managers resolve the registry from .npmrc—often https://registry.npmjs.org/ for the public default. Tarballs may be served from hosts tied to the registry response rather than a single static domain you memorized years ago. That means “I proxied npmjs once” is not a lifetime guarantee; watch the Connections pane in your Clash client when a stubborn install fails.

Operators in mainland or other high-latency regions sometimes switch the registry to a mirror closer on the Internet map. Mirrors can be excellent for bulk downloads, but they also change trust boundaries: you must verify authenticity through checksums and TLS as you would for the primary registry. From a split routing perspective, a mirror may deserve DIRECT while upstream documentation on github.com still needs your offshore group—your YAML should express that nuance instead of forcing everything through one exit.

Tools such as pnpm and Yarn add layer caches and different resolution strategies; they still bottom out on TCP to whatever hostnames your metadata requests identify. If you see fast metadata but slow tarball fetch, split the problem: DNS resolution, TLS handshake time, and actual throughput may implicate different hosts in the chain.

Cursor and other Electron IDEs: where proxy settings land

Cursor inherits Chromium-style networking on some code paths and Node on others. Practically, you validate behavior instead of assuming: enable Clash logging, trigger an update check, and watch which domains appear. Some features may call APIs outside the GitHub namespace entirely; blocking or mis-routing those names shows up as “AI features unavailable” even when vanilla Git works.

Keep editor updates and extension galleries in mind. VS Code–compatible marketplaces and telemetry endpoints can be distinct from GitHub; a minimal ruleset focused only on github.com may be incomplete for “full IDE happiness.” When something fails only inside the editor but not in a terminal curl test, compare whether the editor subprocess inherits the same environment variables you set for shells.

Minimal “make it work” rule strategy without cargo-cult YAML

Start from rule mode (not global) so domestic CDNs and LAN segments can stay DIRECT. Insert explicit developer entries before catch-all GEOIP rules if your provider’s defaults lag behind the hostnames you actually hit. Prefer suffix rules for stable namespaces; reserve keyword rules for messy vendor CDNs only when necessary.

Remote rule providers help you stay current, but embed at least a short local block for the three namespaces you personally depend on—Git hosting, package registry, and your AI vendor’s API domain if policy allows—so you are not stuck when a remote update fails silently. After edits, reload the profile and confirm the match order; Clash evaluates rules top-down, and the first win stops the walk.

# Example: pin npm registry hostname to the same group as GitHub
DOMAIN-SUFFIX,npmjs.org,YourProxyGroup
# If you use a mirror, put it on DIRECT above proxy rules:
# DOMAIN-SUFFIX,your-mirror.example,DIRECT

DNS alignment: why rules “lie” when resolvers disagree

Split tunnels fail in subtle ways when the OS resolver and Clash’s internal DNS story diverge. You might match a rule against a poisoned or geofenced answer, or trigger FakeIP behavior that does not line up with how curl resolves the same label. For a structured walkthrough—FakeIP versus redir-host, DoH upstreams, nameserver-policy—use the Meta core DNS leak prevention guide alongside this routing article.

Practical habit: when GitHub “works in browser but not in terminal,” capture both DNS and the first SYN. Often you will find the browser used DoH through the proxy while the terminal still asked your ISP resolver. Fixing that is DNS policy, not buying a faster CPU for AI programming.

Verification checklist for developer traffic

Treat verification like a short script. First, confirm baseline without Clash to know your ISP’s honest error profile. Then enable Clash and compare: Git ls-remote to an HTTPS remote, an npm metadata request, and a Cursor-driven action that previously failed. Record hostnames from Clash logs at each step.

  1. HTTPS Git: git ls-remote https://github.com/... completes without hanging on TLS.
  2. npm: npm view react version returns quickly; watch for secondary hosts during npm install.
  3. Editor: trigger the feature that was flaky; ensure logs show expected domains, not silent drops.
  4. Egress sanity: your public IP test matches the intended node when proxied, and returns to ISP when bypassed.
  5. Rollback: disable Clash cleanly—no zombie routes or DNS leftovers.

If you live in SSH remotes

Developers who exclusively use [email protected]: should validate SSH separately from HTTP rules. Clash TUN may cover it; pure system proxy will not magically fix SSH unless you engineered ProxyCommand or equivalent. Document what you chose so future you does not confuse “GitHub HTTPS works” with “GitHub SSH works.”

Tradeoffs: speed, auditability, and compliance

Aggressive global proxying simplifies mental load but increases trace surface through third-party exits—sometimes unacceptable on regulated devices. Split routing reduces exposure by limiting which domains leave your region, yet it demands ongoing maintenance as hostnames shift. Mirrors can accelerate downloads but shift trust; corporate MITM appliances add yet another TLS story. There is no universal preset—only informed defaults and observable metrics.

For teams, align on whether AI features may call international APIs from managed hardware at all. Clash cannot answer HR policy; it only enforces the network path you encode. Encode thoughtfully.

Documentation, downloads, and where GitHub fits

When you are ready to standardize profiles across machines, pair routing notes with the configuration documentation on this site so vocabulary lines up—modes, groups, and DNS knobs mean the same things on Windows and macOS clients. For installers, use the official Clash download page as the primary channel for packages; upstream GitHub repositories remain valuable for licenses, issues, and source review, separate from day-to-day installs.

Closing thoughts

Cursor, GitHub, and npm are not mysterious AI peripherals—they are measurable TCP workloads. Clash helps when you translate latency complaints into ordered split routing rules, pick system proxy or TUN deliberately, and align DNS so your matches reflect reality. Compared with turning a single “global VPN” knob all day, a disciplined profile keeps domestic paths fast while stabilizing the small set of hosts that actually define AI coding productivity in 2026.

When your profile is boring rather than brittle—logs match expectations, installs finish, pushes succeed—you can go back to arguing about models and keybindings, which is more fun than debugging MTU at midnight.

Download Clash for free and experience the difference

Clash for developers Rule mode

One Meta-class profile can cover browsers, terminals, and TUN—so GitHub, npm, and IDE traffic share a coherent split-routing story instead of a pile of one-off VPN toggles.

Official builds

Windows, macOS, Linux, Android from the download hub

GitHub-friendly rules

Pin domains and proxy groups you can explain

Proxy or TUN

Start with system proxy; add TUN for CLI parity

DNS deep dives

Pair with the Meta DNS article when FakeIP acts up

Previous & Next

Related Reading

GitHub slow? npm stuck?

Grab Clash from our download page and put GitHub, npm, and your editor on a split-routing profile you can read in the logs.

Download Free Client