AI SummaryThis booster provides AI code style and formatting rules for the FanSync Home Assistant integration, enforcing Python 3.13+ standards, type hints, and licensing requirements through Copilot. Developers contributing to this HACS integration benefit from automated guidance on code quality and consistency.
Install
Copy this and paste it into Claude Code, Cursor, or any AI assistant:
I want to add the "homeassistant-fansync — Copilot Instructions" prompt rules to my project. Repository: https://github.com/tjbaker/homeassistant-fansync Please read the repo to find the rules/prompt file, then: 1. Download it to the correct location (.cursorrules, .windsurfrules, .github/prompts/, or project root — based on the file type) 2. If there's an existing rules file, merge the new rules in rather than overwriting 3. Confirm what was added
Description
FanSync Home Assistant Integration
AI Code Style Rules for this repository
NOTE: The canonical source for these instructions is .cursorrules in the repo root. Any changes should be made there; this file syncs automatically via pre-commit hook.
Style & Formatting
• Use Black/Ruff exactly as configured in pyproject.toml (line length 100, Python 3.13). • Follow PEP 8 principles; Black/Ruff are authoritative for enforcement. • Optimize for clarity and readability; prefer explicit types where helpful. • Prefer X | None in type annotations; prefer union syntax in isinstance() checks (e.g., int | str) over tuples. • Type Annotations: • Always add type hints to function/method parameters and return types • Use modern Python 3.10+ syntax: X | None instead of Optional[X] • In tests, annotate fixtures: hass: HomeAssistant, caplog: pytest.LogCaptureFixture • Add return types even for simple functions: -> None, -> str, -> dict[str, Any]
Imports
• Organize imports consistent with Ruff isort settings. • known-first-party: ["custom_components"] • Do not force single-line imports. • Group order: standard library, third-party, first-party. • Import ABCs (Callable, Iterable, etc.) from collections.abc, not typing. • Use X | None instead of Optional[X] (modern Python 3.10+ syntax).
Linting
• Enable Ruff rules: [E, F, I, B, UP] as configured in pyproject.toml. • Respect per-file ignores from pyproject: • tests/*/.py: [E501, F401, I001]
Discussion
Health Signals
My Fox Den
Community Rating
Sign in to rate this booster
Works With
Any AI assistant that accepts custom rules or system prompts