본문으로 건너뛰기
cccskills
무료GitHub에 공개

bun

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

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(1)

  • SKILL.md11.1 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Bun Skill Reference

Product Summary

Bun is a unified JavaScript runtime, package manager, bundler, and test runner written in Zig. It replaces Node.js, npm, esbuild, and Jest with a single fast binary. Key files: bunfig.toml (configuration), bun.lock (lockfile), package.json (project metadata). Primary commands: bun run, bun install, bun build, bun test. Bun is 4x faster than Node.js on startup and 25x faster than npm for installations. Visit https://bun.com/docs for comprehensive documentation.

When to Use

Use Bun when:

  • Running scripts: Execute TypeScript/JavaScript files directly without compilation steps (bun run file.ts)
  • Managing dependencies: Install, add, remove, or update packages faster than npm/yarn/pnpm (bun install, bun add)
  • Bundling code: Build JavaScript/TypeScript for browser or server targets with bun build
  • Testing: Run Jest-compatible tests with built-in test runner (bun test)
  • Building full-stack apps: Bundle server and client code together into single executables
  • Monorepo workflows: Use workspaces and filtering to manage multiple packages
  • Replacing Node.js: Run any Node.js-compatible code with better performance

Do not use Bun for: type checking (use tsc separately), generating type declarations, or projects requiring exact Node.js compatibility for native modules.

Quick Reference

Essential Commands

TaskCommandNotes
Run TypeScript filebun run file.tsTranspiles on-the-fly; omit run for short form
Run package scriptbun run devExecutes script from package.json
Install dependenciesbun installCreates bun.lock lockfile
Add packagebun add reactAdds to dependencies; use -d for dev
Remove packagebun remove reactRemoves from package.json and node_modules
Run testsbun testFinds *.test.ts, *.spec.ts files automatically
Build bundlebun build ./src/index.ts --outdir ./distBundles with tree-shaking, minification optional
Watch modebun --watch run file.tsRe-runs on file changes
Create projectbun initScaffolds new project with templates

Configuration File: bunfig.toml

Located at project root or ~/.bunfig.toml (global). Optional but useful for customization.

[install]
dev = true                    # Install devDependencies
optional = true               # Install optionalDependencies
peer = true                   # Install peerDependencies
linker = "hoisted"           # "hoisted" or "isolated" (pnpm-style)
saveTextLockfile = true      # Use text bun.lock instead of binary

[serve]
port = 3000                  # Default port for Bun.serve()

[test]
root = "."                   # Test root directory
coverage = false             # Enable coverage reporting
timeout = 5000               # Per-test timeout in ms
preload = ["./setup.ts"]     # Scripts to run before tests

[run]
shell = "system"             # "system" or "bun" (Windows defaults to "bun")
bun = true                   # Auto-alias node to bun in scripts

File Types Supported

Bun natively handles: .js, .jsx, .ts, .tsx, .json, .jsonc, .toml, .yaml, .html, .css, .wasm, .node. No configuration needed—just import and use.

Key Bun APIs

APIPurposeExample
Bun.serve()Start HTTP serverBun.serve({ port: 3000, fetch: handler })
Bun.file()Read/write filesawait Bun.file("path.txt").text()
Bun.write()Write to diskawait Bun.write("out.txt", data)
Bun.build()Bundle codeawait Bun.build({ entrypoints, outdir })
Bun.TranspilerTranspile codenew Bun.Transpiler({ loader: "tsx" })
Bun.spawn()Run child processBun.spawn(["ls", "-la"])

Decision Guidance

When to Use Hoisted vs Isolated Linker

ScenarioUseReason
New monorepo/workspacesisolatedPrevents phantom dependencies, stricter isolation
New single-package projecthoistedTraditional npm behavior, simpler
Existing project (pre-v1.3.2)hoistedBackward compatibility
Migrating from pnpmisolatedMatches pnpm's approach

Set in bunfig.toml: linker = "isolated" or via CLI: bun install --linker isolated

When to Use bun build vs bun run

Use CaseToolWhy
Execute TypeScript directlybun runFast transpilation, no output files
Prepare for productionbun buildMinification, tree-shaking, bundling
Ship single executablebun build --compileCreates standalone binary
Development serverbun run + Bun.serve()Hot reload, fast iteration

When to Use --concurrent in Tests

