Borrowing it
Nothing to install: this file belongs to Iron-Ham/XcodePreviews. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/Iron-Ham/XcodePreviews/main/.claude/commands/preview.mdgit clone --depth 1 https://github.com/Iron-Ham/XcodePreviewsWrote 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.
[](https://agentmods.dev/commands/iron-ham/xcodepreviews/preview)<a href="https://agentmods.dev/commands/iron-ham/xcodepreviews/preview"><img src="https://agentmods.dev/badge/commands/iron-ham/xcodepreviews/preview/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.
<a href="https://agentmods.dev/commands/iron-ham/xcodepreviews/preview"><img src="https://agentmods.dev/badge/commands/iron-ham/xcodepreviews/preview.svg" alt="Reviewed on agentmods" width="80" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00000 | $0.00997 |
| Opus 5.5 | $0.00000 | $0.00399 |
| Sonnet 5.5 | $0.00000 | $0.00199 |
| Haiku 4.5 | $0.00000 | $0.00100 |
Grade A, and why
preview 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 1mo 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.
How it starts
The opening of the file, as written. The whole thing — 147 lines — stays where its author put it; the contents beside it link to each section on GitHub.
/preview - Build and Capture SwiftUI Preview
Build a SwiftUI view and capture its rendered output for visual analysis.
Arguments
$ARGUMENTS - File path, or options like --scheme, --workspace, --capture-only
Instructions
You are the preview capture assistant. Your job is to build SwiftUI previews and analyze their visual output.
Path Resolution: Scripts default to ~/XcodePreviews. If that directory doesn't exist, fall back to ~/Claude-XcodePreviews (legacy name). The PREVIEW_BUILD_PATH environment variable overrides both.
Unified Entry Point
For most cases, use the unified preview script which auto-detects the best approach:
"${PREVIEW_BUILD_PATH:-$HOME/XcodePreviews}"/scripts/preview \
"<path-to-file.swift>" \
--output /tmp/preview.png
This will automatically:
- Detect if the file has a
#Previewblock - Find the associated Xcode project or SPM package
- Use dynamic preview injection for fast builds (~3-4 seconds)
- Fall back to full scheme builds when needed
Preview Modes
The unified preview script auto-detects the best mode. You can also be explicit:
Xcode Project with #Preview (Fastest)
Injects a minimal PreviewHost target, builds only required modules (~3-4 seconds):
"${PREVIEW_BUILD_PATH:-$HOME/XcodePreviews}"/scripts/preview \
"<path-to-file.swift>" \
--project "<path.xcodeproj>" \
--output /tmp/preview.png
SPM Package
Auto-detected from Package.swift in parent directories:
"${PREVIEW_BUILD_PATH:-$HOME/XcodePreviews}"/scripts/preview \
"<path-to-file.swift>" \
--output /tmp/preview.png
Standalone Swift File (No Dependencies)
For Swift files that only use system frameworks (SwiftUI, UIKit, Foundation):
"${PREVIEW_BUILD_PATH:-$HOME/XcodePreviews}"/scripts/preview \
"<path-to-file.swift>" \
--output /tmp/preview.png
Select a Named Preview
When a file has multiple #Preview blocks, select one by name:
"${PREVIEW_BUILD_PATH:-$HOME/XcodePreviews}"/scripts/preview \
"<path-to-file.swift>" \
--project "<path.xcodeproj>" \
--preview-name "Dark Mode" \
--output /tmp/preview.png
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.
- 1mo ago First seen · 147 lines · 0 tokens per session scan A c6b7baee51b5
preview is a command published in the GitHub repository Iron-Ham/XcodePreviews (152 stars, last pushed 3mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 997 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.
Other commands, from other repositories
erne-animate
ERNE — Implement animations using the ui-designer agent with Reanimated and Gesture Handler.
ios-impeccable
The canon is /.claude/docs/reference/design-lane.md — the tier model, the precedence order (owner > aesthetic > detector), the aesthetic-capture protocol, and the shared T1/T2 mechanics are defined THERE, once. This command routes a .swift design request to a tier and executes it with the iOS deltas below. It restates…
port_to_platform
Take an existing design or implementation to another platform (iOS ↔ Android ↔ macOS ↔ web) — porting the intent and IA, not the components.
design-implement
Build or refine a React Native screen to parity with an in-repo design artifact using code-first references.
kmp-update-design-system
Compares the current KMP project's :core:designsystem/components against the reference implementations in the kmp-compose-design-system skill and applies safe updates.
design-mobile
Design a mobile screen or flow. This command never writes SwiftUI or Compose — the deliverable is a device-framed HTML mockup plus a handoff spec for the platform developer.