bun-runtime-expert
Skill129 starsChanged 12 days agoMITView on GitHub
Bun 1.2+ runtime: native Bun.sql, Bun.s3, multi-core HTTP, bun:test / Runtime Bun 1.2+: native Bun.sql, Bun.s3, HTTP multi-core, bun:test.
- Reads credentials
- Deletes or force-pushes
In this repository372 other files it gives its agents.
- AGENTS.mdAGENTS.md
- rules/AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- .cursor/rules/vibes-plug-anti-slop.mdcCursor rule
- .cursor/rules/vibes-plug-backend.mdcCursor rule
- .cursor/rules/vibes-plug-core.mdcCursor rule
- .cursor/rules/vibes-plug-devops.mdcCursor rule
- .cursor/rules/vibes-plug-frontend.mdcCursor rule
- .cursor/rules/vibes-plug-mcp.mdcCursor rule
- .cursor/rules/vibes-plug-skills.mdcCursor rule
- .cursor/rules/vibes-plug-testing.mdcCursor rule
- llms-full.txtllms.txt
- llms.txtllms.txt
- showcase/llms-full.txtllms.txt
- showcase/llms.txtllms.txt
- a2a-agent-protocol-expertSkill
- accessibility-testing-expertSkill
- adaptive-model-cascadeSkill
- affective-computing-emotion-aiSkill
- agentic-coding-workflow-expertSkill
- agentic-m2m-settlementSkill
- agentic-memory-architectSkill
- agentic-micro-economy-architectSkill
- ai-code-review-autonomousSkill
- ai-llm-integration-expertSkill
- ai-media-generation-expertSkill
- ai-prompt-engineering-expertSkill
- ai-safety-governance-expertSkill
- angular-expertSkill
- anti-slopSkill
- api-design-expertSkill
- api-gateway-proxy-expertSkill
- app-analyzer-optimizerSkill
- apple-ecosystem-expertSkill
- app-promo-media-expertSkill
- astro-framework-expertSkill
- async-queue-temporal-expertSkill
- authentication-identity-expertSkill
- autonomous-api-drift-healerSkill
- autonomous-red-teamerSkill
- autonomous-tdd-debuggerSkill
- biome-linter-formatter-expertSkill
- blockchain-web3-expertSkill
- brainstormingSkill
- browser-automation-expertSkill
- browser-extension-mv3-proSkill
- chatbot-messaging-expertSkill
- ci-cd-devops-architectSkill
- cloudflare-workers-expertSkill
- cloud-hosting-expertSkill
- coderabbitSkill
- compliance-gdpr-privacy-expertSkill
- composable-mach-architectSkill
- computer-use-os-agent-expertSkill
- context-window-engineerSkill
- cron-scheduler-expertSkill
- database-orm-expertSkill
- data-pipeline-etl-expertSkill
- data-telemetry-expertSkill
- data-visualization-expertSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 0 are distinctive, and 8 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
Distinctive · estimate
This author's own choices. Worth a look.
8
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 201
Use Bun's built-in C-accelerated Bun.password (Argon2id by default) and array-argument Bun.spawn (never shell-interpolated strings) for …
- Very specific: line 218
Tagged Template Parameterization in
Bun.sql: MUST execute all Bun.sql queries via tagged template literals (` sqlSELECT ... - Very specific: line 219
Native
Bun.passwordArgon2id Hashing: MUST use Bun.password.hash(pw, { algorithm: 'argon2id' }) instead of external native C++ bcrypt … - Very specific: line 220
Opaque Error Responses in
Bun.serve: MUST log unexpected exceptions internally inside error(err) and return an RFC 9457 Problem Details … - Very specific: line 221
Array-Argument
Bun.spawnExecution: MUST pass command arguments as an explicit string array (Bun.spawn(['git', 'status'])) rather than … - Very specific: line 222
Text Lockfile (
bun.lock) Pinning: MUST commit the text-based bun.lock and run bun install --frozen-lockfile in CI pipelines. - Very specific: line 225
Mandatory Blue-Ocean Pairing: Always compose bun-runtime-expert with autonomous-api-drift-healer, formal-spec-z3-verifier, doku-mcp-server, …
- Very specific: line 227
Pre-Disk Gate: Run vibes verify-gate and vibes skill auto-diff --json to inject <350-token slices and eliminate placeholder slop.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Bun 1.2+ Runtime Expert (2026 High-Performance Standard)
English | Bahasa Indonesia
<a name="english"></a>
English
Orchestration & Integration
Connects and orchestrates with domain skills:
- Backend & APIs:
js-backend-expert(Hono on Bun, Fastify/Express migration),api-design-expert(REST & WebSocket contracts), andsse-websocket-streaming-expert(nativeBun.serveWebSockets). - Database & Storage:
database-orm-expert(Drizzle ORM with nativebun:sql, PostgreSQL/SQLite) andfile-upload-media-expert(zero-dependencyBun.s3client). - Quality & Testing:
autonomous-tdd-debugger,e2e-testing-expert, andanti-slopfor executing high-speedbun testsuites with snapshot matching. - Orchestration:
brainstormingandzero-to-prod-orchestrator(Phase 4: Backend & APIs). - Cross-Domain Synergy & Subagent Swarm Integration:
cloudflare-workers-expert
Description
Expert-level guidance for engineering ultra-low-latency backend microservices with Bun 1.2+. Covers the native PostgreSQL driver (import { SQL } from 'bun'), native S3 object storage (Bun.s3), git-friendly text lockfiles (bun.lock), multi-core HTTP clustering via reusePort, built-in SQLite, and high-speed Jest-compatible unit testing via bun:test.
Trigger Conditions
- Scaffolding new high-performance microservices, REST APIs, or WebSocket hubs using Bun.
- Querying PostgreSQL or SQLite without external drivers using native
Bun.sql. - Interacting with Amazon S3, Cloudflare R2, or MinIO using zero-dependency
Bun.s3. - Running multi-core HTTP services with automatic load distribution across CPU cores.
- Executing unit and integration tests using
bun test. - Migrating legacy Node.js/npm codebases to Bun's native execution layer.
Bun 1.2+ Core Architectural Features
1. Native PostgreSQL Client (import { SQL } from 'bun')
Bun 1.2 includes a built-in, high-speed PostgreSQL driver that communicates directly via binary wire protocol without pg or postgres.js:
// src/lib/db.ts
import { SQL } from 'bun';
// Instantiate pooled database client
export const sql = new SQL({
url: process.env.DATABASE_URL || 'postgres://user:password@localhost:5432/production_db',
max: 20, // Connection pool size
idleTimeout: 30, // Max idle time in seconds
});
export interface UserAccount {
id: string;
email: string;
balance: number;
}
// 1. Tagged template query with automatic parameterized SQL injection defense
export async function getActiveUser(email: string): Promise<UserAccount | null> {
const users = await sql<UserAccount[]>`
SELECT id, email, balance
FROM users
WHERE email = ${email} AND active = true
LIMIT 1
`;
return users[0] ?? null;
}
// 2. Atomic Database Transaction
export async function transferFunds(fromUserId: string, toUserId: string, amount: number) {
return await sql.begin(async (tx) => {
const debit = await tx`
UPDATE users
SET balance = balance - ${amount}
WHERE id = ${fromUserId} AND balance >= ${amount}
RETURNING id, balance
`;
if (debit.length === 0) {
throw new Error('Insufficient funds or sender not found');
}
await tx`
UPDATE users
SET balance = balance + ${amount}
WHERE id = ${toUserId}
`;
return { success: true };
});
}2. Native Object Storage (Bun.s3)
Interact with AWS S3, Cloudflare R2, or MinIO with zero external SDK dependencies:
// src/lib/storage.ts
import { s3 } from 'bun';
// Configure credentials once or let Bun auto-detect AWS_* environment variables
s3.credentials({
accessKeyId: process.env.S3_ACCESS_KEY_ID!,
secretAccessKey: process.env.S3_SECRET_ACCESS_KEY!,
bucket: process.env.S3_BUCKET_NAME!,
region: process.env.S3_REGION || 'auto',
endpoint: process.env.S3_ENDPOINT, // e.g. https://{account_id}.r2.cloudflarestorage.com
});
// Upload file directly from memory buffer
export async function uploadInvoicePdf(invoiceId: string, pdfBuffer: Buffer): Promise<string> {
const fileKey = `invoices/${invoiceId}.pdf`;
await s3.write(fileKey, pdfBuffer, {
type: 'application/pdf',
});
return fileKey;
}
// Generate presigned upload URL for direct browser uploads
export function getDirectUploadUrl(fileName: string): string {
return s3.presign(`uploads/${fileName}`, {
method: 'PUT',
expiresIn: 300, // 5 minutes
});
}3. Multi-Core HTTP Clustering with Bun.serve()
Scale HTTP throughput across all CPU cores on a single host with reusePort: true:
// src/server.ts
import { serve } from 'bun';
const server = serve({
port: Number(process.env.PORT) || 3000,
reusePort: true, // Enables SO_REUSEPORT: spawn multiple instances to scale across cores
async fetch(req) {
const url = new URL(req.url);
if (url.pathname === '/health') {
return Response.json({
status: 'healthy',
pid: process.pid,
timestamp: new Date().toISOString(),
});
}
return new Response('Not Found', { status: 404 });
},
error(error) {
console.error('[BunServerError]', error);
return Response.json(
{
type: 'https://httpstatuses.com/500',
title: 'Internal Server Error',
status: 500,
},
{ status: 500, headers: { 'Content-Type': 'application/problem+json' } }
);
},
});
console.log(`Worker process ${process.pid} listening on port ${server.port}`);4. Human-Readable Text Lockfile (bun.lock)
In Bun 1.2+, the default lockfile format is a plain text bun.lock file (replacing binary bun.lockb):
- Git-Friendly: Clean line-by-line diffs in Pull Requests.
- Merge-Conflict Resilient: Standard git conflict resolution tools work seamlessly.
- Auditable: Dependencies and integrity hashes can be inspected with standard CLI tools (
cat,grep).
5. Fast Testing with bun:test
Jest/Vitest compatible test suite running natively on JavaScriptCore:
// test/user.test.ts
import { describe, expect, it, beforeEach } from 'bun:test';
import { getActiveUser, sql } from '../src/lib/db';
describe('User Database Service', () => {
beforeEach(async () => {
await sql`TRUNCATE TABLE users CASCADE`;
await sql`INSERT INTO users (id, email, balance, active) VALUES ('usr-1', 'test@example.com', 100.0, true)`;
});
it('retrieves active user by email', async () => {
const user = await getActiveUser('test@example.com');
expect(user).not.toBeNull();
expect(user?.email).toBe('test@example.com');
expect(user?.balance).toBe(100.0);
});
it('returns null for inactive or missing user', async () => {
const missing = await getActiveUser('missing@example.com');
expect(missing).toBeNull();
});
});6. Native Argon2id Password Hashing (Bun.password) & Safe Subprocess Spawning (Bun.spawn)
Use Bun's built-in C-accelerated Bun.password (Argon2id by default) and array-argument Bun.spawn (never shell-interpolated strings) for zero-dependency security:
export async function hashUserPassword(plainPassword: string): Promise<string> {
return await Bun.password.hash(plainPassword, {
algorithm: 'argon2id',
memoryCost: 65536, // 64 MiB
timeCost: 3,
});
}
export async function verifyUserPassword(plainPassword: string, storedHash: string): Promise<boolean> {
return await Bun.password.verify(plainPassword, storedHash);
}Hard Guardrails (Declarative Invariants)
- Tagged Template Parameterization in
Bun.sql: MUST execute allBun.sqlqueries via tagged template literals (sql`SELECT ... WHERE id = ${id}`) and never concatenate raw strings (sql.unsafe(...)) with user input. - Native
Bun.passwordArgon2id Hashing: MUST useBun.password.hash(pw, { algorithm: 'argon2id' })instead of external native C++bcryptaddons or fast SHA hashes. - Opaque Error Responses in
Bun.serve: MUST log unexpected exceptions internally insideerror(err)and return an RFC 9457 Problem Details payload without leakingerr.messageorerr.stackto clients. - Array-Argument
Bun.spawnExecution: MUST pass command arguments as an explicit string array (Bun.spawn(['git', 'status'])) rather than interpolating user strings intoBun.$shell templates. - Text Lockfile (
bun.lock) Pinning: MUST commit the text-basedbun.lockand runbun install --frozen-lockfilein CI pipelines.
Blue-Ocean Synergy & Anti-Commodity Protocol
- Mandatory Blue-Ocean Pairing: Always compose
bun-runtime-expertwithautonomous-api-drift-healer,formal-spec-z3-verifier,doku-mcp-server,agentic-m2m-settlement,post-quantum-crypto-migratorso commodity boilerplate is elevated into verified, self-healing production architecture. - Anti-Commodity Mandate: Eliminate brittle REST boilerplate: enforce OpenAPI/TypeSpec drift healing, idempotency keys, RFC 9457 Problem Details, and formal Z3 state-transition invariants.
- Pre-Disk Gate: Run
vibes verify-gateandvibes skill auto-diff --jsonto inject <350-token slices and eliminate placeholder slop.
Sovereign Execution, Token Efficiency & Invariants
| Dimension | Sovereign Mandate & Deterministic Contract |
| Frontier Model Cascade | Medium / High (Gemini 4 Neon, Gemini 4 Hydrogen, Gemini 4 Argon, GPT-5.6 Sol Medium, Claude Sonnet 5.5 High, Grok 4.7 High Fast) |
| Availability Fallback | Gemini 4 (Carbon/Hydrogen/Neon/Argon/Pro) -> Gemini 3.8 Flash; Claude Opus 5.5 -> Claude Opus 4.6 (Zero unhandled missing-model errors) |
| KV-Cache & Token Protocol | Pin static instructions & schemas at prompt prefix (kv-cache-prefix-optimizer); pass surgical CONTEXT_MAP.md slices (<250 tokens/call) during Swarm Fan-Out |
| SaaT CLI & MCP Dispatch | CLI: vibes skill exec bun-runtime-expert <audit|eval|verify|generate|blueprint> / MCP: vibes_skill_dispatch, vibes_ast_query, vibes_compile_cache, vibes_optimize_budget, vibes_verify_gate |
| NFR & Anti-Slop Invariants | P99 API Gateway Latency < 85ms, OpenAPI 3.1 / TypeSpec strict schema parity, RFC 9457 Problem Details error contracts, Idempotency-Key enforcement; 100% complete zero-placeholder output verified via node scripts/check-anti-slop.js --strict |
<a name="bahasa-indonesia"></a>
Bahasa Indonesia
Integrasi Orkestrasi
Terhubung dan mengorkestrasi bersama skill domain:
- Backend & API:
js-backend-expert(Hono di atas Bun, migrasi Fastify/Express),api-design-expert(kontrak REST & WebSocket), dansse-websocket-streaming-expert(WebSocket nativeBun.serve). - Database & Penyimpanan:
database-orm-expert(Drizzle ORM dengan nativebun:sql, PostgreSQL/SQLite) danfile-upload-media-expert(klien object storageBun.s3zero-dependency). - Kualitas & Pengujian:
autonomous-tdd-debugger,e2e-testing-expert, dananti-slopuntuk eksekusi test runnerbun testberkecepatan tinggi dengan pencocokan snapshot. - Orkestrator Utama:
brainstormingdanzero-to-prod-orchestrator(Fase 4: Backend & APIs). - Sinergi Lintas Domain & Integrasi Swarm Subagent:
cloudflare-workers-expert
Deskripsi
Panduan tingkat ahli untuk rekayasa microservices backend berlatensi ultra-rendah menggunakan Bun 1.2+. Mencakup driver PostgreSQL native (import { SQL } from 'bun'), penyimpanan objek native S3 (Bun.s3), format lockfile teks yang ramah git (bun.lock), clustering HTTP multi-core melalui reusePort, SQLite bawaan, dan pengujian unit kompatibel Jest via bun:test.
Kondisi Pemicu
- Merancang microservices baru, REST API, atau hub WebSocket berkecepatan tinggi dengan Bun.
- Melakukan query database PostgreSQL atau SQLite tanpa library eksternal menggunakan
Bun.sql. - Berinteraksi dengan AWS S3, Cloudflare R2, atau MinIO tanpa dependensi AWS SDK via
Bun.s3. - Menjalankan layanan HTTP multi-core dengan pembagian beban otomatis di semua core CPU.
- Menjalankan pengujian unit dan integrasi berkecepatan tinggi menggunakan
bun test.
Fitur Arsitektur Inti Bun 1.2+
1. Klien PostgreSQL Native (import { SQL } from 'bun')
Bun 1.2 menyertakan driver PostgreSQL berkecepatan tinggi yang berkomunikasi langsung melalui protokol biner tanpa overhead library pihak ketiga:
import { SQL } from 'bun';
export const sql = new SQL({
url: process.env.DATABASE_URL || 'postgres://user:password@localhost:5432/db_produksi',
max: 20,
});
// Query aman terhadap SQL Injection melalui tagged template literals
export async function cariPenggunaAktif(email: string) {
const pengguna = await sql`
SELECT id, email, balance
FROM users
WHERE email = ${email} AND active = true
LIMIT 1
`;
return pengguna[0] ?? null;
}2. Klien Object Storage Native (Bun.s3)
Unggah dan kelola file di S3 atau Cloudflare R2 secara native:
import { s3 } from 'bun';
// Unggah buffer file dokumen langsung
export async function simpanFaktur(fakturId: string, pdfBuffer: Buffer) {
const namaFile = `faktur/${fakturId}.pdf`;
await s3.write(namaFile, pdfBuffer, { type: 'application/pdf' });
return namaFile;
}
// Buat URL presigned untuk upload langsung dari browser klien
export function buatUrlUploadLangsung(namaFile: string) {
return s3.presign(`unggah/${namaFile}`, {
method: 'PUT',
expiresIn: 300,
});
}3. Clustering HTTP Multi-Core dengan Bun.serve()
import { serve } from 'bun';
const server = serve({
port: Number(process.env.PORT) || 3000,
reusePort: true, // Memungkinkan beberapa proses Bun berjalan di port yang sama lintas CPU cores
async fetch(req) {
return Response.json({
status: 'aktif',
pid: process.pid,
waktu: new Date().toISOString(),
});
},
});Sinergi Blue-Ocean & Protokol Anti-Komoditas
- Pasangan Wajib Blue-Ocean: Selalu komposisikan
bun-runtime-expertbersamaautonomous-api-drift-healer,formal-spec-z3-verifier,doku-mcp-server,agentic-m2m-settlement,post-quantum-crypto-migratoragar boilerplate standar naik kelas menjadi arsitektur produksi terverifikasi dan self-healing. - Mandat Anti-Komoditas: Hapus boilerplate REST rapuh: wajibkan deteksi drift OpenAPI/TypeSpec, idempotency key, error RFC 9457 Problem Details, dan verifikasi invarian state Z3.
- Gerbang Pra-Disk: Jalankan
vibes verify-gatedanvibes skill auto-diff --jsonuntuk menyuntikkan slice <350 token serta mencegah placeholder slop.
Matriks Eksekusi Berdaulat, Efisiensi Token & Invarian
| Dimensi | Mandat Berdaulat & Kontrak Deterministik |
| Kaskade Model Frontier | Medium / High (Gemini 4 Neon, Gemini 4 Hydrogen, Gemini 4 Argon, GPT-5.6 Sol Medium, Claude Sonnet 5.5 High, Grok 4.7 High Fast) |
| Invarian Fallback Ketersediaan | Gemini 4 (Carbon/Hydrogen/Neon/Argon/Pro) -> Gemini 3.8 Flash; Claude Opus 5.5 -> Claude Opus 4.6 (Bebas gagal saat model belum tersedia/kuota penuh) |
| Protokol Hemat Token & KV-Cache | Kunci instruksi & skema statis di prefix awal (kv-cache-prefix-optimizer); kirim potongan CONTEXT_MAP.md (<250 token/panggilan) saat Fan-Out |
| Eksekusi SaaT CLI & MCP | CLI: vibes skill exec bun-runtime-expert <audit|eval|verify|generate|blueprint> / MCP: vibes_skill_dispatch, vibes_ast_query, vibes_compile_cache, vibes_optimize_budget, vibes_verify_gate |
| Invarian NFR & Anti-Slop | Latensi P99 API < 85ms, paritas skema ketat OpenAPI 3.1 / TypeSpec, kontrak error RFC 9457 Problem Details, penegakan Idempotency-Key; kode 100% tuntas tanpa placeholder diverifikasi melalui node scripts/check-anti-slop.js --strict |
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