ScenarioUse --concurrentReason
Independent async testsYesParallel execution speeds up suite
Tests with shared stateNoUse test.serial() for order-dependent tests
Database/API testsMaybeOnly if tests don't interfere
Unit testsYesUsually safe and faster

Workflow

1. Initialize a Project

bun init my-app
cd my-app

Choose template: Blank, React, or Library. Creates package.json, tsconfig.json, .gitignore.

2. Install Dependencies

bun install

Reads package.json, downloads packages, creates bun.lock. Much faster than npm.

3. Add Packages

bun add react
bun add -d @types/react typescript

Updates package.json and bun.lock automatically.

4. Write and Run Code

# Create index.ts
echo "console.log('Hello Bun!')" > index.ts

# Run it
bun run index.ts

Bun transpiles TypeScript on-the-fly; no build step needed.

5. Create HTTP Server

// server.ts
const server = Bun.serve({
	port: 3000,
	fetch(req) {
		return new Response('Hello!')
	},
})
console.log(`Listening on ${server.url}`)
bun run server.ts

6. Write Tests

// math.test.ts
import { test, expect } from 'bun:test'

test('2 + 2 = 4', () => {
	expect(2 + 2).toBe(4)
})
bun test

Finds and runs all *.test.ts files automatically.

7. Bundle for Production

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

Outputs optimized bundle to dist/. Use --target browser|node|bun to control output format.

8. Create Standalone Executable

bun build ./cli.ts --outfile mycli --compile
./mycli

Bundles code + Bun runtime into single executable; no dependencies needed.

Common Gotchas

  • Lifecycle scripts disabled by default: Bun doesn't run postinstall scripts for security. Add trusted packages to trustedDependencies in package.json to allow them.
  • bun run vs bun <script>: If a built-in Bun command exists with the same name, use bun run <script> explicitly to run package.json scripts.
  • Watch mode flag placement: Use bun --watch run file.ts, not bun run file.ts --watch. Flags after the filename are passed to the script itself.
  • TypeScript errors on Bun global: Install @types/bun and add "lib": ["ESNext"] to tsconfig.json compilerOptions.
  • Lockfile format: Bun v1.2+ uses text bun.lock by default (not binary bun.lockb). Commit to version control.
  • Auto-install disabled in CI: Set install.auto = "disable" in bunfig.toml for production to prevent unexpected package downloads.
  • Node.js compatibility: Bun implements most Node.js APIs but not all. Check docs for node: module support before relying on Node-specific code.
  • Bundler always bundles: Unlike esbuild, bun build always bundles by default. Use Bun.Transpiler to transpile individual files without bundling.
  • No type checking in bundler: bun build does not type-check. Run tsc --noEmit separately for type validation.
  • Peer dependencies installed by default: Unlike npm, Bun installs peer dependencies automatically. Set peer = false in bunfig.toml to disable.

Verification Checklist

Before submitting work with Bun:

  • Run bun install to verify dependencies resolve without errors
  • Run bun run <script> to test main entry point
  • Run bun test and verify all tests pass
  • Run bun build and check output files exist in outdir
  • Verify bun.lock is committed to version control (not .gitignored)
  • Check bunfig.toml for any environment-specific settings that should be removed
  • Confirm no node_modules folder is committed (should be in .gitignore)
  • Test with --production flag if building for deployment: bun install --production
  • Verify TypeScript files have no type errors: bun run tsc --noEmit (if tsc installed)
  • Check that package.json "type": "module" is set for ESM projects

Resources

Comprehensive navigation: https://bun.com/docs/llms.txt — Page-by-page listing of all Bun documentation.

Critical pages:

  1. Bun Runtime — Execute files, scripts, and manage the runtime
  2. Package Manager — Install, add, remove packages and manage dependencies
  3. Bundler — Bundle JavaScript/TypeScript for production
  4. Test Runner — Write and run Jest-compatible tests
  5. bunfig.toml — Configure Bun's behavior

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

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

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/Devsync132026년 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/Devsync132026년 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/Devsync132026년 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/Devsync132026년 8월 11일 업데이트

Compress natural language memory files (CLAUDE.md, todos, preferences) into caveman format to save input tokens. Preserves all technical substance, code, URLs, and structure. Compressed version overwrites the original file. Human-readable backup saved as FILE.original.md. Trigger: /caveman:compress <filepath> or "compress memory file"

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

Jannael/Devsync132026년 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/Devsync132026년 8월 11일 업데이트

Jannael의 스킬 모두 보기

이 스킬의 문제 신고