Skip to content
Back to skills

Yaml Config

ASecurity

Use when creating or editing Home Assistant configuration that only exists as YAML files — template sensors beyond the helper UI, REST and command-line sensors, packages, and themes, plus images and videos in /config/www — through HA NOVA Relay's opt-in file access.

  • 20 stars
  • 0 votes
  • 0 copies
  • 7 views
  • Added October 23, 2026
ai-agentspythongoexpressrailsapidatabasefrontend

Works with

  • cli
  • api

Security analysis

A100/100

Scanned November 26, 2026

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

Installs into .claude/skills of the current project.

Are you the author of Yaml Config?

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

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

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: yaml-config
description: Use when creating or editing Home Assistant configuration that only exists as YAML files — template sensors beyond the helper UI, REST and command-line sensors, packages, and themes, plus images and videos in /config/www — through HA NOVA Relay's opt-in file access.
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 YAML Config

## Scope

Configuration that has NO Home Assistant API and only exists as a YAML file:
- template sensors/binary sensors beyond what the helper UI can express (triggers, multiple entities per block, availability templates)
- `rest` and `command_line` sensors
- packages
- frontend themes
- `recorder:` configuration blocks (include/exclude filters, `purge_keep_days`) — recorder is not reloadable, a restart applies it

Not in scope: anything with an API — config-entry template helpers (`ha-nova:helper`), automations and scripts (`ha-nova:write`), dashboards (`ha-nova:dashboard`), scenes (`ha-nova:scene`), ESPHome device files (`ha-nova:esphome`). If a helper can express it, use the helper: it is safer, reloadable, and editable in the UI.

## Bootstrap (once per session)

Read and follow `../ha-nova/session-bootstrap.md`.

This skill needs a Relay with file access AND file access enabled. Both are the user's decision, not yours:
- Probe once: `ha-nova relay files --data-file <payload-file>` with `{"action":"list_dir","path":"/config"}`.
- `FILE_ACCESS_DISABLED` -> file access is OFF (the default). Tell the user how to turn it on (App: Settings > Apps > NOVA Relay > Configuration > `file_access`: `readwrite`, restart; container: `FILE_ACCESS=readwrite` plus a config mount) and what it means, then continue with the manual path below. Do not nag.
- `FILE_ACCESS_READONLY` -> reads work, writes do not. Offer the manual path below instead of asking for more permission.
- A 404 `NOT_FOUND` "Route not found" reply means the Relay predates file access: report it and offer the Relay update. A relay-outdated warning alone never blocks this skill: surface it and continue.

## Relay Contract

`ha-nova call` returns the preview: confirm it once, then `ha-nova apply --plan <id>`.

