Token导航 LogoToken导航TokenDH.com
开发external-servicegithub未标认证来源可访问clear审计提醒

moai-lang-swiftmoai lang Swift 搜索

Agent Skill

moai-lang-swift 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

582

周安装

24

GitHub Stars

15

下载量

190
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:moai-lang-swift(moai lang Swift 搜索)
来源仓库:https://github.com/mosif16/codex-skills
仓库路径:skills/moai-lang-swift
安装命令:
npx skills add https://github.com/mosif16/codex-skills --skill moai-lang-swift
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/mosif16/codex-skills --skill moai-lang-swift

简介

moai-lang-swift 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中整理仓库状态与协作事项。

  • 适用于围绕代码变更、仓库状态或协作流程进行信息梳理的场景。
  • 通过 npx skills add 命令从指定 GitHub 仓库安装并使用该技能。
  • 安装前需确认权限范围、维护状态,注意是否涉及联网、命令执行或文件读写操作。
  • 适用宿主包括 Codex、Claude、Cursor、Gemini CLI,接入前应确认版本、权限和运行环境要求。

SKILL.md

Swift - Enterprise

Metadata

FieldValue
Skill Namemoai-lang-swift
Version4.0.0 (2025-11-12)
Allowed toolsRead, Bash, Context7 MCP
Auto-loadOn demand when keywords detected
TierLanguage Enterprise
Context7 Integration✅ Swift/SwiftUI/Vapor/Combine

What It Does

Swift 6.0 enterprise development featuring modern concurrency with async/await, SwiftUI for declarative UI, Combine for reactive programming, server-side Swift with Vapor, and enterprise-grade patterns for scalable, performant applications. Context7 MCP integration provides real-time access to official Swift and ecosystem documentation.

Key capabilities:

  • ✅ Swift 6.0 with strict concurrency and actor isolation
  • ✅ Advanced async/await patterns and structured concurrency
  • ✅ SwiftUI 6.0 for declarative UI development
  • ✅ Combine framework for reactive programming
  • ✅ Server-side Swift with Vapor 4.x
  • ✅ Enterprise architecture patterns (MVVM, TCA, Clean Architecture)
  • ✅ Context7 MCP integration for real-time docs
  • ✅ Performance optimization and memory management
  • ✅ Testing strategies with XCTest and Swift Testing
  • ✅ Swift Concurrency with actors and distributed actors

When to Use

Automatic triggers:

  • Swift 6.0 development discussions
  • SwiftUI and iOS/macOS app development
  • Async/await and concurrency patterns
  • Combine reactive programming
  • Server-side Swift and Vapor development
  • Enterprise mobile application architecture

Manual invocation:

  • Design iOS/macOS application architecture
  • Implement async/await patterns
  • Optimize performance and memory usage
  • Review enterprise Swift code
  • Implement reactive UI with Combine
  • Troubleshoot concurrency issues

Technology Stack (2025-11-12)

ComponentVersionPurposeStatus
Swift6.0.1Core language✅ Current
SwiftUI6.0Declarative UI✅ Current
Combine6.0Reactive programming✅ Current
Vapor4.102.0Server-side framework✅ Current
Xcode16.2Development environment✅ Current
Swift Concurrency6.0Async/await & actors✅ Current
Swift Testing0.10.0Modern testing framework✅ Current

Quick Start: Hello Async/Await

import Foundation

// Swift 6.0 with async/await
actor GreeterService {
    func greet(name: String) -> String {
        "Hello, \(name)!"
    }
}

// Usage
Task {
    let service = GreeterService()
    let greeting = await service.greet(name: "Swift")
    print(greeting)
}

Level 1: Quick Reference

Core Concepts

  1. Async/Await - Modern concurrency without callbacks

- Function marked with async - Suspends for I/O - Caller uses await - Waits for result - Native error handling with throws - Replaces callbacks and completion handlers

  1. SwiftUI - Declarative UI framework

- State-driven views update automatically - @State for local state - @StateObject for ViewModels - Composable views with modifiers

  1. Combine - Reactive programming

- Publishers emit values - Operators transform pipelines - Subscribers receive results - Error handling with .catch

  1. Actors - Thread-safe state isolation

- Protect mutable state automatically - Replace locks and semaphores - @MainActor for UI thread - Distributed actors for RPC

  1. Vapor - Server-side Swift

- Async route handlers - Database integration (Fluent) - Middleware for cross-cutting concerns - Type-safe API responses

Project Structure

MyApp/
├── Sources/
│   ├── App.swift                 # Entry point
│   ├── Models/                   # Data types
│   ├── Services/                 # Business logic
│   ├── ViewModels/               # UI state management
│   └── Views/                    # SwiftUI components
├── Tests/
│   ├── UnitTests/
│   └── IntegrationTests/
└── Package.swift                 # Dependencies

Level 2: Implementation Patterns

Async/Await Pattern

import Foundation

// Structured async function
func fetchData() async throws -> String {
    let url = URL(string: "https://api.example.com/data")!
    let (data, _) = try await URLSession.shared.data(from: url)
    return String(data: data, encoding: .utf8) ?? ""
}

