{
 "kind": "tool",
 "slug": "debug",
 "path": "tools/debug/",
 "name": "debug",
 "maker": null,
 "density": "full",
 "crumbs": [
  [
   "Tools",
   "tools/"
  ],
  [
   "Logging, monitoring and analytics",
   "tools/observability-analytics/"
  ]
 ],
 "lead": "Detailed logs you switch on by name.",
 "chips": [
  {
   "label": "Logging, monitoring and analytics",
   "path": "tools/observability-analytics/"
  },
  {
   "label": "NPM"
  }
 ],
 "primary": {
  "label": "Copy install command",
  "copy": "npm install debug"
 },
 "links": [
  {
   "label": "GitHub",
   "href": "https://github.com/debug-js/debug"
  },
  {
   "label": "Website",
   "href": "https://github.com/debug-js/debug#readme"
  }
 ],
 "track": "New versions, deprecation and license changes on your dashboard",
 "verdicts": [
  {
   "key": "license",
   "label": "License",
   "value": "MIT",
   "status": "yes",
   "sub": "Use it in paid apps",
   "quote": "including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software",
   "note": "MIT allows use in paid and closed-source products.",
   "src": "https://github.com/debug-js/debug/blob/master/LICENSE"
  },
  {
   "key": "maint",
   "label": "Maintained",
   "value": "Maintained",
   "status": "yes",
   "sub": "Last change Oct 14, 2026",
   "note": "Latest GitHub release Sep 13, 2025. ",
   "src": "https://github.com/debug-js/debug"
  },
  {
   "key": "pop",
   "label": "Used by agents' projects",
   "value": "18 projects",
   "status": "info",
   "sub": "#29 of 121 in its category",
   "note": "Dependency in 18 public GitHub projects set up for AI coding agents that we scanned (0.3%).",
   "src": null
  },
  {
   "key": "agent",
   "label": "Agent access",
   "value": "Community skills",
   "status": "info",
   "sub": "6 skills by others",
   "note": "Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.",
   "src": null
  }
 ],
 "vfoot": "From the package registry and GitHub, checked daily; card checked Nov 10, 2026.",
 "blocks": [
  {
   "id": "overview",
   "nav": "Overview",
   "h2": "What debug does",
   "parts": [
    {
     "t": "prose",
     "text": "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."
    },
    {
     "t": "h3",
     "text": "What people build with it"
    },
    {
     "t": "uses",
     "items": [
      {
       "title": "Watch one part of your app",
       "text": "Payments misbehave; you switch on only the payment and cart messages and leave the noisy database messages off.",
       "idea": false
      },
      {
       "title": "Quiet by default, detail on demand",
       "text": "Leave the messages in your code for good; they print nothing until someone starts the app with DEBUG set.",
       "idea": false
      },
      {
       "title": "Find the slow step",
       "text": "Put a message before and after a slow request; the +340ms at the end of the line shows where the time went.",
       "idea": false
      },
      {
       "title": "Debug a page in the browser",
       "text": "Turn on the messages of one part of your web app in the browser, then reload the page to see them in the console.",
       "idea": false
      },
      {
       "title": "Group messages under sub-names",
       "text": "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.",
       "idea": false
      },
      {
       "title": "Let your assistant rerun with details",
       "text": "When a command fails, your AI assistant reruns it with DEBUG set for one area and reads the extra lines, without editing code.",
       "idea": true
      }
     ]
    }
   ]
  },
  {
   "id": "popularity",
   "nav": "Popularity",
   "h2": "debug popularity",
   "parts": [
    {
     "t": "stats",
     "items": [
      {
       "n": "70",
       "of": "/ 100",
       "l": "Gid Score, #375 overall"
      },
      {
       "n": "977M",
       "l": "downloads a week, npm"
      },
      {
       "n": "11.5K",
       "l": "GitHub stars"
      },
      {
       "n": "18",
       "l": "agent projects use it"
      }
     ]
    },
    {
     "t": "small",
     "text": "Gid Score measures public popularity and activity, not quality.",
     "link": "How the Gid Score is calculated",
     "path": "tools/top/"
    }
   ]
  },
  {
   "id": "usage",
   "nav": "How it is used",
   "h2": "How debug is used",
   "parts": [
    {
     "t": "list",
     "items": [
      "debug is a dependency in 18 of the 6,258 public GitHub projects set up for AI coding agents that we scanned, too few to describe it from them alone. Our scan also samples projects by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750); counting those, it appears in 87 projects, and what it is used with below comes from all of them.",
      "The most used alternative in our scan is Pino (87 projects).",
      "Projects that use it most often also use dotenv (54.0%), ws (33.3%), Express (33.3%)."
     ]
    },
    {
     "t": "h3",
     "text": "By coding agent"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "12 projects, 0.4%",
       "v": "GitHub Copilot",
       "path": "agents/github-copilot/"
      },
      {
       "l": "11 projects, 0.3%",
       "v": "Claude Code",
       "path": "agents/claude-code/"
      },
      {
       "l": "8 projects, 0.3%",
       "v": "Cursor",
       "path": "agents/cursor/"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Often used with"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "In 54.0% of its projects",
       "v": "dotenv",
       "path": "tools/dotenv/"
      },
      {
       "l": "In 33.3% of its projects",
       "v": "ws",
       "path": "tools/ws/"
      },
      {
       "l": "In 33.3% of its projects",
       "v": "Express",
       "path": "tools/express/"
      },
      {
       "l": "In 32.2% of its projects",
       "v": "OpenAI",
       "path": "tools/openai-npm/"
      },
      {
       "l": "In 29.9% of its projects",
       "v": "uuid",
       "path": "tools/uuid/"
      },
      {
       "l": "In 28.7% of its projects",
       "v": "node-fetch",
       "path": "tools/node-fetch/"
      },
      {
       "l": "In 26.4% of its projects",
       "v": "Lodash",
       "path": "tools/lodash/"
      },
      {
       "l": "In 74.7% of its projects",
       "v": "TypeScript",
       "path": "tools/typescript/"
      }
     ]
    }
   ]
  },
  {
   "id": "more",
   "nav": null,
   "spy_as": "usage",
   "h2": "More about debug",
   "parts": [
    {
     "t": "more",
     "items": [
      {
       "title": "Agent Skills for it",
       "path": "skills/",
       "items": [
        "debug: Diagnose the current OMC session or repo state using logs, traces, state, and focused reproduction",
        "debug-voice: Use when the user runs /debug-voice, says voice mode has flaws, asks to see or capture what happened in a Grok realtime voice session, or a",
        "debug-resend-delivery: Find out why an email sent with Resend did not arrive — find the email, read its status, then check the API log, the suppression list, the s",
        "debug-tool: Diagnose runtime and application failures.",
        "debug-hooks: Systematic hook debugging workflow. Use when hooks aren't firing, producing wrong output, or behaving unexpectedly.",
        "debug-mantra: Four-mantra debugging discipline — reproduce, trace the fail path, falsify the hypothesis, cross-reference every breadcrumb. Recite the mant"
       ]
      },
      {
       "title": "More in Logging, monitoring and analytics",
       "path": "tools/observability-analytics/",
       "items": [
        {
         "text": "Vercel Analytics",
         "path": "tools/vercel-analytics/"
        },
        {
         "text": "psutil",
         "path": "tools/psutil/"
        },
        {
         "text": "Vercel Speed Insights",
         "path": "tools/vercel-speed-insights/"
        },
        {
         "text": "Sentry for Next.js",
         "path": "tools/sentry-nextjs/"
        },
        {
         "text": "OpenTelemetry",
         "path": "tools/opentelemetry/"
        },
        {
         "text": "structlog",
         "path": "tools/structlog/"
        },
        {
         "text": "PostHog JS",
         "path": "tools/posthog-js/"
        },
        {
         "text": "Loguru",
         "path": "tools/loguru/"
        }
       ]
      }
     ]
    }
   ]
  },
  {
   "id": "alternatives",
   "nav": "Alternatives",
   "h2": "Alternatives",
   "parts": [
    {
     "t": "alts",
     "items": [
      {
       "name": "debug",
       "me": true,
       "facts": [
        "MIT",
        "Gid 70",
        "977M/wk"
       ]
      },
      {
       "name": "Pino",
       "why": "Pick pino when you need permanent, structured app logs with levels that a log service can read, not on-demand debug lines.",
       "path": "tools/pino/",
       "facts": [
        "MIT",
        "Gid 78",
        "81.5M/wk"
       ]
      },
      {
       "name": "Winston",
       "why": "Pick winston when logs must go to several places at once, such as the console and files, with log levels.",
       "path": "tools/winston/",
       "facts": [
        "MIT",
        "Gid 76",
        "37.3M/wk"
       ]
      },
      {
       "name": "Loguru",
       "why": "Pick Loguru when your program is written in Python.",
       "path": "tools/loguru/",
       "facts": []
      },
      {
       "name": "Sentry Node SDK",
       "why": "Error tracking and performance monitoring for Node.js with OpenTelemetry instrumentation.",
       "path": "tools/sentry-node/",
       "facts": [
        "MIT",
        "Gid 70",
        "59.9M/wk"
       ]
      },
      {
       "name": "Sentry React",
       "why": "Official Sentry SDK for React error tracking and performance monitoring.",
       "path": "tools/sentry-react/",
       "facts": [
        "MIT",
        "Gid 69",
        "43.3M/wk"
       ]
      }
     ],
     "more": "Compare debug with another tool",
     "more_path": "tools/compare/"
    }
   ]
  },
  {
   "id": "start",
   "nav": "Get started",
   "h2": "Get started",
   "parts": [
    {
     "t": "prompt",
     "text": "Add debug 4.4.3 (pin it exactly, never 4.4.2) and give each module a named logger like require('debug')('app:payments'); keep the calls in the code, and tell me to run with DEBUG=app:* to see them."
    },
    {
     "t": "steps",
     "items": [
      {
       "text": "Install debug in your project.",
       "code": "npm install debug",
       "src": "https://github.com/debug-js/debug/blob/master/README.md"
      },
      {
       "text": "Create a named logger and write messages with it.",
       "code": "var debug = require('debug')('http')\n  , http = require('http')\n  , name = 'My App';\n\n// fake app\n\ndebug('booting %o', name);\n",
       "src": "https://github.com/debug-js/debug/blob/master/README.md"
      },
      {
       "text": "Switch the names on when you start the program. A star matches many names, and a minus sign leaves one out.",
       "code": "DEBUG=connect:* node app.js",
       "src": "https://github.com/debug-js/debug/blob/master/README.md"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Mistakes to avoid"
    },
    {
     "t": "mistakes",
     "items": [
      {
       "dont": "debug@4.4.2, or a loose range that once resolved to it in an old lockfile",
       "fix": "Pin debug@4.4.3 exactly and check the lockfile for 4.4.2",
       "why": "4.4.2 was pushed to the registry by an attacker; 4.4.3 is the clean replacement."
      },
      {
       "dont": "Calling debug.enable('app:db') in code and expecting DEBUG=app:* from the shell to still apply",
       "fix": "Pass the full list to enable(), or read process.env.DEBUG and add to it",
       "why": "enable() replaces the earlier setting completely."
      },
      {
       "dont": "A test that captures stdout and expects debug lines there",
       "fix": "Read stderr, or set log.log = console.log.bind(console) for that name",
       "why": "debug writes to stderr by default."
      },
      {
       "dont": "Setting localStorage.debug and looking at the default Chrome console level",
       "fix": "Turn on the Verbose level in the console, then reload the page",
       "why": "Chromium consoles hide debug's messages unless Verbose is on."
      },
      {
       "dont": "Expecting colors from a worker or child process whose stderr is piped",
       "fix": "Pass DEBUG_COLORS=1 in the child process's environment",
       "why": "debug turns colors off when stderr is not a terminal."
      }
     ]
    }
   ]
  },
  {
   "id": "faq",
   "nav": "Questions",
   "h2": "Questions",
   "parts": [
    {
     "t": "faq",
     "items": [
      {
       "q": "Why do I see nothing in Chrome's console?",
       "a": "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.",
       "evidence": {
        "url": "https://github.com/debug-js/debug/blob/master/README.md",
        "quote": "In Chromium-based web browsers (e.g. Brave, Chrome, and Electron), the JavaScript console will—by default—only show messages logged by debug if the \"Verbose\" log level is _enabled_."
       }
      },
      {
       "q": "How do I switch it on in Windows?",
       "a": "In cmd use set DEBUG=*,-not_this; in PowerShell use $env:DEBUG = \"*,-not_this\", then start the program as usual.",
       "evidence": {
        "url": "https://github.com/debug-js/debug/blob/master/README.md",
        "quote": "On Windows the environment variable is set using the set command."
       }
      },
      {
       "q": "Can I switch names on from code?",
       "a": "Yes, with enable(). It replaces whatever DEBUG was set to, and disable() switches everything off.",
       "evidence": {
        "url": "https://github.com/debug-js/debug/blob/master/README.md",
        "quote": "Note that calling enable() completely overrides previously set DEBUG variable"
       }
      },
      {
       "q": "Why are the colors missing in a child process?",
       "a": "Colors are dropped when the error output is piped. Pass DEBUG_COLORS=1 to the child process.",
       "evidence": {
        "url": "https://github.com/debug-js/debug/blob/master/README.md",
        "quote": "A solution is to pass the DEBUG_COLORS=1 environment variable to the child process."
       }
      }
     ]
    }
   ]
  }
 ],
 "glance": [
  [
   "Package",
   "npm debug"
  ],
  [
   "Category",
   "Logging, monitoring and analytics"
  ],
  [
   "License",
   "MIT"
  ],
  [
   "Gid Score",
   "70.3"
  ],
  [
   "Rank in category",
   "#29 of 121"
  ],
  [
   "GitHub",
   "debug-js/debug"
  ],
  [
   "Last change",
   "Oct 14, 2026"
  ]
 ],
 "good": [
  "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."
 ],
 "checked_line": "Read by AgentGid from 6 official pages, card checked Nov 10, 2026; numbers update daily.",
 "logo": "https://agentgid.com/media/avatars/debug-js.png"
}