bun-shell

Execute shell commands and manage subprocesses in Bun using Bun.$ and Bun.spawn.

Updated Jun 22, 2026
One-click install
npx skills add https://github.com/aicodepro/ai-agent-nexi --skill bun-shell-aicodepro
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: bun-shell
Source: https://github.com/aicodepro/ai-agent-nexi/tree/main/agent/skills/bun-shell
Command: npx skills add https://github.com/aicodepro/ai-agent-nexi --skill bun-shell-aicodepro

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Writing shell automation in JavaScript or TypeScript usually means juggling child_process APIs, string escaping, and stream handling. This Skill provides the patterns for running shell commands, capturing output, and managing processes directly in Bun with template literals and spawn APIs. ## Core Features & Use Cases - Shell Template Literals: Run commands with Bun.$ using safe variable interpolation, piping, and typed output such as text, JSON, lines, and blobs. - Process Management: Use Bun.spawn and Bun.spawnSync for stdio control, streaming output, stdin piping, timeouts, and signal-based termination. - Scripting Workflows: Build executable shebang scripts for deployment, git operations, and parallel command execution with proper error handling. - Use Case: Write a deploy script that checks git status, runs tests and builds in sequence, then rsyncs the output to a server, all in a single TypeScript file executed with Bun. ## Quick Start Ask the assistant to write a Bun shell script that runs your build and test commands and prints the git branch name using Bun.$ template literals.

Frequently Asked Questions about bun-shell

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I run shell commands in Bun with TypeScript?

Use the Bun.$ template literal API by importing { $ } from "bun" and writing commands like await $`ls -la`. Capture output with .text(), .json(), or .lines(), and interpolate variables safely since Bun escapes them automatically.

What is the difference between Bun.$ and Bun.spawn?

Bun.$ is a template-literal shell for concise command execution with built-in output parsing, while Bun.spawn gives low-level process control over stdin, stdout, stderr, streaming, and signals. Use $ for scripts and spawn for long-running or interactive processes.

How do I handle command errors with Bun.$?

Bun.$ throws on non-zero exit codes, so wrap calls in try/catch to access err.exitCode and err.stderr. Alternatively call .quiet() to prevent throwing and inspect the returned exitCode manually.

Does Bun shell scripting work on Windows?

Bun.$ provides cross-platform shell behavior, but path handling and shell differences can cause issues on Windows. The Skill's cross-platform reference covers Windows compatibility, path handling, and shell differences.

How do I run multiple commands in parallel with Bun?

Pass multiple Bun.$ calls to Promise.all to run them concurrently, or create several Bun.spawn processes and await all their exited promises. This works well for running lint, typecheck, and tests simultaneously.