generators

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Code Generators

代码生成器

Production-ready code generators for iOS and macOS apps. Unlike advisory skills (review, audit), these skills generate working code tailored to your project.
适用于iOS和macOS应用的生产级代码生成器。与咨询类技能(评审、审计)不同,这些技能会生成适配您项目的可运行代码。

When This Skill Activates

技能激活场景

Use this skill when the user:
  • Wants to add a common app component (logging, analytics, onboarding, etc.)
  • Asks to "set up" or "add" infrastructure code
  • Mentions replacing print() with proper logging
  • Wants to add App Store review prompts
  • Needs analytics or crash reporting setup
当用户有以下需求时使用本技能:
  • 想要添加常见应用组件(日志、分析、引导流程等)
  • 要求“搭建”或“添加”基础设施代码
  • 提及用专业日志替换print()语句
  • 想要添加App Store评分提示
  • 需要搭建分析或崩溃报告功能

Key Principles

核心原则

1. Context-Aware Generation

1. 上下文感知生成

Before generating code, skills will:
  • Read existing project structure and patterns
  • Detect deployment targets and Swift version
  • Identify architecture patterns (MVVM, TCA, etc.)
  • Check for existing implementations to avoid conflicts
在生成代码前,技能会:
  • 读取现有项目结构和模式
  • 检测部署目标和Swift版本
  • 识别架构模式(MVVM、TCA等)
  • 检查现有实现以避免冲突

2. Protocol-Based Architecture

2. 基于协议的架构

Provider-dependent code uses protocols for easy swapping:
swift
protocol AnalyticsService { ... }
class TelemetryDeckAnalytics: AnalyticsService { ... }
class FirebaseAnalytics: AnalyticsService { ... }
// Change provider by swapping ONE line
依赖供应商的代码使用协议实现轻松替换:
swift
protocol AnalyticsService { ... }
class TelemetryDeckAnalytics: AnalyticsService { ... }
class FirebaseAnalytics: AnalyticsService { ... }
// 仅需替换一行代码即可切换供应商

3. Platform Detection

3. 平台检测

Skills detect iOS vs macOS and App Store vs direct distribution to generate appropriate code.
技能会检测iOS与macOS、App Store分发与直接分发的差异,生成对应的适配代码。

Available Generators

可用生成器

Read relevant module files based on the user's needs:
根据用户需求读取相关模块文件:

logging-setup/

logging-setup/

Replace print() statements with structured os.log/Logger.
  • Audit existing print() usage
  • Generate AppLogger infrastructure
  • Migrate print → Logger with proper privacy levels
用结构化的os.log/Logger替换print()语句。
  • 审计现有print()使用情况
  • 生成AppLogger基础设施
  • 将print语句迁移至Logger,并配置合适的隐私级别

analytics-setup/

analytics-setup/

Protocol-based analytics with swappable providers.
  • TelemetryDeck, Firebase, Mixpanel support
  • NoOp implementation for testing/privacy
  • Easy provider switching
基于协议的分析功能,支持切换供应商。
  • 支持TelemetryDeck、Firebase、Mixpanel
  • 提供用于测试/隐私保护的NoOp实现
  • 轻松切换供应商

onboarding-generator/

onboarding-generator/

Multi-step onboarding flow with persistence.
  • Paged or stepped navigation
  • @AppStorage persistence
  • Skip option configuration
  • Accessibility support
带持久化功能的多步骤引导流程。
  • 分页或分步导航
  • 基于@AppStorage的持久化
  • 可配置跳过选项
  • 支持无障碍功能

review-prompt/

review-prompt/

Smart App Store review prompts.
  • Platform detection (skips for non-App Store macOS)
  • Configurable trigger conditions
  • Smart timing logic
  • Debug override for testing
智能App Store评分提示。
  • 平台检测(对非App Store分发的macOS应用跳过)
  • 可配置触发条件
  • 智能时机逻辑
  • 测试用的调试覆盖选项

networking-layer/

networking-layer/

Protocol-based API client with async/await.
  • Clean APIClient protocol for mocking/swapping
  • Type-safe endpoint definitions
  • Comprehensive error handling
  • Environment-based configuration
基于协议的API客户端,支持async/await。
  • 用于模拟/替换的简洁APIClient协议
  • 类型安全的端点定义
  • 全面的错误处理
  • 基于环境的配置

auth-flow/

auth-flow/

Complete authentication flow.
  • Sign in with Apple integration
  • Biometric authentication (Face ID/Touch ID)
  • Secure Keychain storage
  • Credential state monitoring
完整的认证流程。
  • 集成Apple登录
  • 生物识别认证(Face ID/Touch ID)
  • 安全的Keychain存储
  • 凭证状态监控

paywall-generator/

paywall-generator/

StoreKit 2 subscription paywall.
  • Full StoreKit 2 implementation
  • Product loading, purchasing, restoring
  • Subscription status with Environment
  • Beautiful paywall UI
基于StoreKit 2的订阅付费墙。
  • 完整的StoreKit 2实现
  • 产品加载、购买、恢复功能
  • 带Environment的订阅状态
  • 美观的付费墙UI

settings-screen/

settings-screen/

Complete settings screen with modular sections.
  • Centralized AppSettings with @AppStorage
  • Appearance, Notifications, Account, About, Legal sections
  • Cross-platform (iOS/macOS)
  • Reusable row components
带模块化板块的完整设置界面。
  • 基于@AppStorage的集中式AppSettings
  • 外观、通知、账户、关于、法律板块
  • 跨平台(iOS/macOS)
  • 可复用的行组件

persistence-setup/

persistence-setup/

SwiftData persistence with optional iCloud sync.
  • SwiftData container configuration
  • Repository pattern for testability
  • Optional CloudKit/iCloud sync
  • Sync status monitoring
  • Migration support
