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.

Related rules

AWS CDK (TypeScript) CLAUDE.md

CLAUDE.md for AWS CDK v2 apps in TypeScript: constructs, least-privilege grants, snapshot tests, and safe deploys.

Claude Code (CLAUDE.md)AWS CDK

Claude Agent SDK CLAUDE.md

CLAUDE.md for building agents with the Claude Agent SDK (Python/TypeScript): options, tools, permissions, and hooks.

Claude Code (CLAUDE.md)LLM apps & agents

Code reviewer subagent (Claude Code)

A Claude Code subagent definition that reviews the current diff for bugs, security, and tests, reporting by severity.

Claude Code (CLAUDE.md)Agent workflows

/commit slash command (Claude Code)

A Claude Code /commit slash command that reviews staged changes and writes a Conventional Commits message.

Claude Code (CLAUDE.md)Agent workflows

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.