LO

log-focus-debug

Enables isolation of specific log chains using focus tokens and ensures temporary log cleanup.

Install

mkdir -p .claude/skills/log-focus-debug && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/6571" && unzip -o skill.zip -d .claude/skills/log-focus-debug && rm skill.zip

Installs to .claude/skills/log-focus-debug

Activation

This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.

DashPlayer 日志聚焦调试技能。Use when developers ask to reduce noisy logs, focus on one feature log chain, add temporary focus markers (e.g. [FOCUS:token]), or clean up temporary debug logs after task completion. Triggers on: "日志太乱", "只看某个功能日志", "focus token", "withFocus", "临时日志标记", "清理调试日志".
284 chars✓ has a “when” triggerlonger than Claude Code's old 250-char listing cap (fine on current versions)
Beginner

Key capabilities

  • Isolate functional log chains
  • Inject temporary focus markers
  • Filter logs by focus token
  • Clean up debug logs after completion

How it works

The skill uses focus tokens to filter logs at the logger level, allowing developers to isolate specific feature execution chains during debugging.

Inputs & outputs

You give it
Feature module and debug token
You get back
Focused log output and cleanup verification

When to use log-focus-debug

  • Filter noisy logs
  • Debug specific feature flows
  • Clean up temporary debug logs

About this skill

目的

在 DashPlayer 中快速建立“只看当前功能点日志”的调试闭环,并确保临时日志标记在任务结束后被清理。

适用范围

  • Main + Renderer 全链路日志调试
  • 临时功能聚焦(短期)
  • AI 辅助排障与回收

先决条件

  1. 确认项目日志能力已可用:
    • DP_LOG_LEVEL / VITE_DP_LOG_LEVEL
    • DP_LOG_INCLUDE_MODULES / DP_LOG_EXCLUDE_MODULES
    • VITE_DP_LOG_INCLUDE_MODULES / VITE_DP_LOG_EXCLUDE_MODULES
    • DP_LOG_FOCUS_TOKEN / VITE_DP_LOG_FOCUS_TOKEN
  2. 确认 logger API 可用:
    • Main: getMainLogger('Module').withFocus(token)
    • Renderer: getRendererLogger('Module').withFocus(token)

标准操作流程

1) 定义本次调试 token

使用稳定命名:<feature>-<yyyymmdd>,例如:player-speed-20260207

2) 开启聚焦过滤

.env 中设置:

DP_LOG_LEVEL=debug
VITE_DP_LOG_LEVEL=debug
DP_LOG_FOCUS_TOKEN=player-speed-20260207
VITE_DP_LOG_FOCUS_TOKEN=player-speed-20260207

可选叠加模块过滤:

DP_LOG_INCLUDE_MODULES=PlaybackService,PlayerWithControlsPage,SpeedSlider
VITE_DP_LOG_INCLUDE_MODULES=PlayerWithControlsPage,SpeedSlider

3) 注入临时聚焦日志

优先使用 withFocus

const mainLogger = getMainLogger('PlaybackService').withFocus('player-speed-20260207');
mainLogger.debug('sync playback rate', { rate, source });

const rendererLogger = getRendererLogger('SpeedSlider').withFocus('player-speed-20260207');
rendererLogger.debug('speed changed by user', { rate });

兼容写法(仅临时):

logger.debug('[FOCUS:player-speed-20260207] speed changed', { rate });

4) 验证

  • 控制台仅出现目标功能链路
  • 主进程落盘日志仅包含目标 token(在设置了 DP_LOG_FOCUS_TOKEN 时)

清理规约(必须执行)

任务结束时必须移除临时标记,避免调试噪音进入长期代码。

  1. 搜索:
rg "\\[FOCUS:|withFocus\\(" src
  1. 删除本次任务临时加的 withFocus(...)[FOCUS:...]
  2. 保留有长期价值的结构化日志字段(如关键业务上下文),但去掉临时 token。
  3. 运行最小验证:
yarn eslint -c .eslintrc.react-compiler.json <touched-files>
  1. 再次搜索,确保零残留。

输出约定

当使用本技能时,agent 应在回复中明确:

  • 当前 focus token
  • 影响的模块范围(main/renderer)
  • 已注入的临时标记点
  • 清理是否完成(附搜索结果结论)

When not to use it

  • Tasks unrelated to log debugging

Prerequisites

Logger API availabilityConfigured log level and module settings

Limitations

  • Requires removal of temporary markers after task completion

How it compares

It provides a standardized, temporary log-focusing mechanism that ensures cleanup, unlike manual log filtering.

Compared to similar skills

log-focus-debug side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
log-focus-debug (this skill)16moReviewBeginner
langsmith-observability47moReviewIntermediate
error-diagnostics-smart-debug54moNo flagsAdvanced
debugging-toolkit-smart-debug44moNo flagsIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

Search skills

Search the agent skills registry