本文へ移動
cccskills
無料GitHub で公開

Bun

Use when building, testing, or deploying JavaScript/TypeScript applications. Reach for Bun when you need to run scripts, manage packages, bundle code, or test applications with a single unified toolkit.

インストール方法を見る

含まれるファイル(1)

  • SKILL.md8.8 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Bun Skill Reference

Product Summary

Bun is an all-in-one JavaScript/TypeScript toolkit that replaces Node.js, npm, and bundlers with a single binary. It includes a fast runtime (powered by JavaScriptCore), package manager, test runner, and bundler—all optimized for speed and modern JavaScript. Key files: bunfig.toml (configuration), package.json (scripts and dependencies), bun.lock (lockfile). Primary CLI commands: bun run, bun install, bun test, bun build. See https://bun.com/docs for comprehensive documentation.

When to Use

Use Bun when:

  • Running TypeScript/JSX files directly without compilation overhead (bun run file.ts)
  • Installing dependencies faster than npm/yarn/pnpm (bun install)
  • Running tests with Jest-compatible syntax (bun test)
  • Bundling JavaScript/TypeScript for browsers or servers (bun build)
  • Executing package.json scripts with minimal startup time
  • Building full-stack applications with server and client code
  • Setting up monorepos with workspaces
  • Developing with hot-reload/watch mode
  • Deploying to serverless platforms (Vercel, Railway, AWS Lambda, etc.)

Quick Reference

Core Commands

TaskCommandNotes
Run TypeScript filebun run file.ts or bun file.tsTranspiles on-the-fly; supports JSX
Run package scriptbun run dev28x faster than npm run
Install dependenciesbun install25x faster than npm; creates bun.lock
Add packagebun add reactAdds to package.json and installs
Add dev dependencybun add -d typescriptInstalls as devDependency
Run testsbun testFinds *.test.ts, *.spec.ts files
Watch testsbun test --watchRe-runs on file changes
Build bundlebun build ./index.ts --outdir ./distBundles for browser/server
Watch buildbun build ./index.ts --outdir ./dist --watchRebuilds on changes
Execute packagebunx cowsay "hello"Like npx but faster

Configuration Files

FilePurposeLocation
bunfig.tomlBun-specific config (runtime, test, install, build)Project root or ~/.bunfig.toml
package.jsonScripts, dependencies, workspacesProject root
bun.lockLockfile (text format by default)Project root
tsconfig.jsonTypeScript config (Bun respects this)Project root

Key bunfig.toml Sections

# Runtime behavior
[define]
"process.env.API_URL" = "'https://api.example.com'"

# Test runner
[test]
root = "./__tests__"
coverage = true
coverageThreshold = 0.9

# Package manager
[install]
optional = true
dev = true
linker = "hoisted"  # or "isolated"

# Run scripts
[run]
shell = "system"  # or "bun"
bun = true        # alias node to bun

Decision Guidance

When to Use Hoisted vs. Isolated Installs

ScenarioUseReason
New monorepo/workspaceisolatedPrevents phantom dependencies
New single-package projecthoistedTraditional npm behavior
Existing pre-v1.3.2 projecthoistedBackward compatibility
Strict dependency isolation neededisolatedEach package gets own node_modules

Use bun install --linker isolated or set in bunfig.toml.

When to Use bun build vs. bun run

TaskUseWhy
Execute a scriptbun runFast startup, no output files
Prepare for browserbun build --target browserOptimizes for browser APIs
Prepare for serverbun build --target bun or --target nodeOptimizes for server APIs
Create executablebun build --compileSingle binary with Bun embedded
Development serverbun run with Bun.serve()Direct HTTP server in code

When to Use --watch vs. --concurrent

FlagUse Case
bun --watch run devRestart entire process on file change
bun test --concurrentRun async tests in parallel (faster)
bun test --watchRe-run tests on file change
bun build --watchRebuild bundle on file change

Workflow

1. Initialize a New Project

bun init my-app
# Choose template: Blank, React, or Library
cd my-app

2. Install Dependencies

bun install
# Or add specific packages
bun add react
bun add -d @types/react

3. Create and Run Code

# Create index.ts with your code
bun run index.ts

# Or add to package.json scripts
# Then run: bun run dev

4. Write Tests

# Create math.test.ts
# Import from "bun:test"
# Run: bun test

5. Bundle for Production

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

6. Deploy

# Commit bun.lock to version control
# In CI: bun ci (equivalent to bun install --frozen-lockfile)
# Deploy dist/ or compiled executable

Common Gotchas

  • Watch mode flag placement: Use bun --watch run dev, not bun run dev --watch. Flags after the script name are passed to the script itself.
  • Node.js compatibility: Bun aims for Node.js compatibility but not everything is implemented. Check nodejs-compat for status.
  • Lifecycle scripts security: Bun doesn't execute postinstall scripts by default. Add trusted packages to trustedDependencies in package.json.
  • Lockfile format: Bun v1.2+ uses text bun.lock by default (not binary bun.lockb). Commit this to version control.
  • TypeScript types: If you see Bun global errors, install @types/bun and configure tsconfig.json with "lib": ["ESNext"].
  • Auto-install disabled in production: Set [install] auto = "disable" in bunfig.toml for CI/CD to prevent unexpected installs.
  • Peer dependencies: Bun installs peer dependencies by default (unlike npm). Disable with [install] peer = false if needed.
  • Environment variables: Bun loads .env, .env.local, .env.[NODE_ENV] automatically. Disable with [env] file = false.
  • Monorepo filtering: Use --filter with glob patterns: bun install --filter 'packages/*' or bun run --filter 'ba*' test.
  • Bytecode generation: Only works with target: "bun". Requires matching Bun version for execution.

Verification Checklist

Before submitting work with Bun:

  • Run bun install to verify dependencies resolve without errors
  • Run bun test to verify all tests pass
  • Run bun build to verify bundle completes without errors
  • Check bun.lock is committed to version control (for reproducible installs)
  • Verify bunfig.toml has correct [install] and [test] sections if customized
  • Test with bun run <script> to verify package.json scripts work
  • Check for TypeScript errors: bun run tsc --noEmit (if tsc installed)
  • Verify watch mode works: bun --watch run dev (for development)
  • Test in CI environment: bun ci (frozen lockfile install)
  • Confirm no hardcoded Node.js-specific APIs if targeting browser

Resources


For additional documentation and navigation, see: https://bun.com/docs/llms.txt

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Audit and improve web accessibility following WCAG 2.2 guidelines. Use when asked to "improve accessibility", "a11y audit", "WCAG compliance", "screen reader support", "keyboard navigation", or "make accessible".

日本語の概要は準備中です。原文の説明を表示しています。

Jannael/Glinter162026年8月11日 更新

Implement proven backend architecture patterns including Clean Architecture, Hexagonal Architecture, and Domain-Driven Design. Use this skill when designing clean architecture for a new microservice, when refactoring a monolith to use bounded contexts, when implementing hexagonal or onion architecture patterns, or when debugging dependency cycles between application layers.

日本語の概要は準備中です。原文の説明を表示しています。

Jannael/Glinter162026年8月11日 更新

astro

無料

Skill for building with the Astro web framework. Helps create Astro components and pages, configure SSR adapters, set up content collections, deploy static sites, and manage project structure and CLI commands. Use when the user needs to work with Astro, mentions .astro files, asks about static site generation (SSG), islands architecture, content collections, or deploying an Astro project.

日本語の概要は準備中です。原文の説明を表示しています。

Jannael/Glinter162026年8月11日 更新

caveman

無料

Ultra-compressed communication mode. Cuts token usage ~75% by speaking like caveman while keeping full technical accuracy. Supports intensity levels: lite, full (default), ultra, wenyan-lite, wenyan-full, wenyan-ultra. Use when user says "caveman mode", "talk like caveman", "use caveman", "less tokens", "be brief", or invokes /caveman. Also auto-triggers when token efficiency is requested.

日本語の概要は準備中です。原文の説明を表示しています。

Jannael/Glinter162026年8月11日 更新

Ultra-compressed commit message generator. Cuts noise from commit messages while preserving intent and reasoning. Conventional Commits format. Subject ≤50 chars, body only when "why" isn't obvious. Use when user says "write a commit", "commit message", "generate commit", "/commit", or invokes /caveman-commit. Auto-triggers when staging changes.

日本語の概要は準備中です。原文の説明を表示しています。

Jannael/Glinter162026年8月11日 更新

Quick-reference card for all caveman modes, skills, and commands. One-shot display, not a persistent mode. Trigger: /caveman-help, "caveman help", "what caveman commands", "how do I use caveman".

日本語の概要は準備中です。原文の説明を表示しています。

Jannael/Glinter162026年8月11日 更新

Jannael のスキルをすべて見る

このスキルの問題を報告する