Communitygithub.com

ulasalyesil/personal-website-v2

用於建立及重構 SwiftUI 檢視與元件的最佳實務及範例驅動指南。在建立或重構 SwiftUI 使用者介面、以 TabView 設計分頁架構、組合畫面,或需要特定元件的模式及範例時使用。

personal-website-v2 是什麼?

這是一份專為 SwiftUI 開發者設計的準則文件,提供建立與重構使用者介面的結構化方法。文件涵蓋從現有專案功能識別到全新專案架設的完整工作流程,強調使用現代 SwiftUI 狀態管理(如 @State、@Observable、@Environment)取代傳統 ViewModel,並透過 `.task` 搭配 async/await 處理非同步載入與錯誤狀態。文件特別詳細說明 Sheet 的兩種實作模式,並明確建議優先使用 `.sheet(item:)` 搭配模型驅動的方式,讓 Sheet 內部自行處理 dismiss 而非向外傳遞回呼。此外,它包含元件參考索引與新增元件的標準流程,適用於所有支援 SwiftUI 的 Apple 平台(iOS、macOS、watchOS、tvOS),適合團隊協作或個人專案保持一致的程式碼風格。

相容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/ulasalyesil/personal-website-v2/tree/HEAD/.agent/skills/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(建議使用)

@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.

ulasalyesil/personal-website-v2

Create beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations.

ulasalyesil/personal-website-v2

Conduct design interviews, generate five distinct UI variations in a temporary design lab, collect feedback, and produce implementation plans. Use when the user wants to explore UI design options, redesign existing components, or create new UI with multiple approaches to compare.

ulasalyesil/personal-website-v2

Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, artifacts, posters, or applications (examples include websites, landing pages, dashboards, React components, HTML/CSS layouts, or when styling/beautifying any web UI). Generates creative, polished code and UI design that avoids generic AI aesthetics.

ulasalyesil/personal-website-v2

Design and implement microinteractions, motion design, transitions, and user feedback patterns. Use when adding polish to UI interactions, implementing loading states, or creating delightful user experiences.

ulasalyesil/personal-website-v2

This skill is for interface design — dashboards, admin panels, apps, tools, and interactive products. NOT for marketing design (landing pages, marketing sites, campaigns).

ulasalyesil/personal-website-v2

UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 9 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind, shadcn/ui). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient. Integrations: shadcn/ui MCP for component search and examples.

ulasalyesil/personal-website-v2

Conduct WCAG 2.2 accessibility audits with automated testing, manual verification, and remediation guidance. Use when auditing websites for accessibility, fixing WCAG violations, or implementing accessible design patterns.

ulasalyesil/personal-website-v2

Review UI code for Web Interface Guidelines compliance. Use when asked to "review my UI", "check accessibility", "audit design", "review UX", or "check my site against best practices".

ulasalyesil/personal-website-v2

Enforces an opinionated UI baseline to prevent AI-generated interface slop.

ulasalyesil/personal-website-v2

Build modern, composable, and accessible React UI components following the components.build specification. Use when creating, reviewing, or refactoring component libraries, design systems, or any reusable UI components. Triggers on tasks involving component APIs, composition patterns, accessibility, styling systems, or TypeScript props.

ulasalyesil/personal-website-v2

Ship correct, complete metadata.

ulasalyesil/personal-website-v2

Survey any codebase as a senior advisor and produce prioritized, self-contained implementation plans for OTHER models/agents to execute. Strictly read-only on source code — never implements, fixes, or refactors anything itself. Use when asked to audit a codebase, find improvement opportunities (bugs, security, performance, test coverage, tech debt, migrations, DX), suggest features or where to take the project next (roadmap, product direction), or generate handoff plans for another agent to implement.

ulasalyesil/personal-website-v2

Defines the product's objects, relationships, states, and vocabulary independently of any interface — the most load-bearing layer

ulasalyesil/personal-website-v2

Maps domain concepts, terminology conflicts, and bounded contexts — produces a noun harvest for the conceptual model layer

ulasalyesil/personal-website-v2

Maps interaction structure and flow — produces breadboard notation with edge cases, failure paths, and open decisions

ulasalyesil/personal-website-v2

Framework orientation for Layers of Product Design — load this first; provides the context all other skills depend on

ulasalyesil/personal-website-v2

User research planning and synthesis at the observed behaviour layer — produces candidate job stories with confidence ratings

ulasalyesil/personal-website-v2

Diagnostic audit across all seven layers — identifies the bottleneck layer and recommends where to focus

ulasalyesil/personal-website-v2

Connects user opportunities to business outcomes and solution bets — produces a strategy tree and prioritised experiments

ulasalyesil/personal-website-v2

Audits existing surface against lower-layer decisions and produces a surface decision inventory — vocabulary, object consistency, completeness, feedback, hierarchy, accessibility

相關技能