bun-runtime
Use for Bun runtime, bunfig.toml, watch/hot modes, env vars, CLI flags, and module resolution.
What this skill does
# Bun Runtime
Bun is a fast all-in-one JavaScript runtime built on JavaScriptCore (Safari's engine). It provides 4x faster startup than Node.js on Linux.
## Quick Start
```bash
# Run a file
bun run index.ts
bun index.ts # shorthand
# Run with watch mode
bun --watch run index.ts
# Run package.json script
bun run dev
# Run with hot reloading
bun --hot run server.ts
```
## Core CLI Flags
| Flag | Purpose |
|------|---------|
| `--watch` | Restart on file changes |
| `--hot` | Hot module replacement (preserves state) |
| `--smol` | Reduce memory usage (slower GC) |
| `--inspect` | Enable debugger |
| `--preload` | Load modules before execution |
| `--env-file` | Load specific .env file |
| `-e, --eval` | Evaluate code string |
## Running Files
Bun transpiles TypeScript and JSX on-the-fly:
```bash
bun run index.js
bun run index.ts
bun run index.jsx
bun run index.tsx
```
**Important**: Put Bun flags immediately after `bun`:
```bash
bun --watch run dev # Correct
bun run dev --watch # Wrong - flag passed to script
```
## Package.json Scripts
```bash
# Run script
bun run dev
bun dev # shorthand (if no Bun command conflicts)
# List available scripts
bun run
# Run with Bun instead of Node
bun run --bun vite
```
Bun respects lifecycle hooks (`preclean`, `postclean`, etc.).
## Watch Mode vs Hot Reloading
| Mode | Flag | Behavior |
|------|------|----------|
| Watch | `--watch` | Full process restart on changes |
| Hot | `--hot` | Replace modules, preserve state |
```bash
# Watch mode - full restart
bun --watch run server.ts
# Hot reloading - preserves connections/state
bun --hot run server.ts
```
## Environment Variables
Bun automatically loads `.env` files:
```bash
# Loads automatically: .env, .env.local, .env.development
bun run index.ts
# Specify env file
bun --env-file .env.production run index.ts
# Disable auto-loading
# In bunfig.toml: env = false
```
Access in code:
```typescript
const apiKey = process.env.API_KEY;
const bunEnv = Bun.env.NODE_ENV;
```
## Globals Available
| Global | Source | Notes |
|--------|--------|-------|
| `Bun` | Bun | Main API object |
| `Buffer` | Node.js | Binary data |
| `process` | Node.js | Process info |
| `fetch` | Web | HTTP requests |
| `Request/Response` | Web | HTTP types |
| `WebSocket` | Web | WebSocket client |
| `crypto` | Web | Cryptography |
| `console` | Web | Logging |
| `__dirname` | Node.js | Current directory |
| `__filename` | Node.js | Current file |
## Preload Scripts
Load modules before your main script:
```bash
bun --preload ./setup.ts run index.ts
```
Or in `bunfig.toml`:
```toml
preload = ["./setup.ts"]
```
Use cases: polyfills, global setup, instrumentation.
## Stdin Execution
```bash
# Pipe code to Bun
echo "console.log('Hello')" | bun run -
# Redirect file
bun run - < script.js
```
## Workspaces & Monorepos
```bash
# Run script in specific packages
bun run --filter 'pkg-*' build
# Run in all workspaces
bun run --filter '*' test
```
## Debugging
```bash
# Start debugger
bun --inspect run index.ts
# Wait for debugger connection
bun --inspect-wait run index.ts
# Break on first line
bun --inspect-brk run index.ts
```
Connect via Chrome DevTools or VS Code.
## Common Errors
| Error | Cause | Fix |
|-------|-------|-----|
| `Cannot find module` | Missing dependency | Run `bun install` |
| `Top-level await` | Using await outside async | Wrap in async function or use `.mts` |
| `--watch not working` | Flag in wrong position | Put flag before `run` |
## When to Load References
Load `references/bunfig.md` when:
- Configuring bunfig.toml
- Setting up test configuration
- Configuring package manager behavior
- Setting JSX options
Load `references/cli-flags.md` when:
- Need complete CLI flag reference
- Configuring advanced runtime options
- Setting up debugging
Load `references/module-resolution.md` when:
- Troubleshooting import errors
- Configuring path aliases
- Understanding Bun's resolution algorithm
Related in General
modeling-omnistudio-epc-catalog
IncludedSalesforce Industries CME EPC product-modeling skill for Product2-based catalog creation. Use when creating EPC products, configuring product attributes, building offer bundles with Product Child Items, or reviewing EPC DataPack JSON metadata for product catalog changes. TRIGGER when: user creates or updates Product2 EPC records, AttributeAssignment payloads, AttributeMetadata/AttributeDefaultValues, Offer bundles, or ProductChildItem relationships. DO NOT TRIGGER when: designing OmniScripts/FlexCards/Integration Procedures (use building-omnistudio-omniscript, building-omnistudio-flexcard, or building-omnistudio-integration-procedure), implementing Apex business logic (use generating-apex), or troubleshooting deployment pipelines (use deploying-metadata).
relationship-science-coach
IncludedUse this skill for direct, practical adult relationship coaching: couples conflict, repair, trust, marriage, dating, flirting, attachment patterns, emotional connection, sex, desire differences, eroticism, kink negotiation, affection, love languages, breakups, and long-term passion. Draw on Gottman, EFT and Hold Me Tight, attachment science, modern sex research, Perel, Nagoski, Kerner, Schnarch, Love and Stosny, and flexible love-language tools. Be concrete and low-hedge. Redirect only for imminent danger, abuse, coercive control, minors, non-consent, self-harm, stalking, or medical/legal/psychiatric decisions.
building-sf-integrations
IncludedSalesforce integration architecture and runtime plumbing with 120-point scoring. Use this skill to set up Named Credentials, External Credentials, External Services, REST/SOAP callout patterns, Platform Events, and Change Data Capture. TRIGGER when: user sets up Named Credentials, External Services, REST/SOAP callouts, Platform Events, CDC, or touches .namedCredential-meta.xml files. DO NOT TRIGGER when: Connected App/OAuth config (use configuring-connected-apps), Apex-only logic (use generating-apex), or data import/export (use handling-sf-data).
venue-templates
IncludedAccess comprehensive LaTeX templates, formatting requirements, and submission guidelines for major scientific publication venues (Nature, Science, PLOS, IEEE, ACM), academic conferences (NeurIPS, ICML, CVPR, CHI), research posters, and grant proposals (NSF, NIH, DOE, DARPA). This skill should be used when preparing manuscripts for journal submission, conference papers, research posters, or grant proposals and need venue-specific formatting requirements and templates.
let-fate-decide
IncludedDraws the 12 Houses of the Zodiac Tarot spread to inject entropy into planning when prompts are vague, ambiguous, or casually delegated. Interprets the spread to guide next steps. Use when the user says 'let fate decide', 'YOLO', 'whatever', 'idk', or other nonchalant phrases, makes Yu-Gi-Oh references, or when you are about to arbitrarily pick between multiple reasonable approaches. Prefer over ask-questions-if-underspecified when the user's tone is casual or playful rather than precision-seeking.
net-ops
IncludedCross-platform network troubleshooting (Windows, macOS, Linux) via local or remote shell. Use for: DNS broken, can't resolve hostnames, nslookup/dig works but apps fail, NRPT, WFP, scutil, /etc/resolver, systemd-resolved, /etc/resolv.conf, NetworkManager, VPN DNS leak residue (ProtonVPN/Mullvad/WireGuard/AnyConnect), AV/firewall blocking DNS or DoH, Tailscale DNS interaction, intermittent connectivity, remote diagnostics over SSH.