# debug — card for AI agents

Lightweight debugging utility for Node.js and browser with namespace-based filtering.

Category: Logging, monitoring and analytics · npm package `debug` · latest version 4.4.3 (checked 2026-11-01)
Install: `npm install debug`
License: MIT (permissive)

In your own product (generator, app, hosted service): **yes**. Permissive license: ship it inside your own product, closed or open source, and keep its license and copyright notice.

## Agent Skills for it
- debug from Yeachan-Heo/oh-my-claudecode: `npx skills add Yeachan-Heo/oh-my-claudecode --skill debug`
- debug-voice from cursor/plugins: `npx skills add cursor/plugins --skill debug-voice`
- debug-resend-delivery from ParadevAI/Paradev: `npx skills add ParadevAI/Paradev --skill debug-resend-delivery`
- debug-tool from FlorianBruniaux/claude-code-ultimate-guide: `npx skills add FlorianBruniaux/claude-code-ultimate-guide --skill debug-tool`
- debug-hooks from parcadei/Continuous-Claude-v3: `npx skills add parcadei/Continuous-Claude-v3 --skill debug-hooks`
- debug-mantra from thananon/9arm-skills: `npx skills add thananon/9arm-skills --skill debug-mantra`

## Numbers (AgentGid data)
- Gid Score: 70.3 (#375 of all tools, 11 of 121 in its category)
- Used in 18 public projects set up for AI coding agents (0.3%)
- Downloads last week: 977,218,258 (as of 2026-11-24), +34.5% over 4 weeks
- GitHub stars: 11,462 (as of 2026-11-24)
- Last push: 2026-10-14

## Often used with
dotenv 54.0%, ws 33.3%, Express 33.3%, OpenAI 32.2%, uuid 29.9%, node-fetch 28.7%

## Checked alternatives (same job)
- Pino: https://agentgid.com/tools/pino/agent.md
- Winston: https://agentgid.com/tools/winston/agent.md
- Sentry Node SDK: https://agentgid.com/tools/sentry-node/agent.md
- Sentry React: https://agentgid.com/tools/sentry-react/agent.md

## Links
- AgentGid page: https://agentgid.com/tools/debug/
- Homepage: https://github.com/debug-js/debug#readme
- Repository: https://github.com/debug-js/debug


## debug: detailed logs you switch on by name

debug is a free JavaScript package for messages that stay silent until you ask for them. Each part of your app gets a name, and you switch on only the parts you want to watch, in Node.js or in the browser. Each line also shows how much time passed since the previous one.

### Where to use it
- Watch one part of your app: Payments misbehave; you switch on only the payment and cart messages and leave the noisy database messages off.
- Quiet by default, detail on demand: Leave the messages in your code for good; they print nothing until someone starts the app with DEBUG set.
- Find the slow step: Put a message before and after a slow request; the +340ms at the end of the line shows where the time went.
- Debug a page in the browser: Turn on the messages of one part of your web app in the browser, then reload the page to see them in the console.
- Group messages under sub-names: One area of your app, such as sign-in, gets sub-names for each step, so you can watch all of them or just one.
- Let your assistant rerun with details: When a command fails, your AI assistant reruns it with DEBUG set for one area and reads the extra lines, without editing code. (idea, not from the official pages)

### How to start
- Install debug in your project.

```
npm install debug
```

- Create a named logger and write messages with it.

```
var debug = require('debug')('http')
  , http = require('http')
  , name = 'My App';

// fake app

debug('booting %o', name);
```

- Switch the names on when you start the program. A star matches many names, and a minus sign leaves one out.

```
DEBUG=connect:* node app.js
```


### License
Free for any use, also in paid and closed-source products, under the MIT license. No visible credit is needed; keep the license notice if you ship debug's own files.

### Good to know
- Version 4.4.2 on the package registry was a hijacked, harmful release. Use 4.4.3, the same code as 4.4.1, and pin it.
- The latest release, 4.4.3 from September 2025, was made to replace the bad 4.4.2; check the release page before upgrading.
- Messages go to the error output stream, not the normal one, unless you change that per name.
- In Node.js it uses only a few basic colors unless you also install the supports-color package.

Checked 2026-11-10 against: https://github.com/debug-js/debug/blob/master/README.md, https://github.com/debug-js/debug/blob/master/LICENSE, https://github.com/debug-js/debug/blob/master/package.json, https://github.com/debug-js/debug/releases/tag/4.4.3, https://github.com/debug-js/debug/issues/1005, https://registry.npmjs.org/debug

### Mistakes to avoid
- Don't: debug@4.4.2, or a loose range that once resolved to it in an old lockfile → Do: Pin debug@4.4.3 exactly and check the lockfile for 4.4.2 (4.4.2 was pushed to the registry by an attacker; 4.4.3 is the clean replacement.)
- Don't: Calling debug.enable('app:db') in code and expecting DEBUG=app:* from the shell to still apply → Do: Pass the full list to enable(), or read process.env.DEBUG and add to it (enable() replaces the earlier setting completely.)
- Don't: A test that captures stdout and expects debug lines there → Do: Read stderr, or set log.log = console.log.bind(console) for that name (debug writes to stderr by default.)
- Don't: Setting localStorage.debug and looking at the default Chrome console level → Do: Turn on the Verbose level in the console, then reload the page (Chromium consoles hide debug's messages unless Verbose is on.)
- Don't: Expecting colors from a worker or child process whose stderr is piped → Do: Pass DEBUG_COLORS=1 in the child process's environment (debug turns colors off when stderr is not a terminal.)

### Questions
- Why do I see nothing in Chrome's console? Chromium browsers show debug's messages only when the console's Verbose level is turned on, and the names must be enabled in localStorage.debug.
- How do I switch it on in Windows? In cmd use set DEBUG=*,-not_this; in PowerShell use $env:DEBUG = "*,-not_this", then start the program as usual.
- Can I switch names on from code? Yes, with enable(). It replaces whatever DEBUG was set to, and disable() switches everything off.
- Why are the colors missing in a child process? Colors are dropped when the error output is piped. Pass DEBUG_COLORS=1 to the child process.

---
AgentGid's catalog is curated: every entry was checked against the maker's official pages (registry, repository, license and pricing pages) on the date shown; a license value shows the quote it stands on wherever AgentGid has one. Usage numbers come from AgentGid's own scan of public repositories set up for AI coding agents. Claims by makers are reported, not tested by AgentGid.
