मुख्य सामग्री पर जाएँ
Skillpedia
टेस्टिंग29k · #9360

debugging-difficult-bugs

यह क्या करती है

यह स्किल मध्यम या कठिन बग के लिए सावधान डीबगिंग तरीका बताती है। यह एजेंट से कहती है कि कोई सुधार करने से पहले असली समस्या दोबारा पैदा करे और रनटाइम लॉग पढ़े।

कब इस्तेमाल करें

  • ✓जब बग समय, स्टेट, स्ट्रीमिंग या दूसरे रनटाइम व्यवहार से जुड़ा हो, जो टेस्ट शायद न पकड़ें।
  • ✓जब कोई टेस्ट फ़ेल हो रहा हो लेकिन वह असली समस्या का मॉडल न हो।
  • ✓जब आपका मन नए सबूत के बिना एक और अंदाज़े वाला सुधार करने का हो।

Skill का लिंक

https://github.com/mastra-ai/mastra/blob/main/.claude/skills/debugging-difficult-bugs/SKILL.md

इसे कॉपी करके अपने AI (Claude, ChatGPT या Cursor) में पेस्ट करें और निर्देशों का पालन करने को कहें।

कैसे इस्तेमाल करें

सबसे आसान तरीका: मैसेज कॉपी करके अपने AI में पेस्ट करें। वह skill पढ़कर निर्देशों का पालन करेगा।

पेस्ट करने के लिए तैयार मैसेज

इस skill से मेरी मदद करो: https://github.com/mastra-ai/mastra/blob/main/.claude/skills/debugging-difficult-bugs/SKILL.md इस लिंक की SKILL.md फ़ाइल पढ़ो और मेरे काम में उसके निर्देशों का पालन करो।
क्या आप चाहते हैं कि आपका AI ऐसी skills खुद ढूँढे?मुफ़्त Skillpedia MCP इंस्टॉल करें: बस एक लाइन, और हर काम से पहले यह 15,000+ skills में खोजता है।1 मिनट में इंस्टॉल करें →

AI से क्या माँगें: उदाहरण

“यह बग तभी होता है जब दो अनुरोध एक साथ आएँ। कोई कोड बदलने से पहले असली कारण ढूंढने में मेरी मदद कीजिए।”

हर हफ़्ते 5 नई skills, 1 मिनट में पढ़ें।

यह कैसे काम करती है

एजेंट बताता है कि उसे किस बात पर शक है, असली कोड मार्ग में अस्थायी लॉगिंग जोड़ता है, और समस्या दोबारा पैदा करता है। फिर वह लॉग पढ़ता है और सुधार सुझाने से पहले निष्कर्ष बनाता है।

तकनीकी सामग्री (मूल SKILL.md)

लेखक का मूल टेक्स्ट, अंग्रेज़ी में, सीधे GitHub से।

Debugging Difficult Bugs

Use this skill early for medium or hard bugs where normal TDD may give false confidence because the test does not fully capture the real bug.

Core idea: instrument the actual runtime path, reproduce the real issue, then inspect append-only JSONL logs before deciding on a fix.

When to Use

Use this workflow near the start of debugging when any of these are true:

  • The bug is medium or hard complexity, especially if it spans multiple functions, packages, processes, or UI/runtime boundaries.
  • A test is red, but the failing test might be an incomplete model of the real bug.
  • You are tempted to make a second speculative fix without new runtime evidence.
  • The bug depends on runtime ordering, state, caching, streaming, concurrency, persistence, UI interaction, or external services.
  • The user says they can reproduce the issue manually.
  • The test passes after a change, but you are not confident it proves the actual reported bug is fixed.

Do not keep iterating only on tests if you do not understand the runtime behavior.

Skip this workflow only when the root cause is already directly proven by a stack trace or by a deterministic failing test that exercises the real runtime path. If you are tempted to make a second speculative fix, use this workflow.

Required Approach

  1. State the uncertainty

    • Acknowledge that the current test may not capture the actual bug.
    • Identify the real code path that must be observed.
  2. Add temporary unconditional instrumentation

    • Add minimal but sufficient logs through the suspected code flow.
    • Log boundaries, meaningful branch decisions, state transitions, async ordering points, return values, and caught errors; do not log every line.
    • Logs must be unconditional: do not gate them behind an env var, debug flag, or log level.
    • Each log point must append one JSON object per line to a .jsonl file in the current working directory.
    • Include enough context to reconstruct the path: event name, timestamp, relevant ids, input shape, state transitions, branch decisions, return values, and caught errors.
  3. Reproduce the real issue

    • Prefer to run the reproduction yourself if possible.
    • If the issue requires the user's environment or manual interaction, ask the user to reproduce it after instrumentation is added.
    • Tell the user exactly which .jsonl file to send or ask them to tell you when reproduction is complete so you can inspect it.
  4. Analyze the log before fixing

    • Read the JSONL log chronologically.
    • Compare expected flow vs actual flow.
    • Identify the first point where state or behavior diverges.
    • Only then implement the fix.
  5. Clean up instrumentation

    • Remove all temporary unconditional logs after root cause is understood and the fix is verified.
    • Remove debug imports, helper functions, generated .jsonl files, and any other temporary artifacts.
    • Check the final diff for instrumentation remnants.
    • Do not leave debug files, log helpers, or noisy runtime logging in the final diff unless the user explicitly asks.
  6. Keep or improve tests

    • Add or adjust a focused regression test once the real bug is understood.
    • Make the test assert the actual broken behavior discovered from logs, not the earlier incorrect assumption.

