# `naming.generic_name`

A domain or library is called something generic, such as `helpers` or `utils`, that says nothing about what it holds.

Area 1, [Project layout and modules](/docs/project-layout-and-modules.md); not declinable; the next step is usually the agent's.

## Why Jadpo refuses it

A domain's or library's name appears in every call into it, as in
`rounding.half_even(x)` or `inventory.reserve_stock(...)`. A name that
says what it holds tells the reader what the call does. `common`,
`core`, `helpers`, `misc` and `utils` say nothing, and they collect
unrelated code over time.

## What it looks like

main.jadpo:

```jadpo
type Stock = Int {
    min: 0
}

library helpers {
    function add_holdback(subtotal: Stock) -> Stock {
        return subtotal
    }
}
```

```text
error: `helpers` is too generic for a library
 --> main.jadpo:5:9
  |
5 | library helpers {
  |         ^^^^^^^ says nothing about what it holds
  reason: Domains and libraries are named after what they hold, because the name appears in every call; `common`, `core`, `helpers`, `misc` and `utils` say nothing.
  next: Rename the library after what its functions do (agent)
  rule: naming.generic_name
  help: https://jadpo.dev/docs/errors/naming.generic_name

check failed: 1 error, 1 file
```

`(agent)` at the end of the `next:` line means your coding agent can make
the fix itself: it can name a library after what its functions do.

A domain called `utils` is reported at its first file:


domains/utils/actions/tidy.jadpo:

```jadpo
action tidy() -> Unit {}
```

```text
error: `utils` is too generic for a domain
 --> domains/utils/actions/tidy.jadpo:1:1
  |
1 | action tidy() -> Unit {}
  | ^ says nothing about what it holds
  reason: Domains and libraries are named after what they hold, because the name appears in every call; `common`, `core`, `helpers`, `misc` and `utils` say nothing.
  next: Rename `domains/utils/` after the business area it covers (agent)
  rule: naming.generic_name
  help: https://jadpo.dev/docs/errors/naming.generic_name

check failed: 1 error, 2 files
```

This project has no commit yet, so no one depends on the name and your
coding agent can choose one. Once the project has a commit, the next step
ends `(human)`, which tells your coding agent to stop and ask you which fix
you want, because the choice is yours to make: a domain is a boundary other
code is shaped around, so a new domain's name needs your
[acceptance](/docs/acceptances.md).

## How to fix it

**If the library's functions share one job**, name it after that job.
Here they hold stock back:

```jadpo
library holdback {
    ...
}
```


Calls now read `holdback.add_holdback(subtotal)`, which says where the
function lives and what it is about.

When its functions do unrelated jobs, split them into libraries named
after each job, such as `rounding` and `pricing`.

**If it is a domain**, rename its folder after the business area it
covers, such as `ordering` or `planning`, and change each `use utils/...`
line and `utils.` call to match:

```sh
git mv domains/utils domains/housekeeping
```

Until `jadpo domain rename` is built, a renamed domain shows as a new
one, so the change needs your acceptance, `housekeeping:
DomainChange.created`.

## Related

- [Domains](/docs/domains.md)
- [Naming](/docs/naming.md)
- [Calls name their owner](/docs/ownership-and-calls-replace-modules.md#calls-name-their-owner)
- [Acceptances](/docs/acceptances.md)