// Concurrent operations with TaskGroup
func loadMultipleResources() async throws -> (String, String) {
    try await withThrowingTaskGroup(of: (String, String).self) { group in
        group.addTask { ("users", try await fetchUsers()) }
        group.addTask { ("posts", try await fetchPosts()) }

        var results: [String: String] = [:]
        for try await (key, value) in group {
            results[key] = value
        }
        return (results["users"] ?? "", results["posts"] ?? "")
    }
}

SwiftUI State Management

import SwiftUI

@MainActor
class ContentViewModel: ObservableObject {
    @Published var items: [String] = []
    @Published var isLoading = false

    func loadItems() async {
        isLoading = true
        defer { isLoading = false }

        do {
            items = try await fetchItems()
        } catch {
            items = []
        }
    }
}

struct ContentView: View {
    @StateObject private var viewModel = ContentViewModel()

    var body: some View {
        NavigationView {
            VStack {
                if viewModel.isLoading {
                    ProgressView()
                } else {
                    List(viewModel.items, id: \.self) { item in
                        Text(item)
                    }
                }
            }
            .navigationTitle("Items")
            .task {
                await viewModel.loadItems()
            }
        }
    }
}

Actor Isolation Pattern

// Thread-safe counter
actor CounterService {
    private var count: Int = 0

    func increment() { count += 1 }
    func decrement() { count -= 1 }
    func getCount() -> Int { count }
}

// Usage (automatically thread-safe)
Task {
    let counter = CounterService()
    await counter.increment()
    let value = await counter.getCount()
}

Vapor Server Route

import Vapor

func routes(_ app: Application) throws {
    // GET /api/users
    app.get("api", "users") { req async -> [String: String] in
        return ["status": "success"]
    }

    // POST /api/users
    app.post("api", "users") { req async -> HTTPStatus in
        // Save user
        return .created
    }
}

Level 3: Advanced Topics

Concurrency Best Practices

  1. Prefer async/await over Combine for sequential operations
  2. Use actors for mutable shared state (not locks)
  3. Mark UI code @MainActor to ensure main thread
  4. Handle cancellation properly in long-running tasks
  5. Avoid blocking operations (no sleep, no synchronous I/O)

Performance Optimization

  • Memory: Use value types (struct) by default
  • CPU: Profile with Xcode Instruments
  • Rendering: Keep SwiftUI view body pure
  • Networking: Implement request caching
  • Database: Use connection pooling in Vapor

Security Patterns

  • Input validation: Always validate user input
  • Error handling: Don't expose internal errors to users
  • Encryption: Use CryptoKit for sensitive data
  • Authentication: Implement JWT or OAuth2
  • SQL injection prevention: Use parameterized queries

Testing Strategy

  • Unit tests: Pure functions with XCTest
  • Integration tests: Database and API tests
  • UI tests: SwiftUI view behavior
  • Mocking: Use protocols for dependency injection

Context7 MCP Integration

Get latest Swift documentation on-demand:

# Access Swift documentation via Context7
from context7 import resolve_library_id, get_library_docs

# Swift Language Documentation
swift_id = resolve_library_id("swift")
docs = get_library_docs(
    context7_compatible_library_id=swift_id,
    topic="structured-concurrency",
    tokens=5000
)

# SwiftUI Documentation
swiftui_id = resolve_library_id("swiftui")
swiftui_docs = get_library_docs(
    context7_compatible_library_id=swiftui_id,
    topic="state-management",
    tokens=4000
)

# Vapor Framework Documentation
vapor_id = resolve_library_id("vapor")
vapor_docs = get_library_docs(
    context7_compatible_library_id=vapor_id,
    topic="routing",
    tokens=3000
)

Related Skills & Resources

Language Integration:

  • Skill("moai-context7-lang-integration"): Latest Swift/Vapor documentation

Quality & Testing:

  • Skill("moai-foundation-testing"): Swift testing best practices
  • Skill("moai-foundation-trust"): TRUST 5 principles application

Security & Performance:

  • Skill("moai-foundation-security"): Security patterns for Swift
  • Skill("moai-essentials-debug"): Swift debugging techniques

Official Resources:


Troubleshooting

Problem: Sendable conformance error Solution: Implement Sendable protocol or use @Sendable closure

Problem: Actor isolation violation Solution: Use nonisolated for safe properties or proper await calls

Problem: Memory leaks in closures Solution: Capture [weak self] to break retain cycles

Problem: SwiftUI view not updating Solution: Ensure state changes happen on @MainActor


Changelog

  • .0 (2025-11-12): Enterprise upgrade - Progressive Disclosure structure, 90% content reduction, Context7 integration
  • v3.0.0 (2025-03-15): SwiftUI 5.0 and Combine 6.0 patterns
  • v2.0.0 (2025-01-10): Basic Swift 5.x patterns
  • v1.0.0 (2024-12-01): Initial release

Resources

For working examples: See examples.md

For API reference: See reference.md

For advanced patterns: See full SKILL.md in documentation archive


*Last updated: 2025-11-12 | Maintained by moai-adk team*

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

28.64%
按下载量换算54

trae

25.91%
按下载量换算49

Gemini CLI

16.76%
按下载量换算32

Antigravity

12.32%
按下载量换算23

windsurf

8.55%
按下载量换算16

OpenCode

3.76%
按下载量换算7

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

external-service

该 Skill 可能调用第三方服务、云服务或外部模型 API,使用前需要确认账号、额度、数据发送范围和服务条款。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。

来源信息

继续浏览同类 Skills