AGENTS.md
AGENTS.mdAGENTS.mdroot
Quality
71/100
Scores the file, not the repository.Length
843 words
8 headings · 0 code blocksRepository
90k
— · pushed 0 days agoLast changed
today
First indexed 3 days ago.1# GitHub Copilot & Claude Code Instructions23This repository contains the core of Home Assistant, a Python 3 based home automation application.45## Git Commit Guidelines67- **Do NOT amend, squash, or rebase commits that have already been pushed to the PR branch after the PR is opened** - Reviewers need to follow the commit history, as well as see what changed since their last review89## Pull Requests1011- When opening a pull request, use the repository's PR template (`.github/PULL_REQUEST_TEMPLATE.md`). NEVER REMOVE ANYTHING from the template.12- Do not remove checkboxes that are not checked — leave all unchecked checkboxes in place so reviewers can see which options were not selected.1314## Development Commands1516- Run "python3" in current virtual environment to ensure the correct Python version is used for testing.17- When entering a new environment or worktree, run `script/setup` to set up the virtual environment with all development dependencies (pylint, pre-commit hooks, etc.). This is required before committing. If uv reports that no download was found for the required Python version, the environment is running an outdated version of uv; upgrade it with `curl -LsSf https://astral.sh/uv/install.sh | sh` and run `script/setup` again.18- .vscode/tasks.json contains useful commands used for development.19- After finishing a code session, run `uv run --no-sync prek run --all-files` to check for linting and formatting issues.2021## Python Syntax Notes2223- Home Assistant officially supports Python 3.14 as its minimum version. Do not flag syntax or features that require Python 3.14 as issues, and do not suggest workarounds for older Python versions.24- Python 3.14 explicitly allows `except TypeA, TypeB:` without parentheses. Never flag this as an issue.25- Python 3.14 evaluates annotations lazily (PEP 649). Forward references in annotations do not need to be quoted — annotations can reference names defined later in the module without quoting them or using `from __future__ import annotations`. Do not flag unquoted forward references in annotations as issues.2627## Testing2829- Use `uv run --no-sync pytest` to run tests30- After modifying `strings.json` for an integration, regenerate the English translation file before running tests: `python3 -m script.translations develop --integration <integration_name>`. Tests load translations from the generated `translations/en.json`, not directly from `strings.json`.31- When writing or modifying tests, ensure all test function parameters have type annotations.32- Prefer concrete types (for example, `HomeAssistant`, `MockConfigEntry`, etc.) over `Any`.33- Prefer `@pytest.mark.usefixtures` over arguments, if the argument is not going to be used.34- Avoid using conditions/branching in tests. Instead, either split tests or adjust the test parametrization to cover all cases without branching.35- If multiple tests share most of their code, use `pytest.mark.parametrize` to merge them into a single parameterized test instead of duplicating the body. Use `pytest.param` with an `id` parameter to name the test cases clearly.36- We use Syrupy for snapshot testing. Leverage `.ambr` snapshots instead of repetitive and exhaustive generation of test data within Python code itself.37- Hardcoded `entity_id`s in tests are fine. If the same one is repeated, use a constant.3839## Good practices4041- Integrations with Platinum or Gold level in the Integration Quality Scale reflect a high standard of code quality and maintainability. When looking for examples of something, these are good places to start. The level is indicated in the manifest.json of the integration.42- When reviewing entity actions, do not suggest extra defensive checks for input fields that are already validated by Home Assistant's service/action schemas and entity selection filters. Suggest additional guards only when data bypasses those validators or is transformed into a less-safe form.43- When validation guarantees a dict key exists, prefer direct key access (`data["key"]`) instead of `.get("key")` so contract violations are surfaced instead of silently masked.44- Keep comments concise. Prefer one short line stating the non-obvious constraint, or no comment at all.45- Do not add comments that just restate the code on the following line(s) (e.g. `# Check if initialized` above `if self.initialized:`). Comments should only explain why (non-obvious constraints, surprising behavior, or workarounds), never what. Never add comments that justify a change by referencing what the code looked like before. Comments in tests that explain why a function call or assertion is made are ok.46- Do not add section or divider comments (e.g. `# --- XYZ Triggers ---`) inside or outside of functions, since those can easily become stale and be misleading.47- When catching exceptions, try-clauses should be as small as possible, i.e. avoid wrapping large blocks of code in a try-clause, and avoid catching exceptions from functions that are not expected to raise them.48- Sensitive service actions, i.e. those that can change configuration or have security implications, should require an admin user. Register them with the `async_register_admin_service` service helper, which checks this for you.4950## AI policy5152This project follows the [Open Home Foundation AI Policy](AI_POLICY.md).53Autonomous contributions are not accepted: a human must review, understand,54and be able to explain every change before it is submitted. Do not open55issues or pull requests autonomously, and do not post comments on behalf of56a user without their review.57
Also in home-assistant/core
Diff this repo’s formatsOne repository carrying more than one format is the comparison this product exists for: does anyone actually write different content in each file, or is one a copy of the other?
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| home-assistant/core.github/copilot-instructions.md · 90k | Copilot instructions | testlint-formatstyletypes+2 | 78/100 | today | |
| home-assistant/core.github/instructions/integrations.instructions.md · 90k | Copilot instructions | teststyledo-notagent-behaviour | 71/100 | 3 days ago |
Similar configs
Same format, overlapping stack, ranked by quality.
| Repository | Format | Stack | Covers | Score | Changed |
|---|---|---|---|---|---|
| aaif-goose/gooseAGENTS.md · 52k | AGENTS.md | setupbuildtestlint-format+6 | 100/100 | 3 days ago | |
| OnlyTerp/prompt-cache-skillsAGENTS.md · 112 | AGENTS.md | setupbuildtestlint-format+5 | 100/100 | 3 days ago | |
| n8n-io/n8npackages/@n8n/agents/AGENTS.md · 199k | AGENTS.md | buildteststylearch+3 | 100/100 | 3 days ago | |
| mui/material-uiAGENTS.md · 99k | AGENTS.md | setupbuildtestlint-format+9 | 100/100 | 3 days ago | |
| duckduckgo/content-scope-scriptsspecial-pages/AGENTS.md · 70 | AGENTS.md | buildteststylearch+3 | 100/100 | 3 days ago | |
| SkeneTechnologies/skene-cookbookAGENTS.md · 51 | AGENTS.md | setupbuildtestlint-format+7 | 100/100 | 2 days ago | |
| wpscanteam/wpscanAGENTS.md · 9.7k | AGENTS.md | setupbuildteststyle+6 | 100/100 | 2 days ago | |
| vllm-project/vllmAGENTS.md · 88k | AGENTS.md | setuptestlint-formatstyle+5 | 100/100 | 3 days ago |
