swift-code-reviewer-example

An example session showing how a Swift code-review agent reviews an iOS pull request. A pull request is a proposed set of code changes submitted for review before being merged.

In plain words
What is it for?
Use it as a reference when requesting reviews of Swift changes, especially authentication code, token storage, API keys, and memory-management concerns.
Why use it?
It shows what the review can look like, including grouped issues, file locations, and suggested fixes for security and code-quality problems.

Agent

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add agents/okminlee/everything-claude-code-ios/swift-code-reviewer-example
Clone the repo
git clone --depth 1 https://github.com/OkminLee/everything-claude-code-ios
Per session 0 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 823 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00000 $0.00823
Opus 5 $0.00000 $0.00411
Sonnet 5 $0.00000 $0.00165
Haiku 4.5 $0.00000 $0.00082

Measured 2d ago against content hash 5fb36974c315, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

swift-code-reviewer-example scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

examples/agents/swift-code-reviewer-example.md · 130 lines

How it starts

The opening of the file, as written. The whole thing — 130 lines — stays where its author put it; the contents beside it link to each section on GitHub.

swift-code-reviewer 사용 예제

PR 코드 리뷰 세션 예시입니다.


시나리오

새 기능 PR이 올라왔고, 코드 리뷰를 요청하는 상황입니다.

세션 예시

사용자 요청

@swift-code-reviewer
방금 올린 PR 리뷰해줘. 사용자 인증 기능 추가했어.

에이전트 응답 예시

## Code Review Summary

### Files Reviewed
- `Sources/Features/Auth/LoginView.swift` (New)
- `Sources/Features/Auth/LoginViewModel.swift` (New)
- `Sources/Services/AuthService.swift` (New)
- `Sources/Core/Keychain/KeychainManager.swift` (Modified)

---

### 🔴 Critical Issues (2)

| Issue | Location | Fix |
|-------|----------|-----|
| 토큰이 UserDefaults에 저장됨 | AuthService.swift:42 | Keychain 사용 |
| 하드코딩된 API 키 | AuthService.swift:15 | 환경 변수로 이동 |

**1. 토큰이 UserDefaults에 저장됨**
```swift
// ❌ AuthService.swift:42
UserDefaults.standard.set(token, forKey: "authToken")

// ✅ 수정
try KeychainManager.shared.save(
    token,
    forKey: "authToken",
    accessibility: .whenUnlockedThisDeviceOnly
)

2. 하드코딩된 API 키

// ❌ AuthService.swift:15
private let apiKey = "sk-proj-xxxxx"

// ✅ 수정 - xcconfig 또는 환경 변수 사용
private var apiKey: String {
    Bundle.main.infoDictionary?["API_KEY"] as? String ?? ""
}

🟡 High Issues (3)

Issue Location Fix
weak self 누락 LoginViewModel.swift:28 [weak self] 추가
Force unwrap 사용 LoginView.swift:55 guard let 사용
print() 문 존재 AuthService.swift:67 #if DEBUG로 감싸기

1. weak self 누락

// ❌ LoginViewModel.swift:28
Task {
    let result = await authService.login(email: email, password: password)
    self.handleResult(result)  // 잠재적 retain cycle
}

// ✅ 수정
Task { [weak self] in
    guard let self else { return }
    let result = await authService.login(email: email, password: password)
    self.handleResult(result)
}

🟢 Suggestions (2)

  1. LoginViewModel을 @MainActor로 마킹 - UI 업데이트 안전성
  2. 에러 타입 세분화 - AuthError enum 정의 권장

Good Practices Found

  • Dependency Injection 패턴 잘 적용됨
  • Protocol 기반 추상화로 테스트 용이
  • SwiftUI 뷰가 200줄 이하로 적절한 크기

Verdict: ❌ Block

Critical 이슈 2개 해결 후 재리뷰 필요합니다.

우선순위:

  1. UserDefaults → Keychain 마이그레이션
  2. 하드코딩된 API 키 제거
  3. weak self 추가

Read the full file on GitHub · 130 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 130 lines · 0 tokens per session scan A 5fb36974c315

Subscribe to this mod's changes

swift-code-reviewer-example is an agent published in the GitHub repository OkminLee/everything-claude-code-ios (58 stars, last pushed 5mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 823 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.