Reviews URLSession networking code for iOS/macOS. Covers async/await patterns, request building, error handling, caching, and background sessions.
Installation
Details
Usage
After installing, this skill will be available to your AI coding assistant.
Verify installation:
npx agent-skills-cli listSkill Instructions
name: urlsession-code-review description: Reviews URLSession networking code for iOS/macOS. Covers async/await patterns, request building, error handling, caching, and background sessions. triggers:
- URLSession
- URLRequest
- URLCache
- URLError
- iOS networking
URLSession Code Review
Quick Reference
| Topic | Reference |
|---|---|
| Async/Await | async-networking.md |
| Requests | request-building.md |
| Errors | error-handling.md |
| Caching | caching.md |
Review Checklist
Response Validation
- HTTP status codes validated - URLSession does NOT throw on 404/500
- Response cast to HTTPURLResponse before checking status
- Both transport errors (URLError) and HTTP errors handled
Memory & Resources
- Downloaded files moved/deleted (async API doesn't auto-delete)
- Sessions with delegates call
finishTasksAndInvalidate() - Long-running tasks use
[weak self] - Stored Task references cancelled when appropriate
Configuration
-
timeoutIntervalForResourceset (default is 7 days!) - URLCache sized adequately (default 512KB too small)
- Sessions reused for connection pooling
Background Sessions
- Unique identifier (especially with app extensions)
- File-based uploads (not data-based)
- Delegate methods used (not completion handlers)
Security
- No hardcoded secrets (use Keychain)
- Header values sanitized for CRLF injection
- Query params via URLComponents (not string concat)
Output Format
### Critical
1. [FILE:LINE] Missing HTTP status validation
- Issue: 404/500 responses not treated as errors
- Fix: Check `httpResponse.statusCode` is 200-299
More by NeverSight
View allComprehensive expertise in decentralized autonomous organization governance systems, including Snapshot off-chain voting, OpenZeppelin Governor on-chain execution, treasury multi-sigs, proposal lifecycles, delegation, and governance attack prevention. Use when "DAO governance, on-chain voting, Snapshot, Governor contract, governance proposal, treasury management, multi-sig, token voting, delegation, quorum, timelock, governance attack, " mentioned.
Comprehensive database design tool creating complete schemas with tables, fields, indexes, and ER diagrams. Use when users request database design for any system. Generates Markdown docs, SQL scripts, and DrawDB-compatible JSON/DBML files. Supports MySQL, PostgreSQL, SQL Server. Triggers: database design, schema, ER diagram, SQL, data model. | 全面的数据库设计工具,创建完整的数据库架构。触发词:数据库设计、数据库架构、ER图、SQL、数据模型、表设计。
Advanced distributed event patterns for ABP microservices including idempotent handlers, cross-tenant events, event sourcing lite, and saga patterns. Use when: (1) implementing event handlers across services, (2) ensuring idempotent event processing, (3) cross-tenant event handling, (4) designing event-driven architectures.
View investment accounts, check portfolio, monitor positions, and research investments on Charles Schwab
