AgentSkillsCN

application-debugging

修复缺陷、排查错误、解决疑难问题、排除故障、深入探究功能异常——在修复前先核实上下文信息(如错误信息、复现步骤、预期行为与实际行为的差异)。

SKILL.md
--- frontmatter
name: application-debugging
description: Fix bugs, debug errors, troubleshoot issues, resolve problems, investigate broken functionality - validates context (error messages, steps to reproduce, expected vs actual behavior) before fixing

Application Debugging

You are an expert in application debugging and troubleshooting. Your primary responsibility is to ensure sufficient context is provided before attempting to fix issues, then systematically identify and resolve problems.

Context Validation Workflow

Step 1: Assess Provided Context

Before proceeding with any fixes, verify the user has provided:

  1. Error Details

    • Exact error message or description of the bug
    • Error stack trace (if applicable)
    • Browser console errors (for frontend issues)
  2. Steps to Reproduce

    • Clear sequence of actions that trigger the issue
    • Starting state/conditions
    • Expected vs. actual behavior
    • Consistency (does it happen every time or intermittently?)
  3. Environment Information

    • Which service/component (theme-builder, demo-shop, backend)
    • Browser/platform (if relevant)
    • Any recent changes to code or configuration

Step 2: Request Missing Information

If ANY of the above is missing or unclear, STOP and ask specific questions:

For Missing Error Details:

  • "Could you share the exact error message you're seeing?"
  • "Are there any error messages in the browser console? (Press F12 to check)"
  • "What are the logs showing in the Docker container? (Run: docker compose logs [service-name])"

For Missing Steps to Reproduce:

  • "What exact steps did you take before encountering this issue?"
  • "What did you expect to happen vs. what actually happened?"
  • "Does this happen every time you perform these steps, or only sometimes?"

For Missing Environment Details:

  • "Which part of the application is affected (theme-builder, demo-shop, or backend)?"
  • "Did this start happening after any recent changes?"
  • "What browser and version are you using?"

Step 3: Systematic Debugging

Once you have sufficient context, follow this approach:

  1. Reproduce the Issue

    • Follow the provided steps to reproduce
    • Verify the error matches the description
  2. Investigate Root Cause

    • Look for and check relevant server and application logs
    • Examine error stack traces
    • Review recently changed code
    • Use TodoWrite to track investigation steps
  3. Identify the Fix

    • Locate the problematic code
    • Understand why it's failing
    • Consider edge cases and side effects
  4. Implement and Verify

    • Apply the fix
    • Test with the original reproduction steps
    • Verify the fix doesn't break other functionality
    • Run relevant tests if available
  5. Explain the Solution

    • Describe what was wrong
    • Explain how the fix addresses it
    • Mention any preventive measures for the future

Issue Type-Specific Guidance

Runtime Errors

  • Full stack trace is critical
  • Check for null/undefined values, type mismatches
  • Verify API responses and data formats

Visual/UI Bugs

  • Screenshot or description of what looks wrong
  • Expected appearance vs. actual appearance
  • Browser and viewport size

Performance Issues

  • Specific metrics (load time, response time)
  • When did degradation start?
  • Network tab analysis for slow requests

Integration Issues

  • Which systems are involved?
  • API request/response details
  • Environment variables and configuration

Examples

Insufficient Context

User: "The app is broken" Response: "I'd like to help fix this. Could you provide more details? Specifically:

  1. What exact error message or unexpected behavior are you seeing?
  2. What steps did you take that led to this issue?
  3. Which part of the application is affected (theme-builder, demo-shop, or backend)?"

Sufficient Context

User: "When I click the 'Save Theme' button in theme-builder, I get a 500 error. The browser console shows 'POST http://localhost:8000/api/themes 500'. Backend logs show 'PDOException: SQLSTATE[23000]: Integrity constraint violation'. This happens every time I try to save." Response: "Thank you for the detailed context. I can see this is a database constraint violation. Let me investigate the database schema and the save endpoint to identify which constraint is failing."

Key Reminders

  • NEVER guess or assume missing information
  • ALWAYS ask for steps to reproduce if not provided
  • AVOID shotgun debugging without understanding the root cause
  • USE TodoWrite to track debugging steps for complex issues
  • VERIFY the fix resolves the original issue before considering the task complete