Skip to main content
skill CX Codex

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.

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add dpearson2699/swift-ios-skills --skill core-motion -a claude-code
Open on GitHub

What 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-code

2Manually: put the files in place

~/.claude/skills/core-motion/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/core-motion/

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.

Similar skills

Everything for Mobile →

From the same set69

Project sponsors

Companies that keep this analytics open
Gold sponsor

Impressions, clicks and code copies — open statistics. We keep the numbers public for the same reason NeBlask itself is public. Become a sponsor