This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This repository contains production-ready Home Assistant Blueprints for home automation. Blueprints are YAML files with Jinja2 templating that define reusable automation templates for Home Assistant.
See CONTRIBUTING.md for contribution guidelines.
| Target | Description |
|---|---|
make setup |
Setup development environment (pre-commit, Go tools, docs) |
make validate |
Validate all blueprints |
make validate-single FILE=<path> |
Validate a single blueprint |
make build |
Build all Go tools |
make go-init |
Download Go dependencies |
make go-tools |
Install Go dev tools (golangci-lint, gofumpt, goimports) |
make go-test |
Run Go tests |
make go-lint |
Run Go linters (with auto-fix) |
make go-format |
Format Go code |
make go-vet |
Run go vet |
make go-check |
Run all Go checks (format, lint, vet, test) |
make go-audit |
Run security audit with govulncheck |
make go-clean |
Clean Go build artifacts |
make docs-check |
Check docs with Biome |
make docs-fix |
Fix docs issues with Biome |
make markdown-check |
Check markdown files with markdownlint |
make markdown-lint |
Lint and fix markdown files with markdownlint |
make markdown-format |
Format markdown tables with prettier |
make markdown-fix |
Lint and format all markdown files |
make check |
Run all checks (Go + blueprints + docs + markdown) |
make check-all |
Run all checks including security audit |
make clean |
Clean build artifacts |
make help |
Show all available targets |
# Validate a single blueprint
./scripts/validate-blueprint-go/build/validate-blueprint <path/to/blueprint.yaml>
# Validate all blueprints in the repository
./scripts/validate-blueprint-go/build/validate-blueprint --all
# Or use make targets
make validate # Validate all blueprints
make validate-single FILE=<path> # Validate a single fileThe validator checks:
- YAML syntax and blueprint schema
- Input/selector definitions and !input reference validation
- Template syntax (balanced delimiters, no !input inside {{ }})
- Service call structure
- Version sync (blueprint name vs blueprint_version variable)
- Trigger validation (no templates in
for:duration) - Condition structure validation
- Mode validation (single, restart, queued, parallel)
- Delay and wait_template/wait_for_trigger validation
- Empty sequence detection
- README.md and CHANGELOG.md existence
Each blueprint lives in blueprints/<blueprint-name>/ and contains:
*.yaml- The blueprint file (named*_pro.yamlor*_pro_blueprint.yaml)README.md- DocumentationCHANGELOG.md- Version history
blueprint:
name: "Blueprint Name vX.Y.Z"
description: >-
Multi-line description
domain: automation
author: "Author Name"
source_url: https://github.com/...
input:
group_name:
name: Group Label
icon: mdi:icon-name
input:
input_name:
name: Input Label
description: Description
default: value
selector:
selector_type: options...
variables:
blueprint_version: "X.Y.Z"
# Variables defined here, referenced in templates
trigger:
- platform: state
entity_id: !input input_name
# ...
action:
- if:
- condition: template
value_template: "{{ expression }}"
then:
- service: domain.service
target:
entity_id: !input target_input- !input tags: Use
!input input_nameto reference blueprint inputs. Cannot be used inside{{ }}templates - bind to a variable first - Variables section: Must be at root level (not under
blueprint:). Variables can use!inputand are available in templates - Selectors: Every input should have a
selector(entity, number, boolean, select, etc.) - Grouped inputs: Inputs are organized into collapsible groups with
name,icon, and nestedinputdict - Debug logging: Use
logbook.logservice (notsystem_log.write) for debug output - it appears in Home Assistant's Logbook UI which is easier for users to find. Check debug level with direct comparison:{{ debug_level_v in ['basic', 'verbose'] }}
Uses Conventional Commits:
feat(blueprint-name): description- New featuresfix(blueprint-name): description- Bug fixesdocs(readme): description- Documentation changesrefactor: description- Code restructuring
Each blueprint has its own semantic version in:
- Blueprint
namefield:"Blueprint Name vX.Y.Z" blueprint_versionvariableCHANGELOG.md- Add entry for new version
The blueprint name and variable must stay in sync.
The Go tools (ha-ws-client-go and validate-blueprint-go) each have their own semantic version:
- Makefile VERSION: Set
VERSION=X.Y.Zor pass viamake build VERSION=X.Y.Z - CHANGELOG.md: Add entry for each release following Keep a Changelog format
- Version flag: Run
--versionto check current version
When updating Go tools:
- Update the VERSION in Makefile (or rely on git tag for releases)
- Add entry to CHANGELOG.md with date and changes
- Keep both tools' versions synchronized when making coordinated changes
- GitHub Actions will automatically build and release binaries on version tags
Pre-commit hooks:
- The project uses pre-commit instead of Husky
- Hooks validate blueprints, Go code, commit messages, and more
- Configuration:
.pre-commit-config.yaml - Hook scripts:
.pre-commit/hooks/ - Setup:
pip install pre-commit && pre-commit install
Pre-commit checks for Go tools:
- CHANGELOG.md must exist for both tools
- Makefile VERSION must match latest CHANGELOG.md version entry
- Warning if tool versions are not synchronized (not blocking)
Uses markdownlint with:
- Line length limit disabled (MD013: false)
- HTML elements allowed: div, h1, p, em, b, a, img, br, details, summary, kbd
- Never include Claude Code references or co-author lines in commit messages
- Always update the root README.md when adding new blueprints (gallery entry + repository structure)
The project website is served from docs/ and must be kept in sync with blueprints:
Files:
docs/index.html- Main website with blueprint gallerydocs/styles.css- Stylingdocs/script.js- Interactive functionality_config.yml- Jekyll configuration
When adding a new blueprint:
- Update the blueprint count in the hero stats section (
<span class="stat-value">) - Add a new
<article class="blueprint-card">in the blueprints gallery section - Include: icon SVG, title, description, tags, import URL, and docs link
- Import URL format:
https://my.home-assistant.io/redirect/blueprint_import/?blueprint_url=https://raw.githubusercontent.com/schoolboyqueue/home-assistant-blueprints/main/blueprints/<name>/<file>.yaml
When updating a blueprint:
- Update the description if features changed significantly
- Update tags if new capabilities were added
When removing a blueprint:
- Remove the blueprint card from the gallery
- Update the blueprint count in the hero stats
Keep documentation in sync with code changes. When making changes, update all affected documentation:
| Change Type | Files to Update |
|---|---|
| New blueprint | Root README.md (gallery + structure), docs/index.html, CLAUDE.md if patterns change |
| New Go tool feature | Tool's README.md, CLAUDE.md (architecture if new files), CHANGELOG.md |
| New Go tool internal package | Tool's README.md + CLAUDE.md (architecture sections), root README.md (structure) |
| New workflow file | Root README.md (structure section) |
| Changed directory structure | All README.md and CLAUDE.md files with architecture/structure sections |
| New npm script | package.json, CLAUDE.md (npm Scripts table), CONTRIBUTING.md (Available npm Scripts) |
| Contribution process change | CONTRIBUTING.md, CLAUDE.md if it affects documented workflows |
These files contain directory structure diagrams that must stay current:
README.md(root) - Repository structureCONTRIBUTING.md- Development setup and npm scripts tablescripts/ha-ws-client-go/README.md- Architecture sectionscripts/ha-ws-client-go/CLAUDE.md- Architecture sectionscripts/validate-blueprint-go/README.md- Architecture sectionscripts/validate-blueprint-go/CLAUDE.md- Architecture + Package Structure sections
- If you added/removed/renamed files, update relevant architecture sections
- If you added new commands or features, update README.md command tables
- If you changed tool behavior, update CLAUDE.md usage examples
- Run
git diff --statto see changed files and verify docs are updated