bun

bun is a cursor rule for Cursor from sanjeed5/awesome-cursor-rules-mdc. It costs 2,455 tokens per session, scanned A, original, CC0-1.0.

A set of JavaScript and TypeScript rules for using Bun, a runtime and toolkit that can run code, install packages, bundle applications, and run tests. It recommends using Bun's built-in commands where they fit the project.

In plain words
What is it for?
Use it when developing Bun-based backend services or scripts, especially for dependency installation, testing with coverage, bundling, and deployment builds.
Why use it?
It avoids mixing package managers and unnecessary external tools, which can make builds and dependencies harder to maintain. It provides a consistent way to install, test, run, and package backend services.

Cursor rule for Cursor

Written for Cursor: a Cursor rule (.mdc).

Needs its repository: it runs a file that does not travel with it, so clone the repository first. The line is bun build ./src/index.ts --target=bun --outfile=./dist/server.

Good fit Use it when developing Bun-based backend services or scripts, especially for dependency installation, testing with coverage, bundling, and deployment builds.

Compare 6 cursor rules from other repositories ↓
About the project

awesome-cursor-rules-mdc is a generator that creates Cursor MDC rule files from structured library information, using semantic search and language models to gather and organize guidance. Developers use it to produce reusable rules for libraries in Cursor, and the catalogue includes 200 of those rules.

sanjeed5/awesome-cursor-rules-mdc · 3,588 stars · on GitHub

Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/sanjeed5/awesome-cursor-rules-mdc
agentmods
npx agentmods add rules/sanjeed5/awesome-cursor-rules-mdc/bun

Made for: Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for bun

README.md
[![agentmods](https://agentmods.dev/badge/rules/sanjeed5/awesome-cursor-rules-mdc/bun/github.svg)](https://agentmods.dev/rules/sanjeed5/awesome-cursor-rules-mdc/bun)
Your own site
<a href="https://agentmods.dev/rules/sanjeed5/awesome-cursor-rules-mdc/bun"><img src="https://agentmods.dev/badge/rules/sanjeed5/awesome-cursor-rules-mdc/bun/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for bun

Your own site · 80×15
<a href="https://agentmods.dev/rules/sanjeed5/awesome-cursor-rules-mdc/bun"><img src="https://agentmods.dev/badge/rules/sanjeed5/awesome-cursor-rules-mdc/bun.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 2,455 This file is loaded in full into every session.
When invoked 2,455 The same file — it is already loaded in full.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.02455 $0.02455
Opus 5.5 $0.00982 $0.00982
Sonnet 5.5 $0.00491 $0.00491
Haiku 4.5 $0.00246 $0.00246

Measured 3mo ago against content hash 7f19323dfa01, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

bun scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 3mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

const response = await fetch(url);
Origin

Copies of this mod

1 near-identical copy found in the catalogue:

  • bun — 100% identical, 2 lines differ
rules-mdc/bun.mdc · 333 lines

How it starts

The opening of the file, as written. The whole thing — 333 lines — stays where its author put it; the contents beside it link to each section on GitHub.

bun Best Practices

Bun is our go-to runtime for high-performance JavaScript/TypeScript backend services. It's an all-in-one toolkit designed for speed and developer experience. Adhere to these guidelines to maximize Bun's potential and maintain code quality.

1. Embrace Bun's Integrated Toolchain

Bun's strength lies in its unified toolchain. Always default to Bun's built-in features over external alternatives unless a specific project requirement dictates otherwise.

✅ GOOD: Use Bun's native tools

  • Package Management: bun install for dependencies, bun add for new packages.
  • Bundling: bun build for zero-config bundling and standalone executables.
  • Testing: bun test for Jest-compatible testing, including watch mode and coverage.
  • Runtime: bun run or bun <file> for execution.
# Install dependencies (faster than npm/yarn)
bun install

# Add a new package
bun add zod

# Run tests
bun test --coverage

# Build for deployment (e.g., a serverless function)
bun build ./src/index.ts --target=bun --outfile=./dist/server

❌ BAD: Mixing package managers or external bundlers unnecessarily

Avoid npm install or yarn add in Bun projects. Don't use Webpack or Rollup if bun build suffices.

2. Modern JavaScript Language Features

Always use current ECMAScript features (ES2015+). This improves readability, reduces bugs, and aligns with modern development.

✅ GOOD: Modern JS syntax

// 1. Prefer `const` and `let` over `var`
const API_URL = 'https://api.example.com';
let retryCount = 0;

// 2. Use ES Modules for all imports/exports
import { serve } from 'bun'; // Bun's native HTTP server
import { z } from 'zod';

// 3. Use Classes for object-oriented patterns
class UserService {
  #users = new Map(); // 4. Private class fields for true encapsulation

  constructor() {
    this.#users.set('1', { id: '1', name: 'Alice' });
  }

  // 5. Arrow functions for methods to preserve `this` context
  getUser = (id) => {
    return this.#users.get(id);
  };
}

// 6. Nullish coalescing (??) for default values
const user = new UserService().getUser('2');
const userName = user?.name ?? 'Guest'; // 7. Optional chaining (?.) for safe property access

// 8. Async/await for asynchronous operations
async function fetchData(url) {
  try {
    const response = await fetch(url);
    if (!response.ok) {
      throw new Error(`HTTP error! Status: ${response.status}`);
    }
    return await response.json();
  } catch (error) {
    console.error('Failed to fetch:', error);
    return null;
  }
}

// 9. Use `Map` for key-value pairs where keys aren't always strings or order matters
const configMap = new Map([
  ['port', 3000],
  ['debugMode', true],
]);

// 10. Reliable Array checks
const data = [];
if (Array.isArray(data)) {
  console.log('Data is an array.');
}

Read the full file on GitHub · 333 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 3mo ago First seen · 333 lines · 0 tokens per session scan A 7f19323dfa01

Subscribe to this mod's changes

bun is a cursor rule published in the GitHub repository sanjeed5/awesome-cursor-rules-mdc (3,588 stars, last pushed 8d ago), licensed CC0-1.0. It adds 2,455 tokens to every session, about $0.0098 per session on Opus 5.5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

bun compared with cursor rules from other repositories

bun next to 6 cursor rules from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
bunsanjeed5/awesome-cursor-rules-mdcCursor rule3.6k8d agoCC0-1.0A2,455Cursor
api-property-optionality-hygienenovuhq/novuCursor rule40ktodaynoneA0Cursor
cursormrwogu/promptscriptCursor rule324todayMITA53Cursor
pythonPatrickJS/awesome-cursorrulesCursor rule41k6mo agoCC0-1.0A734Cursor
gosupertokens/create-supertokens-appCursor rule245d agoApache-2.0A0Cursor
ehs-ims-conventionsSafetyMP/Autonomous-EHS-ManagementCursor rule92d agoApache-2.0A722Cursor
fastapi-rulesbeel-collab/presets.devCursor rule38d agoMITA0Cursor