Chuyển đến nội dung
Skillpedia
Kiểm thử48k · #4077

bug-hunter

Skill này làm gì

Công cụ này giúp tìm và sửa lỗi trong mã máy tính. Nó lần theo manh mối để tìm nguyên nhân của vấn đề, sửa lỗi và đảm bảo lỗi không quay lại.

Khi nào nên dùng

  • ✓Khi có điều gì đó trong chương trình không hoạt động như mong đợi.
  • ✓Khi bạn nhận được một thông báo lỗi lạ.
  • ✓Khi chương trình hoạt động bất thường.

Liên kết skill

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/bug-hunter/SKILL.md

Sao 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

Hãy dùng skill này để giúp tôi: https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/bug-hunter/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Tôi phát hiện một lỗi trên website của mình, bạn có thể giúp tôi tìm ra vấn đề không?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

Công cụ trước tiên cố gắng tái tạo lỗi có chủ đích để hiểu chuyện gì đang xảy ra. Sau đó, nó thu thập thông tin như thông báo lỗi và nhật ký để đoán nguyên nhân và kiểm tra giả thuyết đó.

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 Hunter

Systematically hunt down and fix bugs using proven debugging techniques. No guessing—follow the evidence.

When to Use This Skill

  • User reports a bug or error
  • Something isn't working as expected
  • User says "fix the bug" or "debug this"
  • Intermittent failures or weird behavior
  • Production issues need investigation

The Debugging Process

1. Reproduce the Bug

First, make it happen consistently:

1. Get exact steps to reproduce
2. Try to reproduce locally
3. Note what triggers it
4. Document the error message/behavior
5. Check if it happens every time or randomly

If you can't reproduce it, gather more info:

  • What environment? (dev, staging, prod)
  • What browser/device?
  • What user actions preceded it?
  • Any error logs?

2. Gather Evidence

Collect all available information:

Check logs:

# Application logs
tail -f logs/app.log

# System logs
journalctl -u myapp -f

# Browser console
# Open DevTools → Console tab

Check error messages:

  • Full stack trace
  • Error type and message
  • Line numbers
  • Timestamp

Check state:

  • What data was being processed?
  • What was the user trying to do?
  • What's in the database?
  • What's in local storage/cookies?

3. Form a Hypothesis

Based on evidence, guess what's wrong:

"The login times out because the session cookie 
expires before the auth check completes"

"The form fails because email validation regex 
doesn't handle plus signs"

"The API returns 500 because the database query 
has a syntax error with special characters"

4. Test the Hypothesis

Prove or disprove your guess:

Add logging:

console.log('Before API call:', userData);
const response = await api.login(userData);
console.log('After API call:', response);

Use debugger:

debugger; // Execution pauses here
const result = processData(input);

Isolate the problem:

// Comment out code to narrow down
// const result = complexFunction();
const result = { mock: 'data' }; // Use mock data

5. Find Root Cause

Trace back to the actual problem:

Common root causes:

  • Null/undefined values
  • Wrong data types
  • Race conditions
  • Missing error handling
  • Incorrect logic
  • Off-by-one errors
  • Async/await issues
  • Missing validation

Example trace:

Symptom: "Cannot read property 'name' of undefined"
↓
Where: user.profile.name
↓
Why: user.profile is undefined
↓
Why: API didn't return profile
↓
Why: User ID was null
↓
Root cause: Login didn't set user ID in session

6. Implement Fix

Fix the root cause, not the symptom:

Bad fix (symptom):

// Just hide the error
const name = user?.profile?.name || 'Unknown';

Good fix (root cause):

// Ensure user ID is set on login
const login = async (credentials) => {
  const user = await authenticate(credentials);
  if (user) {
    session.userId = user.id; // Fix: Set user ID
    return user;
  }
  throw new Error('Invalid credentials');
};

7. Test the Fix

Verify it actually works:

1. Reproduce the original bug
2. Apply the fix
3. Try to reproduce again (should fail)
4. Test edge cases
5. Test related functionality
6. Run existing tests

8. Prevent Regression

Add a test so it doesn't come back:

test('login sets user ID in session', async () => {
  const user = await login({ email: 'test@example.com', password: 'pass' });
  
  expect(session.userId).toBe(user.id);
  expect(session.userId).not.toBeNull();
});

Debugging Techniques

Binary Search

Cut the problem space in half repeatedly:

// Does the bug happen before or after this line?
console.log('CHECKPOINT 1');
// ... code ...
console.log('CHECKPOINT 2');
// ... code ...
console.log('CHECKPOINT 3');

Rubber Duck Debugging

Explain the code line by line out loud. Often you'll spot the issue while explaining.

Print Debugging

Strategic console.logs:

console.log('Input:', input);
console.log('After transform:', transformed);
console.log('Before save:', data);
console.log('Result:', result);

Diff Debugging

Compare working vs broken:

  • What changed recently?
  • What's different between environments?
  • What's different in the data?

Time Travel Debugging

Use git to find when it broke:

git bisect start
git bisect bad  # Current commit is broken
git bisect good abc123  # This old commit worked

…
Câu hỏi thường gặp

“Bug” là gì?

“Bug” là một lỗi hoặc khiếm khuyết trong chương trình máy tính khiến nó không hoạt động đúng.

Công cụ tìm nguyên nhân lỗi bằng cách nào?

Nó dùng các kỹ thuật như lần theo các bước dẫn đến lỗi, phân tích thông báo lỗi và nhật ký, và kiểm tra các giả thuyết để tìm ra nguồn gốc vấn đề.

“Prevent regression” nghĩa là gì?

Nghĩa là đảm bảo lỗi đã sửa không xuất hiện lại trong tương lai, thường bằng cách thêm một bài kiểm thử để xác nhận bản sửa hoạt động.

Chi tiết

Mô tả gốc của tác giả

Systematically finds and fixes bugs using proven debugging techniques. Traces from symptoms to root cause, implements fixes, and prevents regression.

repo: sickn33/agentic-awesome-skills

Độ phổ biến

Sao GitHub
48k
Vị trí xếp hạng
#4077
Giấy phép
MIT
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự