Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

typescript-debugging

БесплатноБез исполняемых скриптовНе проверен

Modern TypeScript/JavaScript debugging with Bun — inspector flags, debug.bun.sh, VSCode launch.json, memory profiling, heap analysis. Use when setting up…

laurigatesот laurigates★ 61 звезда на GitHub

Об этом скилле

TypeScript Debugging

When to Use This Skill

Scenario Use this skill Alternative
Setting up Bun inspector for debugging Yes N/A
Configuring VSCode launch.json for Bun Yes N/A
Investigating memory leaks with heap snapshots Yes N/A
CPU profiling TypeScript applications Yes N/A
Debugging network requests with verbose fetch Yes N/A
Setting up sourcemaps for debugging Yes bun-development for build-time sourcemap flags
Monitoring errors in production No - use typescript-sentry N/A
Running tests to find failures No - use bun-development bun-test for quick test runs

Core Expertise

Modern debugging for TypeScript/JavaScript with Bun runtime:

  • WebKit Inspector Protocol (debug.bun.sh)
  • VSCode integration with Bun extension
  • Memory profiling with V8 heap snapshots
  • Automatic sourcemap generation for TypeScript
  • Chrome DevTools for heap analysis

Inspector Flags

Basic Debugging

# Start with debugger enabled
bun --inspect script.ts

# Custom port
bun --inspect=4000 script.ts

# Custom host:port
bun --inspect=localhost:4000 script.ts

Break on Start

# Break at first line (for fast scripts)
bun --inspect-brk script.ts

# Wait for debugger before running
bun --inspect-wait script.ts

Debugging Tests

# Debug test file
bun --inspect test

# Break before tests run
bun --inspect-brk test auth.test.ts

Web Debugger (debug.bun.sh)

Bun's built-in web debugger is a modified WebKit Web Inspector:

# Start debugging - outputs debug URL
bun --inspect script.ts
# ------------------- Bun Inspector -------------------
# Listening: ws://localhost:6499/
# Open: debug.bun.sh/#localhost:6499
# -----------------------------------------------------

Features

Feature Description
Source view View original TypeScript/JSX with sourcemaps
Breakpoints Click line numbers to set/remove
Console Execute code in current context
Call stack Inspect execution frames
Scope View local/closure/global variables
Watch Add expressions to monitor

Execution Controls

Control Action
Continue (F8) Run until next breakpoint
Step Over (F10) Execute line, skip into functions
Step Into (F11) Enter function call
Step Out (Shift+F11) Complete function, return to caller

VSCode Integration

Extension Setup

Install Bun for Visual Studio Code.

launch.json Configuration

{
  "version": "0.2.0",
  "configurations": [
    {
      "type": "bun",
      "request": "launch",
      "name": "Debug Script",
      "program": "${workspaceFolder}/src/index.ts",
      "cwd": "${workspaceFolder}",
      "stopOnEntry": false,
      "watchMode": false
    },
    {
      "type": "bun",
      "request": "launch",
      "name": "Debug Tests",
      "program": "${workspaceFolder}/tests/index.test.ts",
      "cwd": "${workspaceFolder}",
      "runtime": "bun",
      "runtimeArgs": ["test"]
    },
    {
      "type": "bun",
      "request": "launch",
      "name": "Debug with Watch",
      "program": "${workspaceFolder}/src/index.ts",
      "watchMode": true
    },
    {
      "type": "bun",
      "request": "attach",
      "name": "Attach to Bun",
      "url": "ws://localhost:6499/"
    }
  ]
}

Configuration Options

Option Type Description
program string Entry file path
cwd string Working directory
args string[] Arguments to script
env object Environment variables
stopOnEntry boolean Break at first line
watchMode boolean Enable --watch/--hot
noDebug boolean Run without debugger
strictEnv boolean Only use specified env

Memory Debugging

Heap Snapshots

Create snapshots for Chrome DevTools analysis:

import { writeHeapSnapshot } from "v8";

// Create snapshot at any point
writeHeapSnapshot("before.heapsnapshot");

// After suspect operation
doSomeWork();

writeHeapSnapshot("after.heapsnapshot");

Load .heapsnapshot files in Chrome DevTools Memory tab for comparison.

Heap Statistics (bun:jsc)

import { heapStats } from "bun:jsc";

const stats = heapStats();
console.log({
  heapSize: stats.heapSize,
  objectCount: stats.objectCount,
  objectTypeCounts: stats.objectTypeCounts
});
// objectTypeCounts: { Array: 1234, Object: 5678, Function: 890, ... }

Process Memory

// Resident Set Size (actual RAM used)
console.log(process.memoryUsage.rss());

// Full memory breakdown
console.log(process.memoryUsage());
// { rss, heapTotal, heapUsed, external, arrayBuffers }

Non-JS Memory (mimalloc)

# Show native memory stats
MIMALLOC_SHOW_STATS=1 bun script.ts

Performance P

Полный SKILL.md на GitHub

Установить typescript-debugging в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Bash(bun --inspect test *)
Bash(bun --inspect-brk test *)
Bash(bun build *)
Bash(lsof *)
Read
Write
Edit
Grep
Glob
TodoWrite

FAQ

Что делает скилл typescript-debugging?

Modern TypeScript/JavaScript debugging with Bun — inspector flags, debug.bun.sh, VSCode launch.json, memory profiling, heap analysis. Use when setting up interactive debugging, investigating leaks, CPU profiling with `--cpu-prof`, or sourcemaps.

Как установить скилл typescript-debugging?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл typescript-debugging запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить typescript-debugging с