- `ha-nova relay files --data-file <payload-file>` — reads: `list_dir`, `read_file`. Images and videos in `/config/www`: `www-media.md`. `write_file` (`content`, `backup` defaults to true) and `delete_file` only through `ha-nova plan raw`, then `ha-nova apply`.
- `ha-nova relay core --method POST --path /api/config/core/check_config` — validate the configuration BEFORE reloading.
- `ha-nova call <domain>.reload` — apply the reload from Flow step 5 (`template.reload`, `frontend.reload_themes`, ...). `<domain>.reload` is typed (the person's own confirmation); `frontend.reload_themes` is not.
- `ha-nova relay core --method GET --path /api/states/<entity_id>` — verify the entity actually exists afterwards.

## Flow

Drafts follow `../ha-nova/smallest-solution.md`: the complete requested outcome in the simplest safe design, nothing speculative.


Never skip a step.

1. **Read before write.** `read_file` the target (or `list_dir` to find it). Never write a file you have not read: `write_file` replaces the whole file, so an unread file means an unknown loss.
2. **Build the change in memory**. For template/REST/command-line SENSOR definitions, apply the TS checks from `../review/checks-extended.md` → Template/REST/Command-line Sensors to the draft first — fix HIGH findings inline, show the rest as plain-language advisories below the preview (never the internal codes). Then preview it as the File-Change Preview (below). Never a `-`/`+` unified diff, never the whole file unless asked — but say plainly that the whole file is replaced on save.
3. **Confirm**, then capture the auto config snapshot (category `yaml`; data = `{path: <exact logical path>, content: <current file content>}` — the slugified name is lossy, the stored `path` makes the restore path-stable; `../ha-nova/config-snapshots.md` — the `.bak` holds only ONE step, the snapshot store keeps history; on capture failure follow its capture-failure stop; skip for a brand-new file), then run the drift check IMMEDIATELY before the write (`../ha-nova/write-safety.md` → Drift check before apply) — last, so the snapshot round trip cannot open a new window behind it:
   - existing file: `read_file` it once more and compare against the content step 1 read. Changed? STOP — someone edited it during the pause (the File editor app is the common case) and `write_file` would revert them. Show the new content and ask again.
   - brand-new file: absence IS the basis. Probe the exact path with `read_file`: `FILE_NOT_FOUND` is the expected answer and confirms the file is still absent — treat it as success here, not as an error. Any other outcome means the file exists now, so STOP: something created it since step 1 and writing would overwrite a file nobody read. Do not use `list_dir` for this: it returns at most 500 entries and sets `truncated: true`, so a busy directory can report a file as absent when it is not.

   Then plan `write_file` with `backup: true`. The relay writes `<file>.bak` first — that is your immediate rollback; name it in the preview. A brand-new file gets no `.bak`: say so.
4. **Validate**: `POST /api/config/core/check_config`. `{"result":"invalid"}` means Home Assistant would refuse this config: roll back immediately — restore the `.bak` (`read_file` it, `write_file` it back with `"backup": false`, or the `.bak` becomes the invalid file); a NEW file has no `.bak`: say what was wrong, plan its `delete_file` (`plan raw`; declined, a restart loads it), and do NOT reload.
5. **Reload the right domain** — a full restart is almost never necessary:
   - template sensors -> `template.reload`
   - REST sensors -> `rest.reload`
   - command-line sensors -> `command_line.reload`
   - themes -> `frontend.reload_themes`
   - packages / anything under `homeassistant:` -> `homeassistant.reload_core_config` (say when a real restart IS required — some keys only apply at boot).
   - `recorder:` -> no reload service: after green `check_config`, offer a user-consented `homeassistant.restart` or report the change as applying at the next restart.
6. **Verify by read-back**: the new entity must appear in `/api/states/<entity_id>` with a real state. A `recorder:` edit creates no entity — verify by re-reading the file (and `check_config` after a restart). An entity that never appears means the config was accepted but the platform rejected it. Report that honestly and offer the `.bak` restore. For a multi-entity file, also confirm the file's OTHER entities still appear in `/api/states` — a silently dropped sibling passes `check_config` (still-valid config, fewer entities).

## Conventions

- Keep HA NOVA's own additions in `/config/ha_nova/` and include them from `configuration.yaml` — a small, reviewable footprint the user can delete in one go. Add the `!include` line only once, and show it before writing it.
- Never touch `secrets.yaml`, `.storage/`, or the recorder database: the relay refuses them anyway, and needing them means the approach is wrong.
- Code is not configuration: the relay never writes in `custom_components/`, `python_scripts/`, `www/`; it writes only `.yaml`/`.yml`/`.conf`/`.json`/`.txt`/`.md` — never offer to place scripts there.

## File-Change Preview

The Preview Card variant for file edits (`../ha-nova/output-cards.md` -> Cards) — effect sentences, then ONLY the changed section (after-state), what it replaces, the backup line:

```
📝 Preview: file change template_sensors.yaml
Adds a sensor that shows whether any window is open.

New section (the only part that changes):
- binary_sensor:
    - name: "Any window open"

Replaces: nothing — this section is new. A backup (.bak) is written first.
⚠️  Nothing saved yet.
Save it? I can also show the whole resulting file.
```

For an edit to an existing section, show the after-state section and one sentence naming what the old one did.

## When file access is off (the default)

Do not argue around it. Produce the exact YAML block, name the file, and give the two `/core` commands to apply it (`check_config`, then the reload service). The user pastes the block with the File editor App or their own editor. This path is fully supported.

## Error Handling

Full relay/upstream error taxonomy: `../ha-nova/relay-api.md` -> Error Handling. yaml-config specifics:
- `FILE_ACCESS_DISABLED` / `FILE_ACCESS_READONLY`: a configuration choice, not an error — see Bootstrap.
- `FILE_PATH_DENIED`: the path is permanently off-limits (secrets, `.storage`, database, logs, executable dirs). Do not look for a way around it.
- `FILE_TYPE_DENIED`: not a writable configuration format (see Conventions).
- `FILE_NOT_TEXT` / `FILE_TOO_LARGE`: wrong target, or a file this skill has no business editing.
- `check_config` invalid: roll back BEFORE reporting (`.bak` restore; a new file: step 4), then explain.

## 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.

Previews: the File-Change Preview; results: the Result Card. Report which item appeared and its state; if none did, say so, offer the restore.

## 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.

- **Whole-file replacement**: `write_file` replaces the entire file. Always read first and show the File-Change Preview.
- **The `.bak` is the rollback and it is not automatic beyond one step**: a second write overwrites the first backup. For a bigger change, offer a Home Assistant backup first (`ha-nova:backup`).
- **check_config before reload, always.** Reloading an invalid configuration can drop entities that other automations depend on.
- Never enable `file_access` on the user's behalf, and never ask twice.

## Guardrails

- One file per operation.
- Never write a file without a preceding read and a shown File-Change Preview.
- A user-requested `delete_file` is a `plan raw` item AND captures the auto config snapshot first (no `.bak`; not in `/config/www`; `../ha-nova/config-snapshots.md`).
- Never claim success from a reload alone — the entity must exist in `/api/states`.
- Do not add `!include` lines that already exist, and never rewrite `configuration.yaml` wholesale to add one.

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.