
Bun Shell
If you're writing shell scripts in Bun, this gives you the full arsenal: Bun.$'s template literal syntax for running commands with automatic escaping, Bun.spawn for subprocess control, and all the piping and error handling you'd expect. The template literal approach actually feels cleaner than traditional shell scripting since you get real variable interpolation and can chain to JavaScript functions. Covers the practical stuff like parallel execution, process management, and streaming output. Worth noting that it includes both async and sync APIs, so you can block when you need to. The examples show real deployment scenarios, not just toy commands.
- skills.sh installs
- 331
- GitHub stars
- 248
- last updated
- Aug 21, 2026
Install
$ npx -y skills add secondsky/claude-skills --skill bun-shell --agent claude-codeInstalls into .claude/skills of the current project.
Files
Bun Shell
Bun provides powerful shell scripting capabilities with template literals and spawn APIs.
Bun.$ (Shell Template)
Basic Usage
import { $ } from "bun";
// Run command
await $`echo "Hello World"`;
// Get output
const result = await $`ls -la`.text();
console.log(result);
// JSON output
const pkg = await $`cat package.json`.json();
console.log(pkg.name);
Variable Interpolation
import { $ } from "bun";
const name = "world";
const dir = "./src";
// Safe interpolation (escaped)
await $`echo "Hello ${name}"`;
await $`ls ${dir}`;
// Array expansion
const files = ["a.txt", "b.txt", "c.txt"];
await $`touch ${files}`;
Piping
import { $ } from "bun";
// Pipe commands
const result = await $`cat file.txt | grep "pattern" | wc -l`.text();
// Chain with JavaScript
const files = await $`ls -la`.text();
const lines = files.split("\n").filter(line => line.includes(".ts"));
Error Handling
import { $ } from "bun";
// Throws on non-zero exit
try {
await $`exit 1`;
} catch (err) {
console.log(err.exitCode); // 1
console.log(err.stderr);
}
Sponsors
Details
- Repository
- github.com/secondsky/claude-skills
- Category
- CLI & Terminal
- First seen
- Jun 3, 2026
More from secondsky/claude-skills
All 146- Bun React Ssr330
- Bun Tanstack Start329
- Cloudflare Workers Performance329
- Bun Hot Reloading328
- Bun Redis328
- Bun Ffi326
- Bun Jest Migration326
- Bun Websocket Server326
- Cloudflare Workers Runtime Apis326
- Swift Best Practices326
- Bun Nuxt323
- Bun Macros322
- Cloudflare Workers Frameworks321
- Supabase Postgres Best Practices319
- Cloudflare Workers Ci Cd318
- Cloudflare Workers Dev Experience317
- Cloudflare Workers Observability315
- Cloudflare Workers Migration310
- Cloudflare Workers Multi Lang310
- Verification Before Completion310
- Nuxt Studio308
- Neon Vercel Postgres294
- Chrome Devtools288
- Database Sharding277