docs: PATTERNS.md, the rules that came out of real problems #4

Merged
tim merged 1 commit from docs/patterns into main 2026-10-12 12:05:31 +00:00
Owner

A dedicated file to point people and LLMs at before they change code, CI or releases in any repository. Documentation only, no action changes.

Contents

  • Security: never suppress a scanner finding (restructure the code); build queries and commands from validated fragments (with a worked InfluxQL example); secrets and hostnames (REPO_WRITER_PAT, no hardcoded hosts, the HA_TOKEN="" placeholder is not a leak); scan on every PR, main and weekly.
  • Python projects: one Python version set everywhere at once, and what ruff's target-version really means (PEP 758); one list of dev dependencies and floors not pins, plus the Home Assistant test plugin exception and asyncio_mode = "auto"; lint and format rules; tests (TDD, characterization tests, AST-compare for formatting-only commits).
  • CI and releases: shared actions at @main by full URL; test the path production uses; runner labels; the release flow; depend on our own forks by immutable tag.
  • Working practice: branch per run, check MR state before editing, no force-push, verify in a runner-like container, and how to read CI results through the Forgejo API (global run id, then jobs, then logs).

Every rule comes from something that actually went wrong in the last maintenance run, with the reason, so it is clear when it does not apply.

Linked from the README.

Claude-Session: https://claude.ai/code/session_013jL41LP9srdcUDYggNpC98

🤖 Generated with Claude Code

A dedicated file to point people and LLMs at before they change code, CI or releases in any repository. Documentation only, no action changes. ## Contents - **Security**: never suppress a scanner finding (restructure the code); build queries and commands from validated fragments (with a worked InfluxQL example); secrets and hostnames (`REPO_WRITER_PAT`, no hardcoded hosts, the `HA_TOKEN=""` placeholder is not a leak); scan on every PR, main and weekly. - **Python projects**: one Python version set everywhere at once, and what ruff's `target-version` really means (PEP 758); one list of dev dependencies and floors not pins, plus the Home Assistant test plugin exception and `asyncio_mode = "auto"`; lint and format rules; tests (TDD, characterization tests, AST-compare for formatting-only commits). - **CI and releases**: shared actions at `@main` by full URL; test the path production uses; runner labels; the release flow; depend on our own forks by immutable tag. - **Working practice**: branch per run, check MR state before editing, no force-push, verify in a runner-like container, and how to read CI results through the Forgejo API (global run id, then jobs, then logs). Every rule comes from something that actually went wrong in the last maintenance run, with the reason, so it is clear when it does not apply. Linked from the README. Claude-Session: https://claude.ai/code/session_013jL41LP9srdcUDYggNpC98 🤖 Generated with [Claude Code](https://claude.com/claude-code)
docs: PATTERNS.md, the rules that came out of real problems
All checks were successful
test auto-tag / test (pull_request) Successful in 3s
test docker-publish / test (pull_request) Successful in 4s
test python-test / test (pull_request) Successful in 14s
test security-scan / test (pull_request) Successful in 29s
9a98b8d305
A dedicated file to point people and LLMs at before they change code, CI
or releases: no scanner suppressions, validated query fragments,
secrets and hostnames, one Python version, dev dependency handling for
Home Assistant components, lint and format, tests, shared actions,
runner labels, the release flow, depending on our own forks, and how to
read CI results via the Forgejo API.

Linked from the README.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013jL41LP9srdcUDYggNpC98
tim merged commit 2e664b9be3 into main 2026-10-12 12:05:31 +00:00
tim deleted branch docs/patterns 2026-10-12 12:05:31 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
tim/workflow-basics!4
No description provided.