Skip to content
Back to skills

Write

ASecurity

Use when creating, updating, or deleting Home Assistant automations/scripts, or importing, saving, instantiating, or deleting blueprints through HA NOVA Relay.

  • 20 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added October 23, 2026
ai-agentsgorailsrefactoringapi

Works with

  • cli
  • api
  • mcp

Security analysis

A100/100

Scanned November 26, 2026

npx -y skills add markusleben/ha-nova --skill write --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Write?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Write
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/markusleben-write/badge)](https://www.skillsdirectory.com/skills/markusleben-write)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: write
description: Use when creating, updating, or deleting Home Assistant automations/scripts, or importing, saving, instantiating, or deleting blueprints through HA NOVA Relay.
license: MIT
compatibility: Requires the ha-nova CLI (run 'ha-nova setup' first) and the HA NOVA Relay in Home Assistant (App, or standalone container on Container/Core).
---

# HA NOVA Write

## Scope

Mutations of `automation` and `script` configs: `create`, `update`, `delete`,
and `revert` of a verified update — plus one runtime exception: the paired
immediate service call of a DURATION request and `automation.turn_off` on an
expiry automation this flow just created (`../ha-nova/one-shot-automations.md`). Blueprints: read `../write/blueprints.md` first.

## Bootstrap (once per session)

Read and follow `../ha-nova/session-bootstrap.md`. An unreachable Relay answers exit 1 `RELAY_ERROR`
(then `ha-nova setup`). Multi-server: `--server <name>`
on every command but `apply`; name a non-default server once per response.

## Relay Contract

For automations/scripts, this skill sends no raw `ha-nova relay` config write; blueprints use raw plans:
- Read: `ha-nova find "<phrase>" --domain automation|script`; `ha-nova get <entity_id> --config` (current config + `config_id` from the registry `unique_id`, never the slug); `ha-nova get <entity_id> --related`.
- Plan (read-only): `ha-nova plan write --domain automation|script [--id <config_id> | --create] --file <draft.json>`, `ha-nova plan delete <entity_id>`, `ha-nova plan revert [--target <config_id>] [--domain <d>]`.
- Execute: `ha-nova apply [--confirm <code>] --plan <id> [--no-snapshot]`.

Draft: full config as one JSON object in a client-private scratch
file, posted byte-exactly.
`variables`, `trigger_variables`, script `fields` evaluate top-down: preserve
key order. Updates pass `--id <config_id>` from `get --config`; creates
`--create` (refuses existing ids and automation draft `id`). Script keys derive from alias or `--id`
(`script.<key>`). Update `diff` without a before side: item gone, STOP and ask.

## Flow

Multi-target logical changes: present the plan first (`../ha-nova/write-safety.md` → Multi-Target Changes). 2 to 20 automation/script writes or deletes (mixed): plan each, show each Phase 2 preview without its ask, then `ha-nova plan batch --plan <id> --plan <id> …` in run order and its `say`; one confirmation, one `apply` (`../ha-nova/batch-safety.md` → CLI Batch). With other families in the task: `../ha-nova/grouped-change-set.md`.

Input-device remaps: run the capability preflight per `../ha-nova/input-capability-preflight.md` before drafting; the write stays blocked while the chosen gesture is only assumed or its evidence conflicts. Repurposing or cleaning up an input additionally runs `../ha-nova/consumer-discovery-preflight.md`; incomplete coverage is disclosed, never claimed as "unused".

A one-shot intent ("just today", "tell me when the laundry finishes") takes the self-disabling pattern in `../ha-nova/one-shot-automations.md` and skips unsolicited improvement offers — the Suggestion Block and Phase 5. A recovery, watchdog, self-healing, or retry intent reads `../ha-nova/recovery-workflows.md` before drafting; the preview names the attempt bound — and the persistent-fault path only where the intent promises watchdog/self-healing continuity: an explicitly one-shot recovery keeps an attempt bound of one.

Every draft follows `../ha-nova/smallest-solution.md`.

### Phase 1: Resolve

1. Bare undo-update: `plan revert`; undo-delete: result's `restore` verbatim. Update/delete/named revert: `ha-nova find` (exact `entity_id` wins; disabled: `--include-disabled`), then `ha-nova get <entity_id> --config`. `managed: yaml`/`CONFIG_NOT_FOUND`: YAML/package item, `ha-nova:yaml-config`, never `plan write`/`plan delete`. Ambiguity, no match, or an open choice (which garage door): ask one blocking question before any draft, not inside a preview. No second ambiguity question. Correct invalid premises.
2. Resolve every entity the draft uses with `ha-nova find`/`get`. A trigger or condition on a room, floor, or group ("in the living room", HA 2026.7+) takes a purpose-specific one (`temperature.crossed_threshold`, `motion.detected`) that `get_triggers_for_target`/`get_conditions_for_target` lists for its area, floor, or label, not one sensor's `state`/`numeric_state`: `../ha-nova/best-practices.md` → Triggers, Conditions, and Targets.
3. Suggestion candidates per `../ha-nova/smallest-solution.md` → Write Suggestion Candidates.

### Phase 2: Preview + Confirm

1. Build the draft. Update: full-replacement merge (base=current, overlay=user changes); never rewrite unrelated structure, aliases, or formatting (key order included). Treat notification copy as user-authored content: preserve notification titles, messages, templates, metadata; rename/timing changes must not restyle, relocalize, or restructure existing text, and requested wording changes change only the requested copy. A create gets a one-sentence `description`. New or explicitly edited notification actions follow the canonical contract `../ha-nova/mobile-notification-composition.md`. Its recurring-workflow INTENT classification is not so limited: it runs before the write preview on EVERY recurring-workflow write — existing notification actions and trigger-only edits included, their payloads staying byte-for-byte untouched — and may add an exception-only Suggestion Block item.
2. Scope: draft only what was asked; never rewrite the name, alias, or description unasked, even one quoting the old value (`../ha-nova/smallest-solution.md` rule 7).
3. Suggestions + Pre-Write Checks (skip for delete and revert):
   - **3a) Suggestions**: the candidates as the Suggestion Block (output-cards.md; max 2, smallest intervention first). Accepted numbers merge into the draft BEFORE the preview; no block when there is no candidate and no intent-classification item.
   - **3b) Static Checks**: `../review/checks.md` → Application, analytically on the draft — no relay calls (scripts: F-01..F-08; helper refs: H-01..H-08. Defer H-09/H-10 to Phase 4). A draft with a finding gets one verdict line ("Pre-write check: this draft may not behave as intended."), a clean one none; 🔴 inline with a fix, 🟠🟡 as advisory below the preview, code-free. Advisories do not block the write and do not require extra confirmation:
     - R-18: a variable used above the sibling it reads — move that sibling up.
     - R-19: final else branch is only reached when the earlier entity-state branches are false — move `trigger.id` into `elif` or use `choose` + `condition: trigger`.
     - If R-23 matches: boolean-like template values compared to `"True"`/`"False"` — use the boolean.
     - If R-24 matches: `available_energy` may be current charge, not capacity — ask the user; never rewrite integration entity ids.
     Track findings by check type for dedup in Phase 4, except R-18.
   - **3c) Pre-Write Impact (update only)**: `ha-nova get <entity_id> --related` on the top entities the item acts on or reads — NEVER on the item's own `entity_id` (that is the delete direction). Show other affected automations/scripts/scenes as advisory (read max 3 configs). An empty result names the scanned entities; a failed read is "couldn't check what uses it" — never a no-consumer claim.
   - **3d) Threshold Calibration (update; create for stored threshold setters)**: an update that changes a `numeric_state` `above`/`below`, its `for:`, a wait timeout, or a numeric template predicate on a physical-process sensor — or swaps the compared `entity_id`/`attribute`/`value_template`, or adds/changes an action setting a threshold-backing `input_number` — runs `../ha-nova/threshold-calibration.md` and carries its findings (observed ranges, longest ambiguous phase, data gaps, both failure directions) into the preview; bounded reads of existing traces are its explicit exception to the no-auto-trace rule. A create runs it only for a stored setter on a helper existing items use as a physical-process boundary (one `ha-nova get <helper> --related`); otherwise create keeps its 3c skip. Unrelated numeric edits skip it.
