商业与职场

苹果应用远程推送功能开发

按现有Swift项目和通知类型生成APNs注册与处理代码,可加通知操作、图片及自定义界面。

# 推送通知生成器

生成包含 APNs 注册、处理和富通知的推送通知基础设施。

## 此 Skill 何时启用

- 用户想为应用添加推送通知
- 用户提到 APNs(Apple Push Notification service)
- 用户询问通知类别或操作
- 用户想要包含图片或自定义 UI 的富通知

## 生成前检查

生成之前,确认:

1. **现有通知代码**
   ```bash
   # Check for existing notification handling
   grep -r "UNUserNotificationCenter\|registerForRemoteNotifications" --include="*.swift" | head -5
   ```

2. **Entitlements**
   ```bash
   # Check for push notification entitlement
   find . -name "*.entitlements" -exec grep -l "aps-environment" {} \;
   ```

3. **App Delegate 或 SwiftUI App**
   ```bash
   # Determine app structure
   grep -r "@main\|UIApplicationDelegate" --include="*.swift" | head -5
   ```

## 配置问题

### 1. 通知类型
- **基础** - 带标题和正文的简单提醒
- **富通知** - 包含图片、自定义 UI(需要 Notification Service Extension)
- **两者都要** - 完整的通知支持

### 2. 通知操作
- **无** - 仅显示通知
- **简单操作** - 快捷操作按钮
- **自定义类别** - 多个操作类别

### 3. 静默通知
- **是** - 后台数据更新
- **否** - 仅用户可见的通知

## 生成的文件

### 核心基础设施
```
Sources/Notifications/
├── NotificationManager.swift      # Central notification management
├── NotificationDelegate.swift     # UNUserNotificationCenterDelegate
├── NotificationCategories.swift   # Action categories definition
└── NotificationPayload.swift      # Type-safe payload parsing
```

### 富通知(可选)
```
NotificationServiceExtension/
├── NotificationService.swift      # Modify notifications before display
└── Info.plist                     # Extension configuration
```

### 内容扩展(可选)
```
NotificationContentExtension/
├── NotificationViewController.swift  # Custom notification UI
├── MainInterface.storyboard
└── Info.plist
```

## 主要功能

### 注册流程

```swift
@MainActor
final class NotificationManager {
    static let shared = NotificationManager()

    func requestAuthorization() async throws -> Bool {
        let center = UNUserNotificationCenter.current()
        let options: UNAuthorizationOptions = [.alert, .badge, .sound]
        return try await center.requestAuthorization(options: options)
    }

    func registerForRemoteNotifications() {
        UIApplication.shared.registerForRemoteNotifications()
    }
}
```

### 处理通知

```swift
// Foreground notification
func userNotificationCenter(
    _ center: UNUserNotificationCenter,
    willPresent notification: UNNotification
) async -> UNNotificationPresentationOptions {
    return [.banner, .sound, .badge]
}

// Notification tap/action
func userNotificationCenter(
    _ center: UNUserNotificationCenter,
    didReceive response: UNNotificationResponse
) async {
    let userInfo = response.notification.request.content.userInfo
    await handleNotificationAction(response.actionIdentifier, userInfo: userInfo)
}
```

### 操作类别

```swift
enum NotificationCategory: String {
    case message = "MESSAGE_CATEGORY"
    case reminder = "REMINDER_CATEGORY"

    var actions: [UNNotificationAction] {
        switch self {
        case .message:
            return [
                UNNotificationAction(identifier: "REPLY", title: "Reply", options: []),
                UNNotificationAction(identifier: "MARK_READ", title: "Mark as Read", options: [])
            ]
        case .reminder:
            return [
                UNNotificationAction(identifier: "COMPLETE", title: "Complete", options: []),
                UNNotificationAction(identifier: "SNOOZE", title: "Snooze", options: [])
            ]
        }
    }
}
```

## 通知设计(WWDC18)

“打扰他人是一项真正的特权……这是一种信任关系。”先设计策略,再设计基础设施:

