bun-knowledge-patch_skill

This skill helps you write Bun code using 1.2+ features by applying Bun-specific APIs and patterns across servers, databases, and tooling.

6

GitHub Stars

1

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill nevaberry/nevaberry-plugins --skill bun-knowledge-patch

  • SKILL.md5.7 KB

Overview

This skill provides a focused knowledge patch for Bun features released in 1.2+ (2025–2026). It fills gaps when writing Bun code, using bun:* modules, Bun.serve(), bundler features, new runtime APIs, and updated package tooling. Use it to get accurate, up-to-date guidance on APIs and idiomatic patterns beyond Bun 1.1.

How this skill works

The skill summarizes new APIs, server patterns, database clients, S3 storage helpers, test-runner additions, bundler flags, and runtime/CLI features introduced in Bun 1.2+. It highlights concrete examples (route params, method handlers, SQL tagged templates, S3 file semantics, Bun.markdown, Bun.YAML, Bun.JSON5, Bun.Archive, spawn timeout). It also points to concise reference topics for deeper patterns and edge cases.

When to use it

  • When building HTTP servers with Bun.serve using route params, method handlers, static routes, cookies, or CSRF.
  • When using Bun-provided database clients (sql tagged templates, MySQL/SQLite/Redis integration).
  • When interacting with Bun.s3 for presigned URLs, file reads, writes, and bucket operations.
  • When writing tests with bun:test (fake timers, concurrent tests, retries, vi helpers).
  • When bundling or compiling apps with bun build flags (--compile, --target, --metafile, --feature).
  • When using new runtime/CLI features (spawn timeout, profiling, fetch proxy) or Node compatibility layers.

Best practices

  • Prefer Bun.serve routes object for clear route-level method handlers and direct static responses.
  • Use sql tagged templates and sql(object, ...columns) for safe dynamic column inserts/updates and array IN clauses.
  • Use Bun.s3.file(...) to treat S3 objects like local Bun.file() instances for consistent read/write APIs.
  • Enable test concurrency and retries judiciously; use fake timers with jest/vi APIs for reliable time-based tests.
  • Pass explicit bundler flags for reproducible builds and use metafile output to analyze bundle contents.
  • Use Bun.CSRF and req.cookies APIs for secure session handling and prefer presigned URLs for uploads/downloads.

Example use cases

  • Full-stack Bun.serve app importing an HTML entrypoint, exposing REST routes with params and method-specific handlers.
  • Performing safe SQL inserts/updates using sql(user, 'name', 'email') and querying WHERE IN with arrays.
  • Reading and writing files on S3 via s3.file('path').text() and generating presigned URLs for client uploads.
  • Writing parallel tests with bun:test using jest.useFakeTimers(), test.concurrent, and retry for flaky cases.
  • Building a standalone executable with bun build --compile and using --metafile to inspect bundle output.

FAQ

Yes. Routes can include params like '/api/users/:id' accessible as req.params.id, and routes can be objects with GET/POST handlers.

How do I perform dynamic column inserts safely with Bun sql?

Use the sql(template) helpers: await sqlINSERT INTO users ${sql(user, 'name','email')} and pass arrays via sql([1,2,3]) for WHERE IN.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational