.claude/skills/debugging/when-debugging-code-use-debugging-assistant/SKILL.md
# Debugging Assistant Skill ## Overview Intelligent debugging workflow that systematically identifies symptoms, performs root cause analysis, generates fixes with explanations, validates solutions, and prevents regressions through comprehensive testing. ## Metadata - **Skill ID:** `when-debugging-code-use-debugging-assistant` - **Category:** Development/Debugging - **Complexity:** HIGH - **Agents Required:** coder, code-analyzer, tester - **Prerequisites:** Access to codebase, error logs, te
npx skillsauth add DNYoussef/ai-chrome-extension .claude/skills/debugging/when-debugging-code-use-debugging-assistantInstall 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.
Intelligent debugging workflow that systematically identifies symptoms, performs root cause analysis, generates fixes with explanations, validates solutions, and prevents regressions through comprehensive testing.
when-debugging-code-use-debugging-assistantUse this skill when encountering:
Objective: Gather comprehensive information about the issue
Agent: code-analyzer
Actions:
Outputs:
Success Criteria:
Objective: Trace execution flow and identify the underlying cause
Agent: code-analyzer + coder
Actions:
Techniques:
Outputs:
Success Criteria:
Objective: Develop and explain solution options
Agent: coder
Actions:
Fix Patterns:
Outputs:
Success Criteria:
Objective: Confirm the fix resolves the issue without breaking existing functionality
Agent: tester
Actions:
Test Coverage:
Outputs:
Success Criteria:
Objective: Ensure the issue doesn't recur
Agent: tester + coder
Actions:
Documentation:
Outputs:
Success Criteria:
1. User reports issue → code-analyzer (Symptom Identification)
2. code-analyzer findings → coder (Root Cause Analysis)
3. coder diagnosis → coder (Fix Generation)
4. coder fix → tester (Validation Testing)
5. tester results → coder + tester (Regression Prevention)
6. Final report → User
Memory Keys:
debug/[issue-id]/symptoms - Symptom analysisdebug/[issue-id]/root-cause - RCA findingsdebug/[issue-id]/fix - Solution implementationdebug/[issue-id]/validation - Test resultsdebug/[issue-id]/prevention - Long-term measuresPre-Debug Hook:
npx claude-flow@alpha hooks pre-task --description "Debug: [issue-description]"
npx claude-flow@alpha hooks session-restore --session-id "debug-[issue-id]"
Post-Fix Hook:
npx claude-flow@alpha hooks post-edit --file "[fixed-file]" --memory-key "debug/[issue-id]/fix"
npx claude-flow@alpha hooks notify --message "Fix applied: [description]"
Session End Hook:
npx claude-flow@alpha hooks post-task --task-id "debug-[issue-id]"
npx claude-flow@alpha hooks session-end --export-metrics true
Symptom:
TypeError: Cannot read property 'name' of undefined
at processUser (users.js:45)
Root Cause: User object not validated before property access
Fix:
// Before
function processUser(user) {
return user.name.toUpperCase();
}
// After
function processUser(user) {
if (!user || !user.name) {
throw new Error('Invalid user object');
}
return user.name.toUpperCase();
}
Test:
test('processUser handles missing user gracefully', () => {
expect(() => processUser(null)).toThrow('Invalid user object');
expect(() => processUser({})).toThrow('Invalid user object');
expect(processUser({name: 'john'})).toBe('JOHN');
});
Symptom: Intermittent test failures, data corruption in production
Root Cause: Multiple async operations modifying shared state without synchronization
Fix:
// Before - Race condition
async function updateCart(userId, item) {
const cart = await getCart(userId);
cart.items.push(item);
await saveCart(userId, cart);
}
// After - Using optimistic locking
async function updateCart(userId, item) {
let attempts = 0;
while (attempts < 3) {
const cart = await getCart(userId);
const version = cart._version;
cart.items.push(item);
cart._version = version + 1;
try {
await saveCartWithVersion(userId, cart, version);
return cart;
} catch (error) {
if (error.code === 'VERSION_CONFLICT') {
attempts++;
continue;
}
throw error;
}
}
throw new Error('Failed to update cart after 3 attempts');
}
Test:
test('updateCart handles concurrent modifications', async () => {
const userId = 'user123';
await createCart(userId);
// Simulate concurrent updates
const updates = await Promise.all([
updateCart(userId, {id: 'item1'}),
updateCart(userId, {id: 'item2'}),
updateCart(userId, {id: 'item3'})
]);
const finalCart = await getCart(userId);
expect(finalCart.items).toHaveLength(3);
expect(finalCart._version).toBe(3);
});
Symptom: Application memory usage grows continuously, eventual crash
Root Cause: Event listeners not removed, causing references to remain
Fix:
// Before - Memory leak
class DataStream {
constructor() {
this.listeners = [];
}
subscribe(callback) {
window.addEventListener('data', callback);
this.listeners.push(callback);
}
}
// After - Proper cleanup
class DataStream {
constructor() {
this.listeners = new Set();
}
subscribe(callback) {
window.addEventListener('data', callback);
this.listeners.add(callback);
// Return unsubscribe function
return () => {
window.removeEventListener('data', callback);
this.listeners.delete(callback);
};
}
destroy() {
// Clean up all listeners
this.listeners.forEach(callback => {
window.removeEventListener('data', callback);
});
this.listeners.clear();
}
}
Test:
test('DataStream cleans up event listeners', () => {
const stream = new DataStream();
const callback1 = jest.fn();
const callback2 = jest.fn();
const unsubscribe1 = stream.subscribe(callback1);
const unsubscribe2 = stream.subscribe(callback2);
expect(stream.listeners.size).toBe(2);
unsubscribe1();
expect(stream.listeners.size).toBe(1);
stream.destroy();
expect(stream.listeners.size).toBe(0);
});
If debugging is not progressing:
development
Comprehensive truth scoring, code quality verification, and automatic rollback system with 0.95 accuracy threshold for ensuring high-quality agent outputs and codebase reliability.
development
Comprehensive framework for analyzing, creating, and refining prompts for AI systems using evidence-based techniques
data-ai
Implement adaptive learning with ReasoningBank for pattern recognition, strategy optimization, and continuous improvement
development
Create new Claude Code Skills with proper YAML frontmatter, progressive disclosure structure, and complete directory organization