| 决策 | 规则 |
|----------|------|
| 授权 | 对点赞和评论等被动内容使用**临时授权**(将 `.provisional` 添加到选项中——静默送达通知中心,不弹出提示);将明确的授权提示留给**时效性强的**内容 |
| 何时请求授权 | **绝不要在首次启动时请求。** 先说明价值,再在与场景相关的时刻请求——例如订单刚提交之后,而不是用户下单之前 |
| 内容标准 | 每条通知都应包含**具体消息或可完成的任务**——绝不要只发空洞的“打开应用”提醒 |
| 时机 | 在相关时刻送达;适合时使用基于时间和位置的推送 |
| 设置 | 在应用内提供**按主题细分的开关**,并添加 `.providesAppNotificationSettings`,使系统设置中的“Manage”通过深层链接跳转到你的页面 |
| 分组 | 默认按应用分组;**仅针对有实际区别的信息流**(对话、不同来源)设置 `threadIdentifier`——过度分线程会重新造成分组本来要解决的杂乱问题 |
| 丰富内容 | 富通知是一个**独立完整的内容包**:图片或视频加上无需启动应用即可完成任务的操作 |
| 通知疲劳 | **暂停发送用户反复忽略的通知类型**(Duolingo 的做法)——保持安静总比被卸载好 |

## 所需功能

### 在 Xcode 中
1. 选择项目 target
2. 打开 Signing & Capabilities 选项卡
3. 添加“Push Notifications”功能
4. 添加“Background Modes” > “Remote notifications”(用于静默通知)

### Entitlements
```xml
<key>aps-environment</key>
<string>development</string>  <!-- or "production" -->
```

## 集成步骤

### 1. SwiftUI App

```swift
@main
struct MyApp: App {
    @UIApplicationDelegateAdaptor private var appDelegate: AppDelegate

    var body: some Scene {
        WindowGroup {
            ContentView()
        }
    }
}

class AppDelegate: NSObject, UIApplicationDelegate {
    func application(
        _ application: UIApplication,
        didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
    ) -> Bool {
        UNUserNotificationCenter.current().delegate = NotificationDelegate.shared
        NotificationCategories.registerAll()
        return true
    }

    func application(
        _ application: UIApplication,
        didRegisterForRemoteNotificationsWithDeviceToken deviceToken: Data
    ) {
        let token = deviceToken.map { String(format: "%02.2hhx", $0) }.joined()
        print("Device Token: \(token)")
        // Send token to your server
    }
}
```

### 2. 请求权限(在适当时机)

```swift
Button("Enable Notifications") {
    Task {
        let granted = try await NotificationManager.shared.requestAuthorization()
        if granted {
            await MainActor.run {
                NotificationManager.shared.registerForRemoteNotifications()
            }
        }
    }
}
```

### 3. 服务端设置

配置服务器以发送 APNs 请求:
- 使用 APNs HTTP/2 API
- 包含 team ID、key ID 和 .p8 密钥
- 目标:`api.push.apple.com`(生产环境)或 `api.sandbox.push.apple.com`(开发环境)

## 测试

### 本地通知(模拟器)
```swift
func scheduleTestNotification() {
    let content = UNMutableNotificationContent()
    content.title = "Test"
    content.body = "This is a test notification"
    content.sound = .default

    let trigger = UNTimeIntervalNotificationTrigger(timeInterval: 5, repeats: false)
    let request = UNNotificationRequest(identifier: UUID().uuidString, content: content, trigger: trigger)

    UNUserNotificationCenter.current().add(request)
}
```

### 远程通知(真机)
1. 构建并部署到真机
2. 从控制台复制设备 token
3. 使用 APNs 测试工具或 `curl`:

```bash
curl -v \
  --header "authorization: bearer $JWT_TOKEN" \
  --header "apns-topic: com.yourcompany.yourapp" \
  --header "apns-push-type: alert" \
  --http2 \
  --data '{"aps":{"alert":{"title":"Test","body":"Hello"}}}' \
  https://api.sandbox.push.apple.com/3/device/$DEVICE_TOKEN
```

## 参考资料

