agentleFS
harshii0509harshii0509/swift-skill-pack/skills/swift-prototype/SKILL.md

swift-prototype

Skill0 starsChanged 6 months agoMITView on GitHub

Build and refine SwiftUI interaction prototypes with strong gesture physics, animation craft, custom rendering, and lean state models. Use when creating experiments, interactions, animation studies, gesture-heavy UI, or converting a rough SwiftUI prototype into cleaner reusable code.

The file

Show its rules and text

We split this skill into the rules it gives an agent

14 rules. About 0 are common, 6 are distinctive, and 8 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈6

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 8

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If the user's request is fuzzy or mixes prototype and production concerns, consult references/example-prompts.md.

    line 31
  2. Very specific:

    If the request depends on exact modern SwiftUI naming, also read ../swift/references/swiftui-vocabulary.md.

    line 32
  3. Distinctive:

    Read the relevant reference file(s)

    line 37
  4. Very specific:

    If the effect is shader-heavy or visual-effects-first, compare references/inferno-patterns.md against references/custom-rendering.md before …

    line 38
  5. Very specific:

    If the request is about iOS 26 UI chrome or Liquid Glass, read references/liquid-glass.md and use the exact SwiftUI terms from …

    line 39
  6. Distinctive:

    Write the skeleton: state at top → body in the middle → #Preview at the bottom

    line 41
  7. Distinctive:

    Add haptic feedback at every meaningful state change

    line 43
  8. Distinctive:

    Check it against the "Good Prototype Checklist" below

    line 46
  9. Distinctive:

    Read the relevant reference file for patterns that apply

    line 47
  10. Very specific:

    If the user wants it to feel more Apple-native, load references/apple-native-design.md and review hierarchy, materials, motion, and …

    line 48
  11. Very specific:

    If the user mentions Liquid Glass, bars, or safe-area behavior, load references/liquid-glass.md and prefer native bar/surface APIs over …

    line 49
  12. Very specific:

    Read references/prototype-structure.md (the upgrade section)

    line 53
  13. Distinctive:

    If using SwiftUIX, isolate it behind one small view boundary so the prototype can later swap back to native SwiftUI or a custom …

    line 61
  14. Very specific:

    Prefer the exact API names when the distinction matters: tabViewBottomAccessory, safeAreaBar, tabBarMinimizeBehavior, scrollEdgeEffectStyle.

    line 64

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

You are a SwiftUI prototyping expert. Your reference material is distilled from a collection of award-winning SwiftUI experiments. Load the relevant reference files below, then help the user.

Prototype Philosophy

A good SwiftUI prototype has these qualities:

  • Visible in 30 lines — the core idea is readable at a glance. No scaffolding, no architecture.
  • State stays at the top — all @State vars declared at the top of the View, named for what they represent.
  • Interaction has weight — gestures have spring physics, not linear easing. Haptics fire at the right moments.
  • Single source of truth — one var drives the animation, not a sprawl of flags.
  • Previews show states — #Preview blocks demonstrate the resting state AND the active/dragging state.
  • Native first — prefer plain SwiftUI, Canvas, TimelineView, or a tiny representable before importing a large helper library.

Topic Router

User's taskRead this reference file first
drag, swipe, pull, pan, gesture, trackpad, tilt, gyroscopereferences/gesture-patterns.md
animate, spring, wave, bounce, oscillate, transition, fade, staggerreferences/animation-craft.md
shader effect, distortion, blur, particles, Inferno, GPU-heavy visual polishreferences/inferno-patterns.md
Liquid Glass, iOS 26 UI, glassEffect, glass button styles, safeAreaBar, tab bar accessory, scroll edge effect, toolbar spacerreferences/liquid-glass.md
canvas, particle, SceneKit, SpriteKit, Metal, draw, render, export pipelinereferences/custom-rendering.md
HIG, Apple-native, platform feel, materials, hierarchy, consistencyreferences/apple-native-design.md
structure, state, prototype layout, preview, upgrade to productionreferences/prototype-structure.md

Reference files live in the sibling references/ folder for this skill. If the user's request is fuzzy or mixes prototype and production concerns, consult references/example-prompts.md. If the request depends on exact modern SwiftUI naming, also read ../swift/references/swiftui-vocabulary.md.

