error-detective

aiskillstore/marketplace

Систематическая отладка и поиск причин ошибок по фреймворку TRACE.

Звёзды486
Форки53
Авторaiskillstore
Обновлённоя 17 2026

Установка

SKILL.md

Error Detective - Systematic Debugging and Error Resolution

Overview

Error Detective is a comprehensive debugging skill that applies systematic methodologies to identify, analyze, and resolve errors efficiently. Using the TRACE framework and structured analysis techniques, this skill guides you through debugging from initial error discovery to verified resolution.

Core Capabilities

Stack Trace Analysis

  • Parse and interpret stack traces across multiple languages
  • Identify root cause vs. symptom errors
  • Extract relevant file paths and line numbers
  • Understand call chains and error propagation

Error Pattern Recognition

  • Categorize errors by type (syntax, runtime, logic, integration)
  • Identify common error patterns and anti-patterns
  • Recognize framework-specific errors
  • Map errors to likely root causes

Root Cause Analysis

  • Distinguish between symptoms and underlying issues
  • Follow error chains to original source
  • Identify environmental vs. code issues
  • Detect configuration and dependency problems

Debugging Workflow Management

  • Structured investigation process
  • Hypothesis generation and testing
  • Iterative refinement of understanding
  • Documentation of findings and solutions

The TRACE Framework

TRACE is a systematic five-step approach to debugging any error:

T - Trace the Error

Objective: Capture complete error information and context

  1. Collect the full error message

    • Complete stack trace (not just first few lines)
    • Error type and message
    • Timestamp and occurrence frequency
    • Environment where error occurred
  2. Identify error location

    • Exact file and line number
    • Function or method where error occurred
    • Code context (surrounding lines)
    • Call stack from entry point to error
  3. Gather reproduction steps

    • Minimal steps to reproduce
    • Input data or parameters used
    • Expected vs. actual behavior
    • Consistency of reproduction (always, intermittent, rare)

R - Read the Error Message

