Debug Mantra logo

Debug Mantra

CommunityPopular
thananon
debug-mantra

Four-mantra debugging discipline — reproduce, trace the fail path, falsify the hypothesis, cross-reference every breadcrumb. Recite the mantra block verbatim at the start of any debugging session, then apply the four steps in order before proposing any fix. Trigger on /debug-mantra and proactively whenever debugging starts — user reports a bug, says something is broken/throwing/failing, asks to debug/diagnose/investigate an issue, or pastes a stack trace or error log.

Overview

Publisherthananon
Repository9arm-skills
Skill namedebug-mantra
Stars
3.2K
Forks
424
Bundled files
Instructions only
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 thananon on GitHub. Read the source before you install it.

Installation

Install the Debug Mantra 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.
  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/thananon/9arm-skills.git /tmp/9arm-skills
mkdir -p .claude/skills
cp -r /tmp/9arm-skills/skills/engineering/debug-mantra .claude/skills/debug-mantra
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Debug Mantra 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 Mantra 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 Mantra 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 Mantra

Four-step discipline for any debug session. Recite verbatim, then apply in order.

Recite this — verbatim, as the first thing in your first response

Mantra:

  1. First is reproducibility. Can the issue be reproduced reliably?
  2. Know the fail path. Debugger first; then source trace + knob enumeration; then in-code instrumentation.
  3. Question your hypothesis. What would disprove it?
  4. Every run is a breadcrumb. Cross-reference all of them.

Then begin work.


1. Reproduce reliably

Build a runnable repro before anything else.

  • Reliable repro → capture the exact steps, inputs, and environment as a runnable artifact: failing test, curl script, CLI invocation, replay harness.
  • Flaky repro → the bug is not yet debuggable. Raise the rate first: loop the trigger, parallelise, add stress, narrow timing windows, inject sleeps. 50% flake is debuggable; 1% is not.
  • No repro at all → stop. Say so explicitly. Ask the user for env access, captured artifacts (HAR, log dump, core), or permission to instrument. Do not proceed to hypothesise.

Target: a fast (1–5 s), deterministic pass/fail signal. Pin time, seed the RNG, freeze network, isolate filesystem.

2. Know the fail path

Once reproducible, find where the code breaks and what stops it from breaking. The differential narrows the search. Try in this order — escalate only when the prior tactic fails.

  1. Attach a debugger. If the env supports it, attach and step to the failure site. One breakpoint beats ten logs. Do this before turning any knobs.
  2. Source trace + knob enumeration. If no debugger (or it can't reach the bug), trace the code path end-to-end and list every knob that can influence the outcome:
    • config flags, env vars, feature toggles
    • branch conditions, input shape
    • timing, concurrency, build options Each knob is a candidate axis to flip in the differential. Flip one at a time.
  3. In-code instrumentation. If outside knobs can't move the failure, go inside: printf / log statements at the suspected fail site, dump the relevant internal state. Tag every probe with a unique prefix (e.g. [DBG-a4f2]) so cleanup is a single grep. Let the trace show where reality diverges from your model.

3. Falsify the hypothesis

When a candidate root cause surfaces, scrutinise it before testing it.

  • Does it actually explain the symptom end-to-end? Walk it through.
  • What is the simplest proof? What is the cleanest disproof?
  • Run the disproof first. If the hypothesis survives, it's real. If it dies, you saved yourself from chasing a phantom.
  • Generate 3–5 ranked hypotheses, not one. Single-hypothesis thinking anchors on the first plausible idea.

4. Every run is a breadcrumb

Maintain a running ledger of every experiment in this session. Each entry: what changed, what happened, what it ruled in or out.

  • When a new hypothesis surfaces, walk the ledger. Does it hold for every prior observation, not just the most recent?
  • If any past run contradicts it, the hypothesis is wrong or incomplete — refine or discard.
  • When in doubt, design the single experiment whose outcome makes it certain. Run that next, instead of churning on adjacent runs.
  • Update the ledger after every run. It is your memory across the session.

Operating rules

  • Recite the mantra block once per debug session, in your first response. Do not re-recite mid-session.
  • Recite verbatim. Never paraphrase, shorten, or skip lines of the recital.
  • If the user says "skip the mantra" → skip the recital but still apply the four steps silently.
  • Apply the four steps in order:
    • Do not propose a fix before #1 is satisfied (reliable repro exists).
    • Do not start testing hypotheses before #2 has narrowed the fail path.
    • Do not commit to a hypothesis before #3 has tried to disprove it.
    • Do not declare a hypothesis correct until #4 confirms it against every prior breadcrumb.
  • If you catch yourself proposing a fix without a reliable repro, stop and return to step 1.
  • The mantra is a constraint you carry through the session — not advice to deliver back to the user.

Frequently asked questions

What does the Debug Mantra AI skill do?

Four-mantra debugging discipline — reproduce, trace the fail path, falsify the hypothesis, cross-reference every breadcrumb. Recite the mantra block verbatim at the start of any debugging session, then apply the four steps in order before proposing any fix. Trigger on /debug-mantra and proactively whenever debugging starts — user reports a bug, says something is broken/throwing/failing, asks to debug/diagnose/investigate an issue, or pastes a stack trace or error log.

Why use Debug Mantra on TypingMind?

Because you install it once and use it with any model. Debug Mantra 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 Mantra in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/thananon/9arm-skills/tree/main/skills/engineering/debug-mantra. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Debug Mantra?

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 Mantra?

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

Is the Debug Mantra AI skill free?

It is published on GitHub by thananon. Check the repository for licensing terms. 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 👇