urlsession-code-review
Reviews URLSession networking code for iOS/macOS. Covers async/await patterns, request building, error handling, caching, and background sessions. Use when reviewing code that uses URLSession, URLRequest, URLCache, or URLError, or any iOS networking path.
How do I install this agent skill?
npx skills add https://github.com/existential-birds/beagle --skill urlsession-code-reviewIs this agent skill safe to install?
- Gen Agent Trust Hubpass
This skill provides documentation and checklists for reviewing Swift networking code. It includes guidance on async/await, error handling, caching, and security best practices like avoiding hardcoded credentials and CRLF injection. No malicious patterns or security vulnerabilities were detected.
- Socketpass
No alerts
- Snykpass
Risk: LOW · No issues
- Runlayerpass
2/5 files flagged
What does this agent skill do?
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)
Hard gates (before reporting findings)
Complete in order. Do not advance while a prior gate is open.
- Scope — Pass: You name at least one file under review where
URLSession,URLRequest,HTTPURLResponse/URLResponse,URLCache, orURLErrorappears on a networking path. If none apply, stop with “out of scope.” - HTTP vs transport — Pass: Before claiming missing HTTP status handling or “404 treated as success,” you cite
file:linefor the completion/async/for awaitpath that receivesresponseand state whetherHTTPURLResponseis cast andstatusCodeis checked (or cite the helper that does). If you cannot see the handler, say unknown and ask for it—do not assume. - Session lifecycle — Pass: For a custom
URLSessionwith a delegate, you citefinishTasksAndInvalidate()or the documented long-lived/singleton pattern you rely on; for.shared, say so if the finding depends on configuration. Skip if only ad hocURLSession.sharedone-shots with no delegate issues. - Background or file transfer (if applicable) — Pass: If
URLSessionConfiguration.background,downloadTask, or app-extension–scoped sessions appear, findings cite identifier uniqueness, delegate vs completion-handler usage, or file URLs as required. If none of those APIs appear, mark N/A and continue. - Severity and checklist — Pass: Every Critical item includes
file:lineand names which Review Checklist subsection it violates (e.g. Response Validation, Background Sessions). Lower-severity items still name the file(s) they are drawn from.
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
How can the creator link this skill?
Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.
<a href="https://skillzs.dev/skills/existential-birds/beagle/urlsession-code-review">View urlsession-code-review on skillZs</a>