debug-package

Configures debug() logging with lobe-* namespaces for LobeHub applications.

74|11|Updated Jul 4, 2024
One-click install
npx skills add https://github.com/OpenSourceAGI/qwksearch-research-agent --skill debug-package-opensourceagi
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: debug-package
Source: https://github.com/OpenSourceAGI/qwksearch-research-agent/tree/main/apps/qwk-in-lobe/.agents/skills/debug-package
Command: npx skills add https://github.com/OpenSourceAGI/qwksearch-research-agent --skill debug-package-opensourceagi

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires debug.

What problem does it solve? Developers working in the LobeHub codebase need consistent debug logging conventions, but choosing the right namespace, format specifier, and activation method across browser, Node.js, and Electron environments is error-prone without a reference. ## Core Features & Use Cases - Namespace Conventions: Defines the lobe-[module]:[submodule] naming pattern for desktop, server, client, and router packages. - Format Specifier Reference: Documents %O, %o, %s, and %d specifiers for logging objects, strings, and numbers. - Environment Activation: Shows how to enable debug output via localStorage.debug in browsers, the DEBUG environment variable in Node.js, and process.env.DEBUG in Electron. - Use Case: When adding logging to a new edge router, follow the guide to create a namespaced logger like lobe-edge-router:market and enable it with DEBUG=lobe-* during development. ## Quick Start Add debug logging to my LobeHub server module following the lobe-* namespace conventions and show me how to enable the output.

Frequently Asked Questions about debug-package

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I add debug logging to a TypeScript module with the debug package?

Import debug from 'debug' and create a logger with a namespace, such as debug('lobe-server:market'). Then call the logger with a message and optional format specifiers like %O for objects or %d for numbers.

How to enable debug package output in Node.js and the browser?

In Node.js, set the DEBUG environment variable, for example DEBUG=lobe-* pnpm dev. In the browser, set localStorage.debug = 'lobe-*' and reload the page to see matching log output.

What namespace should I use for debug logging in LobeHub?

Use the pattern lobe-[module]:[submodule]. Desktop code uses lobe-desktop:[module], server code uses lobe-server:[module], client code uses lobe-client:[module], and routers use lobe-[type]-router:[module].

What is the difference between %O and %o format specifiers in debug?

%O expands the object fully and is recommended for complex objects, while %o logs the object in a more compact form. %s formats strings and %d formats numbers.

Why is my debug output not showing in Electron?

Electron does not read the shell DEBUG variable automatically in all contexts. Set process.env.DEBUG = 'lobe-*' in the Electron process before the debug loggers are created.