Agent skill

Preview Build

by Iron-Ham in Iron-Ham/XcodePreviews

Build and capture SwiftUI previews for visual analysis. An agent skill from Iron-Ham/XcodePreviews.

MITAuto-check passedMobile

Install Preview Build

skills CLI
$ npx skills add Iron-Ham/XcodePreviews --skill preview-build -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install Iron-Ham/XcodePreviews preview-build --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/Iron-Ham/XcodePreviews.git skills-src && mkdir -p .claude/skills && cp -r skills-src/.cursor/skills/preview .claude/skills/preview-build && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
preview-build
GitHub stars
152
Token cost
~782 tokens
SKILL.md length
256 words
Files
1
Skills in repo
2
Repo updated
First seen
Licence
MIT

At a glance

Build and capture SwiftUI previews for visual analysis. An agent skill from Iron-Ham/XcodePreviews.

  • Works in 4 steps: Identify the target: Determine what… → Build and capture: Run the appropriate… → Read and analyze: Use the Read tool to… → …
  • The user asks to preview a SwiftUI view
  • SKILL.md covers Installation Path, Available Commands, Workflow and Parameters, plus 1 more section
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md

What it does

Preview Build is an agent skill from Iron-Ham/XcodePreviews. Build and capture SwiftUI previews for visual analysis. Use when the user asks to preview a SwiftUI view, capture a simulator screenshot, or visually inspect iOS UI components. Supports Xcode projects, SPM packages, and standalone Swift files.

Its SKILL.md is about 780 tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Mobile, covering iOS development. It works with SwiftUI, Xcode and iOS. The licence is MIT.

When your agent uses it

  • The user asks to preview a SwiftUI view
  • Capture a simulator screenshot
  • Visually inspect iOS UI components

Example prompts

  • “/preview-build”

Workflow steps

4 steps, taken from the first numbered list in SKILL.md.

  1. Identify the target: Determine what needs to be previewed (Swift file, project scheme, or current simulator state)
  2. Build and capture: Run the appropriate script
  3. Read and analyze: Use the Read tool to view the captured PNG at /tmp/preview.png
  4. Report findings

What it can do on your machine

Read from SKILL.md and the folder at commit a44a29c. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are bash).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Preview Build loads about 782 tokens when it runs. Until then it costs about 64 tokens; SKILL.md has 256 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~64
When it runs · the whole SKILL.md, loaded when a task matches
~782

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from Iron-Ham/XcodePreviews at commit a44a29c, republished under its MIT licence (© Iron-Ham). 256 words, ~782 tokens.