JSONL Logging Pattern

Use append-only JSONL in cwd so it works across CLIs, dev servers, tests, and manual reproduction.

Node / TypeScript

import { appendFileSync } from 'node:fs';
import { join } from 'node:path';

function debugBug(event: string, data: Record<string, unknown> = {}) {
  appendFileSync(
    join(process.cwd(), 'debug-difficult-bug.jsonl'),
    `${JSON.stringify({
      ts: new Date().toISOString(),
      event,
      ...data,
    })}\n`,
  );
}

Call it at every meaningful branch or state transition:

debugBug('workflow.start', { runId, stepId, inputKeys: Object.keys(input ?? {}) });

debugBug('workflow.beforeStep', {
  runId,
  stepId,
  status: step.status,
  hasResumeData: Boolean(resumeData),
});

try {
  const result = await executeStep();
  debugBug('workflow.afterStep', { runId, stepId, resultShape: Object.keys(result ?? {}) });
  return result;
} catch (error) {
  debugBug('workflow.stepError', {
    runId,
    stepId,
    errorName: error instanceof Error ? error.name : typeof error,
    errorMessage: error instanceof Error ? error.message : String(error),
  });
  throw err
अक्सर पूछे जाने वाले सवाल

क्या यह टेस्ट लिखना छोड़ देती है?

नहीं। यह कहती है कि अकेले टेस्ट झूठा भरोसा दे सकते हैं, इसलिए पहले रनटाइम सबूत आता है, और टेस्ट बाद में जोड़े जाते हैं।

यह तरीका कब छोड़ा जा सकता है?

केवल तब जब स्टैक ट्रेस या कोई निश्चित रूप से फ़ेल होने वाला टेस्ट पहले ही कारण साबित कर चुका हो।

क्या लॉग में निजी डेटा होना चाहिए?

तरीका सुझाता है कि केवल मेटाडेटा लॉग किया जाए, प्रॉम्प्ट या सामग्री नहीं।

जानकारी

लेखक का मूल विवरण

Use early when debugging a medium or hard bug, especially when tests alone may not reveal the real runtime failure. Trigger this before extended TDD iteration when a bug involves runtime state, ordering, persistence, streaming, concurrency, UI/manual reproduction, external services, or when a red or newly passing test may not model the real issue. Skip only when the root cause is already directly proven by a stack trace or deterministic test that exercises the real runtime path.

repo: mastra-ai/mastra

लोकप्रियता

GitHub स्टार
29k
रैंकिंग में स्थान
#9360
लाइसेंस
—
अपडेट की गई
2/11/2026

क्या यह skill काम की है?

0

लॉग इन करें वोट करने के लिए।

कमेंट

  • …

इस repository की और skills

mastra-frontend

29k

यह आपके एजेंट को Mastra playground डिज़ाइन सिस्टम के तैयार कॉम्पोनेंट जोड़कर ऐप स्क्रीन बनाने में मदद करती है, शुरू से स्टाइल करने की जगह।

कोडिंगवेबसाइट और UI (frontend)

pr-explainer

29k

यह आपके एजेंट को पुल रिक्वेस्ट को एक साफ़, स्व-निहित HTML पेज में बदलने में मदद करती है, जो रिव्यूअर को बदलाव समझाए।

कोडिंगसामान्य कोडिंग

pr-splitter

29k

यह आपके एजेंट को एक बड़ी, उलझी पुल रिक्वेस्ट को छोटी, रिव्यू योग्य पुल रिक्वेस्ट में बांटने में मदद करती है, मूल काम सुरक्षित रखते हुए।

कोडिंगसामान्य कोडिंग

ralph-plan

29k

यह आपके एजेंट को कुछ छोटी बातचीत से एक केंद्रित, व्यवस्थित टास्क कमांड की योजना बनाने में मदद करती है, ताकि काम के साफ़ चरण और जांच हों।

AI और एजेंटप्रॉम्प्ट और LLM

मिलती-जुलती skills