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

bun

Use when building, running, testing, or bundling JavaScript/TypeScript applications. Reach for Bun when you need to execute scripts, manage dependencies, run tests, or bundle code for production. Bun is a drop-in replacement for Node.js with integrated package manager, test runner, and bundler.

インストール方法を見る

含まれるファイル(1)

  • SKILL.md7.8 KB

SKILL.md(原文)

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

Bun Skill Reference

Product Summary

Bun is an all-in-one JavaScript/TypeScript runtime and toolkit. It replaces Node.js, npm, Jest, and esbuild with a single fast executable. Bun runs TypeScript and JSX natively without configuration, starts 4x faster than Node.js, and includes a package manager (30x faster than npm), test runner (Jest-compatible), and bundler.

Key files and commands:

  • bunfig.toml — Bun configuration (optional, in project root)
  • package.json — Standard Node.js manifest; Bun reads it directly
  • bun run <file> — Execute TypeScript/JavaScript files
  • bun install — Install dependencies (creates bun.lock)
  • bun test — Run tests (finds *.test.ts, *.spec.ts, etc.)
  • bun build — Bundle code for production
  • bunx <package> — Execute packages without installing

Primary docs: https://bun.com/docs


When to Use

Use this skill when:

  • Running TypeScript or JSX files directly without compilation
  • Installing or managing npm packages faster than npm/yarn/pnpm
  • Writing and running tests with a Jest-like API
  • Bundling JavaScript/TypeScript for browsers or servers
  • Building full-stack applications with HTML imports
  • Executing package.json scripts with bun run
  • Setting up a new project with bun init
  • Deploying to production with bun build

Do not use for:

  • Type checking (use tsc separately)
  • Generating TypeScript type declarations
  • Projects that require Node.js-specific APIs not yet in Bun (check compatibility)

Quick Reference

Essential Commands

TaskCommand
Run a filebun run index.ts or bun index.ts
Run a scriptbun run dev (from package.json scripts)
Install depsbun install
Add a packagebun add react
Add dev depbun add -d @types/react
Remove packagebun remove react
Run testsbun test
Watch testsbun test --watch
Bundle codebun build ./index.ts --outdir ./dist
Watch bundlerbun build ./index.ts --outdir ./dist --watch
Execute packagebunx cowsay "Hello"
Initialize projectbun init

File Conventions

PatternMeaning
*.test.ts, *.test.jsTest files (auto-discovered)
*_test.ts, *_spec.tsAlternative test patterns
bunfig.tomlBun configuration (optional)
bun.lockLockfile (text format, commit to git)
.envEnvironment variables (auto-loaded)

Configuration in bunfig.toml

# Runtime
[serve]
port = 3000

[test]
root = "./__tests__"
coverage = true
timeout = 5000

[install]
optional = true
dev = true
production = false
linker = "hoisted"  # or "isolated"

[run]
shell = "system"
bun = true
silent = false

Decision Guidance

When to use bun run vs bun <file>

ScenarioUse
Running a script from package.jsonbun run dev
Running a file directlybun index.ts or bun run index.ts
Running with Bun flags (watch, etc.)bun --watch run index.ts
Running a system commandbun run ls (inside package.json script)

When to use bun install vs bun add

ScenarioUse
Install all dependencies from package.jsonbun install
Add a new packagebun add react
Add a dev dependencybun add -d typescript
Install in production (no devDeps)bun install --production
Frozen lockfile (CI/CD)bun install --frozen-lockfile

When to use hoisted vs isolated linker

ScenarioUse
Traditional npm behavior, shared node_moduleshoisted
Strict dependency isolation, prevent phantom depsisolated
New workspaces/monoreposisolated (default)
Existing projectshoisted (default for backward compat)

When to bundle vs run directly

ScenarioUse
Development, rapid iterationbun run (no bundling)
Production server codebun build --target bun
Browser/client codebun build --target browser
Node.js compatibilitybun build --target node
Single executablebun build --target bun --outfile app

Workflow

1. Start a New Project

bun init
# Choose template: Blank, React, or Library
cd my-app
bun run index.ts

2. Add Dependencies

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

3. Write and Run Code

# Edit index.ts with TypeScript/JSX
bun run index.ts

# Or watch for changes
bun --watch run index.ts

4. Write Tests

Create math.test.ts:

import { test, expect } from "bun:test";

test("2 + 2 = 4", () => {
  expect(2 + 2).toBe(4);
});

Run tests:

bun test
bun test --watch
bun test --coverage

5. Build for Production

# Bundle for browser
bun build ./src/index.tsx --outdir ./dist --target browser

# Bundle for server
bun build ./src/server.ts --outdir ./dist --target bun

# Create single executable
bun build ./src/server.ts --outfile app --target bun

6. Configure bunfig.toml (Optional)

[serve]
port = 8080

[test]
coverage = true
timeout = 10000

[install]
linker = "isolated"

7. Deploy

# Build for production
bun build ./src/server.ts --outdir ./dist --minify

# Run in production
bun ./dist/server.js

