Token导航 LogoToken导航TokenDH.com
研究检索敏感数据github未标认证来源可访问许可证需确认审计提醒

bunBun 运行时

Agent Skill

bun 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

564

周安装

24

GitHub Stars

12

下载量

198
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

unknown

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:bun(Bun 运行时)
来源仓库:https://github.com/claude-dev-suite/claude-dev-suite
仓库路径:skills/bun
安装命令:
npx skills add https://github.com/claude-dev-suite/claude-dev-suite --skill bun
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/claude-dev-suite/claude-dev-suite --skill bun

简介

用于查找、检索和筛选相关信息,适合根据关键词或任务场景快速定位候选结果。

  • 可辅助了解 Bun 运行时的特性,如 TypeScript 直编、包管理和测试加速。
  • 使用时建议结合具体项目需求选择是否替换 Node.js + npm 工作流。
  • 安装前请确认宿主环境支持 GitHub 技能安装,并注意权限与网络访问限制。
  • bun 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Bun - Quick Reference

Deep Knowledge: Use mcp__documentation__fetch_docs with technology: bun for comprehensive documentation.

When to Use This Skill

  • Projects requiring high performance
  • Replacement for Node.js + npm + bundler
  • Fast test runner alternative to Vitest/Jest
  • Quick scripts with native TypeScript

Setup

# Install Bun
curl -fsSL https://bun.sh/install | bash

# Create project
bun init

# Run TypeScript directly (no compilation needed!)
bun run index.ts

# Run with watch mode
bun --watch run index.ts

Package Manager

# Install dependencies (faster than npm/pnpm)
bun install

# Add packages
bun add express zod
bun add -d typescript @types/node

# Remove
bun remove package-name

# Update
bun update

# Run scripts
bun run build
bun run dev

# Execute binary
bunx prisma generate

Workspaces

// package.json
{
  "workspaces": ["packages/*"]
}
# Install all workspace deps
bun install

# Run in specific workspace
bun run --filter @myorg/api build

Bundler

// Build for production
await Bun.build({
  entrypoints: ['./src/index.ts'],
  outdir: './dist',
  target: 'node',        // 'browser' | 'bun'
  minify: true,
  sourcemap: 'external',
  splitting: true,       // Code splitting
  format: 'esm',         // 'cjs' | 'esm'
});

// CLI
bun build ./src/index.ts --outdir ./dist --minify

Build Config

// bunfig.toml alternative - build.ts
const result = await Bun.build({
  entrypoints: ['./src/index.tsx'],
  outdir: './dist',
  target: 'browser',
  minify: {
    whitespace: true,
    identifiers: true,
    syntax: true,
  },
  define: {
    'process.env.NODE_ENV': '"production"',
  },
  external: ['react', 'react-dom'],
  loader: {
    '.png': 'file',
    '.svg': 'text',
  },
});

if (!result.success) {
  console.error('Build failed:', result.logs);
  process.exit(1);
}

Test Runner

// math.test.ts
import { describe, it, expect, beforeAll, mock } from 'bun:test';

describe('math', () => {
  it('adds numbers', () => {
    expect(1 + 2).toBe(3);
  });

  it('handles async', async () => {
    const result = await fetchData();
    expect(result).toBeDefined();
  });
});

// Mocking
const mockFn = mock(() => 42);
mockFn();
expect(mockFn).toHaveBeenCalled();

// Module mocking
mock.module('./config', () => ({
  apiUrl: 'http://test.local',
}));
# Run tests
bun test

# Watch mode
bun test --watch

# Coverage
bun test --coverage

# Filter
bun test --filter "user"

HTTP Server

// Native Bun server (fastest)
Bun.serve({
  port: 3000,
  fetch(req) {
    const url = new URL(req.url);

    if (url.pathname === '/api/health') {
      return Response.json({ status: 'ok' });
    }

    if (url.pathname === '/api/users' && req.method === 'POST') {
      const body = await req.json();
      return Response.json({ id: 1, ...body }, { status: 201 });
    }

    return new Response('Not Found', { status: 404 });
  },
  error(error) {
    return new Response(`Error: ${error.message}`, { status: 500 });
  },
});

console.log('Server running on http://localhost:3000');

With Hono (recommended for APIs)

import { Hono } from 'hono';
import { cors } from 'hono/cors';
import { logger } from 'hono/logger';

const app = new Hono();

app.use('*', logger());
app.use('/api/*', cors());

app.get('/api/users', (c) => {
  return c.json([{ id: 1, name: 'John' }]);
});

app.post('/api/users', async (c) => {
  const body = await c.req.json();
  return c.json({ id: 1, ...body }, 201);
});

export default app;

File I/O

// Read file (returns string or ArrayBuffer)
const text = await Bun.file('data.txt').text();
const json = await Bun.file('data.json').json();
const buffer = await Bun.file('image.png').arrayBuffer();

// Write file
await Bun.write('output.txt', 'Hello World');
await Bun.write('data.json', JSON.stringify(data));

