Home › TypeScript › TypeScript npm library AGENTS.md
TypeScript npm library AGENTS.md
AGENTS.md for publishing TypeScript npm packages: ESM exports maps, bundling with tsdown, type checks, and changesets.
AGENTS.mdTypeScript
How to use
Save this as AGENTS.md in your repository root, commit it, and your agent will pick it up automatically. Edit the commands to match your project.
Note: Review and test before use. Provided as is, without warranty. See Terms.
AGENTS.mdDownload # AGENTS.md: TypeScript library
## Commands
`pnpm build` (tsdown or tsup) · `pnpm test` · `pnpm typecheck` · `pnpm lint` · package checks: `npx publint` and `npx @arethetypeswrong/cli --pack .`
## Package shape
- ESM-first (`"type": "module"`). `exports` map is the public API: each entry has `types` first, then `import` (and `require` only if CJS is still supported).
- `files` whitelist (`dist`, `README.md`, `LICENSE`); nothing else is published.
- `sideEffects: false` unless a module truly has side effects.
- `engines.node` states the minimum supported Node version; test against it in CI.
## Code rules
- Public API is exported from `src/index.ts` (and declared subpaths). Anything not exported is internal and may change.
- Breaking changes (removed exports, changed signatures or behavior) need a major version. Mark deprecations with `/** @deprecated use x */` first.
- No runtime dependencies unless necessary; prefer peer dependencies for frameworks (React, etc.).
- Every public function has TSDoc with an example.
- Don't rely on Node-only APIs if the package claims browser/edge support.
## Releases
- Add a changeset (`pnpm changeset`) describing user-facing changes with the right bump.
- Never run `npm publish` or `pnpm changeset publish` from the agent.
## Done
Build, tests, typecheck, publint and attw all pass.