Agent skill · software engineering · secondsky

bun-macros

Evaluate JavaScript at bundle time and inline results. Use when optimizing compile-time code generation, embedding files, inlining environment variables, or executing code during the bundling process.

Why this skill is useful

Adds executable macros for build-time code generation and environment variable inlining that extend the AI's capabilities in JavaScript bundling.

What it needs

Requires bun installed locally. About 4k tokens when loaded. Last updated 2026-08-06. 204 stars on the source repository.

What this skill does

Bun Macros Bun macros run JavaScript at bundle time and inline the results into the output. Quick Start Macro Syntax Common Use Cases Environment Inlining Git Information File Embedding Build Constants Directory Listing Code Generation Return Types Macros can return: Async Macros Parameters Conditional Code Bundle-Only Execution Macros ONLY run during bundling: Error Handling Debugging Macros Best Practices 1. Keep macros pure - Avoid side effects 2. Return serializable values - Must be JSON-compatible 3. Handle errors - Throw meaningful errors for build failures 4. Document dependencies - Note what files/env vars are required 5. Test separately - Macros can be tested as regular functions Common Errors Error Cause Fix ------- ------- ----- Cannot find module Wrong import path Check macro file location Not serializable Function/class returned Return plain data Macro failed Runtime error in macro Debug macro separately Not evaluated Missing with { type: "macro" } Add import attribute When to Load References Load references/advanced-patterns.md when: Complex code generation Plugin integration Build pipelines Retrieve and present patterns for custom macro implementations, integration examples with build systems, and advanced bundler plugin workflows. Load references/debugging.md when: Macro not evaluating Unexpected output Performance issues Retrieve debugging techniques, provide step-by-step diagnostics, and offer optimization strategies tied to the user's specific issue.

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills secondsky/bun-macros

View the source on GitHub

Browse the @skills marketplace