Use for Core Location implementation patterns - authorization strategy, monitoring strategy, accuracy selection, background location
View on GitHubSelect agents to install to:
npx add-skill https://github.com/CharlesWiltgen/Axiom/blob/main/.claude-plugin/plugins/axiom/skills/axiom-core-location/SKILL.md -a claude-code --skill axiom-core-locationInstallation paths:
.claude/skills/axiom-core-location/# Core Location Patterns
Discipline skill for Core Location implementation decisions. Prevents common authorization mistakes, battery drain, and background location failures.
## When to Use
- Choosing authorization strategy (When In Use vs Always)
- Deciding monitoring approach (continuous vs significant-change vs CLMonitor)
- Implementing geofencing or background location
- Debugging "location not working" issues
- Reviewing location code for anti-patterns
## Related Skills
- `axiom-core-location-ref` — API reference, code examples
- `axiom-core-location-diag` — Symptom-based troubleshooting
- `axiom-energy` — Location as battery subsystem
---
## Part 1: Anti-Patterns (with Time Costs)
### Anti-Pattern 1: Premature Always Authorization
**Wrong** (30-60% denial rate):
```swift
// First launch: "Can we have Always access?"
manager.requestAlwaysAuthorization()
```
**Right** (5-10% denial rate):
```swift
// Start with When In Use
CLServiceSession(authorization: .whenInUse)
// Later, when user triggers background feature:
CLServiceSession(authorization: .always)
```
**Time cost**: 15 min to fix code, but 30-60% of users permanently denied = feature adoption destroyed.
**Why**: Users deny aggressive requests. Start minimal, upgrade when user understands value.
---
### Anti-Pattern 2: Continuous Updates for Geofencing
**Wrong** (10x battery drain):
```swift
for try await update in CLLocationUpdate.liveUpdates() {
if isNearTarget(update.location) {
triggerGeofence()
}
}
```
**Right** (system-managed, low power):
```swift
let monitor = await CLMonitor("Geofences")
let condition = CLMonitor.CircularGeographicCondition(
center: target, radius: 100
)
await monitor.add(condition, identifier: "Target")
for try await event in monitor.events {
if event.state == .satisfied { triggerGeofence() }
}
```
**Time cost**: 5 min to refactor, saves 10x battery.
---
### Anti-Pattern 3: Ignoring Stationary Detection
**Wrong** (wasted battery):
```