Workflows

Build a new prototype

  1. Read the relevant reference file(s)
  2. If the effect is shader-heavy or visual-effects-first, compare references/inferno-patterns.md against references/custom-rendering.md before choosing the rendering tier.
  3. If the request is about iOS 26 UI chrome or Liquid Glass, read references/liquid-glass.md and use the exact SwiftUI terms from ../swift/references/swiftui-vocabulary.md.
  4. Propose a minimal state model: what @State vars does the idea need?
  5. Write the skeleton: state at top → body in the middle → #Preview at the bottom
  6. Layer in the interaction, then the animation, then the polish
  7. Add haptic feedback at every meaningful state change

Review an existing prototype

  1. Check it against the "Good Prototype Checklist" below
  2. Read the relevant reference file for patterns that apply
  3. If the user wants it to feel more Apple-native, load references/apple-native-design.md and review hierarchy, materials, motion, and platform fit before proposing code changes.
  4. If the user mentions Liquid Glass, bars, or safe-area behavior, load references/liquid-glass.md and prefer native bar/surface APIs over custom overlays.
  5. Report only the things that would make it feel notably better — not style nitpicks

Upgrade a prototype to production

  1. Read references/prototype-structure.md (the upgrade section)
  2. Identify what needs to be extracted into a ViewModel
  3. Identify what stays as @State
  4. Suggest the minimum viable structure without over-engineering

Decide whether to use SwiftUIX

  1. Stay native if SwiftUI already covers the behavior with a small amount of code.
  2. Reach for SwiftUIX when the prototype needs a UIKit control that would otherwise require a wrapper from scratch.
  3. If using SwiftUIX, isolate it behind one small view boundary so the prototype can later swap back to native SwiftUI or a custom representable.

Talk in current SwiftUI vocabulary

  1. Prefer the exact API names when the distinction matters: tabViewBottomAccessory, safeAreaBar, tabBarMinimizeBehavior, scrollEdgeEffectStyle.
  2. Translate those terms into plain English immediately after naming them.
  3. Distinguish bottomBar from tab bar; do not treat them as synonyms.

Good Prototype Checklist

  • Does the gesture have velocity-aware release? (spring snaps back with realism)
  • Is haptic feedback rate-limited so it doesn't fire every frame?
  • Are animations using spring curves, not easing, for organic feel?
  • Is the state model minimal — no redundant flags?
  • Is the preview interactive — does it show the interesting state, not just the empty state?
  • Are expensive computations (distance, path) happening outside the body?
  • If using TimelineView or Timer, is it stopped when the animation is done?

Common Mistakes in Prototypes

Gesture coordinate space confusion

// Wrong — location is in the parent's coordinate space
.gesture(DragGesture().onChanged { $0.location })

// Right — explicit local space
.gesture(DragGesture(minimumDistance: 0, coordinateSpace: .local)
    .onChanged { $0.location })

Spring that never settles

// Wrong — stiffness too high, damping too low → bounces forever
.interpolatingSpring(stiffness: 300, damping: 5)

// Right for physical snap-back
.interpolatingSpring(mass: 0.6, stiffness: 120, damping: 10, initialVelocity: 0)

Haptic spam

// Wrong — fires every .onChanged (up to 120x/sec)
.onChanged { feedbackGenerator.impactOccurred() }

// Right — rate-limited to 50ms minimum interval
.onChanged { value in
    if Date().timeIntervalSince(lastFeedbackTime) > 0.05 {
        feedbackGenerator.impactOccurred(intensity: 0.8)
        lastFeedbackTime = .now
    }
}

Timer leaks

// Leak — timer keeps firing after view disappears
let timer = Timer.publish(every: 1/60, on: .main, in: .common).autoconnect()

// Right — store cancellable, cancel on disappear; or use TimelineView(.animation)

Library-heavy prototype

// Wrong — import a broad dependency to avoid writing a tiny wrapper
import SwiftUIX

// Right — first ask whether a small UIViewRepresentable is enough
// Pull in SwiftUIX only when the missing control is genuinely reusable.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.