cursor / claude rules
Network Troubleshooting Cursor Rules
Safety-first network troubleshooting rules for Cursor. Read-only diagnostics, target-scoped checks, classification table for common errors, TLS and proxy guardrails, and explicit user approval before any state change.
## what it does
tl;dr: paste this .mdc into .cursor/rules/ to make Cursor treat network failures as read-only diagnostics — never auto-edit OS, DNS, proxy, package manager, Git, Docker, or trust-store config without your explicit approval.
What the upstream rule covers
Sourced verbatim from PatrickJS/awesome-cursorrules → network-troubleshoot.mdc. The rule is a decision guide, not an automation toolkit. It classifies common errors, gives safe per-platform commands (Linux/macOS and Windows PowerShell), and forces user approval before any remediation that touches system state.
What it tells Cursor
- Safety boundaries first. Read-only diagnostics only. Never print proxy URLs, credentials, tokens, auth headers, package index URLs, registry hostnames from config, or raw config values. Replace internal hosts with placeholders before sharing logs unless the user explicitly approves.
- No config dumps. Never dump local config from npm, pnpm, yarn, pip, Git, Docker, shell, OS proxy, VPN, or certificate stores.
- No TLS bypass. Do not disable, bypass, or skip TLS or certificate verification.
- No state changes without approval. Do not change OS networking, DNS, proxy, package manager, Git, Docker, shell, VPN, or trust-store settings without explicit user approval for the exact action.
The workflow the rule enforces
- Collect. Capture the exact error, failing command, target host/URL/port, OS/shell, proxy/VPN context, and whether the failure affects one target or many.
- Classify. Match the symptom to the most likely category.
- Diagnose. Run only read-only checks scoped to the failing target.
- Explain. Interpret the output before suggesting any fix.
- Advise. Present remediation options as choices; wait for user approval before changing state.
- Verify. Re-run the original failing command or an equivalent target-scoped check.
Error classification table the rule bakes in
| Error pattern | Likely category |
|---|---|
ECONNREFUSED, Connection refused | Target service or port not listening |
ECONNRESET, socket hang up | Connection dropped by target, proxy, firewall, or middlebox |
ETIMEDOUT, Connection timed out | Routing, firewall, proxy, or target availability |
ENOTFOUND, ERR_NAME_NOT_RESOLVED | DNS or hostname issue |
ERR_PROXY_CONNECTION_FAILED, HTTP 407 | Proxy configuration or proxy auth |
UNABLE_TO_VERIFY_LEAF_SIGNATURE, CERT_HAS_EXPIRED, ERR_CERT_* | TLS certificate or local trust issue |
HTTP 403 | Authorization, IP allowlist, CORS, or policy block |
HTTP 502, 503, 504 | Upstream service, gateway, CDN, or transient server issue |
npm ERR! network, package install timeout, pip timeout | Package registry, proxy, DNS, or network path issue |
fatal: unable to access, Git fetch/push timeout | Git remote, proxy, DNS, TLS, or network path issue |
Safe target-scoped checks (selection from the rule)
Connectivity (Linux/macOS):
ping -c 4 <target-host>
curl -v telnet://<target-host>:<port> --connect-timeout 5
Connectivity (Windows PowerShell):
Test-Connection -ComputerName <target-host> -Count 4
Test-NetConnection -ComputerName <target-host> -Port <port>
HTTP timing breakdown:
curl -vvv -o /dev/null \
-w "HTTP %{http_code}\nTime: %{time_total}s\nDNS: %{time_namelookup}s\nConnect: %{time_connect}s\nTLS: %{time_appconnect}s\n" \
https://<target-host>/<path>
TLS subject and expiry (no full chain dump):
echo | openssl s_client -connect <target-host>:<port> -servername <target-host> 2>/dev/null \
| openssl x509 -noout -subject -issuer -dates
Install
mkdir -p .cursor/rules
curl -L -o .cursor/rules/network-troubleshoot.mdc \
https://raw.githubusercontent.com/PatrickJS/awesome-cursorrules/main/rules/network-troubleshoot.mdc
Gotchas
- The rule is intentionally non-automating. Cursor will not “fix” your proxy or trust store on its own. If you wanted a rule that retries installs with
--insecureor flipsstrict-ssltofalse, this is the opposite of what you want — write a separate rule for that and accept the footgun. - The rule’s diagnostics scripts include PowerShell snippets using
[Net.HttpWebRequest]and[Net.WebException]— modern PS prefersInvoke-WebRequestwith try/catch. The upstream keeps the older form because it surfacesServicePoint.Certificatedirectly without thePS7TLS changes. globs: **/*means Cursor attaches this on any file. If you also ship a framework rule with a narrower glob, the framework rule wins on matching files. This rule still triggers when Cursor is invoked with network-error context.- The rule explicitly forbids dumping proxy URLs and config values — even when the user asks “just print the npm config”. Cursor will refuse. That’s the point.
Related
- Anti-Sycophancy Code Discipline Cursor Rules — pairs well when AI agents are the ones running network commands
- JavaScript / TypeScript Code Quality Cursor Rules — for the actual codebase Cursor is editing while it debugs network errors
- Tailwind CSS Cursor Rules — generic frontend rule that often co-exists on the same project
- Cursor Rules Guide
## embed this badge
cache ✓ in cache.directory
