skills/dnyoussef/when-debugging-code-use-debugging-assistant/SKILL.md
Intelligent debugging workflow that systematically identifies symptoms, performs root cause analysis, generates fixes with explanations, validates solutions, and prevents regressions through compre...
npx skillsauth add aiskillstore/marketplace 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
Apple Human Interface Guidelines for content display components. Use this skill when the user asks about charts component, collection view, image view, web view, color well, image well, activity view, lockup, data visualization, content display, displaying images, rendering web content, color pickers, or presenting collections of items in Apple apps. Also use when the user says how should I display charts, what's the best way to show images, should I use a web view, how do I build a grid of items, what component shows media, or how do I present a share sheet. Cross-references: hig-foundations for color/typography/accessibility, hig-patterns for data visualization patterns, hig-components-layout for structural containers, hig-platforms for platform-specific component behavior.
tools
Automate HelpDesk tasks via Rube MCP (Composio): list tickets, manage views, use canned responses, and configure custom fields. Always search tools first for current schemas.
testing
Expert Haskell engineer specializing in advanced type systems, pure functional design, and high-reliability software. Use PROACTIVELY for type-level programming, concurrency, and architecture guidance.
tools
GraphQL gives clients exactly the data they need - no more, no less. One endpoint, typed schema, introspection. But the flexibility that makes it powerful also makes it dangerous. Without proper controls, clients can craft queries that bring down your server. This skill covers schema design, resolvers, DataLoader for N+1 prevention, federation for microservices, and client integration with Apollo/urql. Key insight: GraphQL is a contract. The schema is the API documentation. Design it carefully.