bug-detective
Skill này làm gì
Skill này cho AI của bạn một cách từng bước để truy tìm lỗi, exception và sự cố trong code. Skill dành cho bất kỳ ai có code bị hỏng và muốn một bản sửa cẩn thận, dựa trên bằng chứng.
Khi nào nên dùng
- ✓Khi bạn có một thông báo lỗi, exception hoặc stack trace cần điều tra.
- ✓Khi có gì đó bị hỏng hoặc một tính năng đột nhiên ngừng hoạt động.
- ✓Khi bạn hỏi vì sao một đoạn code thất bại và nguyên nhân không rõ ràng.
Liên kết skill
https://github.com/Galaxy-Dawn/claude-scholar/blob/main/skills/bug-detective/SKILL.mdSao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.
Cách dùng
Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.
Tin nhắn có sẵn để dán
Dành cho Claude Code, Codex hoặc Cursor: chạy lệnh trong thư mục dự án của bạn và skill sẽ được cài đặt.
Tải tệp SKILL.md về và thả vào thư mục skill của agent.
Ví dụ cách nhờ AI
“Trang đăng nhập của tôi báo lỗi 500 sau lần deploy vừa rồi. Hãy tìm nguyên nhân và sửa.”
5 skill mới mỗi tuần. Đọc chỉ 1 phút.
Cách hoạt động
Agent thu thập chi tiết lỗi, phân loại loại lỗi, đưa ra các nguyên nhân có thể, kiểm thử từng nguyên nhân, rồi áp dụng và xác minh bản sửa.
Nội dung kỹ thuật (SKILL.md gốc)
Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.
Bug Detective
A systematic debugging workflow for investigating and resolving code errors, exceptions, and failures. Provides structured debugging methods and common error pattern recognition.
Core Philosophy
Debugging is a scientific problem-solving process that requires:
- Understand the problem - Clearly define symptoms and expected behavior
- Gather evidence - Collect error messages, logs, stack traces
- Form hypotheses - Infer possible causes based on evidence
- Verify hypotheses - Confirm or eliminate causes through experiments
- Resolve the issue - Apply fixes and verify
Debugging Workflow
Step 1: Understand the Problem
Before starting to debug, clarify the following information:
Required information to collect:
- Complete error message content
- Exact location of the error (filename and line number)
- Reproduction steps (how to trigger the error)
- Expected behavior vs actual behavior
- Environment info (OS, versions, dependencies)
Question template:
1. What is the exact error message?
2. Which file and line does the error occur at?
3. How can this issue be reproduced? Provide detailed steps.
4. What was the expected result? What actually happened?
5. What recent changes might have introduced this issue?
Step 2: Analyze Error Type
Choose a debugging strategy based on error type:
| Error Type | Characteristics | Debugging Method |
|---|---|---|
| Syntax Error | Code cannot be parsed | Check syntax, bracket matching, quotes |
| Import Error | ModuleNotFoundError | Check module installation, path config |
| Type Error | TypeError | Check data types, type conversions |
| Attribute Error | AttributeError | Check if object attribute exists |
| Key Error | KeyError | Check if dictionary key exists |
| Index Error | IndexError | Check list/array index range |
| Null Reference | NoneType/NullPointerException | Check if variable is None |
| Network Error | ConnectionError/Timeout | Check network connection, URL, timeout settings |
| Permission Error | PermissionError | Check file permissions, user permissions |
| Resource Error | FileNotFoundError | Check if file path exists |
Step 3: Locate the Problem Source
Use the following methods to locate the issue:
1. Binary Search Method
- Comment out half the code, check if the problem persists
- Progressively narrow the scope until the problematic code is found
2. Log Tracing
- Add print/logging statements at key locations
- Track variable value changes
- Confirm code execution path
3. Breakpoint Debugging
- Use debugger breakpoint functionality
- Step through code execution
- Inspect variable state
4. Stack Trace Analysis
- Find the call chain from the stack trace in the error message
- Determine the direct cause of the error
- Trace back to the root cause
Step 4: Form and Verify Hypotheses
Hypothesis framework:
Hypothesis: [problem description] causes [error phenomenon]
Verification steps:
1. [verification method 1]
2. [verification method 2]
Expected results:
- If hypothesis is correct: [expected phenomenon]
- If hypothesis is wrong: [expected phenomenon]
Step 5: Apply Fix
After fixing, verify:
- The original error is resolved
- No new errors have been introduced
- Related functionality still works correctly
- Tests added to prevent regression
Python Common Error Patterns
1. Indentation Errors
2. Mutable Default Arguments
3. Closure Issues in Loops
4. Modifying a List While Iterating
5. Using is for String Comparison
6. Forgetting to Call super().__init__()
JavaScript/TypeScript Common Error Patterns
1. this Binding Issues
2. Async Error Handling
3. Object Reference Comparison
Bash/Zsh Common Error Patterns
1. Spacing Issues
# ❌ No spaces allowed in assignment
name = "John" # Error: tries to run 'name' command
# ✅ Correct assignment
name="John"
# ❌ Missing spaces in conditional test
if[$name -eq 1]; then # Error
# ✅ Correct
if [ $name -eq 1 ]; then
2. Quoting Issues
# ❌ Variables not expanded inside single quotes
echo 'The value is $var' # Output: The value is $var
# ✅ Use double quotes
echo "The value is $var" # Output: The value is actual_value
# ❌ Using backticks for command substitution (confusing)
result=`command`
# ✅ Use $()
result=$(command)
3. Unquoted Variables
Câu hỏi thường gặp
Tôi nên cung cấp thông tin gì?
Thông báo lỗi đầy đủ, file và dòng nếu biết, các bước để tái hiện, và điều bạn mong đợi xảy ra.
Skill có đoán bản sửa không?
Không. Skill đưa ra các nguyên nhân có thể và kiểm tra từng nguyên nhân trước khi thay đổi code.
Skill có biết các mẫu lỗi thường gặp không?
Có. Skill có các mẫu lỗi thường gặp để chẩn đoán nhanh hơn.
Chi tiết
Mô tả gốc của tác giả
This skill should be used when the user asks to "debug this", "fix this error", "investigate this bug", "troubleshoot this issue", "find the problem", "something is broken", "this isn't working", "why is this failing", or reports errors/exceptions/bugs. Provides systematic debugging workflow and common error patterns.
Độ phổ biến
- Sao GitHub
- 6.0k
- Vị trí xếp hạng
- #14480
- Giấy phép
- MIT
- Cập nhật
- 19/10/2026
Bình luận
- …
Thêm skill từ kho mã này
agent-identifier
6.0kDạy agent của bạn tạo agent Claude Code, viết đúng tên, mô tả kích hoạt, system prompt và cài đặt của chúng.
architecture-design
6.0kDạy agent của bạn bố cục code chuẩn cho dự án machine learning, dùng mẫu factory và registry khi thêm các thành phần có thể đăng ký.
citation-verification
6.0kDạy agent của bạn kiểm tra từng trích dẫn trong một bài báo học thuật với các nguồn học thuật đáng tin cậy, phát hiện tài liệu tham khảo giả hoặc sai.
code-review-excellence
6.0kGiúp agent của bạn rà soát các thay đổi code và pull request với nhận xét rõ ràng, tử tế, có ưu tiên, bắt được lỗi thật và làm code tốt hơn.
Skill tương tự
diffs
394kGiúp agent của bạn tạo một diff có thể chia sẻ về các chỉnh sửa, dưới dạng liên kết xem hoặc file ảnh, thay vì một bản tóm tắt viết tay.
coding-agent
394kGiúp agent của bạn giao một việc lập trình lớn cho Codex, Claude Code hoặc OpenCode chạy nền, rồi theo dõi tiến độ của nó.
gh-issues
394kGiúp agent của bạn tìm issue trên GitHub, chọn những issue cần xử lý và mở pull request với bản sửa, kể cả theo dõi nhận xét đánh giá.