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.

More: all TypeScript rules · all AGENTS.md rules

Related rules

TypeScript strict mode rules

Cursor rules for strict TypeScript 5.9+: no any, unknown narrowing, discriminated unions, satisfies, and runtime validation.

CursorTypeScript

Browser extension with WXT AGENTS.md

AGENTS.md for cross-browser Manifest V3 extensions built with WXT: entrypoints, messaging, storage, and permissions.

AGENTS.mdChrome extensions

htmx + server-rendered HTML AGENTS.md

AGENTS.md for htmx 2 apps with server-rendered templates (any backend), partials, and progressive enhancement.

AGENTS.mdhtmx

Next.js AGENTS.md

AGENTS.md for Next.js 16 App Router projects: commands, folder layout, data access, auth, and done criteria.

AGENTS.mdNext.js

Nuxt 4 AGENTS.md

AGENTS.md for Nuxt 4 apps: the app/ directory layout, data fetching keys, server routes with validation, and runtime config.

AGENTS.mdVue / Nuxt

SvelteKit AGENTS.md

AGENTS.md for SvelteKit 2 + Svelte 5 (runes) apps with TypeScript.

AGENTS.mdSvelteKit

Get new rules weekly

One email a week: fresh rule files, agent tips, and what's changing in Cursor, Claude Code and Copilot. Free, unsubscribe anytime.

Opens the Rulestack Newsletter on beehiiv in a new tab. Or subscribe directly on beehiiv.