4. Plan: `ha-nova plan write` (delete/revert: `plan delete|revert`). Exit 3: stored plan, `plan.confirm` `natural|code`. Exit 0 (`none`): no preview or ask; apply per `next_step`. A `draft` notice: add the in-between state it names to `from:` (`../review/checks.md` R-31) and plan again. Exit 4: `CONFIG_NOT_UI_MANAGED` → `ha-nova:yaml-config`; `CONFIG_ID_IN_USE` → check earlier apply first, never duplicate; otherwise automation: omit `--id`, script: ask another name, `--id <new> --create`; `NO_UNDO_SNAPSHOT` → nothing revertible; `REVERT_UNSUPPORTED` → helper checkpoint, specify `--target <config_id>` or `ha-nova:helper`. Delete exit 5: absent. Revert exit 2 `REVERT_DRIFT`: changed since verified update, nothing planned; show live config, ask desired change.
5. Preview (fixed shape: `../ha-nova/write-safety.md`):
   - update/revert: the plan's `diff` rows **verbatim** in the Changes slot — never write it yourself; state the behavioral effect in the summary sentence (write-safety → Behavior narrative). create: summary. Close the card with the plan's `say` (it names the `members[]` that set the tier — never repeat them, except those it says the preview lists; it ends with the save or confirmation ask); several plans in one preview keep each reason and ask once: each plan's ask, the note once.
   - Delete preview MUST include the consumer-check result before confirmation, from the plan's `consumers` (who references the item's OWN `entity_id`): the consumers; `[]` is an explicit none among automations, scripts, and scenes; absent (`coverage.complete` false) is "couldn't check what uses it", never a no-consumer result. No menu — only `say`.
