Communitygithub.com

ulasalyesil/personal-website-v2

基于最佳实践和示例驱动的方法,指导构建 SwiftUI 视图和组件。适用于创建或重构 SwiftUI 用户界面、设计 TabView 标签架构、组合屏幕,或需要特定组件的模式和示例时。

personal-website-v2 是什么?

该技能为 SwiftUI 开发者提供了一套结构化且基于示例的构建 UI 组件与视图的指南。它涵盖了从现有项目中识别并应用本地模式,到为新项目搭建 TabView、NavigationStack 和 sheet 的完整脚手架。技能强调使用现代 SwiftUI 状态管理(`@State`、`@Binding`、`@Observable`、`@Environment`)和 `async/await` 并行编程,通过 `references/components-index.md` 入口文件提供组件参考,每个参考都包含意图、最佳使用场景、最小使用模式、陷阱和性能说明。它支持所有 SwiftUI 平台(iOS、macOS、tvOS、watchOS),并通过具体的代码示例(如首选 `.sheet(item:)` 方法、让 sheet 自行处理操作和调用 `dismiss()`)确保最佳实践。对于新视图,它会引导定义状态、通过 `@Environment` 注入依赖、提取子视图、实现异步加载以及添加无障碍标签。此外,它还指导如何添加新的组件参考文件并更新索引。

兼容平台~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),避免不必要的视图模型。
  • 优先使用组合;保持视图小而专注。
  • 使用 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

相关技能