healthkit-code-review
Skill91 starsChanged 6 days agoApache-2.0View on GitHub
Reviews HealthKit code for authorization patterns, query usage, query descriptors, background delivery, and data type handling. Use when reviewing code with import HealthKit, HKHealthStore, HKSampleQuery, HKSampleQueryDescriptor, HKObserverQuery, or HKQuantityType.
In this repository85 other files it gives its agents.
- AGENTS.mdAGENTS.md
- llms.txtllms.txt
- agent-architecture-analysisSkill
- app-intents-code-reviewSkill
- artifact-analysisSkill
- axum-code-reviewSkill
- brainstorm-beagleSkill
- bubbletea-code-reviewSkill
- cloudkit-code-reviewSkill
- elixir-performance-reviewSkill
- elixir-security-reviewSkill
- elixir-writing-docsSkill
- exdoc-configSkill
- exunit-code-reviewSkill
- fastapi-code-reviewSkill
- fetch-pr-feedbackSkill
- ffi-code-reviewSkill
- fix-llm-artifactsSkill
- fowler-refactoringSkill
- gen-test-planSkill
- go-architectSkill
- go-code-reviewSkill
- go-data-persistenceSkill
- go-testing-code-reviewSkill
- humanize-beagleSkill
- improve-docSkill
- ios-animation-code-reviewSkill
- liveview-code-reviewSkill
- llm-artifacts-detectionSkill
- llm-judgeSkill
- macros-code-reviewSkill
- phoenix-code-reviewSkill
- postgres-code-reviewSkill
- prfaq-beagleSkill
- prometheus-go-code-reviewSkill
- pytest-code-reviewSkill
- quick-planSkill
- react-flow-code-reviewSkill
- react-flowSkill
- react-router-code-reviewSkill
- react-router-v7Skill
- receive-feedbackSkill
- refactor-repoSkill
- resolve-beagleSkill
- respond-pr-feedbackSkill
- review-ai-writingSkill
- review-elixirSkill
- review-frontendSkill
- review-goSkill
- review-iosSkill
- review-llm-artifactsSkill
- review-planSkill
- review-pythonSkill
- review-remix-v2Skill
- review-rustSkill
- review-skillSkill
- review-structureSkill
- review-tuiSkill
- review-verification-protocolSkill
- run-test-planSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 41
Run in order. Do not state a finding in a later step until the pass condition for the current step is satisfied (each pass condition is …
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
HealthKit Code Review
Quick Reference
| Issue Type | Reference |
| HKHealthStore, permissions, status checks, privacy | references/authorization.md |
| Query descriptors, HKQuery types, predicates, anchored queries, statistics | references/queries.md |
| Background delivery, observer queries, SwiftUI/watchOS app lifecycle | references/background.md |
| HKQuantityType, HKCategoryType, workouts, units | references/data-types.md |
Review Checklist
HKHealthStore.isHealthDataAvailable()called before any HealthKit operations- Authorization requested only for needed data types (minimal permissions)
requestAuthorizationcompletion/return not misinterpreted as read permission granted- No attempt to determine read permission status (privacy by design)
- UI updates isolated on
@MainActor(or dispatched to main actor from legacy query callbacks) HKObjectQueryNoLimit/ unbounded descriptors used only with bounded predicatesHKStatisticsQueryDescriptor/HKStatisticsQueryused for aggregations instead of manual summing- Observer query
completionHandler()always called (usedefer) - Background delivery registered every launch (
App.init()/application(_:didFinishLaunchingWithOptions:)/WKApplicationDelegate.applicationDidFinishLaunching()) - Background delivery entitlement (
com.apple.developer.healthkit.background-delivery) added (iOS 15+) - Correct units used for quantity types (e.g.,
count/minfor heart rate) - Long-running queries /
results(for:)Tasks stored and cancelled/stop()ped on teardown
When to Load References
- Reviewing authorization/permissions flow -> authorization.md
- Reviewing
HKSampleQueryDescriptor,HKAnchoredObjectQueryDescriptor,HKSampleQuery, or predicates -> queries.md - Reviewing
HKObserverQueryorenableBackgroundDelivery-> background.md - Reviewing
HKQuantityType,HKCategoryType, orHKWorkoutBuilder-> data-types.md
Review gates
Run in order. Do not state a finding in a later step until the pass condition for the current step is satisfied (each pass condition is answerable from the codebase under review).
- Scope — Pass: Name the file path(s) and types/symbols using
HealthKit,HKHealthStore, orHK*APIs (or state clearly that the diff touches none). - Availability and store — Pass: Cite the call site of
isHealthDataAvailable()before HealthKit use, or document why omission is acceptable for the scoped code; cite whereHKHealthStoreis created or injected. - Authorization semantics — Pass: For each
requestAuthorization/statusForAuthorizationRequest/getRequestStatusForAuthorization, cite handler branches per references/authorization.md (e.g., success does not prove read access); do not infer read permission fromauthorizationStatusalone. - Queries and limits — Pass: For each query or descriptor, cite predicate + limit (
HKObjectQueryNoLimitonly with a bounded predicate); for totals/aggregates, citeHKStatisticsQueryDescriptor/HKStatisticsQueryvs manual summing per references/queries.md. - Observers and background — Pass: If
HKObserverQueryorenableBackgroundDeliveryappears, cite where the observer is started/stopped and where background delivery is registered on launch; cite entitlements/Info.plistor flag missing config per references/background.md. If absent, Pass: one line “no observer/background in scope.” - Threading, lifecycle, and protocol — Pass: Cite
@MainActorisolation (or main-queue dispatch) for UI updates; cite retention/stop()/Task.cancel()for long-running queries; satisfyreview-verification-protocol(../review-verification-protocol/SKILL.md if installed).
Review Questions
- Is
isHealthDataAvailable()checked before creating or usingHKHealthStore? - Does the code gracefully handle denied read permissions (empty results)?
- Are observer query completion handlers called in all code paths?
- Is work in background handlers minimal (~15 second limit)?
- Are
HKQueryAnchors persisted separately per sample type?
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

