Logo de Bun Runtime Expert

Bun Runtime Expert

Comunidade
roedyrustam
bun-runtime-expert

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.

Visão geral

Publicado porroedyrustam
Repositóriovibes-plug
Nome da habilidadebun-runtime-expert
Estrelas
117
Forks
27
Arquivos incluídos
Somente instruções
LicençaMIT
Links
  • Instruções em Markdown

    Um arquivo SKILL.md que o modelo carrega sob demanda, consumindo tokens apenas quando uma solicitação é realmente relevante para a habilidade.

  • Funciona com qualquer LLM

    As habilidades de IA são escritas em Markdown simples, não em código específico de um provedor. Por isso, funcionam com GPT, Claude, Gemini, Grok ou um modelo local.

  • Sem arquivos extras

    Tudo de que o modelo precisa está nas instruções — sem arquivos extras para sincronizar.

  • Código aberto

    Publicada por roedyrustam no GitHub. Leia os arquivos da habilidade antes de instalá-la.

Instalação

Instale a habilidade de IA Bun Runtime Expert no TypingMind para usá-la com qualquer LLM ou adicione-a a outro agente que leia SKILL.md.

1

Instalar no TypingMind

O TypingMind instala uma habilidade diretamente da pasta dela no GitHub — lê o arquivo SKILL.md, reúne os arquivos de recursos em um pacote e armazena o resultado localmente.

  1. Abra o app e vá para Plugins → Habilidades.
  2. Escolha "Instalar do GitHub".
  3. Cole a URL abaixo, que aponta para a pasta da habilidade, e confirme.
    https://github.com/roedyrustam/vibes-plug/tree/main/skills/bun-runtime-expert
  4. Ative a habilidade em cada chat em que quiser disponibilizá-la.
Plugins → Habilidades → Adicionar habilidade → Via URL do GitHub. Depois, cole a URL da pasta e pressione Continuar.
2

Instalar em outro agente

Qualquer agente que leia o formato Agent Skills pode usar esta habilidade — copie a pasta para o diretório de habilidades desse agente.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/roedyrustam/vibes-plug.git /tmp/vibes-plug
mkdir -p .claude/skills
cp -r /tmp/vibes-plug/skills/bun-runtime-expert .claude/skills/bun-runtime-expert
Reinicie Claude Code após copiar para que a nova habilidade seja reconhecida.

Use no TypingMind

Ative Bun Runtime Expert em qualquer chat do TypingMind e o modelo cuida do resto. O nome e a descrição da habilidade ficam no prompt do sistema e, assim que uma solicitação relevante aparece, o modelo carrega as instruções completas automaticamente — sem precisar de acionamento manual e sem consumir tokens até que ela seja realmente usada.

O modelo carrega Bun Runtime Expert automaticamente assim que uma solicitação é relevante para essa habilidade.

Funciona com qualquer modelo de IA

Habilidades de IA são instruções em Markdown simples, não código específico de um provedor. Por isso, Bun Runtime Expert não fica vinculada ao modelo para o qual foi criada. Instale-a uma vez no TypingMind e use-a com GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama ou um modelo local executado por conta própria — tudo com suas próprias chaves de API.

  • Carregada apenas quando necessário

    O prompt do sistema contém apenas o nome e a descrição. As instruções são buscadas na primeira solicitação relevante, então uma habilidade sem uso não gera custo.

  • Troque de modelo durante a conversa

    Como a habilidade é composta de instruções, não de código, trocar de modelo não afeta seu funcionamento — o próximo modelo lê o mesmo arquivo SKILL.md.

Instruções da habilidade

Este é o conteúdo de SKILL.md que o modelo carrega. Leia antes de instalar — uma habilidade é um conjunto de instruções que seu modelo seguirá.

Bun 1.2+ Runtime Expert (2026 High-Performance Standard)

English | Bahasa Indonesia


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), and sse-websocket-streaming-expert (native Bun.serve WebSockets).
  • Database & Storage: database-orm-expert (Drizzle ORM with native bun:sql, PostgreSQL/SQLite) and file-upload-media-expert (zero-dependency Bun.s3 client).
  • Quality & Testing: autonomous-tdd-debugger, e2e-testing-expert, and anti-slop for executing high-speed bun test suites with snapshot matching.
  • Orchestration: brainstorming and zero-to-prod-orchestrator (Phase 4: Backend & APIs).

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:

typescript
// 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:

typescript
// 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:

typescript
// 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) {
    return new Response(`Internal Server Error: ${error.message}`, { status: 500 });
  },
});

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:

typescript
// 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();
  });
});

Sovereign Execution, Token Efficiency & Invariants

