bun-development
Bun 开发指南
此技能提供了使用 Bun JavaScript 运行时开发的全面文档,涵盖安装、项目设置、包管理、测试以及从 Node.js 迁移。
下载技能 ZIP
在 Claude 中上传
前往 设置 → 功能 → 技能 → 上传技能
开启并开始使用
测试它
正在使用“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.
安全审计
安全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.
风险因素
⚙️ 外部命令 (74)
🌐 网络访问 (13)
📁 文件系统访问 (1)
质量评分
你能构建什么
新项目初始化
使用 Bun 快速的包管理器和内置工具快速设置新的 JavaScript/TypeScript 项目
Node.js 迁移
将现有 Node.js 项目迁移到 Bun 以提高性能
性能关键型应用程序
使用 Bun 的原生 API 构建高性能 HTTP 服务器和 API
试试这些提示
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