hex-domain-servicelisted
Install: claude install-skill wntic/pyhouse
# Hex — Domain Service
Produces one domain service: a stateless class that orchestrates a domain rule using injected protocols. Domain services live next to the aggregate they primarily concern. See `naming` for identifiers.
## When to use vs. neighbours
- Rule enforceable from one entity's own fields → not a service; use `__post_init__` on the entity (see `hex-domain-model`).
- Rule needs to query other aggregates or a domain capability → this skill.
- Rule is a numeric or boolean threshold (max rows, retention days, quotas) → not a service; model it as the tunable value object in `hex-domain-model`.
- Orchestrating a use case across multiple aggregates → that is a command or query handler, not a service (see `hex-application`).
- The `IFooRepository` or `ICan<Verb>` protocols this service takes in its constructor → `hex-domain-ports`.
- The exception an `assert_*` method raises → `exception-catalog`.
- Binding the service (per-operation) so handlers receive it → `hex-wiring`.
- Testing it with stdlib, `pytest` and the domain package alone → `hex-test-domain`.
- What the service, its methods and its module are called → `naming`.
## Template — stdlib only, collaborators injected as domain ports
```python
from ..exceptions import FooConflictError
from .i_foo_repository import IFooRepository
__all__ = ["FooUniquenessService"]
class FooUniquenessService:
def __init__(self, repository: IFooRepository) -> None:
self._repository = repository
async def asser