// Stream large files
const file = Bun.file('large.csv');
const stream = file.stream();

for await (const chunk of stream) {
  process.stdout.write(chunk);
}

// File metadata
const file = Bun.file('data.txt');
console.log(file.size);  // bytes
console.log(file.type);  // MIME type

SQLite (Built-in)

import { Database } from 'bun:sqlite';

const db = new Database('app.db');

// Create table
db.run(`
  CREATE TABLE IF NOT EXISTS users (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    name TEXT NOT NULL,
    email TEXT UNIQUE
  )
`);

// Prepared statements (recommended)
const insert = db.prepare('INSERT INTO users (name, email) VALUES (?, ?)');
insert.run('John', 'john@example.com');

const select = db.prepare('SELECT * FROM users WHERE id = ?');
const user = select.get(1);

// Query all
const all = db.prepare('SELECT * FROM users').all();

// Transaction
db.transaction(() => {
  insert.run('Alice', 'alice@example.com');
  insert.run('Bob', 'bob@example.com');
})();

Environment Variables

// .env file loaded automatically
const apiKey = Bun.env.API_KEY;
const port = Bun.env.PORT ?? '3000';

// process.env also works
const nodeEnv = process.env.NODE_ENV;

Shell Commands

import { $ } from 'bun';

// Simple command
const result = await $`ls -la`;
console.log(result.stdout.toString());

// With variables (auto-escaped)
const filename = 'my file.txt';
await $`cat ${filename}`;

// Piping
const files = await $`ls`.text();
const count = await $`echo ${files} | wc -l`.text();

// Error handling
try {
  await $`exit 1`;
} catch (error) {
  console.error('Command failed:', error.exitCode);
}

Configuration (bunfig.toml)

# bunfig.toml

[install]
# Registry
registry = "https://registry.npmjs.org"

# Frozen lockfile in CI
frozenLockfile = true

[run]
# Shell for scripts
shell = "bash"

[test]
# Test configuration
coverage = true
coverageDir = "coverage"

Node.js Compatibility

// Most Node.js APIs work
import { readFile } from 'fs/promises';
import { createServer } from 'http';
import path from 'path';

// Some differences
import.meta.dir;  // __dirname equivalent
import.meta.file; // __filename equivalent

// Check runtime
const isBun = typeof Bun !== 'undefined';

When NOT to Use This Skill

ScenarioUse Instead
Node.js runtime specificsnodejs skill
Hono frameworkFramework-specific skill
Elysia frameworkFramework-specific skill
TypeScript syntaxtypescript skill
Testing strategiestesting-vitest skill

Anti-Patterns

Anti-PatternWhy It's BadCorrect Approach
Using node_modules/.binNot optimized for BunUse bunx instead
Ignoring compatibilitySome npm packages failTest compatibility
Complex routing in Bun.serveHard to maintainUse Hono or Elysia
Not pinning versionsBreaking changesUse bun.lockb
Mixing package managersInconsistent depsStick to bun
Not using built-in SQLiteExtra dependencyUse bun:sqlite
Blocking operationsDefeats performanceUse async APIs
Not using watch modeSlow dev loopUse --watch flag

Quick Troubleshooting

IssueCauseSolution
"Module not found"npm compatibility issueCheck Bun compatibility list
"bun: command not found"Not installedInstall Bun or add to PATH
Tests fail in Bun but not JestDifferent runtimeCheck Bun-specific APIs
Slow installNetwork/cache issueClear cache with bun pm cache
"Cannot find package"Wrong specifierUse npm: prefix for npm packages
Type errors with.ts filestsconfig mismatchCheck Bun's default config
Build output incorrectWrong targetSet target in Bun.build
SQLite errorsDatabase lockedClose connections properly

Performance Comparison

TaskBunNode.js
Install deps~2s~15s
Run TS file<100ms~500ms (tsx)
HTTP requests/sec~100k~40k
Test execution~200ms~2s

Production Readiness

# Dockerfile
FROM oven/bun:1 AS base
WORKDIR /app

# Install deps
FROM base AS deps
COPY package.json bun.lockb ./
RUN bun install --frozen-lockfile

# Build
FROM base AS build
COPY --from=deps /app/node_modules ./node_modules
COPY . .
RUN bun run build

# Production
FROM base AS production
COPY --from=build /app/dist ./dist
COPY --from=build /app/package.json ./

USER bun
EXPOSE 3000
CMD ["bun", "run", "dist/index.js"]

Checklist

  • Bun installed (v1.0+)
  • bunfig.toml configured
  • Test suite with bun:test
  • Build script configured
  • Docker multi-stage for production
  • npm package compatibility verified

Reference Documentation

Deep Knowledge: Use mcp__documentation__fetch_docs with technology: bun for comprehensive documentation.

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Codex

38.5%
按下载量换算76

Claude

29.35%
按下载量换算58

Cursor

18.15%
按下载量换算36

Gemini CLI

9.54%
按下载量换算19

安全审计

Gen Agent Trust Hub

通过

Socket

通过

Snyk

可疑

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills