Complete Bun.js ecosystem guidance for runtime APIs, file I/O, package management, testing, SQLite, and security; use proactively when setting up Bun projects, replacing Node.js APIs with Bun-native APIs, writing bun test suites, implementing Bun.serve services, using bun:sqlite with prepared statements, configuring workspaces and lockfiles, hardening shell and SQL boundaries, or optimizing Bun performance and migration workflows.
90%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
Navigation hub for Bun guidance focused on production-safe implementation.
Bun.file, Bun.write, Bun.serve)bun testbun:sqlite usage with transactions or prepared statementsbun install fails: check bun.lock/bun.lockb for merge conflicts, resolve them, and re-run bun install.bun test to isolate regressions before proceeding.rg finds non-prepared statements in existing code): refactor each flagged call to use db.prepare(...) with bound parameters before merging; do not leave raw interpolations in place.bun --versionExpected: a Bun version is printed.
bun installExpected: lockfile is updated consistently (bun.lock/bun.lockb per project setup).
bun run src/index.tsExpected: script executes without Node.js runtime shims.
bun testExpected: failing assertions clearly identify behavior regressions.
bun run server.tsExpected: service binds configured port and handles requests via Bun.serve.
rg -n "query\\(|prepare\\(" srcExpected: queries in new code paths use prepared statements where input is user-controlled. If raw query( calls with interpolated values are found in existing code, refactor them to db.prepare(...) with bound parameters before proceeding.
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | Runtime & Core APIs | CRITICAL | runtime- |
| 2 | File I/O Operations | CRITICAL | file- |
| 3 | Testing Framework | HIGH | testing- |
| 4 | SQLite Integration | HIGH | sqlite- |
| 5 | Package Management | MEDIUM | package- |
| 6 | Security Practices | MEDIUM | security- |
WHY: mixed APIs create inconsistent behaviour and miss Bun performance advantages.
BAD:
import { readFileSync } from "node:fs";
const config = readFileSync("./config.json", "utf8");GOOD:
const config = await Bun.file("./config.json").text();npm install in Bun-managed repositoriesWHY: mixed package managers cause lockfile drift and nondeterministic installs.
BAD: npm install
GOOD: bun install
WHY: direct interpolation can introduce SQL injection vulnerabilities.
BAD:
db.query(`SELECT * FROM users WHERE email = '${email}'`).all();GOOD:
db.prepare("SELECT * FROM users WHERE email = ?").all(email);WHY: shell interpolation enables command injection.
BAD:
await Bun.spawn(["sh", "-c", userInput]).exited;GOOD:
const safePath = Bun.file(userProvidedPath);
await safePath.text();query( calls in existing code once flaggedWHY: the SQL validation step exists to find them, and an unrefactored hit is a live injection path.
BAD: merging while an interpolated db.query call that rg flagged is still present.
GOOD: refactor each flagged call to db.prepare(...) with bound parameters before merging.
bun install failsWHY: an unresolved bun.lock/bun.lockb conflict leaves installs nondeterministic.
BAD: re-running bun install repeatedly without opening the lockfile.
GOOD: resolve the conflict markers, then re-run bun install.
bun test after changing dependenciesWHY: dependency changes can cause regressions that only a test run isolates.
BAD: updating packages and moving straight to the next step.
GOOD: run bun test straight after the change and fix regressions before proceeding.
WHY: stacking changes on a failing state hides which change broke behaviour.
BAD: continuing to edit while the validation error is unexplained.
GOOD: revert the last change, confirm the error, then address the specific failure before re-validating.
WHY: the checks are the guard against the injection and package-manager mistakes above.
BAD: finishing straight after implementation.
GOOD: apply the anti-pattern checks (step 4 of the Workflow) before finalising.
WHY: unlinked decisions cannot be re-checked when Bun behaviour changes.
BAD: "Used Bun.file because it is better."
GOOD: "Used Bun.file per references/file-io-patterns.md."
| Topic | Reference | When to Use |
|---|---|---|
| Runtime globals | references/runtime-globals.md | Using Bun runtime globals |
| HTTP server | references/runtime-http-server.md | Building services with Bun.serve |
| File I/O patterns | references/file-io-patterns.md | Reading and writing files |
| Bun vs Node file APIs | references/file-vs-node.md | Migrating from node:fs |
| Globbing | references/file-glob.md | Matching files by pattern |
| Test runner | references/testing-bun-test.md | Writing bun test suites |
| Matchers | references/testing-matchers.md | Choosing assertions |
| Mocking | references/testing-mocking.md | Mocking modules and functions |
| Snapshots | references/testing-snapshots.md | Snapshot testing |
| SQLite | references/sqlite-basics.md | Using bun:sqlite |
| Workspaces | references/pm-workspaces-agent-instructions.md | Package and workspace policy |
| Shell safety | references/runtime-shell.md | Running subprocesses safely |
| Passwords | references/runtime-password.md | Hashing and verifying passwords |
pantheon-org/tekhne
c8416e9
Also appears in
last in sync Aug 28, 2026
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.