技能 bun-development
📦

bun-development

安全 ⚙️ 外部命令🌐 网络访问📁 文件系统访问🔑 环境变量

Bun 开发指南

此技能提供了使用 Bun JavaScript 运行时开发的全面文档,涵盖安装、项目设置、包管理、测试以及从 Node.js 迁移。

支持: Claude Codex Code(CC)
🥉 75 青铜
1

下载技能 ZIP

2

在 Claude 中上传

前往 设置 → 功能 → 技能 → 上传技能

3

开启并开始使用

测试它

正在使用“bun-development”。 Initialize a new Bun project

预期结果:

Running `bun init` creates a new project with package.json, tsconfig.json, index.ts, and README.md. You can then add scripts like "dev": "bun run --watch index.ts" to package.json.

正在使用“bun-development”。 Install express and typescript

预期结果:

Use `bun add express` for dependencies and `bun add -d typescript` for dev dependencies. Bun install is 10-100x faster than npm.

正在使用“bun-development”。 Run tests with bun

预期结果:

Create test files with .test.ts extension. Run `bun test` to execute all tests, or `bun test --watch` for auto-reload on changes.

安全审计

安全
v1 • 2/25/2026

This is a legitimate Bun runtime development skill. All 117 static findings are false positives: external commands are standard Bun CLI tools, network URLs point to official Bun documentation, environment access patterns are standard Bun/Node.js development practices, and the pipe-to-shell pattern is the official Bun installation method. No malicious intent detected.

1
已扫描文件
694
分析行数
4
发现项
1
审计总数

风险因素

⚙️ 外部命令 (74)
🌐 网络访问 (13)
📁 文件系统访问 (1)
🔑 环境变量 (9)
审计者: claude

质量评分

38
架构
100
可维护性
87
内容
50
社区
100
安全
96
规范符合性

你能构建什么

新项目初始化

使用 Bun 快速的包管理器和内置工具快速设置新的 JavaScript/TypeScript 项目

Node.js 迁移

将现有 Node.js 项目迁移到 Bun 以提高性能

性能关键型应用程序

使用 Bun 的原生 API 构建高性能 HTTP 服务器和 API

试试这些提示

创建新的 Bun 项目
Use the bun-development skill to help me initialize a new TypeScript project with Bun. Set up a basic project structure with testing configured.
安装依赖项
Use bun-development to install the following packages: express, typescript, and @types/express. Show me how to add dev dependencies as well.
编写和运行测试
Use bun-development to help me write tests for a simple math utility file. Show me how to use bun:test with common matchers.
构建生产环境
Use bun-development to show me how to bundle my TypeScript application for production deployment, including minification and source maps.

最佳实践

  • Use Bun-native APIs like Bun.file() and Bun.serve() for better performance instead of Node.js compatibility layers
  • Keep package.json scripts simple - leverage Bun's fast execution for direct file running
  • Use Bun.password.hash() for secure password hashing instead of external libraries

避免

  • Avoid using Node.js-specific APIs like require() when import statements work in Bun
  • Do not rely on process.hrtime() - use Bun.nanoseconds() instead
  • Avoid heavy Express/Fastify setups when Bun.serve() provides faster HTTP handling

常见问题

What is Bun?
Bun 是一个快速的、一体化 JavaScript 运行时,旨在替代 Node.js。它在单个工具中包含了包管理器、测试运行器和打包器。
Is Bun faster than Node.js?
是的,Bun 在启动时间(约 25ms vs 100ms+)、包安装(快 10-100 倍)和原生运行 TypeScript 方面明显更快。
Can I use existing Node.js packages with Bun?
大多数 npm 包都可以在 Bun 中使用,但某些带有原生绑定的包可能存在兼容性问题。在迁移生产代码之前,请测试您的依赖项。
How do I migrate from Node.js to Bun?
将 npm 命令替换为对应的 bun 命令(npm install -> bun install),更新 package.json 中的脚本,并添加 @types/bun 以支持 TypeScript。
Does Bun support TypeScript?
是的,Bun 具有原生的 TypeScript 支持。您可以直接运行 .ts 文件,无需转译。
What testing framework does Bun use?
Bun 有一个名为 bun:test 的内置测试运行器,与 Jest 兼容。您可以使用 describe、it、expect 和其他熟悉的模式。

开发者详情

文件结构

📄 SKILL.md