bun-best-practices
Installation
SKILL.md
Bun best practices
Use when building or reviewing JavaScript or TypeScript projects that run on Bun, install dependencies with bun install, test with bun test, or bundle with bun build.
Mental model
- Treat Bun as an integrated toolkit: runtime, package manager, test runner, and bundler in one binary.
- Prefer Bun-native workflows when the project is already committed to Bun instead of mixing in older Node-first commands without a reason.
- Keep the project explicit about whether it targets
bun,node, or the browser.
Runtime and app code
- Use
bun runfor scripts and direct execution of.ts/.tsxentrypoints when the runtime is Bun. - Prefer Web-standard APIs (
fetch,Request,Response,URL, streams) where possible; this keeps code more portable. - Be deliberate with Node compatibility features. Bun supports a large Node surface, but compatibility is an ongoing effort, so verify edge cases before depending on obscure Node internals.