Communitygithub.com

ComeOnOliver/skillshub

基於最佳實務與範例驅動的指南,用於建構 SwiftUI 視圖與元件。當您需要建立或重構 SwiftUI UI、使用 TabView 設計分頁架構、組合畫面,或尋找特定元件的模式與範例時適用。

skillshub 是什麼?

此技能(ComeOnOliver/skillshub)為開發者提供了一套結構化的指南與範例驅動參考,用於在 SwiftUI 專案中實作 UI 模式。它支援所有主要的 AI 代理平台(如 Claude Code、Cursor、Codex),並專注於實際的工作流程。其核心在於提供一個可搜尋的元件參考索引(位於 `references/components-index.md`),涵蓋了 TabView、NavigationStack 與 Sheets 等常見元件。此技能強調現代 SwiftUI 慣例:優先使用 `@State`、`@Binding`、`@Observable` 與 `@Environment` 進行狀態管理,而非傳統的 ViewModel;偏好事件驅動的 sheet(`.sheet(item:)`)並讓 Sheet 自行處理其動作;以及採用非同步/等待(async/await)搭配 `.task` 修飾符來處理資料載入。對於新專案,它提供快速啟動模板與接線指南;對於既有專案,則建議透過辨識主要互動模式(如列表、詳細頁、編輯器)並參考相似元件來遵守既有慣例。此技能極具價值,因為它將 SwiftUI 最佳實務濃縮為可立即套用的模式,協助開發者和 AI 代理高效產出一致、乾淨且可維護的 SwiftUI 程式碼。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/ComeOnOliver/skillshub/tree/HEAD/skills/aiskillstore/marketplace/dimillian/swiftui-ui-patterns

在你喜歡的 AI 中提問

開啟一個已預先載入此 Agent Skill 的新對話。

說明文件

# SwiftUI UI 模式

## 快速開始

根據您的目標選擇一個軌跡:

### 既有專案

- 辨識功能或畫面以及主要的互動模型(列表、詳細頁、編輯器、設定、分頁)。
- 在儲存庫中尋找附近的範例,使用 `rg "TabView\("` 或類似指令,然後閱讀最相關的 SwiftUI 視圖。
- 套用當地慣例:偏好使用 SwiftUI 原生的狀態管理,盡量保持狀態為區域變數,並使用環境注入來共享依賴。
- 從 `references/components-index.md` 選取相關的元件參考,並遵循其指引。
- 使用小而專注的子視圖以及 SwiftUI 原生的資料流來建構視圖。

### 新專案架構初始化

- 從 `references/app-scaffolding-wiring.md` 開始,設定 TabView + NavigationStack + sheets。
- 根據提供的骨架添加一個基本的 `AppTab` 和 `RouterPath`。
- 根據您首先需要的 UI 來選擇下一個元件參考(TabView、NavigationStack、Sheets)。
- 隨著新畫面的加入,擴展路由與 sheet 的列舉。

## 需遵循的通用規則

- 使用現代的 SwiftUI 狀態(`@State`、`@Binding`、`@Observable`、`@Environment`),並避免不必要的 ViewModel。
- 偏好組合;保持視圖小而專注。
- 使用 async/await 搭配 `.task` 以及明確的載入/錯誤狀態。
- 僅在編輯既有檔案時才維持現有的舊模式。
- 遵循專案的格式化工具與風格指南。
- **Sheets**:當狀態代表一個選取的模型時,優先使用 `.sheet(item:)` 而非 `.sheet(isPresented:)`。避免在 sheet 的主體內部使用 `if let`。Sheet 應擁有其動作,並在內部呼叫 `dismiss()`,而非轉發 `onCancel`/`onConfirm` 閉包。

## 建立全新 SwiftUI 視圖的工作流程

1. 定義視圖的狀態及其擁有位置。
2. 辨識需要透過 `@Environment` 注入的依賴。
3. 勾勒視圖的層級結構,並將重複的部分提取成子視圖。
4. 使用 `.task` 與必要的明確狀態列舉來實作非同步載入。
5. 若 UI 具有互動性,加入輔助功能標籤或識別符。
6. 透過建置來驗證,並在必要時更新使用點的呼叫。

## 元件參考

使用 `references/components-index.md` 作為入口點。每個元件參考應包含:
- 意圖與最適合的情境。
- 遵循當地慣例的最小使用模式。
- 陷阱與效能注意事項。
- 目前儲存庫中現有範例的路徑。

## Sheet 模式

### 以項目驅動的 Sheet(建議)

