Agent skill

Bun Hot Reloading

by secondsky in secondsky/claude-skills

A skill your agent uses when implementing hot reloading with Bun (--hot, --watch), HMR, or automatic code reloading during development.

MITAuto-check passed

Install Bun Hot Reloading

skills CLI
$ npx skills add secondsky/claude-skills --skill bun-hot-reloading -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install secondsky/claude-skills bun-hot-reloading --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/secondsky/claude-skills.git skills-src && mkdir -p .claude/skills && cp -r skills-src/plugins/bun/skills/bun-hot-reloading .claude/skills/bun-hot-reloading && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
bun-hot-reloading
GitHub stars
227
Token cost
~1.9k tokens
SKILL.md length
210 words
Files
1
Skills in repo
169
Repo updated
First seen
Licence
MIT

At a glance

A skill your agent uses when implementing hot reloading with Bun (--hot, --watch), HMR, or automatic code reloading during development.

  • Implementing hot reloading with Bun (--hot
  • SKILL.md covers Watch Mode vs Hot Mode, Watch Mode (--watch), Hot Mode (--hot) and import.meta.hot API, plus 9 more sections
  • Calls bun and bunx
  • Automatic code reloading during development

What it does

Bun Hot Reloading is an agent skill from secondsky/claude-skills. Use when implementing hot reloading with Bun (--hot, --watch), HMR, or automatic code reloading during development. Covers watch mode, hot mode, and HTTP server reload.

Its SKILL.md is about 1.9k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

The repository describes itself as: Production-ready skills for Claude Code CLI - Cloudflare, React, Tailwind v4, and AI integrations. The licence is MIT.

When your agent uses it

  • Implementing hot reloading with Bun (--hot
  • Automatic code reloading during development

Example prompts

  • “/bun-hot-reloading”

What it can do on your machine

Read from SKILL.md and the folder at commit 8837836. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • bun
    • bunx

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md. Its commands use bunx, which can reach the network depending on how they are called.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Bun Hot Reloading loads about 1.9k tokens when it runs. Until then it costs about 47 tokens; SKILL.md has 210 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~47
When it runs · the whole SKILL.md, loaded when a task matches
~1.9k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from secondsky/claude-skills at commit 8837836, republished under its MIT licence (© secondsky). 210 words, ~1,908 tokens.

Download SKILL.mdSave it as .claude/skills/bun-hot-reloading/SKILL.md (or your agent's skills folder).
name
bun-hot-reloading
description
Use when implementing hot reloading with Bun (--hot, --watch), HMR, or automatic code reloading during development. Covers watch mode, hot mode, and HTTP server reload.
metadata.version
1.0.0
license
MIT

Bun Hot Reloading

Bun provides built-in hot reloading for faster development cycles.

Watch Mode vs Hot Mode

Feature--watch--hot
BehaviorRestart processReload modules
StateLost on reloadPreserved
Speed~20ms restartInstant reload
Use caseAny file typeBun.serve HTTP

Watch Mode (--watch)

Restarts the entire process when files change.

bash
# Basic watch mode
bun --watch run src/index.ts

# Watch specific script
bun --watch run dev

# Watch with test runner
bun --watch test
package.json Scripts
json
{
  "scripts": {
    "dev": "bun --watch run src/index.ts",
    "dev:server": "bun --watch run src/server.ts",
    "test:watch": "bun --watch test"
  }
}
Watch Behavior
  • Watches imported files automatically
  • Triggers on any .ts, .tsx, .js, .jsx change
  • Also watches .json imports
  • Restarts with fresh state

Hot Mode (--hot)

Reloads modules in-place without restarting the process.

bash
bun --hot run src/server.ts
HTTP Server Hot Reload
typescript
// src/server.ts
let counter = 0; // State preserved across hot reloads

export default {
  port: 3000,
  fetch(req: Request) {
    counter++;
    return new Response(`Request #${counter}`);
  },
};
bash
bun --hot run src/server.ts

When you modify server.ts, the module reloads instantly while counter keeps its value.

Bun.serve with Hot Reload
typescript
// src/server.ts
const server = Bun.serve({
  port: 3000,
  fetch(req) {
    return new Response("Hello!");
  },
});

// Hot reload handler
if (import.meta.hot) {
  import.meta.hot.accept(() => {
    console.log("Hot reload!");
  });
}

console.log(`Server running on port ${server.port}`);

import.meta.hot API

typescript
// Check if hot reload is available
if (import.meta.hot) {
  // Accept updates to this module
  import.meta.hot.accept();

  // Accept with callback
  import.meta.hot.accept((newModule) => {
    console.log("Module updated:", newModule);
  });

  // Cleanup before reload
  import.meta.hot.dispose(() => {
    // Close connections, clear intervals, etc.
    clearInterval(myInterval);
  });

  // Decline hot reload (force full restart)
  import.meta.hot.decline();

  // Invalidate this module (trigger parent reload)
  import.meta.hot.invalidate();
}

HTTP Server Patterns

Express-like Pattern
typescript
// src/server.ts
import { createApp } from "./app";

const app = createApp();

const server = Bun.serve({
  port: 3000,
  fetch: app.fetch,
});

// Hot reload: recreate app
if (import.meta.hot) {
  import.meta.hot.accept((newModule) => {
    // Reload with new fetch handler
    server.reload({
      fetch: newModule.default.fetch,
    });
  });
}
Stateful Server
typescript
// src/server.ts
// Store in globalThis to survive reloads
globalThis.connections ??= new Set();

const server = Bun.serve({
  port: 3000,
  fetch(req) {
    return new Response(`Connections: ${globalThis.connections.size}`);
  },
  websocket: {
    open(ws) {
      globalThis.connections.add(ws);
    },
    close(ws) {
      globalThis.connections.delete(ws);
    },
  },
});

if (import.meta.hot) {
  import.meta.hot.accept();
}

Custom Watch Implementation

typescript
// dev-server.ts
import { watch } from "fs";

const srcDir = "./src";
let server: ReturnType<typeof Bun.serve> | null = null;

async function startServer() {
  // Dynamic import with cache busting
  const module = await import(`./src/server.ts?t=${Date.now()}`);

  if (server) {
    // Bun 1.2+: server.stop() returns a Promise — await it so the old
    // socket is fully torn down before we rebind the same port.
    await server.stop();
  }

  server = Bun.serve(module.default);
  console.log(`Server started on port ${server.port}`);
}

// Initial start
await startServer();

// Watch for changes
watch(srcDir, { recursive: true }, async (event, filename) => {
  if (filename?.endsWith(".ts") || filename?.endsWith(".tsx")) {
    console.log(`\n[${event}] ${filename}`);
    await startServer();
  }
});

console.log("Watching for changes...");

WebSocket Live Reload

Server
typescript
// src/dev-server.ts
const clients = new Set<ServerWebSocket>();

const server = Bun.serve({
  port: 3000,
  fetch(req, server) {
    if (req.headers.get("upgrade") === "websocket") {
      server.upgrade(req);
      return;
    }

    // Inject reload script in dev
    const html = `
      <!DOCTYPE html>
      <html>
        <body>
          <h1>Hello!</h1>
          <script>
            const ws = new WebSocket('ws://localhost:3000');
            ws.onmessage = (e) => {
              if (e.data === 'reload') location.reload();
            };
          </script>
        </body>
      </html>
    `;
    return new Response(html, {
      headers: { "Content-Type": "text/html" },
    });
  },
  websocket: {
    open(ws) {
      clients.add(ws);
    },
    close(ws) {
      clients.delete(ws);
    },
  },
});

// Notify clients on file change
watch("./src", { recursive: true }, () => {
  clients.forEach((ws) => ws.send("reload"));
});

Vite Integration

For frontend development with HMR:

typescript
// vite.config.ts
import { defineConfig } from "vite";
import react from "@vitejs/plugin-react";

export default defineConfig({
  plugins: [react()],
  server: {
    port: 5173,
    hmr: true,
  },
});
bash
# Use Bun to run Vite
bunx --bun vite

Testing with Watch

bash
# Watch tests
bun --watch test

# Watch specific file
bun --watch test src/utils.test.ts

# With bail (stop on first failure)
bun --watch test --bail

Environment Detection

typescript
// Check if running with --hot
const isHot = !!import.meta.hot;

// Check if running with --watch
const isWatch = process.env.BUN_WATCH === "1";

// Development mode
const isDev = process.env.NODE_ENV !== "production";

if (isDev) {
  console.log("Running in development mode");
  console.log(`Hot reload: ${isHot}`);
  console.log(`Watch mode: ${isWatch}`);
}

Common Issues

State Not Preserved
typescript
// ❌ State lost on hot reload
let cache = new Map();

// ✅ State preserved on hot reload
globalThis.cache ??= new Map();
const cache = globalThis.cache;
Cleanup Not Running
typescript
// ❌ Interval keeps running after reload
setInterval(() => console.log("tick"), 1000);

// ✅ Clean up on dispose
const interval = setInterval(() => console.log("tick"), 1000);

if (import.meta.hot) {
  import.meta.hot.dispose(() => {
    clearInterval(interval);
  });
}
Module Not Reloading
typescript
// ❌ Import not watched
const config = require("./config.json");

// ✅ Use import for watching
import config from "./config.json";

Common Errors

ErrorCauseFix
Changes not detectedFile not importedCheck import chain
State lostUsing --watchUse --hot or globalThis
Port in useServer not stoppedawait server.stop() before rebind
Memory leakNo cleanupUse dispose callback

When to Load References

Load references/advanced-hmr.md when:

  • Custom HMR protocols
  • Module federation
  • Complex state management

Load references/debugging.md when:

  • HMR not working
  • State issues
  • Performance debugging

© secondsky, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in plugins/bun/skills/bun-hot-reloading of secondsky/claude-skills.

Open the folder on GitHubat commit 8837836

Compare with similar skills

Bun Hot Reloading next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Bun Hot Reloading compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Bun Hot Reloading this skillsecondsky/claude-skills227—~1.9kAutomated safety check: PassMIT
Mtp Hot Reloaddotnet/skills5.6k1 repos~2.3kAutomated safety check: PassMIT
Uloop Hot ReloadCyberAgentGameEntertainment/NovaShader1.6k—~2kAutomated safety check: PassMIT
Bun Runtimeaffaan-m/ECC275k1 repos~443Automated safety check: NotesMIT
Understanding Hot Reload LimitsrosuH/EasyWatermark1.9k1 repos~2.6kAutomated safety check: PassApache-2.0
Mtp Hot Reloadmicrosoft/testfx1k—~1.5kAutomated safety check: PassMIT

Similar skills

  • Mtp Hot Reload

    dotnet/skills

    Official

    Set up or recover MTP hot reload for a long-lived console-host edit/re-run loop in a Microsoft Testing Platform project.

    5.6k GitHub starsUsed in 1 repo~2.3k tokens
    Testing & QAAuto-check passed
  • Uloop Hot Reload

    CyberAgentGameEntertainment/NovaShader

    Hot reload applies method-body edits and can add new methods and fields (added members are visible to edited code in the same reload within the same assembly); it can also change signatures: a…

    1.6k GitHub stars~2k tokensUpdated yesterday
    Game DevelopmentAuto-check passed
  • Bun Runtime

    affaan-m/ECC

    Bun 作为运行时、包管理器、打包器和测试运行器。何时选择 Bun 而非 Node、迁移注意事项以及 Vercel 支持。

    275k GitHub starsUsed in 1 repo~443 tokens
    Auto-check: notes
  • A skill your agent uses to teach Claude exactly which Kotlin and Compose changes hot-reload under Compose HotSwan and which trigger a full incremental rebuild fallback.

    1.9k GitHub starsUsed in 1 repo~2.6k tokens
    MobileAuto-check passed
  • Mtp Hot Reload

    microsoft/testfx

    Official

    Suggests using Microsoft Testing Platform (MTP) hot reload to iterate fixes on failing tests without rebuilding.

    1k GitHub stars~1.5k tokensUpdated today
    DevOps & CloudAuto-check passed
  • Canary Watch

    affaan-m/ECC

    A skill your agent uses to monitor and verify a deployed URL after releases — checks HTTP endpoints, SSE streams, static assets, console errors, and performance regressions after deploys, merges, or…

    275k GitHub starsUsed in 1 repo~770 tokens
    DevOps & CloudAuto-check passed

More from secondsky/claude-skills

All 169 skills in this repo
  • Tanstack AI

    secondsky/claude-skills

    TanStack AI (alpha) provider-agnostic type-safe chat with streaming for OpenAI, Anthropic, Gemini, Ollama.

    227 GitHub starsUsed in 1 repo~3.6k tokens
    Auto-check: notes
  • Auto Animate

    secondsky/claude-skills

    AutoAnimate (@formkit/auto-animate) zero-config animations for React.

    227 GitHub stars~2.9k tokensUpdated 9 days ago
    Auto-check passed
  • Base UI React

    secondsky/claude-skills

    MUI Base UI unstyled React components with Floating UI. An agent skill from secondsky/claude-skills.

    227 GitHub stars~1.9k tokensUpdated 9 days ago
    Auto-check passed
  • Cloudflare Images

    secondsky/claude-skills

    This skill should be used when the user asks to "upload images to Cloudflare", "implement direct creator upload", "configure image transformations", "optimize WebP/AVIF", "create image variants"…

    227 GitHub stars~3.6k tokensUpdated 9 days ago
    Auto-check: notes
  • Cloudflare Nextjs

    secondsky/claude-skills

    Deploy Next.js to Cloudflare Workers via the OpenNext adapter (@opennextjs/cloudflare).

    227 GitHub stars~5.3k tokensUpdated 9 days ago
    Auto-check: notes
  • Cloudflare Sandbox

    secondsky/claude-skills

    Cloudflare Sandboxes SDK for secure code execution in Linux containers at edge.

    227 GitHub stars~4.5k tokensUpdated 9 days ago
    Auto-check passed

Questions about Bun Hot Reloading

What does Bun Hot Reloading do?

A skill your agent uses when implementing hot reloading with Bun (--hot, --watch), HMR, or automatic code reloading during development. Bun Hot Reloading is an agent skill from secondsky/claude-skills. Use when implementing hot reloading with Bun (--hot, --watch), HMR, or automatic code reloading during development.

When should I use Bun Hot Reloading?

Bun Hot Reloading fits situations like: implementing hot reloading with Bun (--hot; automatic code reloading during development.

How do I install Bun Hot Reloading in Claude Code?

Run `npx skills add secondsky/claude-skills --skill bun-hot-reloading -a claude-code`. Or copy the skill folder (plugins/bun/skills/bun-hot-reloading in secondsky/claude-skills) into .claude/skills/bun-hot-reloading in your project. Claude Code loads it when a task matches its description.

How do I install Bun Hot Reloading in Codex?

Run `npx skills add secondsky/claude-skills --skill bun-hot-reloading -a codex`. Or copy the skill folder (plugins/bun/skills/bun-hot-reloading in secondsky/claude-skills) into .agents/skills/bun-hot-reloading in your project. Codex loads it when a task matches its description.

Can I use Bun Hot Reloading in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add secondsky/claude-skills --skill bun-hot-reloading -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/bun-hot-reloading, .gemini/skills/bun-hot-reloading, .github/skills/bun-hot-reloading and .opencode/skills/bun-hot-reloading in your project.

What does Bun Hot Reloading need to run?

Going by SKILL.md and its folder, Bun Hot Reloading needs the command-line tools its instructions call (bun and bunx).

Does Bun Hot Reloading access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Bun Hot Reloading safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Bun Hot Reloading use?

Bun Hot Reloading is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Bun Hot Reloading use?

About 1.9k tokens (SKILL.md is roughly 7.6k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Bun Hot Reloading?

Skills that share tags, products or a category with Bun Hot Reloading: Mtp Hot Reload (dotnet/skills, 5.6k stars), Uloop Hot Reload (CyberAgentGameEntertainment/NovaShader, 1.6k stars), Bun Runtime (affaan-m/ECC, 275k stars) and Understanding Hot Reload Limits (rosuH/EasyWatermark, 1.9k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Bun Hot Reloading?

secondsky (a GitHub user) maintains it in secondsky/claude-skills, which has 227 GitHub stars. The repository holds 169 skills in this directory. The repository was last updated on September 28, 2026.

Source: secondsky/claude-skills on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.