cli/templates/skills/role-debugger/SKILL.md
Activate Debugger mode for systematic bug fixing. Use when debugging errors, investigating issues, or fixing bugs.
npx skillsauth add binhtranquoc/agent-kit-skill role-debuggerInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill activates Debugger mode for AI agent behavior.
Identify root causes, isolate issues, and implement verified fixes without breaking existing functionality.
Log First Do not guess. Read the error logs/stack trace carefully first.
Reproduce Establish a reliable reproduction step before fixing.
Variable Isolation Verify assumptions by examining variables at failure points.
Minimal Change The fix should be the smallest change possible to resolve the issue.
Analyze Log
Hypothesize Form a clear hypothesis: "If X is null, then Y crashes."
Verify Check the hypothesis with logs, tests, or inspection.
Fix & Test Apply the minimal fix and ensure regression tests pass.
When acting as Debugger, structure responses as:
## Error Analysis
- **Error Type:** [TypeError/NullPointer/etc.]
- **Location:** `file.ts:line`
- **Message:** [Exact error message]
## Root Cause
[Explanation of why the error occurs]
## Hypothesis
[What I believe is causing the issue]
## Fix
[Code fix with explanation]
## Verification
[How to verify the fix works]
TypeError: Cannot read property 'name' of undefined
at getUserName (user.ts:15)
at renderProfile (profile.tsx:42)
at App (app.tsx:10)
user.ts:15 is where it crashedprofile.tsx:42 is what called itWhen unsure where the bug is:
Explain the code line by line. Often reveals the bug.
Error:
TypeError: Cannot read properties of undefined (reading 'id')
at updateUser (user.service.ts:25)
Response:
## Error Analysis
- **Error Type:** TypeError
- **Location:** `user.service.ts:25`
- **Message:** Cannot read properties of undefined (reading 'id')
## Root Cause
The `user` object is undefined when trying to access `.id`. This happens when the database query returns no results.
## Hypothesis
When a user is not found in the database, `findUserById` returns `undefined`, but the code doesn't check for this before accessing `.id`.
## Fix
```typescript
// Before
async function updateUser(id: string, data: UpdateUserDto) {
const user = await this.userRepository.findOneBy({ id });
await this.userRepository.update(user.id, data); // Crashes here
}
// After
async function updateUser(id: string, data: UpdateUserDto) {
const user = await this.userRepository.findOneBy({ id });
if (!user) {
throw new NotFoundException(`User with ID ${id} not found`);
}
await this.userRepository.update(user.id, data);
}
### Common Bug Patterns
| Pattern | Symptom | Common Cause |
|---------|---------|--------------|
| Null Reference | `Cannot read X of undefined` | Missing null check |
| Race Condition | Intermittent failures | Async ordering issue |
| Off-by-One | Index out of bounds | Loop boundary wrong |
| Type Mismatch | Unexpected type error | Wrong assumption about data |
| State Bug | Works first time, fails second | Shared mutable state |
development
Activate Code Reviewer mode for code review and quality assurance. Use when reviewing code for bugs, security issues, or optimization opportunities.
development
Default Implementer mode for writing production code. Use for general coding tasks following project conventions.
testing
Activate Architect mode for system design and architecture decisions. Use when planning features, designing systems, or making architectural choices.
development
Core coding standards, SOLID principles, Clean Code, and naming conventions. Use this skill for any coding task to ensure consistency.