```swift
@State private var selectedItem: Item?

.sheet(item: $selectedItem) { item in
    EditItemSheet(item: item)
}

Sheet 擁有其動作

struct EditItemSheet: View {
    @Environment(\.dismiss) private var dismiss
    @Environment(Store.self) private var store

    let item: Item
    @State private var isSaving = false

    var body: some View {
        VStack {
            Button(isSaving ? "儲存中…" : "儲存") {
                Task { await save() }
            }
        }
    }

    private func save() async {
        isSaving = true
        await store.save(item)
        dismiss()
    }
}

新增一個元件參考

  • 建立 references/<component>.md。
  • 保持簡短且可執行;連結到目前儲存庫中的具體檔案。
  • 在 references/components-index.md 中更新新增的項目。

Individual skills in this repo

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

ComeOnOliver/skillshub

Create stunning, animation-rich HTML presentations from scratch or by converting PowerPoint files. Use when the user wants to build a presentation, convert a PPT/PPTX to web, or create slides for a talk/pitch. Helps non-designers discover their aesthetic through visual exploration rather than abstract choices.

ComeOnOliver/skillshub

Next.js 16+ 和 Turbopack — 增量打包、文件系统缓存、开发速度,以及何时使用 Turbopack 与 webpack。

ComeOnOliver/skillshub

SwiftUI architecture patterns, state management with @Observable, view composition, navigation, performance optimization, and modern iOS/macOS UI best practices.

ComeOnOliver/skillshub

See, Understand, Act on video and audio. See- ingest from local files, URLs, RTSP/live feeds, or live record desktop; return realtime context and playable stream links. Understand- extract frames, build visual/semantic/temporal indexes, and search moments with timestamps and auto-clips. Act- transcode and normalize (codec, fps, resolution, aspect ratio), perform timeline edits (subtitles, text/image overlays, branding, audio overlays, dubbing, translation), generate media assets (image, audio, video), and create real time alerts for events from live streams or desktop capture.

ComeOnOliver/skillshub

AI-assisted video editing workflows for cutting, structuring, and augmenting real footage. Covers the full pipeline from raw capture through FFmpeg, Remotion, ElevenLabs, fal.ai, and final polish in Descript or CapCut. Use when the user wants to edit video, cut footage, create vlogs, or build video content.

ComeOnOliver/skillshub

Next.js 15 애플리케이션을 위한 프론트엔드 개발 가이드라인. React 19, TypeScript, Shadcn/ui, Tailwind CSS를 사용한 모던 패턴. Server Components, Client Components, App Router, 파일 구조, Shadcn/ui 컴포넌트, 성능 최적화, TypeScript 모범 사례 포함. 컴포넌트, 페이지, 기능 생성, 데이터 페칭, 스타일링, 라우팅, 프론트엔드 코드 작업 시 사용.

ComeOnOliver/skillshub

Provides Tamagui patterns for config v4, compiler optimization, styled context, and cross-platform styling. Must use when working with Tamagui projects (tamagui.config.ts, @tamagui imports).

ComeOnOliver/skillshub

Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.

ComeOnOliver/skillshub

Create high-converting, visually distinctive landing pages. Use when building marketing pages, product launches, SaaS homepages, or any single-page conversion-focused website. Guides section-by-section composition with anti-AI-slop principles.

ComeOnOliver/skillshub

Auto-loaded context for Portfolio Buddy 2 development. Use for ANY task involving: React 19 development, TypeScript, portfolio analysis features, metrics calculations, trading strategy comparison, or working with the Portfolio Buddy 2 codebase. Contains tech stack, known issues, and architectural constraints.

ComeOnOliver/skillshub

Next.js development tooling via MCP. Inspect routes, components, build info, and debug Next.js apps. Use when working on Next.js applications, debugging routing, or inspecting app structure. NOT for general React or non-Next.js projects.

ComeOnOliver/skillshub

Implement UI using Shadcn MCP (atoms/theme) and 21st.dev MCP (complex sections). Use when adding buttons, layouts, or generating landing pages.

ComeOnOliver/skillshub

A conceptual skill for building an API client in Next.js that handles JWT tokens

ComeOnOliver/skillshub

Best practices and patterns for Next.js App Router, Server Actions, and Routing in this project.

ComeOnOliver/skillshub

The Design System, Theme, and UX rules for the Physical AI Hub.

ComeOnOliver/skillshub

Comprehensive frontend development skill for building modern, performant web applications using ReactJS, NextJS, TypeScript, Tailwind CSS. Includes component scaffolding, performance optimization, bundle analysis, and UI best practices. Use when developing frontend features, optimizing performance, implementing UI/UX designs, managing state, or reviewing frontend code.

ComeOnOliver/skillshub

This document captures learnings from fixing keyboard navigation issues when floating components (Select, DropdownMenu, Popover) have CSS open/close animations.

ComeOnOliver/skillshub

Build Next.js 16 applications with correct patterns and distinctive design. Use when creating pages, layouts, dynamic routes, upgrading from Next.js 15, or implementing proxy.ts. Covers breaking changes (async params/searchParams, Turbopack, cacheComponents) and frontend aesthetics. NOT when building non-React or backend-only applications.

ComeOnOliver/skillshub

Comprehensive Framer Motion animation library for React. Covers motion components, variants, gestures, page transitions, and scroll animations. Use when adding animations to React/Next.js applications.

ComeOnOliver/skillshub

Build interfaces that resonate, not just render. This skill enforces bold, intentional

相關技能