Bun Macros
Run JavaScript functions at bundle-time with Bun macros
Install
npx skills add jarle/bun-skills --skill Bun Macrosgit clone --depth 1 https://github.com/jarle/bun-skills.git /tmp/bun-skills
mkdir -p ~/.claude/skills
cp -r /tmp/bun-skills/skills/bun-bundler-macros ~/.claude/skills/Bun-MacrosPersonal skills live in ~/.claude/skills. Use .claude/skills in a project folder to share a skill with your team.
From the SKILL.md
# Macros
> Run JavaScript functions at bundle-time with Bun macros
Macros are a mechanism for running JavaScript functions at bundle-time. The value returned from these functions are directly inlined into your bundle.
As a toy example, consider this simple function that returns a random number.
```ts title="random.ts" icon="https://mintcdn.com/bun-1dd33a4e/nIz6GtMH5K-dfXeV/icons/typescript.svg?fit=max&auto=format&n=nIz6GtMH5K-dfXeV&q=85&s=5d73d76daf7eb7b158469d8c30d349b0" theme={"theme":{"light":"github-light","dark":"dracula"}}
export function random() {
return Math.random();
}
```
This is just a regular function in a regular file, but we can use it as a macro like so:
```tsx title="cli.tsx" icon="https://mintcdn.com/bun-1dd33a4e/nIz6GtMH5K-dfXeV/icons/typescript.svg?fit=max&auto=format&n=nIz6GtMH5K-dfXeV&q=85&s=5d73d76daf7eb7b158469d8c30d349b0" theme={"theme":{"light":"github-light","dark":"dracula"}}
import { random } from "./random.ts" with { type: "macro" };
console.log(`Your random number is ${random()}`);
```
<Note>
Macros are indicated using import attribute syntax. If you haven't seen this syntax before, it's a Stage 3 TC39
proposal that lets you attach additional metadata to import statements.
</Note>
Now we'll bundle this file with `bun build`. The bundled file will be printed to stdout.
```bash terminal icon="terminal" theme={"theme":{"light":"github-light","dark":"dracula"}}
bun build ./cli.tsx
```Details
- Skill name
Bun Macros- Repository
- jarle/bun-skills
- Path
skills/bun-bundler-macros/SKILL.md- License
- MIT
- Repo updated
- 24 February 2026
FAQ
What does the Bun Macros skill do?
Run JavaScript functions at bundle-time with Bun macros
How do I install the Bun Macros skill?
skills CLI (Claude Code, Cursor, Codex and more): npx skills add jarle/bun-skills --skill Bun Macros. Skills go in ~/.claude/skills (personal) or .claude/skills (project), and Claude loads them automatically when a task matches the description.
Is Bun Macros popular?
It lives in jarle/bun-skills, which has 9 GitHub stars and 1 forks.
Related skills
Bun Archive
9jarle/bun-skills
Create and extract tar archives with Bun's fast native implementation
Bun Auto Install
9jarle/bun-skills
Bun's automatic package installation feature for standalone script execution
Bun Bun Add
9jarle/bun-skills
Add packages to your project with Bun's fast package manager
Bun Markdown
9jarle/bun-skills
Parse and render Markdown with Bun's built-in Markdown API, supporting GFM extensions and custom rendering callbacks
Bun Hot Reloading
9jarle/bun-skills
Hot Module Replacement (HMR) for Bun's development server
Bun Minifier
9jarle/bun-skills
Reduce bundle sizes with Bun's JavaScript and TypeScript minifier
Browse the most popular Claude skills, all software development skills, or write your own with the skills generator.