Agent skill
iOS Networking
Standards for URLSession, Alamofire, and API communication.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/networking
Metadata
Additional technical details for this skill
- labels
-
ios networking urlsession alamofire codable
- triggers
-
{ "files": [ "**/*Service.swift", "**/*API.swift", "**/*Client.swift" ], "keywords": [ "URLSession", "Alamofire", "Moya", "URLRequest", "URLComponents", "Codable" ] }
SKILL.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
- Native & Alamofire Implementation
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?