# AGENTS.md — JavaScript

Drop this in your repository root and symlink CLAUDE.md to it:

    ln -s AGENTS.md CLAUDE.md

Then delete every line that is not true of YOUR repository, and add the
corrections you have had to make to an agent twice. Under 100 lines is the
target — every line competes for attention with every other line.

From JavaScript at https://learn-javascript.org/ai/ — free to use, MIT.

---

Node LTS, ESM, pnpm. jsconfig.json has checkJs: true.

## Commands
- Check: `pnpm check`  (tsc --noEmit via checkJs, eslint, vitest run)
- Test:  `pnpm vitest run`

## Conventions
- await every promise. No floating promises, ever.
- Promise.all for independent work; a plain loop only when each iteration
  depends on the previous one.
- Promise.allSettled when partial success is acceptable.
- Never pass an async function to forEach — it does not await.
- useEffect that fetches must abort on cleanup (AbortController).
- ?? for nullish defaults, not || — 0 and "" are valid values.
- structuredClone, not JSON.parse(JSON.stringify(x)).
- Do not mutate arguments, props or state.

## Use the platform
fetch not axios. crypto.randomUUID() not uuid. node --env-file not dotenv.
Intl/Temporal not moment. fs.rm not rimraf. Object.groupBy not lodash.