Download SKILL.mdSave it as .claude/skills/preview-build/SKILL.md (or your agent's skills folder).
name
preview-build
description
Build and capture SwiftUI previews for visual analysis. Use when the user asks to preview a SwiftUI view, capture a simulator screenshot, or visually inspect iOS UI components. Supports Xcode projects, SPM packages, and standalone Swift files.

Xcode Preview Capture Skill

Build SwiftUI views and capture screenshots of their rendered output for visual analysis.

Installation Path

Scripts are located at ${PREVIEW_BUILD_PATH:-$HOME/XcodePreviews}/scripts/

Compatibility: If ~/XcodePreviews doesn't exist, fall back to ~/Claude-XcodePreviews (legacy name). The PREVIEW_BUILD_PATH environment variable overrides both.

Available Commands

Auto-detects project type and uses the best approach:

bash
"${PREVIEW_BUILD_PATH:-$HOME/XcodePreviews}"/scripts/preview \
  <path-to-file.swift> \
  --output /tmp/preview.png
Quick Capture (Current Simulator)
bash
"${PREVIEW_BUILD_PATH:-$HOME/XcodePreviews}"/scripts/capture-simulator.sh \
  --output /tmp/preview-capture.png
Xcode Project with #Preview

Fast builds by injecting a minimal PreviewHost target (handled automatically by the unified script):

bash
"${PREVIEW_BUILD_PATH:-$HOME/XcodePreviews}"/scripts/preview \
  <path-to-file.swift> \
  --project <path.xcodeproj> \
  --output /tmp/preview.png
SPM Package Preview

Auto-detected from Package.swift in parent directories:

bash
"${PREVIEW_BUILD_PATH:-$HOME/XcodePreviews}"/scripts/preview \
  <path-to-file.swift> \
  --output /tmp/preview.png
Standalone Swift File

Build a standalone Swift file with system frameworks only:

bash
"${PREVIEW_BUILD_PATH:-$HOME/XcodePreviews}"/scripts/preview \
  <path-to-file.swift> \
  --output /tmp/preview.png

Workflow

When the user asks to preview a SwiftUI view:

  1. Identify the target: Determine what needs to be previewed (Swift file, project scheme, or current simulator state)

  2. Build and capture: Run the appropriate script

  3. Read and analyze: Use the Read tool to view the captured PNG at /tmp/preview.png

  4. Report findings:

    • Layout: Structure and arrangement
    • Visual elements: Buttons, text, images
    • Styling: Colors, fonts, spacing
    • Issues: Alignment, overflow, accessibility
    • Suggestions: Improvements

Parameters

OptionDescription
--project <path>Xcode project file
--workspace <path>Xcode workspace file
--package <path>SPM Package.swift path
--module <name>Target module (auto-detected)
--simulator <name>Simulator name (default: iPhone 17 Pro)
--output <path>Output screenshot path
--verboseShow detailed build output

Error Handling

  • No simulator booted: Run sim-manager.sh boot "iPhone 17 Pro"
  • Build failure: Show error, suggest fixes, offer to retry
  • Resource bundle crash: The dynamic script auto-includes Tuist and common bundle patterns
  • Missing imports: Check if the target module needs to be added to imports

© Iron-Ham, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in .cursor/skills/preview of Iron-Ham/XcodePreviews.

Open the folder on GitHubat commit a44a29c

Compare with similar skills

Preview Build next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Preview Build compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Preview Build this skillIron-Ham/XcodePreviews152—~782Automated safety check: PassMIT
Update Swiftui APIsAvdLee/SwiftUI-Agent-Skill3.7k—~1.2kAutomated safety check: PassMIT
SwiftUI Design SkillWholiver/swiftui-design-skill213—~2.8kAutomated safety check: PassMIT
Swiftui Iphone DuoFloWritesCode/fwc-swiftui-skills388—~3.9kAutomated safety check: PassMIT
Audit Xcode Security Settingssuperagents-lab/xcode27-skills339—~4.6kAutomated safety check: PassNone
iOS Marketing CaptureParthJadhav/ios-marketing-capture262—~6.1kAutomated safety check: PassMIT

Similar skills

  • Update Swiftui APIs

    AvdLee/SwiftUI-Agent-Skill

    Scan Apple's SwiftUI documentation for deprecated APIs and update the SwiftUI Expert Skill with modern replacements.

    3.7k GitHub stars~1.2k tokensUpdated 3 days ago
    MobileAuto-check passed
  • SwiftUI Design Skill

    Wholiver/swiftui-design-skill

    Guides the agent to design distinctive SwiftUI interfaces for iOS and macOS, with six anti-generic rules, a design direction workflow and a five-dimension review.

    213 GitHub stars~2.8k tokensUpdated 5 mo ago
    MobileAuto-check passed
  • Swiftui Iphone Duo

    FloWritesCode/fwc-swiftui-skills

    Adapts and reviews SwiftUI apps for iPhone Duo (Xcode 27.1 / iOS 27.1 SDK) and continuously changing window sizes.

    388 GitHub stars~3.9k tokensUpdated yesterday
    MobileAuto-check passed
  • Audit Xcode Security Settings

    superagents-lab/xcode27-skills

    Audit and enable security-oriented Xcode build settings. An agent skill from superagents-lab/xcode27-skills.

    339 GitHub stars~4.6k tokensUpdated 4 mo ago
    MobileAuto-check passed
  • iOS Marketing Capture

    ParthJadhav/ios-marketing-capture

    A skill your agent uses when the user wants to automate capture of marketing screenshots for a SwiftUI iOS app across multiple locales, devices, or appearances.

    262 GitHub stars~6.1k tokensUpdated 1 mo ago
    MobileAuto-check passed
  • Write AI Doc

    samuelhe52/AniShelf

    Create and maintain curated AniShelf docs-ai/ records for substantial features and non-trivial, decision-shaping fixes (numbered entries with 000-plan.md before implementation and 001-action.md…

    141 GitHub stars~1.8k tokensUpdated 2 days ago
    MobileAuto-check passed

More from Iron-Ham/XcodePreviews

  • Xcode Preview Capture

    Iron-Ham/XcodePreviews

    Build and capture SwiftUI previews for visual analysis in Codex.

    152 GitHub stars~376 tokensUpdated 3 mo ago
    Auto-check passed

Works with

Categories

Questions about Preview Build

What does Preview Build do?

Build and capture SwiftUI previews for visual analysis. An agent skill from Iron-Ham/XcodePreviews. Preview Build is an agent skill from Iron-Ham/XcodePreviews. Build and capture SwiftUI previews for visual analysis.

When should I use Preview Build?

Preview Build fits situations like: the user asks to preview a SwiftUI view; capture a simulator screenshot; visually inspect iOS UI components.

How do I install Preview Build in Claude Code?

Run `npx skills add Iron-Ham/XcodePreviews --skill preview-build -a claude-code`. Or copy the skill folder (.cursor/skills/preview in Iron-Ham/XcodePreviews) into .claude/skills/preview-build in your project. Claude Code loads it when a task matches its description.

How do I install Preview Build in Codex?

Run `npx skills add Iron-Ham/XcodePreviews --skill preview-build -a codex`. Or copy the skill folder (.cursor/skills/preview in Iron-Ham/XcodePreviews) into .agents/skills/preview-build in your project. Codex loads it when a task matches its description.

Can I use Preview Build in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add Iron-Ham/XcodePreviews --skill preview-build -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/preview-build, .gemini/skills/preview-build, .github/skills/preview-build and .opencode/skills/preview-build in your project.

What does Preview Build need to run?

SKILL.md names no scripts, command-line tools or credentials: Preview Build is instructions for the agent only.

Does Preview Build access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Preview Build safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Preview Build use?

Preview Build is published under the MIT licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Preview Build use?

About 782 tokens (SKILL.md is roughly 3.1k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Preview Build?

Skills that share tags, products or a category with Preview Build: Update Swiftui APIs (AvdLee/SwiftUI-Agent-Skill, 3.7k stars), SwiftUI Design Skill (Wholiver/swiftui-design-skill, 213 stars), Swiftui Iphone Duo (FloWritesCode/fwc-swiftui-skills, 388 stars) and Audit Xcode Security Settings (superagents-lab/xcode27-skills, 339 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Preview Build?

Iron-Ham (a GitHub user) maintains it in Iron-Ham/XcodePreviews, which has 152 GitHub stars. The repository holds 2 skills in this directory. The repository was last updated on July 6, 2026.

Source: Iron-Ham/XcodePreviews on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.