Objective: Extract all information from the error itself

  1. Parse error components

    • Error type/class (TypeError, ValueError, etc.)
    • Error message content
    • Suggested fixes (if provided)
    • Related errors or warnings
  2. Understand error semantics

    • What the error type means in this language/framework
    • What conditions trigger this error
    • What the error message is specifically telling you
    • Any error codes or status codes
  3. Identify error category

    • Syntax error (code won't parse)
    • Runtime error (code crashes during execution)
    • Logic error (wrong results, no crash)
    • Integration error (external system failure)
    • Performance error (timeout, resource exhaustion)

A - Analyze the Context

Objective: Understand the broader context around the error

  1. Code analysis

    • Review the failing line and surrounding code
    • Check recent changes to this code
    • Examine function/method signature and usage
    • Review related code that calls or is called by failing code
  2. Data analysis

    • Inspect input values at point of failure
    • Check data types and structures
    • Verify data meets expected format/constraints
    • Identify edge cases or unexpected values
  3. Environment analysis

    • Check dependencies and versions
    • Review configuration files
    • Verify environment variables
    • Confirm required resources are available (files, network, memory)
  4. State analysis

    • Application state at time of error
    • Previous operations that led to this state
    • Shared state or global variables involved
    • Database or external system state

C - Check for Root Cause

Objective: Identify the underlying issue, not just symptoms

  1. Follow the error chain

    • Start at bottom of stack trace (first error)
    • Work up to find originating cause
    • Distinguish between error origin and error handlers
    • Identify wrapped or re-thrown errors
  2. Test hypotheses

    • Generate specific, testable hypotheses
    • Isolate variables (change one thing at a time)
    • Use logging/debugging tools to verify assumptions
    • Document which hypotheses are confirmed or rejected
  3. Common root causes

    • Null/undefined values: Missing initialization or validation
    • Type mismatches: Incorrect data type passed or returned
    • Off-by-one errors: Array/loop boundary issues
    • Race conditions: Timing-dependent failures
    • Resource exhaustion: Memory, disk, connections depleted
    • Configuration errors: Wrong settings or missing config
    • Dependency issues: Version conflicts or missing libraries
    • Permission errors: Insufficient access rights
    • Network errors: Connectivity, timeout, DNS issues
    • Data corruption: Invalid or unexpected data format

E - Execute the Fix

Objective: Implement and verify the solution

  1. Design the fix

    • Address root cause, not symptoms
    • Consider side effects and edge cases
    • Plan for backward compatibility if needed
    • Choose most maintainable solution
  2. Implement carefully

    • Make minimal, targeted changes
    • Add validation and error handling
    • Include logging for future debugging
    • Document the fix and reasoning
  3. Verify thoroughly

    • Confirm original error is resolved
    • Test with reproduction steps
    • Test edge cases and related functionality
    • Verify no new errors introduced
  4. Document and prevent

    • Document what caused the error
    • Document the solution and why it works
    • Add tests to prevent regression
    • Update documentation or add warnings if needed

Debugging Workflow

Initial Assessment (5 minutes)

1. Read complete error message
2. Identify error type and severity
3. Check if error is reproducible
4. Assess impact (blocking, degraded, cosmetic)
5. Decide investigation priority

Deep Investigation (15-30 minutes)

1. Apply TRACE framework systematically
2. Use debugging tools (see scripts/debug_helper.py)
3. Generate and test hypotheses
4. Document findings as you go
5. Narrow down to root cause

Solution Implementation (varies)

1. Design fix addressing root cause
2. Implement with proper error handling
3. Add logging and validation
4. Test thoroughly
5. Document solution

Verification and Prevention (10 minutes)

1. Verify fix with original reproduction steps
2. Test related functionality
3. Add regression tests
4. Update documentation
5. Deploy and monitor

Common Error Patterns by Language

Python

AttributeError: 'NoneType' has no attribute 'X'

  • Root cause: Variable is None when expecting object
  • Check: Initialization, function return values, API responses
  • Fix: Add null checks, ensure proper initialization

KeyError: 'key_name'

  • Root cause: Dictionary missing expected key
  • Check: Data source, parsing logic, key spelling
  • Fix: Use .get() with default, validate data structure

ImportError / ModuleNotFoundError

  • Root cause: Module not installed or not in path
  • Check: requirements.txt, virtual environment, PYTHONPATH
  • Fix: Install missing package, fix import path

IndentationError

  • Root cause: Inconsistent spacing (tabs vs spaces)
  • Check: Editor settings, copied code
  • Fix: Standardize to spaces (PEP 8), use linter

JavaScript/TypeScript

TypeError: Cannot read property 'X' of undefined

  • Root cause: Accessing property on undefined object
  • Check: Object initialization, async timing, API responses
  • Fix: Optional chaining (?.operator), null checks

ReferenceError: X is not defined

  • Root cause: Variable used before declaration or out of scope
  • Check: Variable declaration, scope, hoisting issues
  • Fix: Declare variable, fix scope, check imports

Promise rejection / Uncaught (in promise)

  • Root cause: Async operation failed without catch handler
  • Check: API calls, file operations, async/await usage
  • Fix: Add .catch() or try/catch with await

SyntaxError: Unexpected token

  • Root cause: Invalid syntax, often from parsing JSON or code
  • Check: JSON structure, bracket matching, semicolons
  • Fix: Validate JSON, fix syntax, check for copy/paste errors

Java

NullPointerException

  • Root cause: Method called on null object reference
  • Check: Object initialization, method return values
  • Fix: Add null checks, use Optional, ensure initialization

ClassNotFoundException

  • Root cause: Class not found in classpath
  • Check: Dependencies, build configuration, package structure
  • Fix: Add dependency, fix classpath, check package/class names

ConcurrentModificationException

  • Root cause: Collection modified during iteration
  • Check: Nested loops, multi-threading, iterator usage
  • Fix: Use iterator.remove(), CopyOnWriteArrayList, or synchronization

Error Severity Classification

Critical (Fix Immediately)

  • Application crashes or won't start
  • Data loss or corruption
  • Security vulnerabilities
  • Production outages
  • Payment or transaction failures

High (Fix Soon)

  • Major features broken
  • Degraded performance affecting users
  • Error affects multiple users
  • Workarounds are complex

Medium (Schedule Fix)

  • Minor features broken
  • Cosmetic issues with impact
  • Errors with easy workarounds
  • Edge case failures

Low (Backlog)

  • Cosmetic issues
  • Minor improvements
  • Rare edge cases
  • Non-critical warnings

Debugging Tools and Techniques

Logging Best Practices

import logging

# Configure structured logging
logging.basicConfig(
    level=logging.DEBUG,
    format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
)

# Log with context
logger = logging.getLogger(__name__)
logger.debug(f"Processing item: {item_id}, user: {user_id}")
logger.error(f"Failed to process: {error}", exc_info=True)

Strategic Breakpoints

  1. At error location: Catch exact state when error occurs
  2. Before error: Check inputs and preconditions
  3. After error: See how error propagates
  4. At decision points: Verify logic branches
  5. In loops: Check iteration variables

Print Debugging (Strategic)

# Add contextual debug prints
print(f"DEBUG: function_name called with {param1=}, {param2=}")
print(f"DEBUG: variable state before operation: {var=}")
print(f"DEBUG: condition check: {condition=}, result: {result=}")

Binary Search Debugging

When error location is unclear:

  1. Add checkpoint in middle of code path
  2. Determine if error before or after checkpoint
  3. Repeat in remaining half
  4. Converge on error location quickly

Rubber Duck Debugging

Explain code line-by-line to someone (or something):

  1. Forces you to examine assumptions
  2. Often reveals errors during explanation
  3. Clarifies complex logic
  4. Identifies knowledge gaps

Using the Debug Helper Script

The scripts/debug_helper.py utility provides automated assistance:

# Parse stack trace from file
python scripts/debug_helper.py parse-trace error.log

# Extract error patterns
python scripts/debug_helper.py analyze-log application.log

# Start debug session (creates log)
python scripts/debug_helper.py session start "Login error investigation"

# Add notes to session
python scripts/debug_helper.py session note "Tested with different users - same error"

# Close session with solution
python scripts/debug_helper.py session close "Fixed: Added null check for user.profile"

Best Practices

Do's

  • Read error messages completely: Don't skip details
  • Reproduce consistently: Ensure reliable reproduction before debugging
  • Change one thing at a time: Isolate what fixes the problem
  • Document as you go: Record hypotheses, tests, findings
  • Use version control: Commit before debugging, can revert if needed
  • Add tests: Prevent regression after fixing
  • Fix root cause: Don't just patch symptoms
  • Share knowledge: Document solutions for team

Don'ts

  • Don't assume: Verify your assumptions with data
  • Don't skip reading errors: Error messages contain crucial information
  • Don't make multiple changes: Can't tell what fixed it
  • Don't delete code impulsively: Comment out first, understand why it was there
  • Don't ignore warnings: Today's warning is tomorrow's error
  • Don't fix without understanding: May break something else
  • Don't forget to test: Verify fix works and doesn't introduce new issues

Common Debugging Scenarios

Scenario 1: "It Worked Yesterday"

Approach:

  1. Check recent changes (git diff, git log)
  2. Review dependency updates
  3. Check environment changes
  4. Look for time-dependent logic
  5. Compare configurations between environments

Common Causes:

  • Recent code changes
  • Updated dependencies
  • Configuration changes
  • Database schema changes
  • External API changes
  • Certificate expiration

Scenario 2: "Works on My Machine"

Approach:

  1. Compare environments (OS, dependencies, configs)
  2. Check environment variables
  3. Verify file paths and permissions
  4. Compare data between environments
  5. Look for hardcoded assumptions

Common Causes:

  • Different dependency versions
  • Missing environment variables
  • Different file paths
  • Database state differences
  • Operating system differences
  • Missing configuration files

Scenario 3: "Intermittent Failures"

Approach:

  1. Identify failure pattern (timing, frequency, conditions)
  2. Look for race conditions
  3. Check resource availability
  4. Review concurrent operations
  5. Add extensive logging
  6. Increase reproduction attempts

Common Causes:

  • Race conditions
  • Memory leaks
  • External service instability
  • Network issues
  • Timing-dependent logic
  • Resource exhaustion

Scenario 4: "Error in Production Only"

Approach:

  1. Check production-specific configuration
  2. Review production data characteristics
  3. Check production load/scale
  4. Examine production dependencies
  5. Review security/permission settings

Common Causes:

  • Production data edge cases
  • Scale/load issues
  • Production-specific configuration
  • Different security policies
  • Firewall or network restrictions
  • Production-only integrations

Advanced Techniques

Бисекция при отладке (Git)

Найдите, какой коммит внёс ошибку:

git bisect start
git bisect bad                 # Current version has bug
git bisect good v1.2.0        # Version 1.2.0 was working
# Git checks out middle commit
# Test and mark as good/bad
git bisect good/bad
# Repeat until git identifies culprit commit
git bisect reset

Хайзенбаг (эффект наблюдателя)

Ошибки, исчезающие при отладке:

Стратегии:

  • Добавляйте логирование без точек останова
  • Используйте окружение, близкое к production, для отладки
  • Проверяйте проблемы с таймингом и конкурентностью
  • Проверяйте зависимости от инициализации/тайминга
  • Используйте неинтрузивный мониторинг

Профилирование памяти

Для утечек памяти и производительности:

# Python memory profiling
import tracemalloc

tracemalloc.start()
# ... run code ...
snapshot = tracemalloc.take_snapshot()
top_stats = snapshot.statistics('lineno')

for stat in top_stats[:10]:
    print(stat)

Отладка сети

Для ошибок API и интеграций:

Инструменты:

  • Вкладка Network в Browser DevTools
  • curl с флагом verbose (-v)
  • Postman для тестирования API
  • Wireshark для инспекции пакетов
  • Сетевой прокси (Charles, Fiddler)

Проверяйте:

  • Заголовки запроса/ответа
  • Коды статуса
  • Тело запроса/ответа
  • Тайминг (задержка, таймаут)
  • Проблемы SSL/TLS

Краткий справочник

Быстрый чек-лист по фреймворку TRACE

☐ T - TRACE
  ☐ Full error message captured
  ☐ Stack trace collected
  ☐ Reproduction steps documented
  ☐ Environment identified

☐ R - READ
  ☐ Error type identified
  ☐ Error message analyzed
  ☐ Error category determined
  ☐ Related errors checked

☐ A - ANALYZE
  ☐ Code reviewed
  ☐ Data inspected
  ☐ Environment verified
  ☐ State examined

☐ C - CHECK
  ☐ Error chain followed
  ☐ Hypotheses tested
  ☐ Root cause identified
  ☐ Assumptions verified

☐ E - EXECUTE
  ☐ Fix designed
  ☐ Fix implemented
  ☐ Fix verified
  ☐ Prevention measures added

Матрица приоритетов ошибок

Impact →     Low        Medium       High        Critical
Frequency ↓
High         Medium     High         Critical    Critical
Medium       Low        Medium       High        Critical
Low          Low        Low          Medium      High
Rare         Backlog    Low          Medium      High

Дополнительные ресурсы

Примеры

  • examples/debugging_workflow.md - Примеры пошагового процесса отладки
  • examples/common_errors.md - Каталог частых паттернов ошибок и решений
  • examples/stack_traces.txt - Аннотированные примеры стек-трейсов с анализом

Скрипты

  • scripts/debug_helper.py - Утилиты отладки на Python для разбора трейсов и управления сессиями

Дальнейшее обучение

  • Документация по отладке для конкретных языков
  • Руководства по обработке ошибок во фреймворках
  • Инструменты профилирования и анализа производительности
  • Практики тестирования и обеспечения качества

Помните: Отладка — это детективная работа. Будьте систематичны, будьте терпеливы и позволяйте доказательствам вести вас к истине. Каждое сообщение об ошибке — это улика, ждущая понимания.

Вставить в README

Ссылка на карточку для вашего README — без картинок и счётчиков.

[DarkPlay: error-detective](https://darkplay.ru/ai/skills/aiskillstore-marketplace-error-detective)

Из того же репозитория

when-profiling-performance-use-performance-profiler Система профилирования производительности, поиска узких мест и оптимизации. ★486 when-managing-token-budget-use-token-budget-advisor Управление бюджетом токенов: оценка расхода, анализ сложности, стратегии разбиения. ★486 when-optimizing-agent-learning-use-reasoningbank-intelligence Адаптивное обучение с ReasoningBank: распознавание паттернов и оптимизация стратегий. ★486 when-optimizing-prompts-use-prompt-architect Фреймворк для анализа, создания и улучшения промптов на основе доказательных техник. ★486 when-optimizing-prompts-use-prompt-optimization-analyzer Диагностика промптов: оценка качества, поиск антипаттернов и лишних токенов. ★486 when-orchestrating-swarm-use-swarm-orchestration Оркестрация сложного роя агентов с декомпозицией задач и синтезом результатов. ★486 when-releasing-software-use-github-release-management Оркестрация релизов GitHub: версионирование, тестирование, деплой и откат. ★486 when-reviewing-github-pr-use-github-code-review Ревью pull request в GitHub с параллельным анализом специализированными агентами. ★486

Похожие скиллы и другие разделы каталога

Популярное в разделе «Скиллы»

Самые востребованные скиллов раздела по установкам и звёздам.

find-skillsvercel-labs · Помогает находить и устанавливать навыки агентов по запросам вроде «как сделать X»…
4 400 000 устан.
grill-memattpocock · Настойчивое интервью для доработки плана или дизайна.
1 600 000 устан.
hyperframesheygen-com · Обязательная точка входа для любых задач по видео, анимации и motion-графике в…
1 600 000 устан.
hyperframes-cliheygen-com · Цикл разработки HyperFrames CLI: init, add, render, preview, publish и другие команды.
1 600 000 устан.
agent-browservercel-labs · CLI для автоматизации браузера для ИИ-агентов: навигация по страницам, заполнение форм…
1 600 000 устан.
media-useheygen-com · Agent Media OS: единый навык для медиа в HyperFrames — BGM, SFX, изображения, голос, LUT.
1 500 000 устан.
hyperframes-registryheygen-com · Установка и подключение блоков реестра в композиции HyperFrames через add и catalog.
1 400 000 устан.
grill-with-docsmattpocock · Настойчивое интервью для доработки плана или дизайна, попутно создающее документацию (ADR…
1 300 000 устан.
improve-codebase-architecturemattpocock · Поиск в кодовой базе возможностей для углубления, визуальный HTML-отчёт о них и детальный…
1 300 000 устан.
tddmattpocock · Разработка через тестирование (TDD): red-green-refactor и интеграционные тесты.
1 300 000 устан.
Похожее в других разделах каталога

Соседние разделы каталога: возможно, нужный инструмент живёт там.

Build Error Resolveraffaan-m · Специалист по устранению ошибок сборки и TypeScript. Используйте ПРОАКТИВНО при сбое…
225 587 ★
Cpp Build Resolveraffaan-m · Специалист по ошибкам сборки C++, CMake и линковки.
225 587 ★
Dart Build Resolveraffaan-m · Специалист по ошибкам сборки Dart/Flutter, зависимостей и build_runner.
225 587 ★
Django Build Resolveraffaan-m · Специалист по ошибкам Django: pip/Poetry, миграции, импорты, collectstatic.
225 587 ★
Go Build Resolveraffaan-m · Специалист по ошибкам сборки Go: исправляет build, go vet и предупреждения линтера.
225 587 ★
Go Revieweraffaan-m · Ревьюер кода Go: идиоматичность, конкурентность, обработка ошибок и производительность.
225 587 ★
Java Build Resolveraffaan-m · Специалист по ошибкам сборки Java/Maven/Gradle: определяет Spring Boot или Quarkus и…
225 587 ★
Kotlin Build Resolveraffaan-m · Специалист по ошибкам сборки Kotlin/Gradle: компилятор, зависимости и Gradle.
225 587 ★
Pytorch Build Resolveraffaan-m · Специалист по ошибкам PyTorch: формы тензоров, CUDA, градиенты и DataLoader.
225 587 ★
React Build Resolveraffaan-m · Чинит сборки React в Vite, webpack, Next.js и других: JSX, гидратация, типы.
225 587 ★

Лучшие ИИ-инструменты для генерации видео

Генерация видео

Подборка нейросетей для генерации и монтажа видео. Инструменты, которые превращают текст в готовые ролики, экономят часы на съемках и постпродакшне. Подходит для SMM-специалистов,

VEED.IOVeed
По запросу
5.0
MootionMootion
По запросу
5.0
FlyviFlyvi
Есть бесплатный тариф
4.9
Google Veo 3.1Google
Платно
4.9
Sora (OpenAI)OpenAI
Платно
4.9
PikaPika
Платно
4.9
captions space
Есть бесплатный тариф
4.8
Клайп
Есть бесплатный тариф
4.8
viralpulse.appViralpulse
По запросу
4.8
Viral Maker AIViral-maker
Есть бесплатный тариф
4.8

Лучшие ИИ-инструменты для генерации текста и копирайтинга

Генерация текста и копирайтинг

Подборка нейросетей для генерации текстов и копирайтинга. Сервисы, которые помогают создавать статьи, посты и рекламные объявления с нуля или по черновику, экономя часы рутинной ра

NeuroscribeNeuroscribe
Есть бесплатный тариф
5.0
GoGPTGogpt
По запросу
5.0
ChatsonicChatsonic
По запросу
4.9
НейроТекстерNeuro-texter
По запросу
4.9
ChatGPTOpenAI
По подписке
4.9
Редактум
Есть бесплатный тариф
4.8
ChadGPTChadgpt
По запросу
4.8
Cosmo ScribeCosmoscribe
Есть бесплатный тариф
4.8
Memo HelperCopilot33
По запросу
4.8
LibraChatLibrachat
Есть бесплатный тариф
4.8

Лучшие ИИ-инструменты для генерации изображений

Генерация изображений

Подборка нейросетей для генерации изображений от фотореализма до концепт-арта. Сервисы, которые экономят часы ручной работы, создавая визуал для блогов, рекламы и дизайна за минуты

MagviMagvi
По запросу
5.0
DALL-E 3OpenAI
По подписке
5.0
SupaLabSupalab
По запросу
5.0
Freestyling.aiFreestyling
Есть бесплатный тариф
4.9
ArtGeneration.meArtgeneration
Есть бесплатный тариф
4.9
BigjpgBigjpg
По запросу
4.9
Художник от VKVK
Бесплатно
4.9
Wonderink — ИИ-книги
Есть бесплатный тариф
4.8
Avato AI12ai
По запросу
4.8
Virton AIVirton
По запросу
4.8