skills/generators/networking-layer/SKILL.md
Generates a protocol-based networking layer with async/await, error handling, and swappable implementations. Use when user wants to add API client, networking, or HTTP layer.
npx skillsauth add taiberium/claude_code_setting networking-layerInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Generate a modern, protocol-based networking layer using Swift's async/await concurrency, with proper error handling and easy testability.
Use this skill when the user:
Search for existing networking:
Glob: **/*API*.swift, **/*Network*.swift, **/*Client*.swift
Grep: "URLSession" or "HTTPURLResponse"
If found, ask user:
Ask user via AskUserQuestion:
Authentication type?
Base URL configuration?
Additional features?
Generate these files:
APIClient.swift - Protocol and implementationAPIEndpoint.swift - Endpoint definition protocolNetworkError.swift - Typed errorsAPIConfiguration.swift - Base URL and auth configBased on configuration:
RetryPolicy.swift - If retry logic selectedNetworkLogger.swift - If logging selectedCheck project structure:
Sources/ exists → Sources/Networking/App/ exists → App/Networking/Networking/Reference: Apple's Swift Concurrency Updates
Use @concurrent to offload heavy processing:
@concurrent
static func parseResponse<T: Decodable>(_ data: Data) async throws -> T {
try JSONDecoder().decode(T.self, from: data)
}
Keep UI-related code on MainActor:
@MainActor
class NetworkViewModel: ObservableObject {
@Published var items: [Item] = []
func fetch() async {
items = try await apiClient.fetch(ItemsEndpoint())
}
}
After generation, provide:
Sources/Networking/
├── APIClient.swift # Protocol + URLSession implementation
├── APIEndpoint.swift # Endpoint protocol
├── NetworkError.swift # Error types
├── APIConfiguration.swift # Config (base URL, auth)
└── Endpoints/ # Example endpoints
└── ExampleEndpoint.swift
Define an Endpoint:
struct UsersEndpoint: APIEndpoint {
typealias Response = [User]
var path: String { "/users" }
var method: HTTPMethod { .get }
}
Make a Request:
let client = URLSessionAPIClient(configuration: .production)
let users = try await client.request(UsersEndpoint())
With SwiftUI:
struct UsersView: View {
@State private var users: [User] = []
@Environment(\.apiClient) private var apiClient
var body: some View {
List(users) { user in
Text(user.name)
}
.task {
users = try await apiClient.request(UsersEndpoint())
}
}
}
Use MockAPIClient for tests:
let mockClient = MockAPIClient()
mockClient.mockResponse(for: UsersEndpoint.self, response: [User.mock])
let viewModel = UsersViewModel(apiClient: mockClient)
await viewModel.fetch()
XCTAssertEqual(viewModel.users.count, 1)
tools
Generates multi-step onboarding flows with persistence for iOS/macOS apps. Use when user wants to add onboarding, welcome screens, or first-launch experience.
tools
Generates an offline operation queue with persistence, automatic retry on connectivity, and conflict resolution. Use when user needs offline-first behavior, queued mutations, or pending operations that sync when back online.
development
Generates offer code distribution strategies and configuration guides for subscription and IAP promotions — including partner campaigns, influencer programs, and email re-engagement. Use when setting up offer codes for distribution.
testing
Generates achievement celebration UI with confetti animations, badge unlocks, progress milestones, haptic feedback, and optional share-to-social. Use when user wants to celebrate achievements, show confetti, display milestone badges, or trigger rewards on key thresholds.