swift-networking

swift-networking is a skill for Claude Code from johnrogers/claude-swift-engineering. It costs 56 tokens per session (595 once invoked), scanned A, original, MIT.

Guidance for making network connections with Apple's Network.framework, which provides APIs for sending data over networks such as TCP and UDP. It covers connection setup, lifecycle states, errors, network changes, and newer async APIs.

In plain words
What is it for?
Use it when creating or debugging TCP or UDP connections, migrating from sockets or streaming APIs, handling Wi-Fi-to-cellular changes, troubleshooting TLS and timeouts, or using NetworkConnection with async/await.
Why use it?
It helps replace low-level socket code with a consistent approach to connection startup, failures, timeouts, and switching between Wi-Fi and cellular networks. It also explains when to use the framework's different connection APIs.

Skill for Claude Code

Written for Claude Code: shipped in a Claude Code plugin.

Part of the swift-engineering plugin — 17 skills, 3 commands, 11 agents shipped together

Good fit Use it when creating or debugging TCP or UDP connections, migrating from sockets or streaming APIs, handling Wi-Fi-to-cellular changes, troubleshooting TLS and timeouts, or using NetworkConnection with async/await.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/johnrogers/claude-swift-engineering/swift-networking
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add johnrogers/claude-swift-engineering --skill swift-networking
Clone the repo
git clone --depth 1 https://github.com/johnrogers/claude-swift-engineering

Made for: Claude Code.

Or install swift-engineering, the plugin that ships this one along with the rest of its 17 skills, 3 commands, 11 agents.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for swift-networking

README.md
[![agentmods](https://agentmods.dev/badge/skills/johnrogers/claude-swift-engineering/swift-networking.svg)](https://agentmods.dev/skills/johnrogers/claude-swift-engineering/swift-networking)
Your own site
<a href="https://agentmods.dev/skills/johnrogers/claude-swift-engineering/swift-networking"><img src="https://agentmods.dev/badge/skills/johnrogers/claude-swift-engineering/swift-networking.svg" alt="Measured on agentmods" height="20"></a>
Per session 56 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 595 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00056 $0.00595
Opus 5 $0.00028 $0.00298
Sonnet 5 $0.00011 $0.00119
Haiku 4.5 $0.00006 $0.00060

Measured 9d ago against content hash 2ca2badc3082, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

swift-networking scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 9d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

plugins/swift-engineering/skills/swift-networking/SKILL.md · 47 lines

How it starts

The opening of the file, as written. The whole thing — 47 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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 Setting up NWConnection for TCP/UDP, choosing between APIs
Connection States Handling .waiting, .ready, .failed transitions
iOS 26+ Networking Using NetworkConnection with async/await, TLV framing, Coder protocol
Migration Guide Moving from sockets, CFSocket, SCNetworkReachability, URLSession
Troubleshooting 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.

Read the full file on GitHub · 47 lines

Files

What ships with it

5 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 9d ago First seen · 47 lines · 56 tokens per session scan A 2ca2badc3082

Subscribe to this mod's changes

swift-networking is a skill published in the GitHub repository johnrogers/claude-swift-engineering (228 stars, last pushed 7mo ago), licensed MIT. It adds 56 tokens to every session and 595 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.