jpskill.com
🛠️ 開発・MCP コミュニティ

ios-watchos

watchOS: WidgetKit complications, WatchConnectivity, SwiftUI on Watch, HealthKit, OpenClaw Watch extension

⚡ おすすめ: コマンド1行でインストール(60秒)

下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。

🍎 Mac / 🐧 Linux
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o ios-watchos.zip https://jpskill.com/download/22262.zip && unzip -o ios-watchos.zip && rm ios-watchos.zip
🪟 Windows (PowerShell)
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/22262.zip -OutFile "$d\ios-watchos.zip"; Expand-Archive "$d\ios-watchos.zip" -DestinationPath $d -Force; ri "$d\ios-watchos.zip"

完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。

💾 手動でダウンロードしたい(コマンドが難しい人向け)
  1. 1. 下の青いボタンを押して ios-watchos.zip をダウンロード
  2. 2. ZIPファイルをダブルクリックで解凍 → ios-watchos フォルダができる
  3. 3. そのフォルダを C:\Users\あなたの名前\.claude\skills\(Win)または ~/.claude/skills/(Mac)へ移動
  4. 4. Claude Code を再起動

⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。

🎯 このSkillでできること

下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。

📦 インストール方法 (3ステップ)

  1. 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
  2. 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
  3. 3. 展開してできたフォルダを、ホームフォルダの .claude/skills/ に置く
    • · macOS / Linux: ~/.claude/skills/
    • · Windows: %USERPROFILE%\.claude\skills\

Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。

詳しい使い方ガイドを見る →
最終更新
2026-05-18
取得日時
2026-05-18
同梱ファイル
1
📖 Claude が読む原文 SKILL.md(中身を展開)

この本文は AI(Claude)が読むための原文(英語または中国語)です。日本語訳は順次追加中。

ios-watchos

Purpose

This skill enables development of watchOS apps using Swift and Apple's frameworks, focusing on WidgetKit for complications, WatchConnectivity for device syncing, SwiftUI for interfaces, HealthKit for health data access, and OpenClaw Watch extensions for custom features.

When to Use

Use this skill for building watchOS apps that need dynamic complications (e.g., updating timelines), real-time data transfer from iOS devices, custom SwiftUI layouts on the Watch, querying health metrics like workouts, or integrating OpenClaw for extended functionality. Apply it in scenarios like fitness tracking apps or notification-based tools.

Key Capabilities

  • WidgetKit complications: Create timeline-based updates for watch faces, e.g., using TimelineProvider to refresh data every 15 minutes.
  • WatchConnectivity: Establish sessions for sending/receiving data between iOS and watchOS, handling transfers up to 100KB per message.
  • SwiftUI on Watch: Build responsive interfaces with components like NavigationView and List, optimized for small screens (e.g., 44mm display).
  • HealthKit: Access health data types such as HKWorkout and HKQuantityTypeStepCount, with background delivery for real-time updates.
  • OpenClaw Watch extension: Leverage custom APIs for enhanced app features, requiring authentication via $OPENCLAW_API_KEY for secure connections.

Usage Patterns

Follow these patterns for effective implementation:

  1. For complications: Set up a WidgetKit extension in Xcode, implement a TimelineProvider subclass, and use getTimeline(in:completion:) to generate entries. Example: In your provider, return an array of TimelineEntry objects with dates and views.
  2. For HealthKit integration: Request authorization for specific data types, then query samples. Example: Use HKSampleQuery to fetch workout data after checking permissions.
  3. Common pattern: Use WatchConnectivity to sync data; activate WCSession in AppDelegate and handle incoming messages in didReceiveMessage.
  4. For OpenClaw: Initialize the extension with an API key and handle events in a delegate. Example: Call OpenClawSession.shared.start(with: $OPENCLAW_API_KEY) in your app's launch sequence.
  5. Concrete usage example 1: Build a complication for a fitness app—create a TimelineProvider that queries HealthKit for step count and updates every hour: let entry = TimelineEntry(date: Date(), stepCount: 500); provider.getTimeline(in: context, completion: { timeline in ... }).
  6. Concrete usage example 2: Sync workout data from iOS to Watch—use WCSession.default.sendMessage(["workoutID": "123"], replyHandler: nil) in the iOS app, and process it in the Watch app's session(didReceiveMessage: handler).

Common Commands/API

  • Xcode command: Build and run a watchOS app with xcodebuild -scheme WatchAppExtension -destination 'platform=watchOS Simulator,name=Apple Watch Series 6' -configuration Debug. Use this in CI/CD pipelines.
  • WidgetKit API: Implement a simple TimelineProvider: class MyProvider: TimelineProvider { func getSnapshot(in context: Context, completion: @escaping (SimpleEntry) -> ()) { let entry = SimpleEntry(date: Date()); completion(entry) } }.
  • WatchConnectivity API: Activate session with WCSession.default.activate(); send data: WCSession.default.sendMessage(["key": "value"], replyHandler: nil, errorHandler: nil).
  • HealthKit API: Request authorization: let typesToRead = Set([HKObjectType.workoutType()]); HKHealthStore().requestAuthorization(toShare: nil, read: typesToRead) { granted, error in if granted { // Proceed } }.
  • OpenClaw API: Initialize with auth: let session = OpenClawSession(apiKey: ProcessEnv.get("OPENCLAW_API_KEY")); session.connect(endpoint: "wss://api.openclaw.com/watch"); handle responses in session.delegate.didReceiveData.
  • Config format: Use a JSON config for OpenClaw: { "apiKey": "$OPENCLAW_API_KEY", "endpoint": "wss://api.openclaw.com/watch", "watchID": "device-uuid" }. Load it via let config = try JSONDecoder().decode(OpenClawConfig.self, from: data).

Integration Notes

Integrate this skill by adding a watchOS target in Xcode: Go to File > New > Target > watchOS > Watch App, then link it to your iOS app via group capabilities. For HealthKit, enable the HealthKit capability in project settings and add the NSHealthShareUsageDescription key to Info.plist. When using WatchConnectivity, ensure both iOS and watchOS apps share the same App Group entitlement. For OpenClaw, set the $OPENCLAW_API_KEY environment variable in your build script (e.g., export OPENCLAW_API_KEY=your_key) and import the OpenClaw SDK via Swift Package Manager: .package(url: "https://github.com/openclaw/sdk.git", from: "1.0.0"). Test integrations with Simulator: Run the watchOS app on Apple Watch Simulator and verify data flow using the Console app for logs.

Error Handling

Handle errors proactively: For WidgetKit, check for timeline errors in getTimeline and retry on failures (e.g., if context invalid, log and return an empty timeline). For WatchConnectivity, catch WCSession errors like .notReachable and queue messages for later. In HealthKit, verify authorization before queries—e.g., if HKError.Code.errorAuthorizationDenied, prompt user via UIAlertController with a retry button. For OpenClaw, parse API errors (e.g., 401 Unauthorized) and refresh $OPENCLAW_API_KEY if expired. Use try-catch in Swift for API calls: do { try OpenClawSession.shared.connect() } catch let error as OpenClawError { print(error.localizedDescription); retry after delay }. Log all errors with os_log for debugging.

Graph Relationships

  • Related to: mobile cluster (e.g., shares tags with ios skill for cross-platform features).
  • Links to: ios skill via WatchConnectivity for iOS-Watch syncing.
  • Connected via: watchos tag, healthkit integration with fitness-related skills, and openclaw-watch for custom extensions.