haggle: Agent for Claude Code

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

ha-test-writer is an agent for Claude Code from NaanyaBiz/haggle. It costs 51 tokens per session (656 once invoked), scanned A, original, Apache-2.0.

A testing specialist for a Home Assistant custom integration, using Python test tools and anonymised API fixtures. Home Assistant is software for connecting and automating smart-home devices.

In plain words
What is it for?
Use it after changes in the integration to create or update tests for coordinators, API clients, configuration flows, and entity behaviour.
Why use it?
It keeps tests aligned with the integration's fixtures and testing conventions instead of using real customer data or unsuitable mocks.

Agent for Claude Code

Written for Claude Code: installed under .claude/. Also seen: model in frontmatter.

This is NaanyaBiz/haggle's own configuration. It tells Claude Code how to work on haggle 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 haggle configures →

Reuse

Borrowing it

Nothing to install: this file belongs to NaanyaBiz/haggle. 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/NaanyaBiz/haggle/main/.claude/agents/ha-test-writer.md
Clone the repo
git clone --depth 1 https://github.com/NaanyaBiz/haggle

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/naanyabiz/haggle/ha-test-writer/github.svg)](https://agentmods.dev/agents/naanyabiz/haggle/ha-test-writer)
Your own site
<a href="https://agentmods.dev/agents/naanyabiz/haggle/ha-test-writer"><img src="https://agentmods.dev/badge/agents/naanyabiz/haggle/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/naanyabiz/haggle/ha-test-writer"><img src="https://agentmods.dev/badge/agents/naanyabiz/haggle/ha-test-writer.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 51 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 656 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.00051 $0.00656
Opus 5 $0.00026 $0.00328
Sonnet 5 $0.00010 $0.00131
Haiku 4.5 $0.00005 $0.00066

Measured 4d ago against content hash f3dd06d8aecf, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, 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 4d 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 · 78 lines

How it starts

The opening of the file, as written. The whole thing — 78 lines — stays where its author put it; the contents beside it link to each section on GitHub.

You are an expert in testing Home Assistant custom integrations.

Testing harness

pytest-homeassistant-custom-component  — provides `hass` fixture, MockConfigEntry, async test loop
aioresponses                           — mock aiohttp calls
syrupy                                 — snapshot tests for entity states

Fixture patterns

Use the canonical placeholder identifiers (1234567890 for account, 9999999999 for contract). Do not use real customer values.

from pytest_homeassistant_custom_component.common import MockConfigEntry

entry = MockConfigEntry(
    domain=DOMAIN,
    data={
        CONF_REFRESH_TOKEN: "v1.testtoken",
        CONF_CONTRACT_NUMBER: "9999999999",
        CONF_ACCOUNT_NUMBER: "1234567890",
    },
    unique_id="1234567890_9999999999",
)
entry.add_to_hass(hass)

Patching strategy

Patch at the boundary nearest the test:

  • For coordinator tests: patch("custom_components.haggle.coordinator.HaggleCoordinator._async_update_data")
  • For client tests: load anonymised JSON fixtures from tests/fixtures/ and feed to aioresponses
  • For config flow tests: patch _discover_contracts directly

Test fixture files

Anonymised AGL API response shapes live in tests/fixtures/. Load them:

import json, pathlib

FIXTURES = pathlib.Path(__file__).parent / "fixtures"

def load_fixture(name: str) -> dict:
    return json.loads((FIXTURES / name).read_text())

What to test

  1. Setup / unload roundtrip — entry sets up, sensors created, entry unloads cleanly, session closed.
  2. Config flow — user step shows form, stub path creates entry, multi-contract shows selector.
  3. Coordinator update — mock /Hourly response, assert coordinator data has correct keys/values.
  4. import_statistics call — assert async_import_statistics is called with correct StatisticData after hourly fetch.
  5. Reauth trigger — when _async_update_data raises AGLAuthError, assert ConfigEntryAuthFailed bubbles up.
  6. Token rotation — when AglAuth.async_force_refresh is called, assert persist_callback is called with the new token.

Read the full file on GitHub · 78 lines

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. 4d ago First seen · 78 lines · 51 tokens per session scan A f3dd06d8aecf

Subscribe to this mod's changes

ha-test-writer is an agent published in the GitHub repository NaanyaBiz/haggle (13 stars, last pushed 5d ago), licensed Apache-2.0. It adds 51 tokens to every session and 656 once invoked, about $0.0003 per session on Opus 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-09-04.

Related

Other agents, from other repositories

requirement-tracer

Requirement traceability specialist. Maps every spec requirement (REQ-XXXX) to test cases, tracks feature verification status, and identifies untested requirements. Produces traceability matrix reports in reviews/.

babyworm/rtl-agent-team · 43 tokens

embedded-qa

Use when verifying embedded competition project at CP-3: static analysis, MIL/SIL/PIL three-tier validation, 5-tuple scoring checklist verification, and one-click firmware pipeline. Independent verifier — never implements code, only audits.

DunCanYounG-1/auto-embedded · 51 tokens

formal-reviewer

Formal verification quality reviewer. Reviews SVA assertion completeness, vacuity, assume/assert/cover balance, proof strategy, and SymbiYosys configuration. Produces review reports in reviews/.

babyworm/rtl-agent-team · 42 tokens

p5s-coverage-orchestrator

Coverage analysis orchestrator. Manages 3-round iterative coverage gap analysis (Initial→Deepen→Close), directed test generation for high-priority gaps, and coverage convergence tracking.

babyworm/rtl-agent-team · 45 tokens

p5s-func-verify-orchestrator

Tier 3 functional verification orchestrator. Manages pipelined cocotb TB generation, multi-seed parallel regression, incremental coverage analysis, waveform failure diagnosis, and Requirement Traceability Matrix generation.

babyworm/rtl-agent-team · 51 tokens

ppa-optimizer-dc-orchestrator

Coordinator for one PPA optimization iteration. Sequences DC synthesis, report parsing, RTL patching, equivalence, smoke regression, delta computation, and convergence verdict. Self-contained; spawned by rtl-ppa-optimize-dc or rat-ultraloop-ppa skill.

babyworm/rtl-agent-team · 64 tokens