ha-pi-hole-v6: Agent for Claude Code

.claude/agents/ha-test-writer.md

ha-test-writer is an agent for Claude Code from bastgau/ha-pi-hole-v6. It costs 47 tokens per session (655 once invoked), scanned A, original, MIT.

A test-writing assistant for Home Assistant custom integrations. It writes and fixes pytest tests, including tests for the standalone client and tests that run inside Home Assistant, until the project's coverage checks pass.

In plain words
What is it for?
Use it after changing an integration or when its coverage falls. It helps test external-service responses, integration setup and unloading, configuration flows, errors, and related behavior.
Why use it?
It reduces the effort of covering normal results, bad data, network failures, setup errors, and configuration-flow cases after code changes. Pytest is a Python testing tool, and coverage measures how much code behavior the tests exercise.

Agent for Claude Code

Written for Claude Code: installed under .claude/. Also seen: model in frontmatter; mentions CLAUDE.md.

This is bastgau/ha-pi-hole-v6's own configuration. It tells Claude Code how to work on ha-pi-hole-v6 itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything ha-pi-hole-v6 configures →

Reuse

Borrowing it

Nothing to install: this file belongs to bastgau/ha-pi-hole-v6. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/bastgau/ha-pi-hole-v6/develop/.claude/agents/ha-test-writer.md
Clone the repo
git clone --depth 1 https://github.com/bastgau/ha-pi-hole-v6

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for ha-test-writer

README.md
[![agentmods](https://agentmods.dev/badge/agents/bastgau/ha-pi-hole-v6/ha-test-writer/github.svg)](https://agentmods.dev/agents/bastgau/ha-pi-hole-v6/ha-test-writer)
Your own site
<a href="https://agentmods.dev/agents/bastgau/ha-pi-hole-v6/ha-test-writer"><img src="https://agentmods.dev/badge/agents/bastgau/ha-pi-hole-v6/ha-test-writer/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for ha-test-writer

Your own site · 80×15
<a href="https://agentmods.dev/agents/bastgau/ha-pi-hole-v6/ha-test-writer"><img src="https://agentmods.dev/badge/agents/bastgau/ha-pi-hole-v6/ha-test-writer.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 47 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 655 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00047 $0.00655
Opus 5.5 $0.00019 $0.00262
Sonnet 5.5 $0.00009 $0.00131
Haiku 4.5 $0.00005 $0.00065

Measured 12d ago against content hash 485cee0c469c, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

ha-test-writer scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/agents/ha-test-writer.md · 28 lines

What it actually says

You write the tests of a Home Assistant custom integration built from the ha-dev-environment Copier template.

Read first: CLAUDE.md (the project and its data source), .copier-answers.yml (integration_domain, client_package, client_tests_path, coverage_fail_under), the design in docs/, and the code under test.

scripts/test runs one coverage gate per scope, each at coverage_fail_under % branch coverage on its own:

  • client — client_tests_path: plain pytest + pytest-asyncio, no Home Assistant. Mock at the edge of the external service (the third-party library, or HTTP with aioresponses / a fake session) and feed it fixtures shaped like real responses. Cover the mapping to the integration's models, malformed or missing data, timeouts and network errors mapped to the integration's exceptions. Client code reached only by the integration tests does not count here.
  • integration — the rest of tests/: the hass fixture and MockConfigEntry; mock the integration's own client, never the library beneath it. Cover the config flow (every step, every error, abort on a duplicate unique id, reconfigure / options if present), setup and unload, ConfigEntryNotReady, a coordinator failure making entities unavailable then recovering, entity states and attributes, diagnostics if present. Restarts, with the store pre-filled through hass_storage: fresh stored data → setup makes no client call and the next refresh is scheduled from the stored fetch time; stale stored data → setup refreshes; the source failing at setup → the stored data is served instead of ConfigEntryNotReady; nothing stored and the source failing → ConfigEntryNotReady; the store is written after a successful refresh and removed with the entry; a setup at a later time of day shows exactly what the current time implies (nothing depends on a timer having fired).

Rules:

  • Tests never touch the network.
  • Fixture data lives in tests/**/fixtures/ as JSON: small, realistic, nothing that looks like personal data or a real secret.
  • Test behaviour through public entry points, not implementation details, unless a branch can only be reached otherwise.
  • Prefer pytest.mark.parametrize to copy-pasted tests. Freeze time (freezer) wherever dates matter.
  • Tests follow the same lint rules (ruff, pylint, docstring-linter with the tests/** overrides).

If a test reveals a bug in production code, do not fix the production code: write the failing test, mark it xfail with the reason, and report it.

Before you finish: scripts/test and scripts/lint tests must pass. Report each scope's coverage, the tests added, and any bug found.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 28 lines · 47 tokens per session scan A 485cee0c469c

Subscribe to this mod's changes

ha-test-writer is an agent published in the GitHub repository bastgau/ha-pi-hole-v6 (527 stars, last pushed 2d ago), licensed MIT. It adds 47 tokens to every session and 655 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-11-19.

Related

ha-test-writer compared with agents from other repositories

ha-test-writer next to 6 agents from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
ha-test-writerbastgau/ha-pi-hole-v6Agent5272d agoMITA47Claude Code
test-gapswesammustafa/Claude-Code-Everything-You-Need-to-KnowAgent3.7k2d agononeA38Claude Code
pydantic-ai-validatorcoleam00/context-engineering-introAgent14k8mo agoMITA46Claude Code
test-engineerashrafmusa/agenticanaAgent27d agoMITA49Claude Code
fix-verifierXRenSiu/claude-code-forgeAgent29d agoMITA132Claude Code
test-expert-cskbyerlikaya/claude-starter-kitAgent242mo agoMITA41Claude Code
test-writersequenzia/agent-alchemyAgent466mo agoMITA42Claude Code