Generate production-ready Bun Cursor rules for Project Rules (.mdc), AGENTS.md, or legacy .cursorrules. This template encodes stack-specific conventions for projects using Bun. All-in-one JavaScript runtime with bundler, test runner, and TypeScript support.
The template focuses Cursor AI on concrete Bun practices instead of generic coding advice. Required sections are always included; optional sections can be enabled when they match your project.
Required guidance
- Bun Runtime Features
- Performance Patterns
- Project Structure & Configuration
Default style
- Indentation: 2 spaces
- Quotes: single
- Semicolons: enabled
- Naming: camelCase
Optional sections: Testing with Bun.
Example Bun Rules
The generator turns these sections into Project Rules with frontmatter, AGENTS.md, or a single .cursorrules file depending on the output format you choose.
Bun Runtime Features
- Use Bun's built-in APIs: Bun.file(), Bun.write(), Bun.serve() instead of Node.js equivalents.
- Use Bun's native TypeScript support — no need for ts-node or separate compilation step.
- Use Bun's built-in test runner (bun test) instead of Jest or Vitest for new projects.
- Use Bun's native SQLite client (bun:sqlite) for embedded database needs.
- Use Bun's built-in environment variable support via Bun.env instead of process.env.
- Use Bun.password for password hashing and Bun.randomUUIDv7 for unique IDs.
- Leverage Bun's fetch() built-in — no need for node-fetch or axios for HTTP.
Performance Patterns
- Use Bun's native file I/O (Bun.file, Bun.write) which is significantly faster than Node.js fs.
- Use Bun.spawn() for subprocess management — faster and simpler than child_process.
- Prefer Bun.serve() over Express or other Node HTTP frameworks for maximum throughput.
- Use Bun's built-in WebSocket support for real-time applications.
- Avoid blocking the event loop — use async/await and Bun's Promise-based APIs.
- Use Bun's bundler (Bun.build) for production builds with tree-shaking and minification.
- Leverage Bun's transpiler for JSX/TSX without additional Babel or TypeScript config.
Project Structure & Configuration
- Use bunfig.toml for project-level Bun configuration (install settings, lockfile path).
- Use bun.lockb as the lockfile — commit it to version control for reproducible installs.
- Use 2 spaces for indentation in .ts/.tsx files.
- Use camelCase for variables and functions.
- Use single quotes for strings.
- Use ESM imports/exports — Bun is ESM-first.
- Organize code by feature: src/features/<feature>/ with index.ts barrel exports.
- Use bun add for package installation and bun remove for removal.
Common Searches This Page Helps With
bun cursor rulesbun .cursorrulesbun AGENTS.md
Frequently Asked Questions
What does the Bun Cursor rules template include?
It includes 4 rule sections covering bun runtime features, performance patterns, project structure & configuration and other Bun development conventions.
Can I generate Bun Project Rules and AGENTS.md from the same template?
Yes. The generator can export the same stack-specific guidance as modern Project Rules (.mdc), AGENTS.md, or a legacy .cursorrules file.
Should I combine Bun with other Cursor rules templates?
Yes. You can combine Bun with related templates such as TypeScript, Tailwind CSS, Docker, or backend frameworks when your project uses multiple technologies.