Home › Bun › Bun runtime CLAUDE.md

Bun runtime CLAUDE.md

CLAUDE.md for TypeScript projects on Bun 1.2+: bun test, Bun.serve, built-in SQLite/Postgres, and bundling.

Claude Code (CLAUDE.md)Bun

How to use

Save this as CLAUDE.md in your repository root, commit it, and your agent will pick it up automatically. Edit the commands to match your project.

CLAUDE.mdDownload  
# CLAUDE.md: Bun project

## Commands
- Install: `bun install` (lockfile `bun.lock`) · Run: `bun run dev` · Test: `bun test` · Types: `bunx tsc --noEmit`

## Use Bun's built-ins first
- HTTP: `Bun.serve({ routes: {...}, fetch })` instead of adding Express.
- Files: `Bun.file(path)` / `Bun.write`. Shell scripts: `import { $ } from "bun"`.
- SQLite via `bun:sqlite`; Postgres via `Bun.sql` if the project uses it. Use parameterized queries (tagged templates), never string concatenation.
- Env vars load from `.env` automatically; read with `Bun.env` or `process.env`. Don't add `dotenv`.
- Password hashing: `Bun.password.hash/verify`.
- Tests: `import { test, expect, mock } from "bun:test"`. Don't add Jest or Vitest.

## Rules
- Keep code Node-compatible only if `package.json` says the package must run on Node too.
- Use `bun add` / `bun add -d` so the lockfile stays in sync; never edit `bun.lock` by hand.
- TypeScript runs directly; no build step for scripts. Use `bun build` only for shipping bundles.

## Don't
- Don't use `npm`/`yarn`/`pnpm` commands in this repo.

## Done when
`bun test` and `bunx tsc --noEmit` pass.

More: all Bun rules · all Claude Code (CLAUDE.md) rules

Related rules

Django CLAUDE.md

CLAUDE.md for Django 5 projects with DRF, pytest-django and PostgreSQL.

Claude Code (CLAUDE.md)Django

Django models & migrations .claude/rules file

A path-scoped Claude Code rules file for Django models, migrations, and ORM queries, loaded only for those files.

Claude Code (CLAUDE.md)Django

Elixir Phoenix CLAUDE.md

CLAUDE.md for Phoenix 1.8 + LiveView 1.x apps in Elixir: contexts, Ecto changesets, and ExUnit tests.

Claude Code (CLAUDE.md)Elixir / Phoenix

Go backend CLAUDE.md

CLAUDE.md for idiomatic Go HTTP services using the standard library, sqlc and table-driven tests.

Claude Code (CLAUDE.md)Go

Go CLI (Cobra) CLAUDE.md

CLAUDE.md for command-line tools in Go 1.27 with Cobra: commands, flags, output formats, exit codes, and tests.

Claude Code (CLAUDE.md)Go

NestJS CLAUDE.md

CLAUDE.md for NestJS 11 APIs in TypeScript: modules, DTO validation, providers, and e2e tests.

Claude Code (CLAUDE.md)NestJS

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.