OpenParable
Skip to content
← Back to skills

Ha IOS Persistence

Development
ha-ios-persistence

Ha IOS Persistence is an Agent Skill for development published in the home-assistant/iOS repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

Data persistence across GRDB, Realm, and UserDefaults. Use when adding or migrating a persistent model, choosing a storage layer, implementing DatabaseTableProtocol, or reading/writing config for Watch, CarPlay, widgets, or the entity registry.

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/home-assistant/iOS/blob/HEAD/.agents/skills/ha-ios-persistence/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/ha-ios-persistence, but wait for my approval before writing files or running scripts.

Copying this prompt does not install or run the skill. Review third-party files before use.

Data Persistence

The project uses two database layers:

  • GRDB (GRDB.swift): newer layer, accessed via Current.database(). Used for Watch config, CarPlay config, widget config, entity registry, panels, etc. When adding a new persistent model, prefer GRDB: implement DatabaseTableProtocol (defines tableName, definedColumns, and createIfNeeded) and register it in DatabaseQueue.tables() in GRDB+Initialization.swift. The protocol's migrateColumns helper auto-handles additive migrations.
  • Realm (RealmSwift): legacy layer, used for older models (actions, zones, sensors, etc.). Access via Current.realm().
  • UserDefaults: simple preferences and watch communication.