Ha card features add
Skill nolte/claude-home-assistant/skills/ha-card-features-add
Augments an existing Home Assistant frontend module with one custom tile/card feature — the interactive control row rendered inside the tile card and other host cards — conforming to spec/ha/lovelace-card-features. Creates the feature custom element implementing the card-feature contract (setConfig with an invalid-config reject path, the hass setter, a shared isSupported predicate resolving stateObj from context.entity_id, the render() of the control row calling hass.callService), optional static getStubConfig/getConfigElement, and registration via window.customCardFeatures.push plus customElements.define. Activate on "add a tile feature", "create a custom card feature", "add a control row to the tile card", or equivalent German requests. Do not activate for a full card (ha-lovelace-card-scaffold), a card config editor (ha-card-editor-add), badges (ha-badge-add), or deploying to a live HA instance.From its SKILL.md
npx -y skills add nolte/claude-home-assistant --skill ha-card-features-addAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
8.7 KB, as published. Nobody here has run it
HA Card Features Add
Spec: spec/claude/ha-card-features-add/en.md (EN canonical) / spec/claude/ha-card-features-add/de.md (DE translation).
Why this is a skill, not an agent
- Human-visible augmentation surface — the user describes a quick control and reads back the feature element, its registration, and the conformance report; a skill keeps this on the visible command surface, like the sibling augment skills (
ha-lovelace-card-scaffold,ha-config-flow-augment). - Mid-flow interactivity — the applicability-predicate decision (which domain/entity, entity- vs. area-bound) and whether the feature is configurable are per-run dialogues the user approves before generation.
- Bounded, inline generation — one feature custom element plus its registration fits inline; no isolated agent context is needed.
- Counter-dimension considered: the draft→validate loop could be an agent, but the predicate decision and the host-card context binding belong in the user's working context; skill wins.
When this skill activates
Use this skill to add one custom card feature — an interactive control row rendered inside the tile card (or another host card) — to an existing frontend module, acting on the parent card's bound entity.
When NOT to activate
- a full custom card (card file layout,
set hasslifecycle,getCardSize/getGridOptions) →ha-lovelace-card-scaffold/ha/lovelace-card-patterns - the feature's graphical config editor mechanics →
ha/lovelace-card-editor - badges as a separate dashboard delivery shape →
ha-badge-add - deploying/importing into a running HA instance → out of scope
Hard rules
- One feature, one run. No multi-feature batches.
- Read
spec/ha/lovelace-card-features/en.mdfirst. Do not generate from memory. - Register both ways. Register the feature via
window.customCardFeatures = window.customCardFeatures || []; window.customCardFeatures.push({ type, name, ... })with mandatorytypeandname, and register the element viacustomElements.define("<feature-type>", <FeatureClass>)so thetyperesolves. The element extendsHTMLElementorLitElement. setConfiglifecycle. ImplementsetConfig(config)(this.config = config) and reject a missing/invalid config withthrow new Error("Invalid configuration").- Context contract. Carry
hass,config,contextas properties (the host card sets them); resolve the targetstateObjfromthis.hass.states[this.context.entity_id], handling a missingcontext/entity_id; returnnullfromrender()whileconfig/hass/contextare unset or the entity is unsupported. - Service on interaction. Render controls and on interaction call
this.hass.callService(domain, service, { entity_id })on the target entity; callev.stopPropagation()so the click does not bubble up to the host card. - One predicate, two uses. Provide an
isSupported(hass, context)predicate that resolves thestateObjfromcontext.entity_id, returnsfalsewhen none exists, and checks applicability by domain (not a single entity ID) — and use the same function inrender()and in thecustomCardFeaturesisSupportedentry. - Configurable only when configured. For a configurable feature add
static getStubConfig()(returning a default config incl.type: "custom:<feature-type>"), setconfigurable: true, and addstatic getConfigElement()for a graphical editor (seespec/ha/lovelace-card-editor/en.md); never requiregetConfigElement/getStubConfigfor a feature with no extra config —configurablestaysfalse. - HA default styling. Use the CSS custom properties
--feature-height,--feature-border-radius,--feature-button-spacing. - Name per
spec/ha/naming-conventions/en.mdand verify HA internals against the official docs (seespec/ha/upstream-docs-verification/en.md).
Inputs
| Field | Required | Default | Notes |
|---|---|---|---|
target_dir | yes | — | repo root; an existing frontend module the feature is added into |
control | yes | — | the quick control the feature expresses, in prose |
feature_type | no | derived | the customElements type and customCardFeatures type |
name | no | derived | editor label |
| domain / predicate | no | inferred + confirmed | which domain/entity the feature binds to; entity- vs. area-bound |
| configurable | no | false | whether the feature offers extra config (e.g. a label) |
If the user is silent on an optional field, use the default but state it explicitly.
Pre-flight (in order — abort on first failure)
target_dircontains an existing frontend module the feature can be augmented into.- Read
ha/lovelace-card-features. - Confirm the applicability predicate: which domain/entity the feature binds to, and whether it is entity- or area-bound.
- The feature /
feature_typeis not already declared. If it is, abort.
Workflow
1) Resolve and confirm
State feature_type, name, the target domain/predicate, entity- vs. area-bound, and whether the feature is configurable in one paragraph. Wait for confirmation.
2) Generate
Create the feature custom element extending HTMLElement/LitElement with: setConfig(config) (reject invalid config), the hass/config/context properties, the shared isSupported(hass, context) predicate, and render() (returns null until ready / when unsupported; calls this.hass.callService(...) on interaction with ev.stopPropagation(); styled with --feature-*). Register via window.customCardFeatures.push({ type, name, ... }) and customElements.define. Add static getStubConfig/static getConfigElement and configurable: true only when the feature is configurable.
3) Validate and report
Validate offline (registered both ways with type/name; extends HTMLElement/LitElement; setConfig throws on invalid config; stateObj resolved from this.hass.states[this.context.entity_id] with missing context/entity_id handled; render() returns null when not ready; interaction calls this.hass.callService(...); the same predicate is used in render() and isSupported; configurable features set configurable: true plus getStubConfig/getConfigElement). Emit a CONFORMANT / NEEDS-WORK report keyed to ha/lovelace-card-features acceptance criteria, plus the changed file paths and the quality-scale marker (not part of the HA quality scale, portfolio-specific).
4) No deploy
The skill never deploys to a live HA instance. Surface the report and stop.
Boundaries
- A full custom card →
ha-lovelace-card-scaffold/ha/lovelace-card-patterns - The feature's graphical config editor →
ha/lovelace-card-editor - Badges →
ha-badge-add - Feature JS delivery / frontend loading (
StaticPathConfig) →ha/lovelace-card-patterns - Deploy to live HA → out of scope