ios-coverage

A command that measures which parts of an iOS project's code are exercised by tests and creates tests for under-tested areas.

In plain words
What is it for?
It runs tests with Xcode coverage enabled, reads the results with xccov, finds files below the threshold, and generates unit or integration tests for missing paths and edge cases.
Why use it?
It shows where tests are missing instead of relying on guesswork. It compares coverage before and after adding tests and checks against an 80% target.

Command

Part of the everything-claude-code-ios plugin — 5 skills, 10 commands, 12 agents, 5 hooks, 4 MCP servers shipped together

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 commands/okminlee/everything-claude-code-ios/ios-coverage
Clone the repo
git clone --depth 1 https://github.com/OkminLee/everything-claude-code-ios

Or install everything-claude-code-ios, the plugin that ships this one along with the rest of its 5 skills, 10 commands, 12 agents, 5 hooks, 4 MCP servers.

Per session 30 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,141 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. 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.00030 $0.02141
Opus 5 $0.00015 $0.01071
Sonnet 5 $0.00006 $0.00428
Haiku 4.5 $0.00003 $0.00214

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

Security

Grade A, and why

ios-coverage scanned grade A with 1 finding 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 3d 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.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

bash <(curl -s https://codecov.io/bash) -f coverage.lcov
commands/ios-coverage.md · 334 lines

How it starts

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

iOS Test Coverage

Analyze test coverage and generate missing tests for iOS projects.

What This Command Does

  1. Run Tests with Coverage - Execute tests with code coverage enabled
  2. Analyze Coverage Report - Parse xcresult bundle with xccov
  3. Identify Gaps - Find files below 80% threshold
  4. Generate Missing Tests - Create unit/integration tests
  5. Verify and Report - Show before/after metrics

Process

  1. Run tests with coverage:

    xcodebuild test \
      -scheme MyApp \
      -destination 'platform=iOS Simulator,name=iPhone 16' \
      -enableCodeCoverage YES \
      -resultBundlePath TestResults.xcresult
    
  2. Analyze coverage report:

    xcrun xccov view --report TestResults.xcresult
    
  3. Identify files below 80% coverage threshold

  4. For each under-covered file:

    • Analyze untested code paths
    • Generate unit tests for functions
    • Generate integration tests for repositories
    • Identify edge cases to cover
  5. Verify new tests pass

  6. Show before/after coverage metrics

  7. Ensure project reaches 80%+ overall coverage

Running Coverage Analysis

Xcode Project

# Run tests with coverage
xcodebuild test \
  -scheme MyApp \
  -destination 'platform=iOS Simulator,name=iPhone 16' \
  -enableCodeCoverage YES \
  -resultBundlePath TestResults.xcresult

# View summary report
xcrun xccov view --report TestResults.xcresult

# View JSON report (for parsing)
xcrun xccov view --report --json TestResults.xcresult > coverage.json

# View specific file coverage
xcrun xccov view --archive --file Sources/HomeViewModel.swift TestResults.xcresult

Swift Package

# Run with coverage
swift test --enable-code-coverage

# Find coverage data
COVERAGE_PATH=$(swift test --show-codecov-path)

# Convert to report
xcrun llvm-cov report \
  .build/debug/MyPackagePackageTests.xctest/Contents/MacOS/MyPackagePackageTests \
  -instr-profile=$COVERAGE_PATH

Coverage Report Format

╔══════════════════════════════════════════════════════════════╗
║                    Coverage Report                           ║
╠══════════════════════════════════════════════════════════════╣
║ Overall Coverage: 72.4% (Target: 80%)                        ║
║ Status: ❌ BELOW THRESHOLD                                   ║
╚══════════════════════════════════════════════════════════════╝

## Coverage by Target

| Target | Coverage | Status |
|--------|----------|--------|
| MyApp | 68.2% | ❌ |
| MyAppTests | 100% | ✅ |

## Files Below Threshold (<80%)

| File | Coverage | Lines Missed | Priority |
|------|----------|--------------|----------|
| HomeViewModel.swift | 45.2% | 28/51 | 🔴 HIGH |
| NetworkClient.swift | 62.1% | 19/50 | 🟡 MEDIUM |
| UserService.swift | 78.3% | 5/23 | 🟢 LOW |

## Untested Code Paths

### HomeViewModel.swift (45.2%)

**Untested Functions:**
1. `fetchItems()` - Line 23-45
   - Error handling path not tested
   - Empty result case not tested

2. `deleteItem(id:)` - Line 67-89
   - Entire function untested

3. `refreshData()` - Line 102-115
   - Cancellation path not tested

**Recommended Tests:**
```swift
@Test func fetchItems_onError_showsAlert() async {
    // Test error handling path
}

Read the full file on GitHub · 334 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. 3d ago First seen · 334 lines · 30 tokens per session scan A fa7daf142db0

Subscribe to this mod's changes

ios-coverage is a command published in the GitHub repository OkminLee/everything-claude-code-ios (58 stars, last pushed 5mo ago), licensed MIT. It adds 30 tokens to every session and 2,141 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.