带可选iCloud同步的SwiftData持久化。
  • SwiftData容器配置
  • 用于可测试性的仓库模式
  • 可选CloudKit/iCloud同步
  • 同步状态监控
  • 迁移支持

error-monitoring/

error-monitoring/

Protocol-based crash/error reporting.
  • Sentry and Firebase Crashlytics support
  • NoOp implementation for testing/privacy
  • Breadcrumbs for debugging context
  • User context (anonymized)
  • Easy provider swapping
基于协议的崩溃/错误报告。
  • 支持Sentry和Firebase Crashlytics
  • 提供用于测试/隐私保护的NoOp实现
  • 用于调试上下文的面包屑记录
  • 匿名化的用户上下文
  • 轻松切换供应商

ci-cd-setup/

ci-cd-setup/

CI/CD configuration for automated builds and deployment.
  • GitHub Actions workflows (build, test, TestFlight, App Store)
  • Xcode Cloud scripts and setup guide
  • fastlane lanes for advanced automation
  • Code signing and secrets management
  • macOS notarization support
用于自动化构建和部署的CI/CD配置。
  • GitHub Actions工作流(构建、测试、TestFlight、App Store)
  • Xcode Cloud脚本和设置指南
  • 用于高级自动化的fastlane lanes
  • 代码签名和密钥管理
  • 支持macOS公证

localization-setup/

localization-setup/

Internationalization (i18n) infrastructure for multi-language apps.
  • String Catalogs (iOS 16+, recommended)
  • Type-safe L10n enum for compile-time safety
  • Pluralization and interpolation patterns
  • RTL layout support
  • SwiftUI preview helpers for testing locales
用于多语言应用的国际化(i18n)基础设施。
  • String Catalogs(iOS 16+,推荐使用)
  • 用于编译时安全的类型安全L10n枚举
  • 复数和插值模式
  • RTL布局支持
  • 用于测试语言环境的SwiftUI预览助手

push-notifications/

push-notifications/

Push notification infrastructure with APNs setup.
  • Registration and authorization flow
  • UNUserNotificationCenterDelegate implementation
  • Notification categories with action buttons
  • Type-safe payload parsing
  • Rich notifications and silent notifications
带APNs配置的推送通知基础设施。
  • 注册和授权流程
  • UNUserNotificationCenterDelegate实现
  • 带操作按钮的通知分类
  • 类型安全的负载解析
  • 富通知和静默通知

deep-linking/

deep-linking/

Deep linking with URL schemes, Universal Links, and App Intents.
  • Custom URL scheme handling
  • Universal Links with AASA file
  • App Intents for Siri and Shortcuts
  • Type-safe route definitions and navigation
  • Spotlight indexing support
支持URL Scheme、Universal Links和App Intents的深度链接。
  • 自定义URL Scheme处理
  • 带AASA文件的Universal Links
  • 用于Siri和快捷指令的App Intents
  • 类型安全的路由定义和导航
  • 支持Spotlight索引

test-generator/

test-generator/

Test templates for unit, integration, and UI tests.
  • Swift Testing (modern, iOS 16+) and XCTest patterns
  • Mock object generation
  • ViewModel and service testing patterns
  • UI testing with page object pattern
单元测试、集成测试和UI测试的模板。
  • Swift Testing(现代,iOS 16+)和XCTest模式
  • 生成Mock对象
  • ViewModel和服务的测试模式
  • 基于页面对象模式的UI测试

accessibility-generator/

accessibility-generator/

Accessibility infrastructure for inclusive apps.
  • VoiceOver labels, hints, and traits
  • Dynamic Type support with scaling
  • Reduce Motion handling
  • Accessibility audit checklist
用于包容性应用的无障碍基础设施。
  • VoiceOver标签、提示和特性
  • 支持动态类型缩放
  • 处理减少动效设置
  • 无障碍审计清单

widget-generator/

widget-generator/

WidgetKit widgets for home screen and lock screen.
  • Static and interactive widgets (iOS 17+)
  • Timeline providers
  • Lock screen complications
  • Widget intents for configuration
用于主屏幕和锁屏的WidgetKit小组件。
  • 静态和交互式小组件(iOS 17+)
  • Timeline提供者
  • 锁屏复杂功能
  • 用于配置的Widget Intents

feature-flags/

feature-flags/

Feature flag infrastructure with local and remote support.
  • Protocol-based service
  • Firebase Remote Config integration
  • Local defaults with remote override
  • Debug menu for testing
支持本地和远程配置的功能标志基础设施。
  • 基于协议的服务
  • 集成Firebase Remote Config
  • 本地默认值支持远程覆盖
  • 用于测试的调试菜单

How to Use

使用方法

  1. User requests a component (e.g., "add logging to my app")
  2. Read the relevant skill's SKILL.md
  3. Run pre-generation checks (conflicts, deployment target, etc.)
  4. Ask configuration questions via AskUserQuestion
  5. Generate code from templates, adapting to project context
  6. Provide integration instructions
  1. 用户请求某个组件(例如:“为我的应用添加日志功能”)
  2. 读取相关技能的SKILL.md文件
  3. 运行生成前检查(冲突、部署目标等)
  4. 通过AskUserQuestion询问配置问题
  5. 从模板生成代码,并适配项目上下文
  6. 提供集成说明

Output Format

输出格式

After generation, always provide:
  • Files created (with full paths)
  • Integration steps (how to wire into existing code)
  • Required capabilities (entitlements, dependencies)
  • Testing instructions (how to verify it works)
生成完成后,需始终提供:
  • 创建的文件(带完整路径)
  • 集成步骤(如何接入现有代码)
  • 所需权限(授权、依赖)
  • 测试说明(如何验证功能正常)