core-motion — Claude Code skill: iOS sensors in Swift
A Core Motion skill for your coding agent: accelerometer, gyroscope, pedometer, activity recognition, altitude, AirPods motion and watchOS dive depth.
npx skills add dpearson2699/swift-ios-skills --skill core-motion -a claude-codeWhat core-motion does
The skill hands the agent a Core Motion reference for Swift 6.3 and iOS 26+. Its sections cover raw accelerometer and gyro streams from CMMotionManager, fused device motion with the attitude reference frames, CMPedometer for steps and distance, CMMotionActivityManager for walking, running, cycling or driving, and CMAltimeter for altitude. It also goes over polling samples each frame in a game loop, update intervals and battery cost.
There are traps worth knowing. Keep a single CMMotionManager for the whole app, since more than one instance drags sensor rates down. Ask CMMotionManager.availableAttitudeReferenceFrames() before requesting a magnetic-north or true-north frame and fall back to what exists. The NSMotionUsageDescription key belongs in Info.plist; skip it and the app crashes on the first sensor call.
Some managers report authorization on their own (CMPedometer, CMMotionActivityManager, CMAltimeter), while CMMotionManager streams have no such request API and surface failures through start and update callbacks. Availability checks such as isStepCountingAvailable() or isAccelerometerAvailable are collected in a table. A list of common mistakes and a review checklist close out the skill.
What it helps with
- read accelerometer and gyroscope samples at a fixed rate
- count steps and distance walked today
- detect whether the user is walking, running or driving
- track altitude and floors climbed
- pick a working attitude reference frame instead of a missing one
Example prompts for the agent
- Show how to subscribe to raw accelerometer updates from CMMotionManager at 60 Hz.
- Query today's step history from CMPedometer and print the distance.
- My .xTrueNorthZVertical frame returns nothing. Check which attitude frames the device supports.
How to install core-motion
1Skills CLI (Vercel)
npx skills add dpearson2699/swift-ios-skills --skill core-motion -a claude-code2Manually: put the files in place
~/.claude/skills/core-motion/SKILL.mdCopy the whole skill folder; for one project use .claude/skills/core-motion/
1Skills CLI (Vercel)
npx skills add dpearson2699/swift-ios-skills --skill core-motion -a codex2Manually: put the files in place
.agents/skills/core-motion/SKILL.mdFor all projects use ~/.agents/skills/
1Skills CLI (Vercel)
npx skills add dpearson2699/swift-ios-skills --skill core-motion -a cursor2Manually: put the files in place
.cursor/skills/core-motion/SKILL.mdCursor also reads .agents/skills/ and .claude/skills/
1GitHub CLI
gh skill install dpearson2699/swift-ios-skills core-motion2Manually: put the files in place
.github/skills/core-motion/SKILL.md1Skills CLI (Vercel)
npx skills add dpearson2699/swift-ios-skills --skill core-motion -a gemini-cli2Platform CLI
gemini skills install https://github.com/dpearson2699/swift-ios-skills --path skills/core-motionManually: put the files in place
.devin/skills/core-motion/SKILL.mdThe legacy .windsurf/skills/ path still works
Skills CLI (Vercel)
npx skills add dpearson2699/swift-ios-skills --skill core-motion -a opencodeClaude.ai
Zip the folder and upload it in Settings → Capabilities → Skills
Step by step, with commands for each platform: How to install skills in Claude Code: five ways
Questions about core-motion
How do I install core-motion in Claude Code?
Run npx skills add dpearson2699/swift-ios-skills --skill core-motion -a claude-code. The skill lands at ~/.claude/skills/core-motion/SKILL.md.
What does the core-motion skill do?
It gives your agent Core Motion guidance in Swift: sensor reads, step counting, activity detection, altitude and headphone motion, plus the mistakes to avoid.
Does it require an Info.plist key?
Yes. Add NSMotionUsageDescription with a user-facing explanation, or the app crashes when it first touches motion data.