Chuyển đến nội dung
Skillpedia
Lập trình chung48k · #5438

phase-gated-debugging

Skill này làm gì

Trợ lý AI này giúp sửa lỗi trong mã một cách có tổ chức. Nó đảm bảo tìm đúng vấn đề thực sự trước khi thực hiện bất kỳ thay đổi nào, theo quy trình 5 bước để tránh sửa vội.

Khi nào nên dùng

  • ✓Khi một lỗi có vẻ đã được sửa nhưng vẫn quay lại.
  • ✓Khi bạn cần một quy trình từng bước để tìm nguyên nhân lỗi.
  • ✓Khi lỗi thỉnh thoảng xảy ra và khó truy tìm.

Liên kết skill

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/phase-gated-debugging/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/phase-gated-debugging/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

“Có một lỗi đang xuất hiện trong mã của tôi và tôi không tìm ra nguyên nhân. Bạn có thể giúp tôi điều tra theo một quy trình có tổ chức không?”

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

Cách hoạt động

AI trước tiên thử tái tạo lỗi, sau đó thêm ghi chú để hiểu vấn đề xảy ra ở đâu, phân tích nguyên nhân gốc, và chỉ sau đó mới áp dụng bản sửa. Cuối cùng, nó kiểm tra xem lỗi đã thực sự được giải quyết chư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.

Phase-Gated Debugging

Overview

AI coding agents see an error and immediately edit code. They guess at fixes, get it wrong, and spiral. This skill enforces a strict 5-phase protocol where you CANNOT edit source code until the root cause is identified and confirmed.

Based on claude-debug (full plugin with PreToolUse hook enforcement).

When to Use

Use this skill when:

  • a bug keeps getting "fixed" without resolving the underlying issue
  • you need to slow an agent down and force disciplined debugging before code edits
  • the failure is intermittent, a regression, performance-related, or otherwise hard to isolate
  • you want an explicit user confirmation checkpoint before any fix is applied

The Protocol

Phase 1: REPRODUCE

Run the failing command/test. Capture the exact error. Run 2-3 times for consistency.

  • Do NOT read source code
  • Do NOT hypothesize
  • Do NOT edit any files

Phase 2: ISOLATE

Read code. Add diagnostic logging marked // DEBUG. Re-run with diagnostics. Binary search to narrow down.

  • Only // DEBUG marked logging is allowed
  • Do NOT fix the bug even if you see it

Phase 3: ROOT CAUSE

Analyze WHY at the isolated location. Use "5 Whys" technique. Remove debug logging.

State: "This is my root cause analysis: [explanation]. Do you agree, or should I investigate further?"

WAIT for user confirmation. Do NOT proceed without it.

Phase 4: FIX

Remove all // DEBUG lines. Apply minimal change addressing confirmed root cause.

  • Only edit files related to root cause
  • Do NOT refactor unrelated code

Phase 5: VERIFY

Run original failing test — must pass. Run related tests. For intermittent bugs, run 5+ times. If verification fails: root cause was wrong, go back to Phase 2.

Bug-Type Strategies

Type Technique
Crash/Panic Stack trace backward — trace the bad value to its source
Wrong Output Binary search — log midpoint, halve search space each iteration
Intermittent Compare passing vs failing run logs — find ordering divergence
Regression git bisect — find the offending commit
Performance Timing at stage boundaries — find the bottleneck

Key Rules

  1. NEVER edit source code in phases 1-3 (except // DEBUG in phase 2)
  2. NEVER proceed past phase 3 without user confirmation
  3. ALWAYS reproduce before investigating
  4. ALWAYS verify after fixing

Example

User request:

a bug keeps getting "fixed" without resolving the underlying issue; diagnose it and return the concrete next action.

Limitations

  • Use this skill only when the task clearly matches the scope described above.
  • Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
  • Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.
Câu hỏi thường gặp

Vì sao không thể sửa mã ngay lập tức?

Sửa mã khi chưa hiểu nguyên nhân gốc có thể làm vấn đề tệ hơn hoặc tạo lỗi mới. Quy trình này đảm bảo bản sửa nhắm đúng vào nguồn gốc vấn đề.

5 giai đoạn là gì?

Đó là: 1. Tái tạo lỗi, 2. Cô lập vấn đề bằng ghi chú, 3. Xác định nguyên nhân gốc, 4. Áp dụng bản sửa, và 5. Xác minh lỗi đã được giải quyết.

Điều gì xảy ra nếu bản sửa không hiệu quả?

Nếu lỗi chưa được giải quyết trong giai đoạn xác minh, AI quay lại giai đoạn cô lập để điều tra lại.

Chi tiết

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

Use when debugging any bug. Enforces a 5-phase protocol where code edits are blocked until root cause is confirmed. Prevents premature fix attempts.

repo: sickn33/agentic-awesome-skills

Độ phổ biến

Sao GitHub
48k
Vị trí xếp hạng
#5438
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ự