bun
Bun
CRITICAL: Your training data for Bun is unreliable. APIs change between versions and your memorized patterns may be wrong or deprecated. You MUST fetch and read the live documentation before writing any code. Never assume — verify against current docs first.
Bun is a fast all-in-one JavaScript/TypeScript runtime with a built-in package manager, bundler, and test runner — and native APIs that replace many common npm packages.
Documentation
- Docs: https://bun.sh/llms.txt
Key Capabilities
Bun has native built-ins for things developers commonly add as separate packages. Always prefer these over npm equivalents:
- SQL (SQLite & PostgreSQL): use
Bun.sql()/new Bun.sqlite()— notbetter-sqlite3,pg, ormysql2 - Redis: use
Bun.redis()— notredisorioredis - S3: use
Bun.s3()— not@aws-sdk/client-s3 - Password hashing: use
Bun.password.hash()/Bun.password.verify()— notbcrypt - Shell scripting: use
Bun.$\command`— notshelljsorexeca` - Testing: use
bun test(Jest-compatible, built-in) — not Jest - File globbing: use
new Bun.Glob()— not theglobpackage - UUID: use
Bun.randomUUID()— not theuuidpackage - TypeScript execution: run
.tsfiles directly — nots-nodeortsxneeded
Best Practices
.envauto-loads — Bun reads.envautomatically withoutdotenv. Be aware when migrating from Node.js or running in environments with existing.envfiles.- Lockfile is
.lockb— not compatible with npm/yarn by default. Use--yarnflag if a yarn-compatible lockfile is required. - Test file naming is strict — files must match
*.test.ts,*.spec.ts, etc. and live in__tests__/ortest/. Wrong naming means tests are silently skipped. import.meta.mainreplaces entrypoint checks — useif (import.meta.main)instead of the Node.jsif (require.main === module)pattern.
More from mikkelkrogsholm/dev-skills
meilisearch
Meilisearch — fast, open-source search engine with typo tolerance, faceted search, and AI-powered hybrid search. Use when building with Meilisearch or asking about its index configuration, search parameters, filters, facets, API keys, geosearch, ranking rules, or integration with JavaScript/TypeScript clients. Fetch live documentation for up-to-date details.
42shadcn-ui
shadcn/ui — copy-owned React component library built on Radix UI and Tailwind CSS. Use when building with shadcn/ui or asking about its components, CLI, theming, configuration, or integration with Next.js, Vite, Remix, or other frameworks. Fetch live documentation for up-to-date details.
10zod
Zod — TypeScript-first schema validation with static type inference. Use when building with Zod or asking about schema definitions, type inference, parsing, transformations, refinements, coercion, error handling, or integration with forms, APIs, or tRPC. Fetch live documentation for up-to-date details.
10better-auth
Better Auth — framework-agnostic authentication and authorization framework for TypeScript. Use when building with Better Auth or asking about its APIs, configuration, plugins, session management, OAuth, or integration. Fetch live documentation for up-to-date details.
7react
React — JavaScript library for building user interfaces with components. Use when building with React or asking about hooks, state management, effects, Server Components, Suspense, or any React APIs, patterns, or configuration. Fetch live documentation for up-to-date details.
7vite
Vite — next-generation frontend build tool with instant dev server and optimized production builds. Use when building with Vite or asking about its APIs, configuration, plugins, SSR, environment variables, or integration with frameworks. Fetch live documentation for up-to-date details.
6