CLAUDE.md for a Node.js and TypeScript project
Short instructions telling Claude how to build, test and lint a TypeScript project and which conventions to follow. Replace the {{…}} spots with your real commands and folders, then delete what you do not use.
Tested with Claude Code 2.1.329
Spots to fill
{{project_name}}Project namee.g.checkout-api{{package_manager}}The package manager you use (npm, pnpm, yarn or bun)e.g.pnpm{{source_dir}}Folder that holds the source codee.g.src
CLAUDE.md
# {{project_name}}
TypeScript on Node.js. Package manager: {{package_manager}} (never mix in another one).
## Commands
- Install: `{{package_manager}} install`
- Type check: `{{package_manager}} run typecheck`
- Test all: `{{package_manager}} test`
- Test one file: `{{package_manager}} test -- path/to/file.test.ts`
- Lint and format: `{{package_manager}} run lint --fix`
Run the type check and the tests for the files you touched before saying a task is done.
## Layout
- Source lives in `{{source_dir}}/`; tests sit next to the code as `*.test.ts`.
- Shared types go in `{{source_dir}}/types/`. Do not redefine a type that already exists there.
## Conventions
- `strict` TypeScript: no `any`, no `@ts-ignore`. Use `unknown` and narrow it.
- Named exports only; no default exports.
- Use `async`/`await`, never raw `.then()` chains.
- Errors: throw `Error` subclasses with a clear message; never swallow an error silently.
## Do not
- Edit generated files under `dist/` or anything ignored by git.
- Add a dependency without saying why in your reply.
- Commit `.env` files or print secrets.
CLAUDE.md
# checkout-api
TypeScript on Node.js. Package manager: pnpm (never mix in another one).
## Commands
- Install: `pnpm install`
- Type check: `pnpm run typecheck`
- Test all: `pnpm test`
- Test one file: `pnpm test -- path/to/file.test.ts`
- Lint and format: `pnpm run lint --fix`
Run the type check and the tests for the files you touched before saying a task is done.
## Layout
- Source lives in `src/`; tests sit next to the code as `*.test.ts`.
- Shared types go in `src/types/`. Do not redefine a type that already exists there.
## Conventions
- `strict` TypeScript: no `any`, no `@ts-ignore`. Use `unknown` and narrow it.
- Named exports only; no default exports.
- Use `async`/`await`, never raw `.then()` chains.
- Errors: throw `Error` subclasses with a clear message; never swallow an error silently.
## Do not
- Edit generated files under `dist/` or anything ignored by git.
- Add a dependency without saying why in your reply.
- Commit `.env` files or print secrets.