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

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.

agentmods
npx agentmods add skills/wangjianqi/appstore/06-network-api
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.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.svg" alt="Measured on agentmods" 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. Scan, not verified.
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 $0.00037 $0.03221
Opus 5 $0.00018 $0.01611
Sonnet 5 $0.00007 $0.00644
Haiku 4.5 $0.00004 $0.00322

Measured 4d ago against content hash 566723cc3e0a, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, 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 4d 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. 4d 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 (10 stars, last pushed 3mo ago), licensed MIT. It adds 37 tokens to every session and 3,221 once invoked, about $0.0002 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-31.

Related

Other skills, from other repositories

ipaship-audit

Use when auditing iOS/Android app submissions for compliance with Apple App Store Review Guidelines or Google Play Developer Policies. Scan .ipa, .apk, or .zip files against official store policies, generate structured compliance reports, and identify violations with remediation steps.

atharvnaik1/ipaship-audit · 57 tokens

view-specifications

Guide for writing view specification documents and a starter template for SwiftUI and cross-platform views.

jpavley/meta-loop-ios · 21 tokens

project-structure

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

jpavley/meta-loop-ios · 18 tokens

argent-settings-permissions

Grant, deny, or reset an app's runtime permissions (camera, microphone, photos, contacts, notifications, calendar, location, location-always, media-library, motion, reminders) on an iOS simulator or Android device using the argent settings-permissions tool - without navigating the system Settings UI. Use when the…

software-mansion/argent · 140 tokens

argent-react-native-optimization

Optimizes a React Native app by profiling first to find real bottlenecks, then sweeping for mechanical issues. Entry-point for all performance work. Use when the app feels slow, user asks to optimize, fix re-renders, reduce jank, or improve startup. Delegates to argent-react-native-profiler for measurement.

software-mansion/argent · 71 tokens

mobile-automation

Control Android and iOS devices, emulators and simulators — launch apps, tap, swipe, type, take screenshots, read the accessibility tree. Use when a task involves a mobile device or app, mobile UI testing, or reproducing a bug on a phone.

mobile-next/mobile-mcp · 58 tokens