Common Gotchas

  • TypeScript errors on Bun global: Install @types/bun and configure tsconfig.json with "lib": ["ESNext"]
  • Lifecycle scripts don't run by default: Add packages to trustedDependencies in package.json to allow postinstall scripts
  • bun run flags must come before the script name: Use bun --watch run dev, not bun run dev --watch
  • Test files must match patterns: Use *.test.ts, *_test.ts, *.spec.ts, or *_spec.ts
  • Environment variables auto-load from .env: Disable with env = false in bunfig.toml if needed
  • bun.lock is text format: Commit it to git; it's human-readable and mergeable
  • Peer dependencies install by default: Unlike npm, Bun installs peerDependencies automatically
  • Node.js compatibility is ongoing: Check Node.js compat docs for unsupported APIs
  • Bundler doesn't type-check: Run tsc --noEmit separately for type checking
  • Auto-install disabled in production: Set install.auto = "disable" in bunfig.toml for CI/CD

Verification Checklist

Before submitting work with Bun:

  • Tests pass: bun test runs without errors
  • No TypeScript errors: bunx tsc --noEmit (if using TypeScript)
  • Code runs locally: bun run index.ts or bun run dev
  • Dependencies are declared: bun add <package> (not manually edited package.json)
  • bun.lock is committed (if using version control)
  • bunfig.toml is configured for your use case (if needed)
  • Build succeeds: bun build ./src/index.ts --outdir ./dist
  • No console errors or warnings in output
  • Environment variables are set (check .env or CI/CD config)
  • Trusted dependencies are declared if using lifecycle scripts

Resources

Comprehensive navigation: https://bun.com/docs/llms.txt

Critical documentation pages:

  1. Bun Runtime — Execute files and scripts
  2. Package Manager — Install and manage dependencies
  3. Test Runner — Write and run tests
  4. Bundler — Bundle code for production
  5. HTTP Server — Build servers with Bun.serve

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

レビュー

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

同じリポジトリのスキル

概要と使いどころ

Build AI agents on Cloudflare Workers using the Agents SDK. Load when creating stateful agents, durable workflows, real-time WebSocket apps, scheduled tasks, MCP servers, chat applications, voice agents, or browser automation. Covers Agent class, state management, callable RPC, Workflows, durable execution, queues, retries, observability, and React hooks. Biases towards retrieval from Cloudflare docs over pre-trained knowledge.

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

galfrevn/apollo2382026年8月18日 更新

ai-seo

無料

When the user wants to optimize content for AI search engines, get cited by LLMs, or appear in AI-generated answers. Also use when the user mentions 'AI SEO,' 'AEO,' 'GEO,' 'LLMO,' 'answer engine optimization,' 'generative engine optimization,' 'LLM optimization,' 'AI Overviews,' 'optimize for ChatGPT,' 'optimize for Perplexity,' 'AI citations,' 'AI visibility,' 'zero-click search,' 'how do I show up in AI answers,' 'LLM mentions,' 'optimize for Claude/Gemini,' 'llms.txt,' 'OKF,' 'Open Knowledge Format,' 'knowledge bundle,' or 'agent-readable site.' Use this whenever someone wants their content to be cited or surfaced by AI assistants and AI search engines. For traditional technical and on-page SEO audits, see seo-audit. For structured data implementation, see schema.

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

galfrevn/apollo2382026年8月18日 更新

animate

無料

Build an animation from scratch, making the decisions in the order that determines whether it feels right — should it animate at all, what purpose, which tool, which properties, which curve and duration, how it interrupts, how it exits. Writes the implementation. Use when asked to animate something, add motion, make a component feel alive, or build a transition. For critiquing existing motion use review-animations; for auditing a whole codebase use improve-animations.

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

galfrevn/apollo2382026年8月18日 更新

Reverse-lookup glossary that turns a vague description of a web animation or motion effect into its exact term ("the bouncy thing when a popover opens" → Pop in; "the iOS rubber-band scroll" → Rubber-banding). Use when the user asks "what's it called when…", or describes a motion effect without knowing its name and wants the right word to prompt an AI or designer with. For naming an effect, not designing or building one.

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

galfrevn/apollo2382026年8月18日 更新

Fallback reference for Cloudflare products that have no dedicated skill here — Pages, storage (KV, D1, R2), AI (Workers AI, Vectorize), feature flags (Flagship), networking (Tunnel, Spectrum), security (WAF, DDoS), and infrastructure-as-code (Terraform, Pulumi). Prefer the focused skill when one fits: agents-sdk for the Agents SDK, durable-objects for Durable Objects, workers-best-practices for reviewing or authoring Worker code, wrangler for CLI commands, sandbox-sdk for sandboxed execution. Biases towards retrieval from Cloudflare docs over pre-trained knowledge.

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

galfrevn/apollo2382026年8月18日 更新

Structured diagnostic for technical SEO problems. Use when the user asks about crawl issues, indexation problems, why pages aren't being indexed, robots.txt questions, canonical errors, sitemap issues, rendering problems, or general technical SEO troubleshooting. For Core Web Vitals and page speed, see audit-speed.

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

galfrevn/apollo2382026年8月18日 更新

galfrevn のスキルをすべて見る

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