Token导航 LogoToken导航TokenDH.com
研究检索需要联网github未标认证来源可访问clear审计通过

swift-health-kitSwift health KIT 搜索

Agent Skill

swift-health-kit 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

727

周安装

30

GitHub Stars

12

下载量

238
CodexClaudeCursorGemini CLI

安装说明

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

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

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

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

命令行安装

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

skills.shnpx skills
npx skills add https://github.com/nonameplum/agent-skills --skill swift-health-kit

简介

swift-health-kit 用于查找、检索和筛选相关信息。

  • 适合在 Codex、Claude、Cursor、Gemini CLI 中根据关键词或任务场景快速定位候选结果。
  • 通过命令行调用,支持基于线索的信息聚合与筛选。
  • 安装前需确认权限范围、维护状态及是否触发联网或命令执行。
  • 建议结合来源仓库和原始 README 进一步核验具体用法。

SKILL.md

HealthKit

What to open

  • Use Articles/healtkit.md for complete HealthKit documentation (188 pages consolidated).
  • Search within the file by section URLs or keywords like HKHealthStore, HKQuantitySample, HKWorkout, HKObserverQuery.

Document structure

The documentation file is organized by Apple documentation URLs as section headers. Key sections:

LineTopic
~11Framework overview
~115About the HealthKit framework (architecture)
~246Setting up HealthKit (entitlements, Info.plist)
~357Authorizing access to health data
~517Protecting user privacy
~586Saving data to HealthKit
~673Reading data from HealthKit (queries)
~760HKHealthStore API reference
~968Creating a Mobility Health App (sample project)
~1025Data types (type identifiers)
~1614Samples (HKSample, quantity, category, correlations)
~1871Queries (sample, anchored, statistics, observer)
~2146Visualizing State of Mind in visionOS
~2203Logging symptoms associated with a medication
~2278Workouts and activity rings
~2449HKError and error handling
~3152Executing observer queries
~4778Background delivery (HKUpdateFrequency)
~5974HKObjectType and subclasses
~7264HKSampleType reference

Setup checklist

  1. Add HealthKit capability in Xcode (enable Clinical Health Records only if needed).
  2. Add NSHealthShareUsageDescription and NSHealthUpdateUsageDescription to Info.plist.
  3. Check HKHealthStore.isHealthDataAvailable() before any HealthKit calls.
  4. Create a single HKHealthStore instance and retain it for the app's lifetime.
  5. Request authorization with requestAuthorization(toShare:read:) before reading or writing.

Common workflows

Reading data

  1. Create the appropriate HKSampleType or HKQuantityType.
  2. Build a query descriptor (e.g., HKSampleQueryDescriptor, HKStatisticsQueryDescriptor).
  3. Execute the query against HKHealthStore.
  4. Handle results on a background queue; dispatch to main for UI updates.

Saving data

  1. Create an HKQuantitySample, HKCategorySample, or HKCorrelation.
  2. Use matching units for the data type (e.g., .count() for steps, .meter() for distance).
  3. Call healthStore.save(_:withCompletion:).
  4. Check authorizationStatus(for:) before saving to catch permission issues early.

Background delivery

  1. Enable Background Modes in Xcode (Background fetch).
  2. Call enableBackgroundDelivery(for:frequency:withCompletion:) for each data type.
  3. Register an HKObserverQuery with an update handler.
  4. When woken, call healthStore.execute(_:) to re-run the query.

Workouts

  1. Create an HKWorkoutConfiguration with activity type and location.
  2. Start a workout session on Apple Watch with HKWorkoutSession.
  3. Use HKLiveWorkoutBuilder to collect real-time samples.
  4. End the session and save the workout with endCollection(withEnd:completion:).

Key types

TypePurpose
HKHealthStoreCentral access point; authorization, queries, saving
HKQuantitySampleNumeric health data (steps, heart rate, weight)
HKCategorySampleEnumerated data (sleep analysis, menstrual flow)
HKCorrelationComposite samples (food, blood pressure)
HKWorkoutFitness activity with duration, energy, distance
HKObserverQueryLong-running query for store changes
HKAnchoredObjectQueryDescriptorTrack additions/deletions since last anchor
HKStatisticsQueryDescriptorAggregate calculations (sum, avg, min, max)
HKStatisticsCollectionQueryDescriptorTime-bucketed statistics for charts

Privacy and authorization

  • HealthKit uses fine-grained authorization per data type.
  • Apps cannot detect if read permission was denied; queries simply return no data.
  • Use authorizationStatus(for:) to check write permission before saving.
  • Guest User sessions on visionOS restrict mutations; handle errorNotPermissibleForGuestUserMode.
  • Never use HealthKit data for advertising or sell it to third parties.

Platform availability

  • iPhone/Apple Watch/visionOS: Full HealthKit store with sync.
  • iPadOS 17+: Has its own HealthKit store.
  • iPadOS 16 and earlier / macOS 13+: Framework available but isHealthDataAvailable() returns false.
  • Use earliestPermittedSampleDate() on Apple Watch to find oldest available data.

Error handling

Check for these common HKError.Code values:

  • errorHealthDataUnavailable – Device doesn't support HealthKit.
  • errorHealthDataRestricted – Enterprise or parental restrictions.
  • errorAuthorizationNotDetermined – Authorization not yet requested.
  • errorAuthorizationDenied – User denied write permission.
  • errorNotPermissibleForGuestUserMode – Vision Pro guest session restriction.
  • errorRequiredAuthorizationDenied – Required clinical record types denied.

SwiftUI integration

Use the HealthKitUI framework for SwiftUI authorization:

import HealthKitUI

.healthDataAccessRequest(
    store: healthStore,
    shareTypes: allTypes,
    readTypes: allTypes,
    trigger: trigger
) { result in
    // Handle authorization result
}

Reminders

  • HealthKit store is thread-safe; samples are immutable.
  • Avoid samples longer than 24 hours; many types have duration limits.
  • Correlations store contained samples internally—don't save them separately.
  • Use HKDeletedObject via anchored queries to detect deletions.
  • For workout heart rate zones, use HKWorkoutActivity and route samples.

适合场景

01

用户想查找某类 Agent Skill 时

02

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

03

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

04

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

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

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

能力 4

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

能力 5

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

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

平台分布

Claude Code

30.95%
按下载量换算74

OpenCode

25.46%
按下载量换算61

Antigravity

17.81%
按下载量换算42

windsurf

12.9%
按下载量换算31

trae

7.82%
按下载量换算19

Cursor

3.87%
按下载量换算9

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

通过

权限和风险

需要联网

该 Skill 可能需要联网访问来源站点、仓库或外部 API;具体网络访问范围需要结合源码和 README 复核。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。

来源信息

继续浏览同类 Skills