swift-arch-check

swift-arch-check is a command for Claude Code from jeremieb/swift-unit-test-instructions. It costs 0 tokens per session (568 once invoked), scanned A, original, MIT.

A read-only checker for the structure and design of a Swift app. It reviews the user interface, data storage, network code, and concurrency without changing files.

In plain words
What is it for?
Use it to review SwiftUI, UIKit, or mixed apps, check MVVM separation, and inspect persistence, networking, and concurrency patterns.
Why use it?
It helps find misplaced files and architecture problems before they become harder to fix. Suggested fixes are reported but not applied.

Command for Claude Code

Written for Claude Code: installed under .claude/.

Good fit Use it to review SwiftUI, UIKit, or mixed apps, check MVVM separation, and inspect persistence, networking, and concurrency patterns.

Compare 6 commands from other repositories ↓
Install with agentmods
npx agentmods add commands/jeremieb/swift-unit-test-instructions/swift-arch-check
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.

Clone the repo
git clone --depth 1 https://github.com/jeremieb/swift-unit-test-instructions

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for swift-arch-check

README.md
[![agentmods](https://agentmods.dev/badge/commands/jeremieb/swift-unit-test-instructions/swift-arch-check/github.svg)](https://agentmods.dev/commands/jeremieb/swift-unit-test-instructions/swift-arch-check)
Your own site
<a href="https://agentmods.dev/commands/jeremieb/swift-unit-test-instructions/swift-arch-check"><img src="https://agentmods.dev/badge/commands/jeremieb/swift-unit-test-instructions/swift-arch-check/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for swift-arch-check

Your own site · 80×15
<a href="https://agentmods.dev/commands/jeremieb/swift-unit-test-instructions/swift-arch-check"><img src="https://agentmods.dev/badge/commands/jeremieb/swift-unit-test-instructions/swift-arch-check.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
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 568 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00000 $0.00568
Opus 5 $0.00000 $0.00284
Sonnet 5 $0.00000 $0.00114
Haiku 4.5 $0.00000 $0.00057

Measured 9d ago against content hash b3f64dd04345, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-09, from the pricing page.

Security

Grade A, and why

swift-arch-check 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 9d 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.

.claude/commands/swift-arch-check.md · 81 lines

How it starts

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

Read-only architecture audit. Scans the project and produces a structured report. Makes NO changes to any file.

Rules

  • Read files only — never edit, never write
  • If a fix is obvious, describe it in the report but do not apply it
  • Cover every layer: structure, MVVM compliance, persistence, networking, concurrency

Steps

1. Detect UI framework

Scan for @main, UIApplicationDelegate, UIHostingController. Determine: SwiftUI / UIKit / Mixed.

2. Check folder structure

Compare against the matching reference:

  • SwiftUI → skills/swift-project-setup/references/structure-swiftui.md
  • UIKit → skills/swift-project-setup/references/structure-uikit.md
  • Mixed → skills/swift-project-setup/references/structure-mixed.md

Note every deviation: missing folders, files in wrong locations, misnamed groups.

3. Check MVVM compliance

Read 3–5 representative feature files. Flag:

  • Business logic inside View or ViewController
  • Network or storage calls not behind a protocol
  • Missing ViewModel for screens with non-trivial state
  • @State holding data that belongs in a ViewModel

4. Check persistence layer (if present)

Identify whether project uses SwiftData, CoreData, or neither. Flag:

  • ModelContext or NSManagedObjectContext used directly in ViewModel or View
  • Missing repository abstraction over persistence
  • Models not separated from UI layer

5. Check concurrency

Flag:

  • DispatchQueue.main.async in ViewModel or Service layer
  • Missing @MainActor on types that update UI state
  • sleep() anywhere
  • Completion handlers in new code where async/await should be used

6. Check testability

Flag:

  • Dependencies instantiated inside types (let service = NetworkService())
  • No protocol abstraction for external dependencies
  • ViewModel that imports SwiftUI or UIKit

7. Output report

# Architecture Audit: [ProjectName]

## Health: [Good / Needs Work / Critical Issues]

## Structure
- [deviation or ✓ Correct]

## MVVM Compliance
- [issue with file:line, or ✓ Compliant]

## Persistence Layer
- [issue with file:line, or ✓ Correct, or — Not used]

## Concurrency
- [issue with file:line, or ✓ Correct]

## Testability
- [issue, or ✓ Testable]

## Priority Fixes
1. [Most critical]
2. [Second]
3. [Third]

Read the full file on GitHub · 81 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. 9d ago First seen · 81 lines · 0 tokens per session scan A b3f64dd04345

Subscribe to this mod's changes

swift-arch-check is a command published in the GitHub repository jeremieb/swift-unit-test-instructions (5 stars, last pushed 6mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 568 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-31.