Communitygithub.com

SkillMedev/skills

Builds clean, performant, accessible SwiftUI views with correct state ownership, scoped invalidation, and smooth list scrolling, and reviews existing SwiftUI code against a concrete frame-time and re-render budget. Use when someone asks "why does my SwiftUI list stutter", "should this be @State or @Observable", "my whole screen re-renders when one row changes", "how do I animate this transition", or wants a SwiftUI view built or refactored. Do NOT use for cross-platform React Native apps - use react-native-pro instead; do NOT use for Flutter widget trees - use flutter-widget-architect instead; do NOT use for Android Compose UIs - use jetpack-compose-builder instead.

skills란 무엇인가요?

skills is a Claude Code agent skill that builds clean, performant, accessible SwiftUI views with correct state ownership, scoped invalidation, and smooth list scrolling, and reviews existing SwiftUI code against a concrete frame-time and re-render budget. Use when someone asks "why does my SwiftUI list stutter", "should this be @State or @Observable", "my whole screen re-renders when one row changes", "how do I animate this transition", or wants a SwiftUI view built or refactored. Do NOT use for cross-platform React Native apps - use react-native-pro instead; do NOT use for Flutter widget trees - use flutter-widget-architect instead; do NOT use for Android Compose UIs - use jetpack-compose-builder instead.

지원 대상~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/SkillMedev/skills/tree/HEAD/skills/swift-ui

즐겨 사용하는 AI에게 물어보기

이 에이전트 스킬이 미리 로드된 새 채팅을 엽니다.

문서

SwiftUI Expert

A SwiftUI screen lives or dies on state ownership: put state in the wrong place and every keystroke re-evaluates the whole tree, lists stutter, and animations tear. This skill builds and reviews SwiftUI views so that invalidation stays scoped to the views that actually read changed data, the frame budget holds under scroll, and the result is accessible by default rather than retrofitted.

Operating procedure

Work in this order because state design determines everything downstream - fixing state after the view hierarchy is built means rewriting the hierarchy.

Step 1: Gather inputs

Collect before writing any view code. Where the user does not know, use the default and label it a guess.

  • Target devices and refresh rate (default: assume ProMotion 120Hz iPhone plus a 60Hz baseline device).
  • Data shape: how many items in the largest list, how often data mutates, whether it streams in.
  • Ownership map: for each piece of state, which view creates it, which views read it, which mutate it.
  • Accessibility requirements beyond baseline (default: full Dynamic Type + VoiceOver support).

Step 2: Choose state ownership per value

Pick the narrowest wrapper that works:

  • @State - local, view-owned, value-type state. Also the correct owner for an @Observable model instance created by the view.
  • @Binding - a two-way reference to state owned elsewhere. Pass a binding only when the child mutates; pass a plain value when it only reads.
  • @Observable (Observation framework) - model objects; views observe only the properties they read, so invalidation is per-property, not per-object.
  • @Environment - dependency injection down the tree for services and shared models.

Rule: state lives at the lowest common ancestor of every view that reads or writes it - no lower (it resets when the view disappears) and no higher (it widens invalidation).

Step 3: Compose views to scope invalidation

  • Keep body small; extract subviews so a change invalidates one row, not the screen. A body that exceeds roughly 50 lines or three levels of nesting is a split candidate.
  • Pass minimal data into subviews - pass item.title, not the whole store - so only affected views re-render.
  • Use @ViewBuilder helpers instead of giant nested closures.
  • Never do heavy work (formatting, sorting, filtering, decoding) in body; compute it in the model and hand the view finished values. body must stay in the microsecond range because it can run every frame during animation.

Step 4: Lists and the frame budget

The budget is 8.3ms per frame at 120Hz, 16.7ms at 60Hz - everything on the main thread for that frame, not just your row. Practical rules:

  • Use List or LazyVStack for anything above ~50 rows so rows render on demand; a plain VStack in a ScrollView builds every row up front.
  • Give items stable ids from your data (item.id), never array indices or UUID() computed in body - unstable ids destroy row identity, causing flicker, lost scroll position, and lost row state.
  • Rows must be constant-cost: no per-row date formatters or image decoding; cache formatters, use AsyncImage or a caching image pipeline.
  • Verify with Instruments' SwiftUI template: watch view-body evaluation counts while scrolling. A row type whose body evaluates when unrelated state changes is a state-ownership bug - fix Step 2, do not memoize around it.

