network-api

network-api is a skill for Claude Code, Codex from wangjianqi/AppStore. It costs 37 tokens per session (3,221 once invoked), scanned A, original, MIT.

Network and API guidance for Swift applications, covering HTTP requests, backend interfaces, URL sessions, data parsing, token refresh, retries, and AI API integration.

In plain words
What is it for?
Use it when designing or implementing a Swift network layer, defining API endpoints, calling web services, uploading data, or handling authentication and request errors.
Why use it?
It provides a consistent way to send requests, upload data, decode responses, refresh credentials, and retry failures. It also discourages adding a separate networking library when the project does not already use one.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: positional $N argument.

Good fit Use it when designing or implementing a Swift network layer, defining API endpoints, calling web services, uploading data, or handling authentication and request errors.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/wangjianqi/appstore/06-network-api
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 wangjianqi/AppStore --skill 06-network-api
Clone the repo
git clone --depth 1 https://github.com/wangjianqi/AppStore

Made for: Claude Code, Codex.

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 network-api

README.md
[![agentmods](https://agentmods.dev/badge/skills/wangjianqi/appstore/06-network-api/github.svg)](https://agentmods.dev/skills/wangjianqi/appstore/06-network-api)
Your own site
<a href="https://agentmods.dev/skills/wangjianqi/appstore/06-network-api"><img src="https://agentmods.dev/badge/skills/wangjianqi/appstore/06-network-api/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for network-api

Your own site · 80×15
<a href="https://agentmods.dev/skills/wangjianqi/appstore/06-network-api"><img src="https://agentmods.dev/badge/skills/wangjianqi/appstore/06-network-api.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 37 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,221 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.00037 $0.03221
Opus 5.5 $0.00015 $0.01288
Sonnet 5.5 $0.00007 $0.00644
Haiku 4.5 $0.00004 $0.00322

Measured 1mo ago against content hash 566723cc3e0a, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

network-api 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 1mo 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.

ios-claude-skills/06-network-api/SKILL.md · 413 lines

How it starts

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

网络 / API 层

网络层架构

  • 基础层:URLSession(禁止引入 Alamofire,除非已存在)
  • 封装层:NetworkService.swift 统一处理请求、错误、重试
  • 接口定义:每个模块有对应 XxxAPI.swift,定义 endpoint + 参数

NetworkService 完整封装

protocol NetworkServiceProtocol {
    func request<T: Decodable>(_ endpoint: APIEndpoint) async throws -> T
    func upload<T: Decodable>(_ endpoint: APIEndpoint, data: Data) async throws -> T
}

final class NetworkService: NetworkServiceProtocol {
    private let session: URLSession
    private let keychain: KeychainStorage
    private let config: APIConfig

    init(session: URLSession = .shared, keychain: KeychainStorage = .shared, config: APIConfig = .current) {
        self.session = session
        self.keychain = keychain
        self.config = config
    }

    func request<T: Decodable>(_ endpoint: APIEndpoint) async throws -> T {
        let urlRequest = try buildRequest(for: endpoint)
        let response: T = try await executeWithRetry(urlRequest, maxRetries: endpoint.retryCount)
        return response
    }

    func upload<T: Decodable>(_ endpoint: APIEndpoint, data: Data) async throws -> T {
        var urlRequest = try buildRequest(for: endpoint)
        urlRequest.httpBody = data
        urlRequest.setValue("application/octet-stream", forHTTPHeaderField: "Content-Type")
        return try await execute(urlRequest)
    }

    private func buildRequest(for endpoint: APIEndpoint) throws -> URLRequest {
        var components = URLComponents(string: config.baseURL + endpoint.path)
        if let parameters = endpoint.queryParameters {
            components?.queryItems = parameters.map { URLQueryItem(name: $0.key, value: "\($0.value)") }
        }
        guard let url = components?.url else { throw NetworkError.invalidURL }

        var request = URLRequest(url: url)
        request.httpMethod = endpoint.method.rawValue
        request.timeoutInterval = endpoint.timeout

        if endpoint.requiresAuth {
            guard let token = keychain.loadToken() else { throw NetworkError.unauthorized }
            request.setValue("Bearer \(token)", forHTTPHeaderField: "Authorization")
        }

        if let body = endpoint.body {
            request.httpBody = try JSONSerialization.data(withJSONObject: body)
            request.setValue("application/json", forHTTPHeaderField: "Content-Type")
        }

        request.setValue("application/json", forHTTPHeaderField: "Accept")
        request.setValue(Bundle.main.appVersion, forHTTPHeaderField: "X-App-Version")
        request.setValue(UIDevice.current.systemVersion, forHTTPHeaderField: "X-iOS-Version")

        return request
    }

    private func execute<T: Decodable>(_ request: URLRequest) async throws -> T {
        #if DEBUG
        logRequest(request)
        #endif

        let (data, urlResponse) = try await session.data(for: request)

        #if DEBUG
        logResponse(data, response: urlResponse)
        #endif

        guard let httpResponse = urlResponse as? HTTPURLResponse else {
            throw NetworkError.invalidResponse
        }

        switch httpResponse.statusCode {
        case 200...299:
            do {
                let decoder = JSONDecoder()
                decoder.keyDecodingStrategy = .convertFromSnakeCase
                decoder.dateDecodingStrategy = .iso8601
                return try decoder.decode(T.self, from: data)
            } catch {
                throw NetworkError.decodingFailed
            }
        case 401:
            throw NetworkError.unauthorized
        case 400...499:
            if let errorBody = try? JSONDecoder().decode(ErrorResponse.self, from: data) {
                throw NetworkError.clientError(httpResponse.statusCode, errorBody.message)
            }
            throw NetworkError.clientError(httpResponse.statusCode, "客户端错误")
        case 500...599:
            throw NetworkError.serverError(httpResponse.statusCode)
        default:
            throw NetworkError.unknown
        }
    }
}

Read the full file on GitHub · 413 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. 1mo ago First seen · 413 lines · 37 tokens per session scan A 566723cc3e0a

Subscribe to this mod's changes

network-api is a skill published in the GitHub repository wangjianqi/AppStore (17 stars, last pushed 4mo ago), licensed MIT. It adds 37 tokens to every session and 3,221 once invoked, about $0.0001 per session on Opus 5.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-31.

Related

Other skills, from other repositories

ktor-patterns

Ktor HTTP client for an Android-only app - OkHttp/Android engine setup, ContentNegotiation with kotlinx.serialization, plugins/interceptors, and error handling on a single platform. For shared/multiplatform networking (commonMain, Darwin engine on iOS) use kmp-networking. For deeper, source-backed Ktor coverage…

TalissonVitorino/kmp-ios-skills · 96 tokens

swift-codable

Implement Swift Codable models for JSON and property-list encoding and decoding with JSONDecoder, JSONEncoder, CodingKeys, and custom init(from:) or encode(to:). Use when parsing API responses, remapping keys, flattening nested JSON, handling date or data decoding strategies, decoding heterogeneous arrays, or…

JordanCoin/ios-skills-collection · 76 tokens

swift-codable

Master serialization and deserialization in Swift with Codable. Use when implementing custom CodingKeys, date/data decoding strategies, polymorphic/mixed collections, lossy array decoding, property wrappers for default values, or bridging Codable with SwiftData/CoreData persistence.

thiennc-tesoglobal/ios-skills · 53 tokens

project-structure

Directory layout, file responsibilities, and Xcode integration for meta-loop projects.

jpavley/meta-loop-ios · 18 tokens

kotlin-ktor-patterns

Ktor server patterns including routing DSL, plugins, authentication, Koin DI, kotlinx.serialization, WebSockets, and testApplication testing.

hashgraph-online/awesome-codex-plugins · 34 tokens

sweetpad

Build, run, and test Xcode and Swift Package apps from the terminal with the sweetpad CLI ("xcodebuild for humans"). Use when the user wants to compile an iOS/macOS/Swift app, run it on a simulator or device, read build errors, run tests, or inspect resolved build settings from the command line — with agent-safe…

sweetpad-dev/sweetpad · 90 tokens