| name | debug |
| description | Root-cause analysis for bugs, failing commands, broken behavior, and error logs. Use when the user encounters errors, crashes, or unexpected behavior. Triggers: debug, fix, bug, error, crash, lỗi, sửa lỗi, hỏng, fail. |
| encoding | UTF-8 |
| agents | ["debugger","backend-specialist","frontend-specialist"] |
| related-skills | ["test","enhance","status"] |
Memory Protocol
START: Read .ai-memory.md from project root. Check for known bugs, past fixes, tech stack details, common error patterns, and architecture notes.
END: Update .ai-memory.md using Memory Compaction Rules with: bug, root cause, fix, files touched, lessons learned, and remaining risks.
Goal
Find the real root cause, not just the first visible symptom.
Agent Routing
- If bug is in API/server/backend → read
.kiro/skills/agents/agents/backend-specialist.md and apply its knowledge
- If bug is in UI/rendering/CSS → read
.kiro/skills/agents/agents/frontend-specialist.md and apply its knowledge
- If bug is in database/queries → read
.kiro/skills/agents/agents/database-architect.md and apply its knowledge
- If bug may be a security issue → read
.kiro/skills/agents/agents/security-auditor.md and apply its knowledge
- Default → read
.kiro/skills/agents/agents/debugger.md and apply its systematic analysis
Socratic Gate
Before debugging, verify:
- What is the expected behavior vs actual behavior?
- Is there a log, stacktrace, or error message?
- When did this start? (recent change, always broken, intermittent?)
- Have we tried this before?
If any answer is missing, ASK before proceeding.
Workflow
- Read Memory — Load
.ai-memory.md for project context and past bug history.
- Summarize the bug, expected behavior, and actual behavior.
- Gather evidence from logs, stack traces, code paths, config, and recent changes.
- List the top hypotheses ranked by likelihood. Eliminate previously failed hypotheses immediately.
- Eliminate hypotheses using direct evidence.
- Identify the root cause and confirm with evidence before attempting any code changes.
- Propose an effective solution that addresses the root cause definitively. Ensure clean code standards are met and fully update all related files.
- Suggest how to verify the fix and prevent regressions.
- Quality Gate — Read
.kiro/skills/_scripts/checklist.md and run cross-cutting quality checks.
- Update Memory — Save root cause, fix, and lessons to
.ai-memory.md.
Output format
- Symptom
- Evidence collected
- Failed Attempts (to avoid repetition)
- Hypotheses (ranked by likelihood)
- Root cause
- Fix (Clean code & complete file updates)
- Verification steps
- Regression prevention
Checklist
Rules
- Do not guess when evidence is missing; say what must be checked.
- Prefer deterministic reproduction steps.
- Mention any hidden risk or side effect of the fix.
- Avoid changing unrelated files; if a fix seems wide-impact, ASK before proceeding.
- Always read and update the memory file.
Related Skills
/test → read .kiro/skills/test/SKILL.md — Write tests to prevent regression
/enhance → read .kiro/skills/enhance/SKILL.md — Improve code quality after fixing
/status → read .kiro/skills/status/SKILL.md — Check project health after fix
Encoding
All code snippets and example files referenced or produced by this skill must be UTF-8 encoded. When applicable, include encoding: "UTF-8" in SKILL.md front-matter and ensure saved files use UTF-8 (no BOM).