Step 5: Animate from state

  • Drive animation from state: withAnimation { model.expanded.toggle() }.
  • Prefer .animation(_:value:) scoped to a specific value over implicit global animations, which animate things you did not intend.
  • Use matchedGeometryEffect for shared-element transitions; transition for insert/remove.
  • Respect accessibilityReduceMotion: replace movement with opacity fades when it is set.

Step 6: Accessibility pass

  • Add accessibilityLabel/accessibilityValue; group related elements with accessibilityElement(children: .combine) so a row reads as one sentence, not five fragments.
  • Respect Dynamic Type - system text styles, no fixed frames that clip text; verify at the largest accessibility size.
  • Check contrast and add #Preview variants for dark mode, large Dynamic Type, and empty/loading/error states with sample data.

Worked artifact: state ownership, bad vs good

Bad - the whole screen invalidates on every keystroke because the search text lives in a model the entire tree observes, and rows receive the whole store:

@Observable final class ScreenStore {
  var searchText = ""
  var items: [Item] = []
}

struct ContactList: View {
  @State private var store = ScreenStore()
  var body: some View {
    VStack {
      TextField("Search", text: $store.searchText)
      ForEach(store.items) { item in
        ContactRow(store: store, item: item) // row observes everything
      }
    }
  }
}

Good - search text is view-local, rows get only the values they read, and the list is lazy with stable ids:

struct ContactList: View {
  @State private var searchText = ""
  @Environment(ContactModel.self) private var model
  var body: some View {
    List(model.filtered(searchText)) { item in
      ContactRow(name: item.name, isOnline: item.isOnline)
    }
    .searchable(text: $searchText)
  }
}

struct ContactRow: View {
  let name: String
  let isOnline: Bool
  var body: some View {
    Label(name, systemImage: isOnline ? "circle.fill" : "circle")
  }
}

Typing in the good version invalidates the List content closure and the rows whose filtered membership changed - nothing else.

Deliverable

Produce working SwiftUI view code plus a one-paragraph state map stating, for each piece of state: its owner, its wrapper, and which views read vs write it. For reviews, produce a findings list ordered by frame-budget impact, each with the fix.

Do NOT

  • Never mutate state during body evaluation - it loops or triggers undefined-behavior warnings.
  • Do not do async work in onAppear with a raw Task - use .task {}, which cancels automatically on disappear.
  • Do not put view types (Color, Image, AnyView) in models; models must stay testable without UI.
  • Do not lift all state to one screen-level store "for simplicity" - that is exactly the pattern that makes every keystroke redraw the screen.
  • Do not paper over invalidation bugs with equatable() or caching before fixing ownership; the bug will resurface in the next view that observes the same object.
  • Do not use fixed frames on text - Dynamic Type will clip it.

Quality bar

A finished view passes when:

  • Every piece of state has exactly one owner and the narrowest wrapper that works.
  • Instruments shows row bodies evaluating only when their own data changes.
  • Scrolling the largest expected list holds the frame budget on the baseline 60Hz device.
  • Long-lived state is lifted above any view that can disappear, so it survives navigation.
  • Keyboard avoidance and safe areas are handled (safeAreaInset, scrollDismissesKeyboard).
  • VoiceOver reads each interactive element with a meaningful label; the layout survives the largest Dynamic Type size; reduceMotion is respected.
  • Previews exist for loading, empty, error, dark mode, and large-type states.

For app-wide profiling beyond a single screen, pair with mobile-perf-profiler.

Individual skills in this repo

This repo contains 11 individual skills — each has its own dedicated page.

SkillMedev/skills

Designs REST API surfaces - resource naming, HTTP method and status-code semantics, error shapes, pagination, and filtering - and delivers an endpoint spec a consumer can build against without asking questions. Use when someone asks "how should I name this endpoint", "what status code should this return", "should this be PUT or PATCH", "how do I paginate this list", or is reviewing an API before it ships to external consumers. Do NOT use for planning breaking-change rollouts and deprecation windows - use api-versioning-strategist instead; for GraphQL type and resolver design - use graphql-schema instead; for generating client SDKs from an existing spec - use api-client-generator instead; for designing inbound webhook endpoints - use webhook-receiver-hardener instead.

SkillMedev/skills