6. Confirmation: the CLI decides — `plan.confirm` none → apply; natural → show the preview and wait for the user's reply; code → follow `say`/`next_step` (window, phone, form, or chat code), never a menu. A duration pair takes its stricter plan's confirmation for both halves. Relay `say` and add no other reason; never cite, link, or name this skill or any HA NOVA rule file. A code counts only as a reply that is only the code, after the preview. After a "yes" to a code plan, repeat `say`'s note and code block. Never pass a code they did not type. Pre-preview consent is draft-only; a changed draft needs a new plan and preview. An answer to a clarifying question is never a confirmation: end the turn with each new or changed plan's preview (except Phase 3 step 4's natural-confirmation duration call re-plan with action and tier unchanged).

### Phase 3: Apply + Verify

1. `ha-nova apply --plan <id>` (a `plan.code`: `--confirm <the user's exact text>` before `--plan`; else per `next_step`). Exit 2: the live config changed since the preview, nothing written; show the new diff and ask again. Never retry after exit 6 or 7.
2. `verified` = the read-back equals the planned body (content and `variables`/`fields` order), Home Assistant loaded it, the registry entity is live; `unverified` says why in `verification[].note` or `.observed` (not loaded in time: saved, but whether it runs is unknown; say so); exit 7: relay `say`, then read `ha-nova get <entity_id> --config` and name it; `before_config` in the result is the way back. An `undo` notice: the update is not revertible; say so. Do not report destructive success until verification proves the target is gone.
3. Deletes: the CLI saves the pre-delete config snapshot (`snapshot` in the result). `SNAPSHOT_FAILED` deleted nothing: offer pruning the snapshot store, a full safety backup (`ha-nova:backup`), or proceeding without one; only after the user picks the last, `apply [--confirm <code>] --plan <id> --no-snapshot`.
4. **Duration requests carry an immediate action too** — "sprinkler for 30 minutes" is the expiry automation PLUS the turn-on under one preview (`../ha-nova/automation-patterns.md`): plan both first (`plan write`, `plan call`) for the one preview. Apply and verify the automation, re-check deadline margin and restore value — if stale, disable the armed expiry immediately and remove it through the delete flow before re-previewing. The new automation watches the actuator, so the call plan drifts: re-plan it (`plan call`) and apply the new plan under the same confirmation only if action and tier are unchanged (a new `plan.code`: the user types it); otherwise it fails below. VERIFY the immediate action by reading the target back; on any failure — every non-zero exit but `CONFIRM_WAITING` (rerun per `next_step`) — disable the automation at once (`ha-nova call automation.turn_off <entity_id>`) and clean it up through the delete flow before anything is re-previewed. Never hand the immediate half back to the user as a separate step.

### Phase 4: Post-Write Review (MANDATORY)

Not via `ha-nova:review`.

1. Reviewed config: the draft when `verified`, else `ha-nova get <entity_id> --config`. If `verification[].entity_id` differs from the requested slug, report it — do not silently assume the requested slug won.
2. Checks: verified → skip what Phase 2 covered, re-run R-18 on the read-back; a differing read-back → full checks per `../review/checks.md` → Application. **Dedup**: findings the user saw in 3b MUST NOT repeat (by check type) — except R-18 still matching the persisted config: report it again as a persisted runtime risk with the reorder fix. Do not auto-trigger or auto-read traces outside an accepted Phase 5 test plan. `R-19` follows normal dedup. Actions referencing helpers: always H-01..H-11.
3. Collision scan: `ha-nova get <entity_id> --related` on the entities it triggers on and acts on, minus the item itself (3c fail-closed rule); read max 3 related configs.
4. Localized output (`../ha-nova/output-cards.md` → Findings, Empty States): **Findings** real issues; **Collision check** related items or failed scan ("couldn't check what uses it"); **Advisory** non-empty only — never print an empty "none" bucket; nothing at all → no review line beyond `say`. Never emit `Questions to consider`, `Suggestions`, or `Instant help` post-write; never repeat an item across **Findings** and **Advisory**. Sole exception: the one-line Replication Line after a verified create; Phase 5's line closes.
5. Update-Revert: an update (a revert too) lands on the undo stack automatically — reflect the save receipt in the result — the `undo` receipt (`replaced`: only this newest update stays revertible; evicted targets are no longer revertible) and offer `revert` unless its `say` already names the way back (write-safety → Update-Revert). Creates → cleanup via normal HA NOVA delete flow (preview, its confirmation, absence verification); never promise a code. Deletes → offer `restore` (one plan + apply), else Home Assistant Backups.

### Phase 5: Test Offer (create/update only)

Every saved create/update ends, in the same response as the result's `say`, with one closing line offering a test preview ("Want a test preview? I'll show which devices would change before anything runs.", localized). Only exceptions: a one-shot or duration intent; a batch or grouped change set (on request); the user stopped these offers this session. An earlier test is no exception. A "yes" asks for the card, never a run (Test Plan Card mechanics: `../ha-nova/test-run.md`). Never execute anything unconsented; the choice confirms only that card, and the card confirmation never replaces the typed confirmation. Skip this phase for deletes.

## Output Format

Apply `../ha-nova/output-rules.md`: plain words, HA names verbatim; unless asked or names clash, no ids, "entity", modes, Relay/HA URLs, snapshots, raw JSON.

Render Cards per `../ha-nova/output-cards.md`. A create summary (or a deleted item's restore) names the item and devices, triggers, conditions, actions (scripts: inputs/steps); mode only if not `single`, in plain words; ids and the full config only when asked.

## Safety

- Safety Core: before any write, apply `../ha-nova/safety-core.md`; not yet in this conversation → read it first; unreadable or incomplete → stop and write nothing.

- Destructive cleanup keeps the delete's full confirmation, even for items created earlier in the same session.
- No third-party MCP server, no direct HA API, no raw `ha-nova relay` config write.

## Guardrails

- No raw `get_states`.

## References

Always load:
- `../ha-nova/best-practices.md`, `../ha-nova/write-safety.md`, `../ha-nova/smallest-solution.md`
- Review checks: `../review/checks.md` (catalog + Application; evidence boundaries on demand as it says)
- A delete needs only `../ha-nova/write-safety.md` of these.

On demand — read only when the trigger applies:
- `../ha-nova/payload-schemas.md` — a script, `choose`, or wait shape
- `../ha-nova/automation-patterns.md` — new branching, timing, or flow-control logic; restart-surviving save/restore (Persistence Model)
- `../ha-nova/one-shot-automations.md` — one-shot or duration-bound requests
- `../ha-nova/recovery-workflows.md` — recovery, watchdog, or retry intent
- `../ha-nova/template-guidelines.md` — the draft contains Jinja templates
- `../ha-nova/safe-refactoring.md` — rename, migrate, or orphan cleanup
- `../ha-nova/update-revert.md` — revert, undo, or restore a verified update
- `../ha-nova/config-snapshots.md` — restore from a config snapshot
- `../ha-nova/test-run.md` — only after the user accepts the Phase 5 test offer
- `../ha-nova/input-capability-preflight.md` — remapping an input device
- `../ha-nova/consumer-discovery-preflight.md` — repurposing an input's consumers
- `../ha-nova/threshold-calibration.md` — threshold, `for:`, wait-timeout, or compared-signal changes

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.