preview-data-generator
Generate sample data and a multi-variant #Preview matrix for SwiftUI views — empty/loading/error/loaded states, light/dark, Dynamic Type, locales/RTL, and devices. Use when the user says "add previews", "sample data for previews", "preview my view in different states", "preview data", "prototype this UI", or wants realistic Xcode canvas data without hand-rolling it.
npx skills add rshankras/claude-code-apple-skills --skill preview-data-generator --agent claude-code
Same command for any agent — swap --agent for codex, cursor, copilot.
Weekly change comes from our own snapshots, not the repository page — it measures attention, not adoption.
# Preview Data Generator Generates two tightly-coupled things for a SwiftUI view: 1. **Sample data** tuned for the Xcode canvas — realistic instances *plus* the visual edge cases that break layouts (empty, one item, huge list, long/overflowing strings, missing images, error and loading states). 2. **A `#Preview` matrix** — the variant blocks you'd otherwise hand-write to prototype and QA a view across light/dark, Dynamic Type, locale/RTL, device sizes, and data states. This is the design-time counterpart to `testing/test-data-factory` (which makes fixtures for the *test suite*). Where a factory already exists, this skill **reuses** `Model.fixture()` instead of inventing parallel data. ## When This Skill Activates Use this skill when the user: - Wants sample/mock data for Xcode previews ("what do I put in the preview?") - Wants to preview a view in multiple states (empty / loading / error / loaded) - Is prototyping UI and wants light/dark, Dynamic Type, RTL, or device variants - Says "add previews", "preview matrix", "preview this in dark mode + large text" - Has a SwiftData `@Model` and needs an in-memory seeded container for previews - Is on Xcode 16 / iOS 18 and wants shared, cac
- When This Skill Activates
- Reference Files
- Pre-Generation Checks
- Generation Process
- Step 1: Build the Sample Data
- Step 2: Build the Preview Matrix
- Step 3: Wire Up Infrastructure (when needed)
- Step 4: Place the Code
- Output Format
- Example Output Summary
- When NOT to Use This Skill
- Cross-Skill Integration
- Deliverables
What does the preview-data-generator skill do?
Generate sample data and a multi-variant #Preview matrix for SwiftUI views — empty/loading/error/loaded states, light/dark, Dynamic Type, locales/RTL, and devices. Use when the user says "add previews", "sample data for previews", "preview my view in different states", "preview data", "prototype this UI", or wants realistic Xcode canvas data without hand-rolling it.
How do I install it?
Run `npx skills add rshankras/claude-code-apple-skills --skill preview-data-generator --agent claude-code` — it drops the skill into your project so the agent can pick it up. Swap the --agent value for codex, cursor or copilot if you use one of those.
Where does this skill come from?
From rshankras/claude-code-apple-skills, a repository with 589 stars. We read it straight from the repository tree rather than a submitted listing, so what you see here is what is actually published.
Is a popular skill a good skill?
Not necessarily. Stars measure attention, not adoption — a repository can trend for a week and be abandoned. That is why we show the weekly change from our own snapshots next to the total, instead of a single flattering number.