Turns data and charts into a decision-driving narrative structured as headline finding, trend, implication, and recommended action - with finding-led chart titles, context for every number, annotation guidance, and honest flags on any conclusion the data cannot support. Use when someone says "turn these numbers into a story", "what's the takeaway from this data", "help me present these results to leadership", or has charts but no narrative. Do NOT use for compressing a long document into a one-pager - use executive-summary instead - or for running the analysis that produces the findings - use eda-playbook instead.

SkillMedev/skills

Use when a task needs live or historical money data - "convert USD to EUR", "current/past exchange rate", "FX rate on this date / over this range", or "current price of Bitcoin/Ethereum, market cap, 24h change". Frankfurter (ECB reference rates, no key) is the FX default; CoinGecko's free keyless tier covers crypto. Do NOT use for stock quotes or equities - no keyless stock API survives verification, say so instead of guessing; do NOT use for country economic indicators like GDP or inflation series - use government-open-data instead; if the request is a vague "I need live data", route through public-data-api-picker.

SkillMedev/skills

Builds a driver-based FP&A operating model linking business inputs to P&L, balance sheet, and cash flow outputs. Use when building an annual plan, preparing investor materials, running scenario analysis, or stress-testing the business.

SkillMedev/skills

Use when a task needs live geographic lookups - "geocode this address", "what's at these coordinates" (reverse geocoding), "lat/lon for this city", "which country/state is this ZIP or postal code in", or "country facts: capital, currency, population, flag". Nominatim (OpenStreetMap) is the geocoding default; Zippopotam for postal codes; APICountries for country facts. All keyless. Do NOT use for weather at a location - use weather-climate instead; do NOT use for country-level statistics over time (GDP, population trends) - use government-open-data instead; if the request is a vague "I need live data", route through public-data-api-picker.

SkillMedev/skills

Runs the full Getting Things Done loop - capture, clarify, organize, reflect, engage - building a trusted system of context lists, a projects list with defined next actions, and a weekly review habit. Use when someone says "I'm overwhelmed and things are slipping through the cracks", "set up GTD for me", "help me do a brain dump and organize it", or "my to-do list is a mess". Do NOT use for just running the weekly review ritual itself - use weekly-review instead - or for clearing an email backlog - use inbox-zero.

SkillMedev/skills

Processes any email backlog to zero using the 4Ds - Delete, Delegate, Defer, Do - with a mass-archive strategy for the obvious, a touch-each-email-once discipline, and a keep-it-clear system of batched processing windows, ruthless unsubscribing, filters, and a minimal folder setup. Use when someone says "I have 5,000 unread emails", "help me get to inbox zero", "email is eating my whole day", or treats their inbox as a to-do list. Do NOT use for drafting the reply emails themselves or prioritization rules for an ongoing support queue - use email-triage instead - or for protecting focus time around the email windows - use deep-work-planner instead.

SkillMedev/skills

Runs structured coaching sessions using values clarification and the GROW model, ending every session with one committed action, a deadline, and an if-then plan for the likely obstacle. Use when someone says "I feel stuck in my life", "help me figure out what I want", "hold me accountable to my goals", or "coach me through this decision". Do NOT use for building a stress toolkit - use stress-management instead - or a journaling practice - use journal-framework; for a standing goal-tracking system, use goals-accountability. Coaching, not therapy: signs of clinical distress route to a licensed professional.

SkillMedev/skills

Classifies incident severity (SEV1-4) using impact, scope, and urgency signals and decides who to page. Use when an alert fires or a report comes in and a severity call must be made quickly.

SkillMedev/skills

Use the Skill Me catalog from inside any conversation - discover, install, and manage Claude skills through the Skill Me MCP, and load installed skills automatically each session.

SkillMedev/skills

Writes and tunes PySpark jobs - join strategy and broadcast size limits, shuffle-partition sizing, skew diagnosis and salting, UDF avoidance, caching, and output file layout - with concrete size and skew thresholds. Use when someone asks "why is my Spark job slow", "should I broadcast this join", "one task takes forever while the rest finish", "my job OOMs during a join", or is writing a new PySpark ETL job. Do NOT use for Kafka topic, consumer-group, or streaming-pipeline design - use kafka-pipelines instead; do NOT use for single-machine dataframe work that fits in memory - use pandas-expert instead.

관련 스킬