一键导入
swift-development
提供 Swift 6+ 核心语言开发能力,涵盖并发编程、宏、数据模型设计和业务逻辑实现。使用此技能编写 ViewModel、Service 或 Repository 层代码、定义数据模型、实现算法、编写单元测试,或修复并发警告和数据竞争时使用。
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
提供 Swift 6+ 核心语言开发能力,涵盖并发编程、宏、数据模型设计和业务逻辑实现。使用此技能编写 ViewModel、Service 或 Repository 层代码、定义数据模型、实现算法、编写单元测试,或修复并发警告和数据竞争时使用。
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Expert Git skills covering interactive rebase, worktree management, reflog recovery, bisect debugging, advanced workflows, commit message best practices, and clean history management. Use this skill when needing advanced Git operations, cleaning commit history, managing multiple worktrees, recovering lost commits, debugging with bisect, or implementing sophisticated Git workflows.
Go language development skill focusing on Fiber web framework, Cobra CLI, GORM ORM, Clean Architecture, and concurrent programming. Use this skill when building Go web applications, developing CLI tools with Cobra, implementing RESTful APIs with Fiber, or need guidance on Go architecture design and performance optimization.
Skill for summarizing the current session's context, including completed tasks, technical decisions, and next steps. Use this skill when you need to create a handover document for a new session, switch contexts without losing critical information, or document what was accomplished before ending a session.
Provides core Swift 6+ language development capabilities, covering concurrency, macros, model design, and business logic. Use this skill when writing ViewModel, Service, or Repository layer code, defining data models, implementing algorithms, writing unit tests, or fixing concurrency warnings and data races.
Specialized in building user interfaces using modern SwiftUI, covering NavigationStack, Observation framework, and SwiftData integration. Use this skill when writing SwiftUI view files, designing app navigation, handling animations and transitions, or binding ViewModel data to the interface.
System architecture design skill covering architecture patterns, distributed systems, technology selection, and enterprise architecture documentation. Use this skill when designing system architectures, evaluating technology stacks, planning distributed systems, or creating architecture decision records and documentation.
| name | swift-development |
| description | 提供 Swift 6+ 核心语言开发能力,涵盖并发编程、宏、数据模型设计和业务逻辑实现。使用此技能编写 ViewModel、Service 或 Repository 层代码、定义数据模型、实现算法、编写单元测试,或修复并发警告和数据竞争时使用。 |
当处理非 UI 的 Swift 代码、业务逻辑、算法或数据层时,请遵循本指南。你的目标是编写高性能、线程安全且富有表现力的 Swift 代码。
/// 一个线程安全的用户数据服务
actor UserService {
private var cache: [String: User] = [:]
// 使用 typed throws 明确错误类型
func fetchUser(id: String) async throws(NetworkError) -> User {
if let cached = cache[id] {
return cached
}
// 模拟网络请求
let user = try await NetworkClient.shared.get("/users/\(id)", as: User.self)
cache[id] = user
return user
}
}
import Testing
@testable import MyApp
@Test("User parsing should succeed")
func userParsing() async throws {
let json = """
{ "id": "1", "name": "Alice" }
""".data(using: .utf8)!
let user = try JSONDecoder().decode(User.self, from: json)
#expect(user.name == "Alice")
#expect(user.id == "1")
}
Sendable 协议。let over var: 默认使用常量,仅在必要时使用变量。throws 和 do-catch,而不是返回 Optional 或 Result 类型(在 async 上下文中 throws 更自然)。[weak self] 或 [unowned self] 的使用(但在 Task 中通常不需要 weak,除非为了打破循环引用)。