Skip to main content
skill CX Codex

swift-networking — Claude Code skill: what it does, how to install

swift-networking guides Network.framework implementation in Swift, handling low-level TCP and UDP traffic, concurrency queues, and connection state transitions.

MIT ★ 233 updated 2026-01-18

Install into Claude Code · Plugin marketplace All methods and platforms ↓
/plugin marketplace add johnrogers/claude-swift-engineering
/plugin install swift-engineering@claude-swift-engineering
Open on GitHub

What swift-networking does

This skill instructs Claude Code on building network logic using Apple's Network.framework. It covers both legacy NWConnection pipelines for iOS 12+ and modern NetworkConnection setups using structured concurrency for iOS 26+. In addition, it provides direct patterns for migrating away from raw BSD sockets, CFSocket, and URLSession streams.

The logic specifically targets queue discipline. Network calls like receive() must stay off the UI thread, and queue conflicts that trigger deadlocks are caught early. State change handlers for .waiting, .ready, and .failed are treated as mandatory, paired with exponential backoff on retryable failures.

A clear operational boundary applies: standard HTTPS, HTTP, and WebSocket traffic stays on URLSession, reserving Network.framework exclusively for custom framing, UDP, and peer-to-peer protocols.

What it helps with

  • implement TCP, UDP, or QUIC channels with NWConnection
  • handle cellular to Wi-Fi handoffs and connection viability changes
  • migrate socket code from CFSocket or SCNetworkReachability
  • troubleshoot TLS handshake failures and receive timeouts

Example prompts for the agent

  • Set up an NWConnection TCP client with dedicated queue error handling
  • Migrate this socket stream to NetworkConnection using async/await
  • Debug connection drops during Wi-Fi transitions in this network service

How to install swift-networking

1Plugin marketplace

/plugin marketplace add johnrogers/claude-swift-engineering
/plugin install swift-engineering@claude-swift-engineering

This installs the whole swift-engineering plugin with all its skills

2Skills CLI (Vercel)

npx skills add johnrogers/claude-swift-engineering --skill swift-networking -a claude-code

3Manually: put the files in place

~/.claude/skills/swift-networking/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/swift-networking/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about swift-networking

How to install swift-networking in Claude Code?

Run /plugin marketplace add johnrogers/claude-swift-engineering, followed by /plugin install swift-engineering@claude-swift-engineering in your session.

What does swift-networking do?

It provides Claude Code with reference architectures and migration paths for Apple's Network.framework across TCP, UDP, and QUIC transports.

When does it recommend URLSession over Network.framework?

It prescribes URLSession for standard HTTP, HTTPS, and WebSocket traffic, saving Network.framework for custom framing, low-latency gaming, and raw UDP needs.

Source text

SKILL.md · MIT
---
name: swift-networking
description: Use when implementing Network.framework connections (NWConnection, NetworkConnection), debugging connection failures, migrating from sockets/URLSession streams, or handling network transitions. Covers UDP/TCP patterns, structured concurrency networking (iOS 26+), and common anti-patterns.
---

# Swift Networking

Network.framework is Apple's modern networking API for TCP/UDP connections, replacing BSD sockets with smart connection establishment, user-space networking, and seamless mobility handling.

## Reference Loading Guide

**ALWAYS load reference files if there is even a small chance the content may be required.** It's better to have the context than to miss a pattern or make a mistake.

| Reference | Load When |
|-----------|-----------|
| **[Getting Started](references/getting-started.md)** | Setting up NWConnection for TCP/UDP, choosing between APIs |
| **[Connection States](references/connection-states.md)** | Handling `.waiting`, `.ready`, `.failed` transitions |
| **[iOS 26+ Networking](references/ios26-networking.md)** | Using NetworkConnection with async/await, TLV framing, Coder protocol |
| **[Migration Guide](references/migration.md)** | Moving from sockets, CFSocket, SCNetworkReachability, URLSession |
| **[Troubleshooting](references/troubleshooting.md)** | Debugging timeouts, TLS failures, connection issues |

## Core Workflow

1. Choose transport (TCP/UDP/QUIC) based on use case
2. Create NWConnection (iOS 12+) or NetworkConnection (iOS 26+)
3. Set up state handler for connection lifecycle
4. Start connection on appropriate queue
5. Send/receive data with proper error handling
6. Handle network transitions (WiFi to cellular)

## When to Use Network.framework vs URLSession

- **URLSession**: HTTP, HTTPS, WebSocket, simple TCP/TLS streams
- **Network.framework**: UDP, custom protocols, low-level control, peer-to-peer, gaming

## Common Mistakes

1. **Ignoring state handlers** — Creating an NWConnection without a state change handler means you never learn when it's ready or failed. Always implement the state handler first.

2. **Blocking the main thread** — Never call `receive()` on the main queue. Use a background DispatchQueue or Task for all network operations.

3. **Wrong queue selection** — Using the wrong queue (UI queue for network work, or serial queue for concurrent reads) causes deadlocks or silent failures. Always explicit your queue choice.

4. **Not handling network transitions** — WiFi/cellular switches or network loss aren't always detected automatically. Implement viability checks and state monitoring for robust apps.

5. **Improper error recovery** — Network errors need retry logic with backoff. Immediately failing on transient errors (timeouts, temporary loss) creates poor UX.

© John Rogers (@johnrogers) · MIT · johnrogers/claude-swift-engineering

Similar skills

All skills for Mobile →

From the same set33

The whole set →
swift-test-creator swift-test-creator writes unit and integration tests with Swift Testing — @Test, #expect, #require. Meant to run once the feature code is in place. CX Codex ★ 233repo stars swift-documenter swift-documenter is a Claude Code subagent that creates and updates README files and Swift doc comments after a feature is finished or during package documentation revisions. CX Codex ★ 233repo stars swift-modernizer The swift-modernizer subagent updates legacy Swift code toward async/await, modern APIs, and SwiftUI. Use it to plan and verify incremental migrations in an existing project. CX Codex ★ 233repo stars reflect reflect is a Claude Code command that reviews chat context and project settings, then suggests changes to instructions, commands, and configuration. CX Codex +1 ★ 233repo stars ios-hig ios-hig is a Claude Code skill that applies Apple's iOS interface guidance to accessibility, visual design, and interaction. It supports screen creation and control review. CX Codex +1 ★ 233repo stars swift-engineer swift-engineer — a Claude subagent that writes vanilla Swift for models, services, networking and persistence when the plan rules out TCA. CX Codex ★ 233repo stars grdb Guides Claude Code in writing direct SQLite queries, schema migrations, and reactive observations with GRDB.swift on iOS and macOS. CX Codex +1 ★ 233repo stars swift-diagnostics The swift-diagnostics skill guides investigations into navigation, build, and memory issues in iOS and macOS projects. Use it to follow diagnostic checks before changing code. CX Codex +1 ★ 233repo stars

Project sponsors

Companies that keep this analytics open