Bun Macros
Build-time JavaScript evaluation for Bun that inlines macro results into the bundled output.
- CCM score
- 52 of 100
- skills.sh installs
- 407
- GitHub stars
- 257
- last updated
- Aug 21, 2026
Own this skill? Claim it
What it does
- Covers macro syntax via
with { type: "macro" }imports and their evaluation only duringbun build, notbun run - Includes examples for env inlining, git metadata, file embedding, directory listing, platform checks, and async fetches
- Requires macro return values to be serializable, and makes a failing
requireEnvcheck fail the build - Designed for build-time code generation and constant embedding in Bun projects, with
references/files for advanced patterns and debugging
Install
$ npx -y skills add secondsky/claude-skills --skill bun-macros -yInstalls into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.
Files
Bun Macros
Bun macros run JavaScript at bundle time and inline the results into the output.
Quick Start
// src/config.ts (macro file)
export function getVersion() {
return "1.0.0";
}
export function getBuildTime() {
return new Date().toISOString();
}
// src/index.ts (consumer)
import { getVersion, getBuildTime } from "./config" with { type: "macro" };
// At bundle time, these become:
const version = "1.0.0";
const buildTime = "2024-01-15T12:00:00.000Z";
Macro Syntax
// Import with macro attribute
import { fn } from "./macro-file" with { type: "macro" };
// Call the macro (evaluated at build time)
const result = fn();
Common Use Cases
Environment Inlining
// macros/env.ts
export function env(key: string): string {
return process.env[key] ?? "";
}
// src/index.ts
import { env } from "./macros/env" with { type: "macro" };
const apiUrl = env("API_URL");
// Becomes: const apiUrl = "https://api.example.com";
Git Information
// macros/git.ts
export function gitCommit(): string {
return Bun.spawnSync(["git", "rev-parse", "HEAD"])
.stdout.toString().trim();
}
Details
- Repository
- github.com/secondsky/claude-skills
- Categories
- Frontend & UI Code, CLI & Terminal
- First seen
- Jun 3, 2026
Questions
What does the bun-macros skill do?
The bun-macros skill teaches an agent to evaluate JavaScript at bundle time and inline the results into the output. It covers embedding files, inlining environment variables, and running code during the bundling process.
How do I install the bun-macros skill?
Run npx -y skills add secondsky/claude-skills --skill bun-macros -y in your project. Once installed, the agent can write macro files that Bun evaluates during bundling.
Which other skills lead the Frontend & UI Code category?
bun-macros sits in the Frontend & UI Code category alongside vercel-react-best-practices, web-design-guidelines, design-taste-frontend, vercel-composition-patterns and lark-apps. Its focus is compile-time code generation, which is narrower than the design and React guidance of those skills.
Do macros run when I start my app with bun run?
No, macros only execute during bundling, so bun build triggers them but bun run does not. The skill notes this behavior explicitly so you can plan where generated values are computed.
More from secondsky/claude-skills
All 116- Multi Ai Consultant407
- Model Deployment405
- Graphql Implementation403
- Jest Generator402
- Thesys Generative Ui393
- Nuxt Studio391
- Maz Ui390
- Woocommerce Code Review389
- Woocommerce Backend Dev388
- Woocommerce Copy Guidelines384
- Woocommerce Dev Cycle384
- Nuxt Seo345
- Tailwind V4 Shadcn8.4K
- Aceternity Ui1.7K
- Vitest Testing1.3K
- Motion1.2K
- Playwright1.1K
- Api Testing929
- Responsive Web Design731
- Zod677
- Nano Banana Prompts655
- Mobile First Design629
- Image Optimization622
- Rest Api Design614
Similar to Bun Macros
More Frontend & UI Codebun-bundlerSkillsecondsky/claude-skills423 installsBun's esbuild-compatible JavaScript and TypeScript bundler, covering CLI and Bun.build usage for production builds.
bun-runtimeSkillsecondsky/claude-skills438 installsFast all-in-one JavaScript runtime covering CLI flags, watch and hot modes, env loading, and module resolution.
bunSkilldalestudy/skills556 installsBun runtime guide that replaces npm and Node.js commands with Bun equivalents for projects and scripts.
jutsu-bunPluginTheBushidoCollective/han201 starsValidation and quality enforcement for Bun.js projects with runtime, testing, bundler, package manager, and SQLite skills.
bun-developmentSkillsickn33/agentic-awesome-skills2.9K installsFast JavaScript and TypeScript development guidance for the Bun runtime, including Node.js migration and Bun's built-in tooling.
Code RunnerMCP serverformulahendry241 starsRuns code snippets in dozens of languages locally and returns the output to the assistant.