- [User Notifications Framework](https://developer.apple.com/documentation/usernotifications)
- [Registering for APNs](https://developer.apple.com/documentation/usernotifications/registering-your-app-with-apns)
- [Notification Service Extension](https://developer.apple.com/documentation/usernotifications/modifying-content-in-newly-delivered-notifications)

同类提示词

商业与职场

招聘面试轮次与面试官排期

提供岗位要求和面试官的可用时间,规划各轮评估内容、人员搭配及面试顺序,并起草题库和候选人通知。

# 面试安排 > 设计高效的面试流程,优化面试小组构成和日程安排,带来良好的候选人体验。 ## 何时使用此技能 - 设置多轮面试流程 - 协调面试小组日程 - 设计面试阶段 - 优化候选人体验 - 创建面试执行手册 ## 方法论基础 基于**结构化面试最佳实践**和**候选人体验研究**,结合: - 与阶段相适应的评估 - 面试小组多样性要求 - 招聘周期优化 - 候选人沟通 ## Claude的工作与由你决定的事项 | Claude的工作 | 由你决定 | |-------------|------------| | 设计面试阶段 | 最
可填 1 项
商业与职场

十五镜头产品营销视频分镜

填写营销文案与产品外观描述,按开场钩子、故事和促销安排分镜,逐条标明产品镜头或场景镜头。

你是一位精通营销心理学的商业视频分镜师。请根据营销文本和产品外观描述,创建具有强营销力的15个分镜。 营销文本:{text} 产品外观描述:{image} 【核心标记规则】⚠️ 极其重要 每个分镜必须在开头使用以下标记之一: - [产品镜头] - 画面中包含产品实体,需要保持产品外观一致性 - [场景镜头] - 不包含产品的纯环境、人物或情境画面 标记决定后端使用哪个生成模型,必须准确标注! 【营销策略分析】(内部分析,不输出) 分析营销文本,提取以下信息用于指导分镜创作: 1. 目标受众:识别目标人群特征,确定画面风格和场景选择 2. 核心卖点
可填 2 项中文原创
商业与职场

等距分层与爆炸图动画

为产品演示或信息图制作 2.5D 场景,用统一投影和分面明暗表现立体感,支持层叠展开及爆炸图动画。

# 等轴测(2.5D)动画 等轴测场景无需使用真正的透视,就能让讲解动画、UI 操作演示和信息图呈现出搭建而成的立体感:各轴等比例缩短、Z 轴方向堆叠的层级、拉伸立体块、爆炸图。整体风格几何感强、构图讲究——深度来自一致的轴向和各面的明暗处理,动效则通过逐层展示结构来实现。 ## 适用场景 - 用于讲解动画、产品 UI 或“工作原理”信息图的 2.5D 场景。 - 从下往上搭建的堆叠层级 / 楼层 / 技术栈塔。 - 拉伸立体块、等轴测网格、等轴测城市 / 服务器机架场景。 - 沿 Z 轴拆开再重新组装的爆炸图。 - 需要增添轻微生动感的静态等轴测
商业与职场

六页电影感演示文稿设计总览

选择浅色或深色方向,用图像模型把六页幻灯片合成一张电影感概览图,适合演示提案和版式评审。

# 演示文稿设计 创建一张**高端 6 页演示文稿设计展板**,将所有幻灯片合成为一张图片——让用户一眼看完整套演示文稿,适合电视屏幕展示,具有电影感。 主要用途:PPT 设计概念、主题演讲风格的幻灯片设计稿、战略演示文稿视觉方案、活动 / 新闻 / 体育 / 商业分析演示文稿、编辑式数据故事、高管演示文稿。 ## 图像生成要求 最终展板必须由**图像生成模型**生成(默认使用内置的 `image_gen` 工具,或经批准的项目图像生成工作流)。不要使用代码、SVG、HTML/CSS、canvas、图表、占位图或确定性形状脚本创建展板。这些方法只
商业与职场

十五款AI视频模型选型顾问

回答三至四个需求问题,按中文表现、音频、编辑能力、时长和可用性等条件获取模型推荐及理由。

# model-selector 15 个主流 AI 视频模型(11 商业 + 4 开源)的"购物顾问"。问用户 3-4 个关键问题,给出推荐 + 理由。 ## 何时不用此 skill - 用户已经确定要用某个模型 → 用对应的 `<model>-prompter` skill - 用户问"提示词怎么写" → 用 `seedance-prompter` / `kling-prompter` / `happyhorse-prompter` - 用户的提示词不工作 → 用 `seedance-debugger` ## 11 模型能力速查矩阵 | 模
中文原创
商业与职场

界面创意转视觉设计规格

填写界面用途、受众、尺寸和文案,将初步构想细化为包含网格、字体、配色与图像风格的设计规格。

# 设计优先的 UI 提示词技能 此技能适用于**设计优先的提示词编写**:将模糊的想法转化为严谨的规格说明,生成风格一致的 UI。 ## 核心原则 **像设计系统一样编写提示词,而不是许愿。** ## 提示词结构(复制/粘贴) 使用以下框架,然后填入空白。 ```text GOAL - What are we making? (e.g., landing page hero / onboarding / dashboard / carousel slide) - Who is it for? (persona) - What’s the suc
✓