Communitygithub.com

ComeOnOliver/skillshub

编写、审查或改进 SwiftUI 代码,遵循状态管理、视图组合、性能优化、macOS 特定 API 以及 iOS 26+ Liquid Glass 的最佳实践。适用于构建新的 SwiftUI 功能、重构现有视图、审查代码质量或采用现代 SwiftUI 模式时。

skillshub 是什么?

该技能专门用于帮助开发者在 SwiftUI 项目中编写高质量、符合最佳实践的代码。它涵盖了从状态管理、视图组合、性能优化到平台特定 API 的广泛主题,并提供了详细的主题路由器和参考文件,使得开发者可以根据具体问题快速找到对应的指南。技能强调使用原生 SwiftUI API,避免使用已废弃的 API,并鼓励分离业务逻辑与视图,以提升可测试性。此外,它还特别关注 iOS 26+ 的 Liquid Glass 效果等新特性,并提供向后兼容的降级方案。通过遵循其正确性检查清单和任务工作流,开发者可以有效减少状态管理 bug、提升渲染性能,并确保代码在多个 iOS/macOS 版本上都能正常工作。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/ComeOnOliver/skillshub/tree/HEAD/skills/AvdLee/SwiftUI-Agent-Skill/swiftui-expert-skill

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

SwiftUI 专家技能

操作规则

  • 在每项任务开始时查阅 references/latest-apis.md,避免使用已废弃的 API
  • 优先使用原生 SwiftUI API,而非 UIKit/AppKit 桥接,除非桥接是必需的
  • 注重正确性和性能;不强制要求特定的架构(MVVM、VIPER 等)
  • 鼓励将业务逻辑与视图分离以提高可测试性,但不强制规定如何做
  • 遵循苹果的《人机界面指南》和 API 设计模式
  • 仅在用户明确要求时采用 Liquid Glass(参见 references/liquid-glass.md)
  • 将性能优化作为建议而非要求提出
  • 使用 #available 条件编译并提供合理的回退方案,以支持特定版本的 API

任务工作流

审查现有 SwiftUI 代码

  • 阅读待审查的代码,确定哪些主题适用
  • 标记已废弃的 API(与 references/latest-apis.md 进行比较)
  • 针对每个相关主题运行下面的主题路由器
  • 验证 #available 条件编译和 iOS 26+ 特性的回退路径

改进现有 SwiftUI 代码

  • 根据主题路由器的主题审计当前实现
  • 将已废弃的 API 替换为 references/latest-apis.md 中的现代等价物
  • 重构热路径以减少不必要的状态更新
  • 将复杂的视图 body 拆分为独立的子视图
  • 当遇到 UIImage(data:) 时,建议图像降采样(可选优化,参见 references/image-optimization.md)

实现新的 SwiftUI 功能

  • 先设计数据流:确定属于自身拥有的状态还是注入的状态
  • 优化视图结构以实现高效差异比较(尽早拆分子视图)
  • 应用正确的动画模式(隐式与显式动画、转场)
  • 对所有可点击的元素使用 Button;添加无障碍分组和标签
  • 使用 #available 条件编译特定版本的 API,并提供回退方案

主题路由器

针对与当前任务相关的每个主题,查阅相应的参考文件:

主题参考文件
状态管理references/state-management.md
视图组合references/view-structure.md
性能references/performance-patterns.md
列表与 ForEachreferences/list-patterns.md
布局references/layout-best-practices.md
Sheet 和导航references/sheet-navigation-patterns.md
ScrollViewreferences/scroll-patterns.md
动画(基础)references/animation-basics.md
动画(转场)references/animation-transitions.md
动画(高级)references/animation-advanced.md
无障碍references/accessibility-patterns.md
Swift Chartsreferences/charts.md
图表无障碍references/charts-accessibility.md
图像优化references/image-optimization.md
Liquid Glass(iOS 26+)references/liquid-glass.md
macOS 场景references/macos-scenes.md
macOS 窗口样式references/macos-window-styling.md
macOS 视图references/macos-views.md
已废弃 API 查询references/latest-apis.md

正确性检查清单

以下为硬性规则——违反即视为 bug:

  • @State 属性是 private 的
  • @Binding 仅用于子视图修改父视图状态时
  • 传入的值永远不会声明为 @State 或 @StateObject(它们会忽略更新)
  • @StateObject 用于视图拥有的对象;@ObservedObject 用于注入的对象
  • iOS 17+:@State 与 @Observable 配合使用;@Bindable 用于需要绑定的注入可观察对象
  • ForEach 使用稳定的标识(动态内容绝不使用 .indices)
  • 每个 ForEach 元素的视图数量恒定
  • .animation(_:value:) 始终包含 value 参数
  • iOS 26+ API 使用 #available 条件编译并提供回退
  • 使用图表类型的文件中包含 import Charts

参考文件

  • references/latest-apis.md —— 每项任务首先阅读。 从已废弃到现代的 API 过渡(iOS 15+ 至 iOS 26+)
  • references/state-management.md —— 属性包装器、数据流、@Observable 迁移
  • references/view-structure.md —— 视图提取、容器模式、@ViewBuilder
  • references/performance-patterns.md —— 热路径优化、更新控制、_logChanges()
  • references/list-patterns.md —— ForEach 标识、Table(iOS 16+)、内联过滤陷阱
  • references/layout-best-practices.md —— 布局模式、GeometryReader 替代方案
  • references/accessibility-patterns.md —— VoiceOver、动态类型、分组、特征
  • references/animation-basics.md —— 隐式/显式动画、时序、性能
  • references/animation-transitions.md —— 视图转场、matchedGeometryEffect、Animatable
  • references/animation-advanced.md —— 阶段/关键帧动画(iOS 17+)、@Animatable 宏(iOS 26+)
  • references/charts.md —— Swift Charts 标记、坐标轴、选择、样式、Chart3D(iOS 26+)
  • references/charts-accessibility.md —— 图表 VoiceOver、音频图形、回退策略
  • references/sheet-navigation-patterns.md —— Sheets、NavigationSplitView、Inspector
  • references/scroll-patterns.md —— ScrollViewReader、程序化滚动
  • references/image-optimization.md —— AsyncImage、降采样、缓存
  • references/liquid-glass.md —— iOS 26+ Liquid Glass 效果及回退模式
  • references/macos-scenes.md —— Settings、MenuBarExtra、WindowGroup、多窗口
  • references/macos-window-styling.md —— 工具栏样式、窗口大小、Commands
  • references/macos-views.md —— HSplitView、Table、PasteButton、AppKit 互操作

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

相关技能