DimensionSovereign Mandate & Deterministic Contract
Frontier Model CascadeMedium / High (GPT-5.6 Sol Medium, Gemini 4 Argon, Claude Sonnet 5.5 High, Grok 4.7 High Fast)
Availability FallbackGemini 4 Argon/Pro -> Gemini 3.8 Flash; Claude Opus 5.5 -> Claude Opus 4.6 (Zero unhandled missing-model errors)
KV-Cache & Token ProtocolPin 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 DispatchCLI: 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 InvariantsP99 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


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), dan sse-websocket-streaming-expert (WebSocket native Bun.serve).
  • Database & Penyimpanan: database-orm-expert (Drizzle ORM dengan native bun:sql, PostgreSQL/SQLite) dan file-upload-media-expert (klien object storage Bun.s3 zero-dependency).
  • Kualitas & Pengujian: autonomous-tdd-debugger, e2e-testing-expert, dan anti-slop untuk eksekusi test runner bun test berkecepatan tinggi dengan pencocokan snapshot.
  • Orkestrator Utama: brainstorming dan zero-to-prod-orchestrator (Fase 4: Backend & APIs).

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:

typescript
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:

typescript
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()
typescript
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(),
    });
  },
});

Matriks Eksekusi Berdaulat, Efisiensi Token & Invarian

DimensiMandat Berdaulat & Kontrak Deterministik
Kaskade Model FrontierMedium / High (GPT-5.6 Sol Medium, Gemini 4 Argon, Claude Sonnet 5.5 High, Grok 4.7 High Fast)
Invarian Fallback KetersediaanGemini 4 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-CacheKunci instruksi & skema statis di prefix awal (kv-cache-prefix-optimizer); kirim potongan CONTEXT_MAP.md (<250 token/panggilan) saat Fan-Out
Eksekusi SaaT CLI & MCPCLI: 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-SlopLatensi 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

Perguntas frequentes

O que a habilidade de IA Bun Runtime Expert faz?

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.

Por que usar Bun Runtime Expert no TypingMind?

Porque basta instalar uma vez para usar com qualquer modelo. A habilidade Bun Runtime Expert é escrita em Markdown simples, e não em código específico de um provedor, então a mesma habilidade funciona com GPT-5, Claude, Gemini, Grok ou um modelo local — e é possível trocar de modelo no meio do chat sem que ela deixe de funcionar. No TypingMind, você usa suas próprias chaves de API e paga diretamente aos provedores, em vez de pagar uma assinatura por licença de usuário. Suas habilidades e chats permanecem no seu próprio armazenamento.

Como instalar Bun Runtime Expert no TypingMind?

Abra Plugins → Habilidades → Instalar do GitHub no TypingMind e cole https://github.com/roedyrustam/vibes-plug/tree/main/skills/bun-runtime-expert. O TypingMind lê o arquivo SKILL.md e instala a habilidade para que possa ser ativada em cada chat.

Quais modelos de IA podem usar Bun Runtime Expert?

Qualquer modelo conectado no TypingMind. As habilidades de IA são instruções em Markdown simples, e não código específico de um provedor. Assim, GPT, Claude, Gemini, Grok e modelos locais podem carregar esta habilidade quando uma solicitação corresponder a ela.

Quantos modelos de IA posso usar com Bun Runtime Expert?

Quantos quiser. Desde que o modelo ofereça suporte a habilidades, é possível usar Bun Runtime Expert com ele — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama e outros — tudo no TypingMind com suas próprias chaves de API.

A habilidade de IA Bun Runtime Expert é gratuita?

Sim. A habilidade é publicada no GitHub por roedyrustam sob a licença MIT. O pagamento é feito apenas ao seu provedor de IA pelos tokens usados.

O que são habilidades de IA?

Uma habilidade de IA é um conjunto reutilizável de instruções que ensina um modelo de IA a realizar uma tarefa específica. Ela segue o formato aberto Agent Skills: um arquivo SKILL.md com nome e descrição, além de scripts, templates ou arquivos de referência de que o modelo possa precisar. O modelo lê as instruções apenas quando sua solicitação corresponde à habilidade, então uma habilidade instalada não gera custos até ser usada.

Qual é a diferença entre habilidades de IA e plugins ou servidores MCP?

Um plugin ou servidor MCP oferece ao modelo novas ferramentas que ele pode acionar — código que é executado em algum lugar e retorna um resultado. Já uma habilidade de IA dá ao modelo o conhecimento e as orientações de que ele precisa: como abordar uma tarefa, quais etapas seguir e como deve ser um bom resultado. As habilidades são escritas em Markdown simples, por isso não precisam de servidor, chave de API nem ambiente de execução, e funcionam com qualquer modelo.

Ver lista completa

Crie seu próprio espaço de trabalho com IA agora

Inscreva-se na nossa newsletter para receber avisos sobre novos recursos e futuros sorteios 👇