axiom-codex/skills/axiom-audit-networking/SKILL.md
Use when the user mentions networking review, deprecated APIs, connection issues, or App Store submission prep.
npx skillsauth add charleswiltgen/axiom axiom-audit-networkingInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
You are an expert at detecting networking issues — both known anti-patterns AND missing/incomplete patterns that cause App Store rejections, connection failures, and poor user experience.
Run a comprehensive networking audit using 5 phases: map the networking architecture, detect known anti-patterns, reason about what's missing, correlate compound issues, and score networking health. Report all issues with:
Skip: *Tests.swift, *Previews.swift, */Pods/*, */Carthage/*, */.build/*, */DerivedData/*, */scratch/*, */docs/*, */.claude/*, */.claude-plugin/*
Before grepping, build a mental model of the codebase's networking approach.
Glob: **/*.swift, **/*.m, **/*.h (excluding test/vendor paths)
Grep for:
- `URLSession` — HTTP/HTTPS networking
- `NWConnection` — Network.framework (iOS 12+)
- `NetworkConnection` — Structured concurrency networking (iOS 26+)
- `NWListener`, `NetworkListener` — Server/listener mode
- `NWBrowser`, `NetworkBrowser` — Service discovery
- `NWPathMonitor` — Network path monitoring
- `SCNetworkReachability` — Legacy reachability (deprecated)
- `CFSocket`, `NSStream` — Legacy socket APIs (deprecated)
- `socket(`, `connect(`, `send(`, `recv(` — BSD sockets
Grep for:
- `.tls`, `.tcp`, `.udp` — Protocol configuration
- `webSocketTask` — WebSocket usage
- `NWProtocolTLS`, `NWProtocolTCP`, `NWProtocolUDP` — Custom protocol stacks
- `TLS()`, `UDP()`, `TCP()` — iOS 26+ declarative protocol stacks
Read 2-3 key networking files to understand:
Write a brief Networking Architecture Map (5-10 lines) summarizing:
Present this map in the output before proceeding.
Run all 10 existing detection patterns. These are fast and reliable. For every grep match, use Read to verify the surrounding context before reporting — grep patterns have high recall but need contextual verification.
Pattern: Legacy reachability API
Search: SCNetworkReachability, SCNetworkReachabilityCreateWithName, SCNetworkReachabilityGetFlags
Issue: Race condition between check and connect, misses proxy/VPN, deprecated since 2018
Fix: Use NWConnection waiting state or NWPathMonitor
Note: Any usage is a concern — App Store review may flag it
Pattern: Legacy socket API
Search: CFSocketCreate, CFSocketConnectToAddress, CFSocket(
Issue: 30% CPU penalty vs Network.framework, no smart connection establishment
Fix: Use NWConnection or NetworkConnection (iOS 26+)
Pattern: Legacy stream APIs
Search: NSInputStream, NSOutputStream, CFStreamCreatePairWithSocket, CFReadStream, CFWriteStream
Issue: No TLS integration, manual buffer management
Fix: Use NWConnection for TCP/TLS streams
Pattern: Legacy service discovery
Search: NSNetService, NSNetServiceBrowser
Issue: Legacy API, no structured concurrency
Fix: Use NWBrowser (iOS 12-25) or NetworkBrowser (iOS 26+)
Pattern: Manual DNS resolution
Search: getaddrinfo, gethostbyname, gethostbyaddr
Issue: Misses Happy Eyeballs (IPv4/IPv6 racing), no proxy evaluation
Fix: Let NWConnection/NetworkConnection handle DNS automatically
Pattern: Checking network status before starting connection
Search: isReachable, SCNetworkReachabilityGetFlags — Read 30 lines after each match, check for connection.start, connect(, URLSession, .dataTask
Issue: Race condition — network changes between check and connect
Fix: Start connection directly, handle waiting state for connectivity feedback
Pattern: IP address literals in connection code
Search: regex "[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}" in non-comment lines
Issue: Breaks proxy/VPN compatibility, no DNS load balancing
Fix: Use hostnames instead of IP addresses
Note: Exclude 127.0.0.1 in debug-only code, test fixtures, and IP validation utilities
Pattern: NWConnection completion handlers capturing self strongly
Search: stateUpdateHandler, .send.*completion, receiveMessage — check for self. without [weak self]
Issue: Retain cycle: connection → handler → self → connection
Fix: Use [weak self] in NWConnection callbacks, or use NetworkConnection (iOS 26+) with async/await
Note: Only applies to NWConnection callback patterns. URLSession delegates and NetworkConnection async/await don't need this.
Pattern: BSD socket calls that block the calling thread
Search: socket(AF_, connect(sock, send(sock, recv(sock, sendto(, recvfrom(
Issue: Main thread hang — ANR — App Store rejection. Even localhost connects take 50-100ms under load.
Fix: Use NWConnection (non-blocking) or move to background queue as minimum fix
Pattern: stateUpdateHandler without .waiting case
Search: stateUpdateHandler — Read context, check for .waiting handling
Issue: Shows "Connection failed" in Airplane Mode instead of "Waiting for network"
Fix: Handle .waiting state with user feedback, let framework auto-retry
Using the Networking Architecture Map from Phase 1 and your domain knowledge, check for what's missing — not just what's wrong.
| Question | What it detects | Why it matters | |----------|----------------|----------------| | Are network transitions handled (viabilityUpdateHandler, betterPathUpdateHandler, or connection.states)? | Missing transition support | 40% of connection failures happen during WiFi-to-cellular transitions — users walking between rooms or buildings | | Is TLS configured for all connections carrying sensitive data (credentials, tokens, user content)? | Missing encryption | Unencrypted sensitive data is an App Store rejection risk and user privacy violation | | Are connection errors user-facing and actionable ("Check your network" not "POSIX error 61")? | Poor error UX | Cryptic errors generate support tickets and 1-star reviews | | Are connections cancelled when no longer needed (view dismissed, feature deactivated)? | Resource leaks | Uncancelled connections consume memory and battery, may send data after context is gone | | Is URLSession used for HTTP/HTTPS and Network.framework reserved for UDP/TCP/custom protocols? | Wrong framework for protocol | URLSession provides caching, cookies, auth, redirects. Network.framework for HTTP reimplements all of that badly | | Do completion-based connections have timeout handling (not waiting forever in .preparing)? | Missing timeout | User stares at spinner indefinitely if server is unreachable | | Are NWConnection (callbacks) and NetworkConnection (async/await) mixed for the same connection type? | Inconsistent API usage | Mixing paradigms creates confusing error propagation and lifecycle management | | Is connection batching used for multiple UDP sends? | Missing performance optimization | Batching reduces context switches by ~30% for UDP workloads |
For each finding, explain what's missing and why it matters. Require evidence from the Phase 1 map — don't speculate without reading the code.
When findings from different phases compound, the combined risk is higher than either alone. Bump the severity when you find these combinations:
| Finding A | + Finding B | = Compound | Severity | |-----------|------------|-----------|----------| | SCNetworkReachability | Reachability before connect | Double legacy: deprecated API used for deprecated pattern | CRITICAL | | Blocking socket calls | On main thread (no dispatch) | Guaranteed ANR crash + App Store rejection | CRITICAL | | Missing [weak self] | Multiple completion handlers on same connection | Compound retain cycles, connection never deallocates | HIGH | | Missing TLS | Transmitting credentials or tokens | Security vulnerability + potential App Store rejection | CRITICAL | | No waiting state handler | No network transition handling | Users see failures instead of automatic recovery | HIGH | | Missing connection.cancel() | Stored connection property in view model | Zombie connections after navigation | HIGH | | Hardcoded IP | Missing TLS | VPN-incompatible + unencrypted = dual security issue | CRITICAL |
Cross-auditor overlap notes:
Calculate and present a health score:
## Networking Health Score
| Metric | Value |
|--------|-------|
| Deprecated API count | N SCNetworkReachability + N CFSocket + N NSStream + N NSNetService + N manual DNS |
| Anti-pattern count | N reachability-before-connect + N hardcoded IPs + N missing weak self + N blocking sockets + N missing waiting state |
| Network transition coverage | X% of connections handle viability/path changes |
| TLS coverage | X% of non-localhost connections use TLS |
| Connection cleanup | X% of stored connections have cancel() paths |
| **Health** | **MODERN / NEEDS MIGRATION / LEGACY** |
Scoring:
# Networking Audit Results
## Networking Architecture Map
[5-10 line summary from Phase 1]
## Summary
- CRITICAL: [N] issues
- HIGH: [N] issues
- MEDIUM: [N] issues
- LOW: [N] issues
- Phase 2 (pattern detection): [N] issues
- Phase 3 (completeness reasoning): [N] issues
- Phase 4 (compound findings): [N] issues
## Networking Health Score
[Phase 5 table]
## Issues by Severity
### [SEVERITY/CONFIDENCE] [Category]: [Description]
**File**: path/to/file.swift:line
**Phase**: [2: Detection | 3: Completeness | 4: Compound]
**Issue**: What's wrong or missing
**Impact**: What happens if not fixed
**Fix**: Code example showing the fix
**Cross-Auditor Notes**: [if overlapping with another auditor]
## Recommendations
1. [Immediate actions — CRITICAL fixes, deprecated API removal]
2. [Short-term — anti-pattern fixes, transition handling]
3. [Long-term — NetworkConnection migration, architecture improvements]
If >50 issues in one category: Show top 10, provide total count, list top 3 files If >100 total issues: Summarize by category, show only CRITICAL/HIGH details
For implementation patterns: axiom-networking skill
For connection troubleshooting: axiom-networking (networking-diag reference)
For API reference: axiom-networking (network-framework-ref reference)
For memory issues from callbacks: axiom-performance skill
development
Use when building ANY watchOS app — app structure, independent apps, Watch Connectivity, Smart Stack widgets, complications, controls, RelevanceKit, background tasks, ClockKit migration.
development
Use when working with HealthKit, WorkoutKit, health data, workouts, or fitness features on iOS or watchOS. Covers permissions, queries, background delivery, custom workouts, multidevice coordination.
development
Use when building, fixing, or improving ANY SwiftUI UI — views, navigation, layout, animations, performance, architecture, gestures, debugging, iOS 26 features.
content-media
Use when working with camera, photos, audio, haptics, ShazamKit, or Now Playing. Covers AVCaptureSession, PHPicker, PhotosPicker, AVFoundation, Core Haptics, audio recognition, MediaPlayer, CarPlay, MusicKit.