> ios-networking
Standards for URLSession, Alamofire, and API communication. Use when implementing URLSession networking, Alamofire, or API clients in iOS. (triggers: **/*Service.swift, **/*API.swift, **/*Client.swift, URLSession, Alamofire, Moya, URLRequest, URLComponents, Codable)
curl "https://skillshub.wtf/HoangNguyen0403/agent-skills-standard/ios-networking?format=md"iOS Networking Standards
Priority: P0
Implementation Guidelines
URLSession (Native)
- Tasks: Use
dataTaskPublisher(Combine) ordata(for:delegate:)(async/await). - Configuration: Use
URLSessionConfiguration.defaultfor standard tasks andephemeralfor private browsing/clearing cache. - Request Building: Use
URLComponentsandURLQueryItemto build URLs safely. Never use string interpolation for parameters.
Alamofire (Standard Third-Party)
- Session: Maintain a singleton or DI-injected
Sessioninstance. - Request: Use
.validate()to automatically check for 200..299 status codes. - Encoding: Use
JSONParameterEncoder.defaultfor body parameters.
Best Practices
- Codable: Use
Codablefor JSON mapping. Prefersnake_casetocamelCasedecoding strategies if the API follows snake_case. - Retriers & Adapters: Use
RequestInterceptorfor adding Auth headers (Bearer) and handling token refresh (401). - SSL Pinning: Implement using
ServerTrustManagerfor production security.
Anti-Patterns
- Main Thread completion:
**No UI updates in background task**: Always jump to Main thread/MainActor. - Raw Mapping:
**No manual JSONSerialization**: Use Codable. - Missing Timeout:
**No indefinite wait**: Always set a reasonable timeoutInterval (e.g., 30s).
References
> related_skills --same-repo
> typescript-tooling
Development tools, linting, and build config for TypeScript. Use when configuring ESLint, Prettier, Jest, Vitest, tsconfig, or any TS build tooling. (triggers: tsconfig.json, .eslintrc.*, jest.config.*, package.json, eslint, prettier, jest, vitest, build, compile, lint)
> typescript-security
Secure coding practices for TypeScript. Use when validating input, handling auth tokens, sanitizing data, or managing secrets and sensitive configuration. (triggers: **/*.ts, **/*.tsx, validate, sanitize, xss, injection, auth, password, secret, token)
> typescript-language
Modern TypeScript standards for type safety and maintainability. Use when working with types, interfaces, generics, enums, unions, or tsconfig settings. (triggers: **/*.ts, **/*.tsx, tsconfig.json, type, interface, generic, enum, union, intersection, readonly, const, namespace)
> typescript-best-practices
Idiomatic TypeScript patterns for clean, maintainable code. Use when writing or refactoring TypeScript classes, functions, modules, or async logic. (triggers: **/*.ts, **/*.tsx, class, function, module, import, export, async, promise)