writing-bundler-tests

writing-bundler-tests is a skill for Claude Code from twaldin/hone. It costs 42 tokens per session (1,238 once invoked), scanned A, original, MIT.

A guide for writing tests for Bun's bundler, the tool that combines and transforms project files for running or shipping. It uses Bun-specific test helpers to describe input files, bundler settings, and expected output.

In plain words
What is it for?
Use it when adding or changing tests for bundling, transpilation, or code transformation behavior.
Why use it?
It gives bundler tests a consistent setup for checking transformations, generated files, runtime output, and options such as minification or source maps.

Skill for Claude Code

Written for Claude Code: installed under .claude/.

Good fit Use it when adding or changing tests for bundling, transpilation, or code transformation behavior.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/twaldin/hone/writing-bundler-tests
View source ↗ twaldin/hone
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add twaldin/hone --skill writing-bundler-tests
Clone the repo
git clone --depth 1 https://github.com/twaldin/hone

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for writing-bundler-tests

README.md
[![agentmods](https://agentmods.dev/badge/skills/twaldin/hone/writing-bundler-tests/github.svg)](https://agentmods.dev/skills/twaldin/hone/writing-bundler-tests)
Your own site
<a href="https://agentmods.dev/skills/twaldin/hone/writing-bundler-tests"><img src="https://agentmods.dev/badge/skills/twaldin/hone/writing-bundler-tests/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for writing-bundler-tests

Your own site · 80×15
<a href="https://agentmods.dev/skills/twaldin/hone/writing-bundler-tests"><img src="https://agentmods.dev/badge/skills/twaldin/hone/writing-bundler-tests.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 42 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,238 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00042 $0.01238
Opus 5 $0.00021 $0.00619
Sonnet 5 $0.00008 $0.00248
Haiku 4.5 $0.00004 $0.00124

Measured 2d ago against content hash 5e9ef4c764da, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

writing-bundler-tests scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

capsules/bun-module-loader/.candidate-5187e276/.claude/skills/writing-bundler-tests/SKILL.md · 223 lines

How it starts

The opening of the file, as written. The whole thing — 223 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Writing Bundler Tests

Bundler tests use itBundled() from test/bundler/expectBundled.ts to test Bun's bundler.

Basic Usage

import { describe } from "bun:test";
import { itBundled, dedent } from "./expectBundled";

describe("bundler", () => {
  itBundled("category/TestName", {
    files: {
      "index.js": `console.log("hello");`,
    },
    run: {
      stdout: "hello",
    },
  });
});

Test ID format: category/TestName (e.g., banner/CommentBanner, minify/Empty)

File Setup

{
  files: {
    "index.js": `console.log("test");`,
    "lib.ts": `export const foo = 123;`,
    "nested/file.js": `export default {};`,
  },
  entryPoints: ["index.js"],  // defaults to first file
  runtimeFiles: {             // written AFTER bundling
    "extra.js": `console.log("added later");`,
  },
}

Bundler Options

{
  outfile: "/out.js",
  outdir: "/out",
  format: "esm" | "cjs" | "iife",
  target: "bun" | "browser" | "node",

  // Minification
  minifyWhitespace: true,
  minifyIdentifiers: true,
  minifySyntax: true,

  // Code manipulation
  banner: "// copyright",
  footer: "// end",
  define: { "PROD": "true" },
  external: ["lodash"],

  // Advanced
  sourceMap: "inline" | "external",
  splitting: true,
  treeShaking: true,
  drop: ["console"],
}

Runtime Verification

{
  run: {
    stdout: "expected output",      // exact match
    stdout: /regex/,                // pattern match
    partialStdout: "contains this", // substring
    stderr: "error output",
    exitCode: 1,
    env: { NODE_ENV: "production" },
    runtime: "bun" | "node",

    // Runtime errors
    error: "ReferenceError: x is not defined",
  },
}

Bundle Errors/Warnings

{
  bundleErrors: {
    "/file.js": ["error message 1", "error message 2"],
  },
  bundleWarnings: {
    "/file.js": ["warning message"],
  },
}

Dead Code Elimination (DCE)

Add markers in source code:

// KEEP - this should survive
const used = 1;

// REMOVE - this should be eliminated
const unused = 2;

Read the full file on GitHub · 223 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 223 lines · 42 tokens per session scan A 5e9ef4c764da

Subscribe to this mod's changes

writing-bundler-tests is a skill published in the GitHub repository twaldin/hone (47 stars, last pushed 2d ago), licensed MIT. It adds 42 tokens to every session and 1,238 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-07.