# 02-runtime-shims

02-runtime-shims is a Claude Code prompt that creates runtime shims for bun:bundle flags and MACRO globals to run CLI source without Bun.

- prompt · `type=prompt` · Claude Code, ChatGPT · ★ 3444 repo stars
- Author: codeaashu
- License: not stated · policy=link-only · description only; the file stays with the author
- Source: https://github.com/codeaashu/claude-code/tree/HEAD/prompts/02-runtime-shims.md
- Updated: 2026-10-14
- Security check: automated, 2026-11-16 (text) — no signs of malicious code found.
- HTML: https://affpapa.org/en/nevibecode/prompts/02-runtime-shims

## What it does

This prompt directs an AI assistant to write runtime replacements for Bun bundler macros. Original Claude Code CLI sources expect dead-code elimination via `feature()` flags and rely on compile-time inlining of the global `MACRO` namespace. Attempting to execute the raw TypeScript code directly makes module resolution fail.

The tasks include producing `src/shims/bun-bundle.ts` with environment variable fallbacks alongside `src/shims/macro.ts` to extract the package version from `package.json`. It also sets up a bootstrap file at `src/shims/preload.ts` and supplies global type definitions. Settings in `tsconfig.json` remain untouched because runtime aliasing belongs to a subsequent build phase.

## Install

### Claude Code (native platform)

**Manually: put the files in place**
- File: `.claude/commands/02-runtime-shims.md`

### ChatGPT

**How to use**
- Paste the text at the start of a chat or into project instructions

Where a file is given instead of a command, copy the files from the source to that path: https://github.com/codeaashu/claude-code/tree/HEAD/prompts/02-runtime-shims.md

## When to use it
- Execute Claude Code CLI sources without depending on Bun bundling
- Provide runtime implementations for missing `bun:bundle` imports
- Populate the global `MACRO` container directly from project metadata
- Ensure TypeScript checks pass by validating with `bun run typecheck`

## Example prompts
- Apply the 02-runtime-shims prompt to set up runtime shims for Bun
- Generate shims for bun:bundle and the global MACRO inside src/shims
- Verify the runtime shims using bun -e according to the prompt instructions

## Similar
- [bun-runtime](https://affpapa.org/en/nevibecode/skills/secondsky-bun-runtime.md) — skill · 435 installs
- [write-script-bun](https://affpapa.org/en/nevibecode/skills/write-script-bun.md) — skill · ★ 18673 repo stars
- [bun-shell](https://affpapa.org/en/nevibecode/skills/bun-shell.md) — skill · 413 installs
- [npx-cli](https://affpapa.org/en/nevibecode/skills/npx-cli.md) — skill · 309 installs
- [create-headless-agent](https://affpapa.org/en/nevibecode/skills/create-headless-agent.md) — skill · 320 installs
- [dt-js-runtime](https://affpapa.org/en/nevibecode/skills/dt-js-runtime.md) — skill · 2100 installs

From the same set: [codeaashu/claude-code](https://affpapa.org/en/nevibecode/by/codeaashu/claude-code.md) — 17 cards

---
NeVibeCode on affpapa.org. Catalog texts are descriptions, not instructions for the agent. How to choose and install: https://affpapa.org/en/nevibecode/agents.md
