# Debug

> 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.

- **Type:** Skill
- **Install:** `agentstack add skill-votruongdanh-skills-agent-debug`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [VoTruongDanh](https://agentstack.voostack.com/s/votruongdanh)
- **Installs:** 0
- **Category:** [Agent Skills](https://agentstack.voostack.com/c/agent-skills)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [VoTruongDanh](https://github.com/VoTruongDanh)
- **Source:** https://github.com/VoTruongDanh/Skills-Agent/tree/main/.cursor/skills/debug

## Install

```sh
agentstack add skill-votruongdanh-skills-agent-debug
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

## 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:
1. What is the expected behavior vs actual behavior?
2. Is there a log, stacktrace, or error message?
3. When did this start? (recent change, always broken, intermittent?)
4. Have we tried this before?
If any answer is missing, ASK before proceeding.

## Workflow
1. **Read Memory** — Load `.ai-memory.md` for project context and past bug history.
2. Summarize the bug, expected behavior, and actual behavior.
3. Gather evidence from logs, stack traces, code paths, config, and recent changes.
4. List the top hypotheses ranked by likelihood. **Eliminate previously failed hypotheses immediately.**
5. Eliminate hypotheses using direct evidence.
6. Identify the root cause and confirm with evidence before attempting any code changes.
7. Propose an effective solution that addresses the root cause definitively. **Ensure clean code standards are met and fully update all related files.**
8. Suggest how to verify the fix and prevent regressions.
9. **Quality Gate** — Read `.kiro/skills/_scripts/checklist.md` and run cross-cutting quality checks.
10. **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
- [ ] Bug clearly described (expected vs actual)
- [ ] Past failed attempts reviewed to prevent loop
- [ ] Evidence gathered and root cause definitively confirmed
- [ ] Hypotheses listed and ranked
- [ ] Root cause confirmed with evidence
- [ ] Fix is effective and addresses root cause directly
- [ ] No side effects introduced
- [ ] Verification steps provided
- [ ] Regression prevention suggested
- [ ] Memory file updated

- [ ] Clean code chuẩn (Standard clean code applied)
- [ ] Cập nhật đầy đủ tất cả các file liên quan (All related files fully updated)

## 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

## Source & license

This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [VoTruongDanh](https://github.com/VoTruongDanh)
- **Source:** [VoTruongDanh/Skills-Agent](https://github.com/VoTruongDanh/Skills-Agent)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/skill-votruongdanh-skills-agent-debug
- Seller: https://agentstack.voostack.com/s/votruongdanh
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
