networking

networking is a skill for Claude Code from markdavidgan/apple-dev-skills. It costs 107 tokens per session (1,362 once invoked), scanned A, original, MIT.

A guide to building network calls in Swift with Apple's URLSession and async/await. It covers typed requests, JSON decoding, HTTP errors, retries, offline handling, and a concurrency-safe API client.

In plain words
What is it for?
It helps create REST and JSON API clients, build URLs with query parameters, decode responses, retry temporary failures, and handle connectivity changes.
Why use it?
It separates server failures, connection failures, and malformed responses instead of treating them all as the same error. It also avoids incorrectly assuming that URLSession throws for every HTTP error.

Skill for Claude Code

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

Part of the apple-dev-skills plugin — 62 skills, 25 commands, 7 agents shipped together

Good fit It helps create REST and JSON API clients, build URLs with query parameters, decode responses, retry temporary failures, and handle connectivity changes.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/markdavidgan/apple-dev-skills/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 markdavidgan/apple-dev-skills --skill networking
Clone the repo
git clone --depth 1 https://github.com/markdavidgan/apple-dev-skills

Made for: Claude Code.

Or install apple-dev-skills, the plugin that ships this one along with the rest of its 62 skills, 25 commands, 7 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 networking

README.md
[![agentmods](https://agentmods.dev/badge/skills/markdavidgan/apple-dev-skills/networking.svg)](https://agentmods.dev/skills/markdavidgan/apple-dev-skills/networking)
Your own site
<a href="https://agentmods.dev/skills/markdavidgan/apple-dev-skills/networking"><img src="https://agentmods.dev/badge/skills/markdavidgan/apple-dev-skills/networking.svg" alt="Measured on agentmods" height="20"></a>
Per session 107 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,362 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.00107 $0.01362
Opus 5 $0.00053 $0.00681
Sonnet 5 $0.00021 $0.00272
Haiku 4.5 $0.00011 $0.00136

Measured 3d ago against content hash dfcdd7fa8292, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

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 3d 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.

platforms/claude/skills/networking/SKILL.md · 136 lines

How it starts

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

Networking (URLSession + async/await)

Build a correct, Sendable networking layer with structured concurrency. No third-party library needed for most apps. Concurrency/isolation rules follow ios-standards.


The core call

let (data, response) = try await URLSession.shared.data(for: request)
guard let http = response as? HTTPURLResponse else { throw APIError.nonHTTP }
guard 200..<300 ~= http.statusCode else { throw APIError.status(http.statusCode, data) }
let value = try decoder.decode(T.self, from: data)

Three things people skip and regret:

  1. Cast to HTTPURLResponse and check the status codeURLSession does not throw on 4xx/5xx; you get a normal response with an error body.
  2. Decode errors are not network errors — keep them distinct so you can log the payload.
  3. Build URLs with URLComponents (proper percent-encoding of query items), never string concatenation.

A typed, Sendable client

struct Endpoint<Response: Decodable> {
    var path: String
    var method = "GET"
    var query: [URLQueryItem] = []
    var body: Data? = nil
}

actor APIClient {
    private let base: URL
    private let session: URLSession
    private let decoder: JSONDecoder

    init(base: URL, session: URLSession = .shared) {
        self.base = base
        self.session = session
        decoder = JSONDecoder()
        decoder.keyDecodingStrategy = .convertFromSnakeCase
        decoder.dateDecodingStrategy = .iso8601
    }

    func send<R>(_ endpoint: Endpoint<R>) async throws -> R {
        var comps = URLComponents(url: base.appending(path: endpoint.path),
                                  resolvingAgainstBaseURL: false)!
        if !endpoint.query.isEmpty { comps.queryItems = endpoint.query }
        var req = URLRequest(url: comps.url!)
        req.httpMethod = endpoint.method
        req.httpBody = endpoint.body
        if endpoint.body != nil { req.setValue("application/json", forHTTPHeaderField: "Content-Type") }

        let (data, response) = try await session.data(for: req)
        guard let http = response as? HTTPURLResponse else { throw APIError.nonHTTP }
        guard 200..<300 ~= http.statusCode else { throw APIError.status(http.statusCode, data) }
        do { return try decoder.decode(R.self, from: data) }
        catch { throw APIError.decoding(error) }
    }
}

enum APIError: Error { case nonHTTP, status(Int, Data), decoding(Error), offline }

Read the full file on GitHub · 136 lines

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. 3d ago First seen · 136 lines · 107 tokens per session scan A dfcdd7fa8292

Subscribe to this mod's changes

networking is a skill published in the GitHub repository markdavidgan/apple-dev-skills (5 stars, last pushed 8d ago), licensed MIT. It adds 107 tokens to every session and 1,362 once invoked, about $0.0005 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-09-03.

Related

Other skills, from other repositories

n8n-architect

Use when the user explicitly wants to create, edit, validate, sync, or troubleshoot n8n workflows, asks about n8n nodes or automation, or wants to use n8n-as-code in the current context root.

EtienneLescot/n8n-as-code · 52 tokens

asc-ppp-pricing

Set territory-specific pricing for subscriptions and in-app purchases using current asc setup, pricing summary, price import, and price schedule commands. Use when adjusting prices by country or implementing localized PPP strategies.

rorkai/app-store-connect-cli-skills · 45 tokens

asc-apple-ads

Use when managing Apple Ads with asc, including OAuth profiles, ad-account discovery, Platform API v1 campaigns and targeting, reports, assets, recommendations, guarded mutations, raw requests, and Campaign Management API v5 migration.

rorkai/app-store-connect-cli-skills · 50 tokens

asc-revenuecat-catalog-sync

Reconcile App Store Connect subscriptions and in-app purchases with RevenueCat products, entitlements, offerings, and packages using asc and RevenueCat MCP. Use when setting up or syncing subscription catalogs across ASC and RevenueCat.

rorkai/app-store-connect-cli-skills · 51 tokens

asc-aso-audit

Run an offline ASO audit on canonical App Store metadata under ./metadata and surface keyword gaps using Astro MCP. Use after pulling metadata with asc metadata pull.

rorkai/app-store-connect-cli-skills · 40 tokens

asc-localize-metadata

Automatically translate and sync App Store metadata (description, keywords, what's new, subtitle) to multiple languages using LLM translation and asc CLI. Use when asked to localize an app's App Store listing, translate app descriptions, or add new languages to App Store Connect.

rorkai/app-store-connect-cli-skills · 60 tokens