ha-frontend-contexts
Skill by home-assistant
Guides developers on moving Home Assistant frontend components from the broad hass object to narrower Lit context consumers. It is for contributors working on the Home Assistant frontend.
Install ha-frontend-contexts
Built from the published package, never by AI.
git clone --depth 1 https://github.com/home-assistant/frontend /tmp/frontend && mkdir -p ~/.claude/skills && cp -r /tmp/frontend/.agents/skills/ha-frontend-contexts ~/.claude/skills/ha-frontend-contextsRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/home-assistant/frontend /tmp/frontend && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/frontend/.agents/skills/ha-frontend-contexts ~/.gemini/antigravity-cli/skills/ha-frontend-contextsAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Step-by-step: install ha-frontend-contexts in Antigravity CLI
Skills can run scripts on your machine. Some need an API key: check the README.
About
This skill gives guidance for Home Assistant frontend code that reads state, registries, localization, services, config, UI data, connection state, or API helpers. It asks components to move away from the broad hass object and consume the narrowest context that covers their reads. A table maps each context, such as statesContext, entitiesContext, and apiContext, to the hass properties it replaces.
The skill explains the consume decorator from the frontend's own common decorators folder, which should be used instead of the @lit/context version. It covers when to pair @state() and @transform, how reactive controllers use consumeContext, and when to use the entity-scoped helpers. A review checklist covers rerender behavior and test mocks. It is written for frontend developers who add or change component state access in Home Assistant.
Written from the project's SKILL.md and checked against it.
What it can do
- Context selection tableMaps each Home Assistant context, such as statesContext or configContext, to the hass properties it replaces.
- Consume decorator guidanceExplains when to use @state(), @consume, and @transform so only the needed updates trigger a rerender.
- Reactive controller patternShows how to extend ContextController and use consumeContext in reactive controllers.
- Entity-scoped helpersDescribes consumeEntityState, consumeEntityRegistryEntry, and consumeEntityStates for entity IDs held on the host.
- Review checklistLists checks for narrow context use, brand image token handling, @state() use, and test mocks.
Try asking
- Migrate this Lit component from hass.states to statesContext
- Which context replaces hass.localize and hass.language in this card?
- Review this component for unnecessary rerenders caused by broad hass access
Good to know
- Single-field contexts such as localizeContext, themesContext, and userContext are deprecated.
- @state() and @transform do not work on reactive controller fields; call host.requestUpdate() instead.
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: .agents/skills/ha-frontend-contexts/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
-
SKILL.md8 KB
Alternatives to ha-frontend-contexts
All alternatives →Runs a 7-stage workflow for auditing, cleaning up and reviewing GitHub repositories, plus competitor analysis. Written for developers who want a repo checked for secrets, junk files and documentation gaps.
Teaches an AI assistant to build, debug and explain Gradio web UIs and ML demos in Python. It covers the core API, components, event listeners, layouts and the MCP server option. Aimed at Python developers who work with Gradio.
Recommends menus, buttons, toolbars and disclosure controls for Apple platforms using Human Interface Guidelines conventions. Built for developers and designers making iOS, iPadOS, macOS or visionOS interfaces. Checks existing project design context before asking questions.
Creates production-ready FastAPI project structures with async patterns, dependency injection, and error handling. It is for developers starting new FastAPI applications or backend API projects.
Analyzes Android apps to find user workflows to expose as AppFunctions, so AI agents and system shortcuts can run them without opening the app UI. Generates Kotlin code and refines KDoc for Android developers.
Creates, edits, validates and runs Agent QA tests, suites and hooks through MCP or CLI. It keeps canonical IDs and schema contracts intact, for developers and QA teams using Agent QA.
Compare with openclaw-github-repo-commander, gradio or hig-components-menus
ha-frontend-contexts: common questions
Why should components avoid the broad hass object?
The source says broad hass access rerenders components for unrelated changes, hides the data a component depends on, and makes tests harder to mock.
Which consume function should be imported?
The source says to import consume from src/common/decorators/consume, not from @lit/context, because the @lit/context version forces a host update on every context change.
Are container components required to remove hass?
No. The source says container components may keep hass when they own it and feed providers, while leaf components should consume the narrowest context.
How do I install ha-frontend-contexts?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is ha-frontend-contexts free?
The code is published under the Apache-2.0 licence. The service it connects to may have its own pricing.
Is ha-frontend-contexts safe to use?
It scores 83 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to ha-frontend-contexts?
Similar skills: openclaw-github-repo-commander, gradio, hig-components-menus, fastapi-templates.
