Debug Mode logo

Debug Mode

Community
doraemonkeys
debug-mode

Interactive debugging mode that generates hypotheses, instruments code with runtime logs, and iteratively fixes bugs via autonomous reproduce-analyze loops, with human help only as a fallback. Only for hard-to-diagnose bugs; in those cases, remind the user that debug-mode is available, and never proactively activate this skill.

Overview

Publisherdoraemonkeys
Repositoryclaude-code-debug-mode
Skill namedebug-mode
Stars
120
Forks
7
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by doraemonkeys on GitHub. Read the source before you install it.

Installation

Install the Debug Mode AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/doraemonkeys/claude-code-debug-mode/tree/master/debug-mode
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/doraemonkeys/claude-code-debug-mode.git /tmp/claude-code-debug-mode
mkdir -p .claude/skills
cp -r /tmp/claude-code-debug-mode/debug-mode .claude/skills/debug-mode
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Debug Mode in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Debug Mode on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Debug Mode is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Debug Mode

You are in Debug Mode — a hypothesis-driven debugging workflow. Do NOT jump to fixes. Follow each phase in order.


Phase 1: Understand the Bug

Ask the user (if not already provided): expected vs actual behavior, reproduction steps, error messages.

Read the relevant source code. Understand the call chain and data flow.

Phase 2: Generate Hypotheses

Generate testable hypotheses as a numbered list:

Based on my analysis, here are my hypotheses:

1. **[Title]** — [What might be wrong and why]
2. **[Title]** — [Explanation]
3. **[Title]** — [Explanation]

Include both obvious and non-obvious causes (race conditions, off-by-one, stale closures, type coercion, etc.).

Manual reproduction fatigues users—especially after 3+ rounds without finding the root cause. Include sufficiently detailed and reasonable debug information upfront to minimize reproduction cycles.

Phase 3: Instrument the Code

Log file & Evidence Collection

Write to {project_root}/.agents/debug.log using an absolute path by default.

project_root = hardcoded constant string inferred from context (file paths in the conversation). PROHIBITED: import.meta.dir, __dirname, process.cwd(), Deno.cwd(), path.resolve() or any runtime detection. Exception: remote/CI environments or non-writable local filesystem — use /tmp/.agents/debug.log instead.

Before each reproduction: create .agents/ if needed. If .agents/debug.log exists and is non-empty, archive it first (rename to debug-1.log, debug-2.log, etc., incrementing sequentially) before resetting debug.log to empty, preserving historical logs.

Server-side: file-append API (fs.appendFileSync, open("a"), etc.). Browser-side: fetch POST to a debug API route. Must work in all environments (dev/release).

Adapt for non-standard environments & intermittent bugs (Evidence over Ritual):

  • Restricted/remote/mobile runtimes: If the code runs on mobile, embedded, or remote environments that cannot write to the project root, adapt the log destination (e.g. device storage, remote endpoint, or memory buffer) and ask the user to provide/paste the logs.
  • Intermittent bugs: If the bug cannot be triggered immediately, keep instrumentation in place and let the user report back with logs whenever the issue occurs.

Region markers

ALL instrumentation MUST be wrapped in region blocks for clean removal:

// #region DEBUG       (JS/TS/Java/C#/Go/Rust/C/C++)
# #region DEBUG        (Python/Ruby/Shell/YAML)
<!-- #region DEBUG --> (HTML/Vue/Svelte)
-- #region DEBUG       (Lua)

...instrumentation...

// #endregion DEBUG    (matching closer)

Logging rules

  • NEVER use console.log、print or any stdout/stderr output. All debug output MUST go to debug.log — server-side via file-append, browser-side via fetch to a debug API endpoint.
  • Log messages include hypothesis number: [DEBUG H1], [DEBUG H2], etc.
  • Log variable states, execution paths, timing, decision points
  • Be minimal — only what's needed to confirm/rule out each hypothesis

After instrumenting, reproduce the bug yourself when the environment allows (run the failing command, tests, or endpoint). Only if you cannot reproduce it, tell the user how to reproduce, then STOP and wait.

Phase 4: Analyze Logs & Diagnose

When the bug has been reproduced (by you or the user):

  1. Check log file size first (e.g. wc -l or ls -lh). If the log is large, use tail or grep "[DEBUG H" to extract only the relevant lines instead of reading the entire file — avoid flooding the context window.
  2. Map logs to hypotheses — determine which are confirmed vs ruled out
  3. Present diagnosis with evidence:
## Diagnosis

**Root cause**: [Explanation backed by log evidence]

Evidence:
- [H1] Ruled out — [why]
- [H2] Confirmed — [log evidence]

If inconclusive: new hypotheses → more instrumentation → archive & reset log → reproduce again yourself; ask the user only when you cannot.

Phase 5: Generate a Fix

Write a fix. Keep debug instrumentation in place.

Archive and reset .agents/debug.log, then reproduce again yourself to verify the fix. If you cannot reproduce it yourself, ask the user to verify, then STOP and wait.

Phase 6: Verify & Clean Up

If fixed: Remove all #region DEBUG blocks and contents (use Grep to find them), delete all .agents/debug*.log files (including archived logs), summarize.

If NOT fixed: Read the new logs; ask the user what they observed only if they were the one who reproduced. Return to Phase 2 and iterate.


Rules

  • Never skip phases. Instrument and verify even if you think you know the answer.
  • Never remove instrumentation until the fix is verified (by you, or by the user when you cannot reproduce it yourself).
  • Never use console.log、print etc. Route all debug output to {project_root}/.agents/debug.log (or adapt the transport if runtime constraints require it).
  • Always archive existing logs and reset debug.log before each reproduction.
  • Always wrap instrumentation in #region DEBUG blocks.

Frequently asked questions

What does the Debug Mode AI skill do?

Interactive debugging mode that generates hypotheses, instruments code with runtime logs, and iteratively fixes bugs via autonomous reproduce-analyze loops, with human help only as a fallback. Only for hard-to-diagnose bugs; in those cases, remind the user that debug-mode is available, and never proactively activate this skill.

Why use Debug Mode on TypingMind?

Because you install it once and use it with any model. Debug Mode is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Debug Mode in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/doraemonkeys/claude-code-debug-mode/tree/master/debug-mode. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Debug Mode?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Debug Mode?

As many as you like. As long as a model supports skills, you can use Debug Mode with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Debug Mode AI skill free?

Yes. It is published on GitHub by doraemonkeys under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