Command Palette

Search for a command to run...

Назад к скиллам
скилл № 28558

debug-flight-recorder

Add contextual logging to the exact call sites a bug passes through, run the repro, collect the logs, then REMOVE the logs. Saves dev 20 min of manually…

БесплатноБез исполняемых скриптов
nghiahsgsот nghiahsgs★ 31 звезда на GitHub

Установить debug-flight-recorder в Claude Code и Claude Desktop

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

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

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

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

debug-flight-recorder — Instrument, Repro, Collect, Revert

Step 0 — Preflight

# clean working tree required — we'll add logs then remove them
git status --porcelain

If dirty → "Anh đang có thay đổi chưa commit. Stash hoặc commit trước rồi mới debug nha (để em revert log sau mà không đụng code anh đang viết)."

Capture snapshot SHA:

git rev-parse HEAD > .taw/debug-sha.txt

Step 1 — Understand the bug

Ask the user:

Mô tả bug (ngắn thôi):
  1. Steps to reproduce (cách tái hiện)?
  2. What should happen (đáng lẽ gì xảy ra)?
  3. What actually happens (thực tế gì xảy ra)?
  4. Có error message không? (paste vào cũng được)

Store in .taw/debug-session.json:

{
  "bug": "<short>",
  "repro_steps": "<list>",
  "expected": "...",
  "actual": "...",
  "error": "<if any>",
  "started_at": "<ISO>",
  "state": "planning"
}

Step 2 — Identify instrument points

From the user's description, grep for relevant files:

# by keyword from bug description
git grep -n --files-with-matches 'checkout' app/ lib/ components/ 2>/dev/null
# by error message (if any)
git grep -n --files-with-matches '<error snippet>' 2>/dev/null

Pick 3-8 strategic points (never more — cognitive load):

  • Entry: route handler or form submit
  • Key branching: if that decides success vs error
  • External calls: fetch(, await supabase, stripe.
  • State mutations: setState(, dispatch(
  • Right before/after the line that crashes

Present candidates to user:

Em sẽ thêm log ở 5 chỗ nghi ngờ:
  1. app/checkout/page.tsx:34     — form submit handler
  2. app/api/checkout/route.ts:12 — entry route handler
  3. lib/cart.ts:56               — calcTotal
  4. lib/stripe.ts:23             — session create
  5. lib/supabase.ts:89           — save order

Gõ:
  y        → thêm log và chạy repro
  skip 3   → bỏ chỗ số 3
  add <path>:<line> → thêm chỗ khác
  cancel   → huỷ

Step 3 — Instrument (marker-based)

Every log uses this exact marker so cleanup is safe:

// [TAW-DEBUG-FR] marker — removed automatically by debug-flight-recorder

For each point, insert ONE log line with rich context. Pattern by site type:

Function entry

export function calcTotal(items: Item[]) {
  console.log('[TAW-DEBUG-FR] lib/cart.ts:calcTotal entry', { items_count: items.length, items_sample: items.slice(0,2) }); // [TAW-DEBUG-FR] marker
  // ... existing body
}

Before external call

console.log('[TAW-DEBUG-FR] app/api/checkout/route.ts:pre-supabase', { user_id: user?.id, cart: body }); // [TAW-DEBUG-FR] marker
const { data, error } = await supabase.from('orders').insert(body);
console.log('[TAW-DEBUG-FR] app/api/checkout/route.ts:post-supabase', { data, error }); // [TAW-DEBUG-FR] marker

Inside conditional

if (session.status === 'complete') {
  console.log('[TAW-DEBUG-FR] route:branch=complete', { session_id: session.id }); // [TAW-DEBUG-FR] marker
  // ...
} else {
  console.log('[TAW-DEBUG-FR] route:branch=incomplete', { status: session.status, reason: session.last_error }); // [TAW-DEBUG-FR] marker
  // ...
}

Before throw / return

console.log('[TAW-DEBUG-FR] pre-throw', { err, ctx }); // [TAW-DEBUG-FR] marker
throw err;

Scrub sensitive values

Never log: passwords, full tokens, credit card, session secrets. Truncate: token?.slice(0,8) + '...'.

Track touched files in .taw/debug-files.txt:

app/checkout/page.tsx
app/api/checkout/route.ts
lib/cart.ts
lib/stripe.ts

Update session state:

{"state": "instrumented", "points": 5}

Step 4 — Run repro

# detect dev server
pgrep -f 'next dev' >/dev/null && echo "dev server running" || echo "start dev server: npm run dev"

Emit (VN):

Đã thêm log vào 5 chỗ. Giờ:
  1. Mở terminal khác, chạy `npm run dev` nếu chưa
  2. Tái hiện bug (theo steps anh mô tả)
  3. Copy output console trong terminal dev server + browser console (nếu có)
  4. Paste vào đây, hoặc gõ `dev-log` để em tail dev.log

Xong gõ: `done`

Option: if user has npm run dev piped to dev.log:

tail -f dev.log | command grep '\[TAW-DEBUG-FR\]' &

Step 5 — Analyze logs

User pastes log output (or points to file). Parse:

  1. Group by site ID ([TAW-DEBUG-FR] <file>:<marker>)
  2. Build timeline: which sites fired, in what order
  3. Compare to expected flow (from Step 1 user description)

Render (VN):

Phân tích logs:

Timeline:
  1. ✓ app/checkout/page.tsx:submit      (13:42:01)
  2. ✓ app/api/checkout/route.ts:entry   (13:42:01)
  3. ✓ lib/cart.ts:calcTotal entry        (13:42:01) — items_count: 3
  4. ✓ route:pre-supabase                 (13:42:02)
  5. ✗ route:post-supabase                 — không thấy log này
  6. ✗ route:branch=complete              — không vào nhánh success

Kết luận nghi vấn:
  Supabase insert không return → có thể hang, timeout, hoặc throw.
  Kiểm tra:
    - RLS policy có cho user insert không?
    - Supabase URL + anon key đúng không?
    - Netw
Полный SKILL.md на GitHub

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

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

  1. 01Read
  2. 02Write
  3. 03Edit
  4. 04Bash
  5. 05Grep

FAQ

Что делает скилл debug-flight-recorder?

Add contextual logging to the exact call sites a bug passes through, run the repro, collect the logs, then REMOVE the logs. Saves dev 20 min of manually adding/removing console.log statements. Uses a marker comment so cleanup is safe and fully reversible even if something fails mid-run. Trigger phrases (EN + VN): "debug with logs", "add console logs", "flight recorder", "bug khong tai hien", "khong biet loi o dau", "add log de debug", "trace bug", "dung console log debug".

Как установить скилл debug-flight-recorder?

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

Скилл debug-flight-recorder запускает скрипты?

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

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

Сравнить debug-flight-recorder с