/preview-build:previewfrom preview-build
Builds and captures Xcode/SwiftUI previews for visual analysis of SwiftUI views. Supports standalone files, Xcode projects, and SPM packages.
Claude never picks this skill on its own
Its frontmatter has no description. Without a description, Claude Code leaves it out of the list Claude chooses from. Typing /preview-build:preview still runs it.
What the skill costs in Claude's context, stage by stage
No description Claude Code can read, so Claude's list leaves it out: only you can start it.
SKILL.md joins the conversation and stays.
This skill allows you to build SwiftUI views and capture screenshots of their rendered output for visual analysis. It supports:
Scripts are located at ${CLAUDE_PLUGIN_ROOT}/scripts/
Auto-detects project type and uses the best approach:
"${CLAUDE_PLUGIN_ROOT}"/scripts/preview \
<path-to-file.swift> \
--output /tmp/preview.png
Capture a screenshot of whatever is currently displayed on the booted simulator.
"${CLAUDE_PLUGIN_ROOT}"/scripts/capture-simulator.sh \
--output /tmp/preview-capture.png
Fast builds by injecting a minimal PreviewHost target (handled automatically by the unified script):
"${CLAUDE_PLUGIN_ROOT}"/scripts/preview \
<path-to-file.swift> \
--project <path.xcodeproj> \
--output /tmp/preview.png
Auto-detected from Package.swift in parent directories:
"${CLAUDE_PLUGIN_ROOT}"/scripts/preview \
<path-to-file.swift> \
--output /tmp/preview.png
Build a standalone Swift file with system frameworks only:
"${CLAUDE_PLUGIN_ROOT}"/scripts/preview \
<path-to-file.swift> \
--output /tmp/preview.png
When the user invokes /preview, follow this workflow:
Identify the target: Determine what needs to be previewed:
Build and capture: Use the appropriate script based on the target
Read and analyze: Use the Read tool to view the captured PNG image
Report findings: Describe what you see in the preview, including:
The user can specify:
file: Path to a Swift file to previewproject: Path to an Xcode projectworkspace: Path to an Xcode workspacescheme: Build scheme namesimulator: Simulator to use (default: "iPhone 17 Pro")wait: Seconds to wait before capture (default: 3)User: /preview ContentView.swift
User: /preview --project MyApp.xcodeproj --scheme MyApp
User: /preview --capture-only
If the build fails:
If no simulator is booted:
After capturing, always:
What SKILL.md sets; muted values are Claude Code's defaults
None: SKILL.md is the whole skill.
npx claudepluginhub iron-ham/xcodepreviews --plugin preview-buildOther plugins' skills for the same job