hassette
Copilot instructions81 starsChanged 7 months agoMITView on GitHub
Condensed from CLAUDE.md and .claude/rules/. When a convention there changes, update this file too. Hassette is an async-first Python framework for building Home Assistant automations. Python 3.11–3.14. The frontend is React + TypeScript + Vite, styled with Tailwind CSS v4 and shadcn/ui. Core components: App (user automations), Bus (event pub/sub), Scheduler (triggers/jobs), Api (HA REST/WebSocket), StateManager (state access/caching). All are async. Resource is the base class; Service extends it for background services.
We split this copilot-instructions.md into the rules it gives an agent
7 rules. About 0 are common, 2 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 14
No
Optional[X]: Use X | None. - Very specific: line 15
No lazy imports: All imports at the top of the file.
- Distinctive: line 16
Immutability: Create new objects, never mutate existing ones.
- Distinctive: line 25
Explicit timeouts on external calls: No implicit "wait forever."
- Very specific: line 26
No bare
except:or silentexcept Exception: pass: Use contextlib.suppress with a specific type when intentional. - Very specific: line 30
No
any: Use unknown and narrow. - Very specific: line 32
No
enum: Use as const objects or union types.
≈ “Common” is an estimate: at least 1 in 5 of the 3,669 Copilot instructions files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Copilot Instructions
Condensed from
CLAUDE.mdand.claude/rules/. When a convention there changes, update this file too.
Project
Hassette is an async-first Python framework for building Home Assistant automations. Python 3.11–3.14. The frontend is React + TypeScript + Vite, styled with Tailwind CSS v4 and shadcn/ui.
Core components: App (user automations), Bus (event pub/sub), Scheduler (triggers/jobs), Api (HA REST/WebSocket), StateManager (state access/caching). All are async. Resource is the base class; Service extends it for background services.
Python Rules
- No
from __future__ import annotations. Breaks Pydantic, FastAPI, dataclasses, and runtime type inspection. Always flag this. - No
Optional[X]. UseX | None. - No lazy imports. All imports at the top of the file. Exceptions:
TYPE_CHECKINGguards and deferred imports in__main__.pyto break circular dependencies at startup. - Immutability. Create new objects, never mutate existing ones.
- Use
wheneverinstead of stdlibdatetime. Convert at boundaries when libraries require stdlib types. _prefix marks private methods on public classes only. Public classes that app authors use directly (App,Bus,Scheduler,Api,StateManager) prefix non-API methods with_to keep their public surface clean. Internal classes that app authors never touch (the*Serviceclasses, executors, repositories) use no_prefixes — the class is already internal, so marking individual methods private is redundant noise.- Early returns. Guard clauses at the top, happy path at the bottom.
- No section divider comments between methods.
- Dependencies as parameters. Functions receive collaborators, not create them inline. If testing requires
mock.patchmore than one level deep, the code needs restructuring. - Mock only at boundaries. External APIs, databases, time, filesystem. Use real instances for internal collaborators.
- No mutable default arguments on functions or methods.
- Every coroutine call must be awaited. Forgetting
awaitsilently does nothing. - Explicit timeouts on external calls. No implicit "wait forever."
- No bare
except:or silentexcept Exception: pass. Usecontextlib.suppresswith a specific type when intentional.
TypeScript Rules
- No
any. Useunknownand narrow. - No
ascasts except after full validation, foras const, or unavoidable patterns like.json() as Promise<T>. Use schema validation orsatisfieswhere possible. - No
enum. Useas constobjects or union types. - Discriminated unions over optional fields for variant types.
- Strict mode required (
"strict": true).
Frontend
- React function components with hooks. No class components. Every
useEffectwith subscriptions must return a cleanup function. - Tailwind utilities in JSX. Compose conditional classes with
cn()from@/lib/utils. No CSS Modules, no@apply, no raw hex colors — use the design tokens. - Design tokens live in
frontend/src/global.css, the single CSS entry point. Prefer the shadcn-named tokens (--background,--foreground,--primary,--border); reference project tokens without a Tailwind utility as arbitrary values (text-[var(--handler-job)]).--accentis Hassette's brand color, not shadcn's highlight role (that is--highlight-bg). - Primitives (
Button,Badge,Card,Dialog,Table, etc.) are shadcn components incomponents/ui/; composites live incomponents/shared/. Use them instead of rebuilding standard controls with raw markup. - Module-level Tailwind class-string constants are named
FOO_CLASS/FOO_CLASSESso theno-unknown-classeslint rule can validate them.
Commits and PR Titles
- Conventional commits:
feat:,fix:,refactor:,docs:,test:,chore:,perf:,ci:. Lowercase imperative mood, no period. - This repo uses release-please — PR titles become changelog entries. They should describe user-visible outcomes, not implementation details.
Testing
uv run nox -s devfor local test runs.uv run nox -s testsfor CI-equivalent (Python 3.11–3.14).prek -afor lint/format;prek run pyright -a --stage pre-pushfor type checking.- Two test harnesses:
HassetteHarness(real components, integration tests) andcreate_hassette_stub()(MagicMock, web/API tests). - E2E tests use Playwright with Chromium.
Where files are headingNew Copilot instructions files have more rules about branches and pull requests, and fewer about code style.
Of the Copilot instructions files we read, the 2,297 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
In this repository10 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- doc-accuracy-reviewSkill
- doc-coverage-reviewSkill
- doc-persona-reviewSkill
- docsSkill
- ha-version-bumpSkill
- review-autofixesSkill
- triage-autofix-issuesSkill
- triage-medium-issuesSkill
- ui-qaSkill
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
Reviews can't be read right now.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

