[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6QHXYB9CSFCAKA5SX78B2AR":3,"skill-same:01M6QHXYB9CSFCAKA5SX78B2AR":90},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":15,"categories":16,"keywords":27,"publishedAt":48,"linkOnly":49,"markdownContent":50,"markdownBody":51,"frontMatter":52,"refName":70,"commitSha":71,"skillDirectory":72,"forksCount":13,"repositoryHtmlUrl":73,"repositoryHomepageUrl":6,"ownerHtmlUrl":74,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":75,"install":76,"resources":89},"01M6QHXYB9CSFCAKA5SX78B2AR","debug-session",null,"Chain-combined skill for systematic debugging workflow. Combines bug reproduction judgment, error analysis, execution tracing, and debugging expertise into a complete session规范. Use when user mentions debugging, fixing bugs, something not working, error messages, or when code isn't behaving as expected. Triggers especially when user says \"debug this\", \"why is this broken\", \"it's not working\", \"error message\", \"something went wrong\", or \"help me find the bug\".","ImaginerLabs\u002Fskill-manager","ImaginerLabs","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F214277308?v=4","01M6QGGDPNF15RMMT1RCFDH9FN","01M6QGGDTH5BY64DQ123NR8M33",0,"MIT","https:\u002F\u002Fgithub.com\u002FImaginerLabs\u002Fskill-manager\u002Fblob\u002Fmain\u002Fskills\u002Fcoding\u002Fdebug-session\u002FSKILL.md",[17,22],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",{"categoryNo":23,"categoryName":24,"taxonomyType":25,"taxonomyTypeDesc":26},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",[28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47],"session","debug session","debug","expert","combined","error analysis","error","chain","systematic","message","me","systematic debugging","workflow","read","broken","why","analysis","messages","code","debugging","2026-11-10 10:12:30",false,"---\nname: debug-session\ndescription: >-\n  Chain-combined skill for systematic debugging workflow. Combines bug reproduction judgment, error analysis, execution tracing, and debugging expertise into a complete session规范. Use when user mentions debugging, fixing bugs, something not working, error messages, or when code isn't behaving as expected. Triggers especially when user says \"debug this\", \"why is this broken\", \"it's not working\", \"error message\", \"something went wrong\", or \"help me find the bug\".\ncategory: coding\npriority: P0\ntrigger_patterns:\n  - \"debug this\"\n  - \"why is this broken\"\n  - \"not working\"\n  - \"error message\"\n  - \"something went wrong\"\n  - \"find the bug\"\n  - \"debugging\"\n  - \"it's throwing an error\"\n  - \"null is not\"\n  - \"cannot read property\"\ncombines:\n  - debug-expert\n  - reproduce-bug\n  - understand-error\n  - trace-execution\n---\n\n# Debug Session — Systematic Bug Resolution Framework\n\n## Overview\n\nDebug-session is a **chain-combined behavioral specification skill** that merges:\n\n- `debug-expert` — Expert debugging methodology\n- `reproduce-bug` — Reliable bug reproduction\n- `understand-error` — Error message interpretation\n- `trace-execution` — Execution path tracking\n\nThe core judgment it encapsulates: **\"How do I systematically find and fix this bug without introducing new ones?\"**\n\nThis skill embodies the disciplined approach of an expert debugger: reproducible steps, systematic elimination, and verified fixes.\n\n## Core Philosophy\n\n### The Debugging Paradox\n\n> \"The bug is usually where you least expect it — which is exactly why you need to expect it everywhere.\"\n\nThe first rule of debugging: **Assume nothing.** The bug is in the code you wrote, not in the framework, the language, or cosmic rays.\n\n### The Debugging Mindset\n\n```\n┌─────────────────────────────────────────────────────────────┐\n│                    DEBUGGING MINDSET                        │\n│                                                             │\n│    MYSTERIOUS                       SYSTEMATIC               │\n│         │                                │                  │\n│         ▼                                ▼                  │\n│    ┌─────────┐                    ┌─────────────┐           │\n│    │ \"How did│                    │ Facts first │           │\n│    │  this   │                    │ Hypothesis  │           │\n│    │  happen?\"│                   │ then verify │           │\n│    └─────────┘                    └─────────────┘           │\n│         │                                │                  │\n│         ▼                                ▼                  │\n│    ┌─────────┐                    ┌─────────────┐           │\n│    │ Random  │                    │  Root cause │           │\n│    │ poking   │                    │  identified │           │\n│    └─────────┘                    └─────────────┘           │\n└─────────────────────────────────────────────────────────────┘\n```\n\n## Behavioral Specification\n\n### Phase 1: Reproduce the Bug\n\n**Rule #1: If you can't reproduce it, you can't fix it.**\n\n#### 1.1 Gather Information\n\nBefore anything else, collect:\n\n```markdown\n## Bug Report Summary\n\n| Field | Value |\n|-------|-------|\n| Error message | [exact text] |\n| When does it occur? | [steps to reproduce] |\n| Frequency | [always\u002Fsometimes\u002Fonce] |\n| Environment | [dev\u002Fprod\u002Fbrowser\u002Fnode] |\n| Version | [git commit or version] |\n```\n\n#### 1.2 Create Minimal Reproduction\n\n```markdown\n## Reproduction Steps\n\n1. [Step 1 - specific action]\n2. [Step 2 - specific action]\n3. [Step 3 - specific action]\n\nExpected: [what should happen]\nActual: [what happens instead]\n```\n\n**The ideal reproduction:**\n- Minimal code\n- No unrelated code\n- Same environment as production\n- Can be shared with others\n\n#### 1.3 Verify Reproduction\n\nBefore fixing, confirm you can:\n- [ ] Make it happen on demand\n- [ ] Make it NOT happen when you change something specific\n- [ ] Run the exact same steps in a fresh environment\n\n### Phase 2: Understand the Error\n\n#### 2.1 Error Message Analysis\n\n```\n┌─────────────────────────────────────────────────────────────┐\n│                 ERROR MESSAGE DECODER                       │\n│                                                             │\n│  Error: \"Cannot read property 'name' of undefined\"         │\n│                                                             │\n│  ┌─────────────────────────────────────────────────────┐   │\n│  │ WHERE │ WHAT │ WHY                                  │   │\n│  ├───────┼──────┼──────────────────────────────────────┤   │\n│  │ Line# │ 'name'│ 'name' property                     │   │\n│  │       │       │ doesn't exist on                    │   │\n│  │       │       │ the object                          │   │\n│  │       │       │ returned from                        │   │\n│  │       │       │ previous function                   │   │\n│  └─────────────────────────────────────────────────────┘   │\n│                                                             │\n│  Question: Why is the object undefined?                    │\n│  Next: Trace back to find where it should have a value     │\n└─────────────────────────────────────────────────────────────┘\n```\n\n#### 2.2 Stack Trace Reading\n\n```markdown\n## Stack Trace Analysis\n\nError: TypeError: Cannot read property 'name'\n\nat User.getFullName (User.ts:45)\n    └── WHERE: Line 45 of User.ts\n\nat UserController.handleRequest (UserController.ts:89)\n    └── WHO CALLED: Line 89 of UserController\n\nat Router.dispatch (Router.ts:123)\n    └── HOW WE GOT HERE: ...\n\n---\n\nQuestion to ask: \"What should be on line 45?\"\nAnswer: A User object with a 'name' property\n\nQuestion: \"Where does the User come from?\"\nAnswer: It's returned from UserController.handleRequest\n\nConclusion: UserController is passing undefined instead of a User\n```\n\n### Phase 3: Trace the Execution\n\n#### 3.1 Follow the Data\n\n```bash\n# Find where data is created\ngrep -r \"createUser\" --include=\"*.ts\" src\u002F\n\n# Find where data flows\ngrep -r \"getFullName\" --include=\"*.ts\" src\u002F\n```\n\n#### 3.2 State Inspection Points\n\n```markdown\n## Data Flow Map\n\nRouter ──► Controller ──► Service ──► Database\n              │\n              ▼\n         [User object]\n              │\n              ▼\n         [Middleware?] ──► Adds auth?\n              │\n              ▼\n         [Handler] ──► Line 45: user.getFullName()\n              │\n              ▼\n         ERROR: user is undefined\n              │\n              ▼\n         WHY: Middleware didn't run?\n         WHY: Service returned null?\n         WHY: Database query failed?\n```\n\n#### 3.3 Breakpoint Strategy\n\n**Where to break:**\n1. Where the error occurs (line 45)\n2. One step before (Controller line 89)\n3. Where the data is created (Service)\n4. Entry point (Router)\n\n**What to check at each:**\n- Variables exist\n- Variables have expected values\n- Functions return expected types\n\n### Phase 4: Form Hypothesis\n\n**Rule #2: If you think you found it, prove it.**\n\n#### 4.1 Hypothesis Template\n\n```markdown\n## Hypothesis\n\nI believe the bug is caused by:\n[Specific code or condition]\n\nMy reasoning:\n1. [Observation 1]\n2. [Observation 2]\n3. [Conclusion]\n\nTo verify this hypothesis, I will:\n[Specific test or check]\n\nIf I'm right, [expected outcome]\nIf I'm wrong, [expected different outcome]\n```\n\n#### 4.2 Common Root Causes\n\n| Category | Common Culprits |\n|-----------|-----------------|\n| Null\u002FUndefined | Missing null checks, failed queries |\n| Async | Race conditions, missing await |\n| Types | Wrong type assumptions, missing casting |\n| Scope | Closures, callbacks, this binding |\n| State | Stale state, update timing, mutations |\n| I\u002FO | Network failures, file not found |\n\n### Phase 5: Fix and Verify\n\n#### 5.1 The Fix\n\n**Rule #3: Fix the root cause, not the symptom.**\n\n```markdown\n## Bug Fix Analysis\n\nSYMPTOM: \"user.getFullName is not a function\"\n\nWRONG FIX:\nuser.getFullName?.()  \u002F\u002F Masks the real problem\n\nRIGHT FIX:\nUnderstand WHY user is undefined\nFix THAT\nThen user.getFullName() works naturally\n```\n\n#### 5.2 Verification Protocol\n\n```\n┌─────────────────────────────────────────────────────────────┐\n│                   FIX VERIFICATION                           │\n│                                                             │\n│  1. Does the original bug still occur? (NO should be answer)│\n│  2. Do existing tests still pass?                           │\n│  3. Did I introduce any new bugs?                            │\n│  4. Is the fix minimal? (No over-engineering)                │\n│  5. Can I explain the fix in one sentence?                   │\n│                                                             │\n│  If all YES → Proceed                                       │\n│  If any NO → Revert and reconsider                          │\n└─────────────────────────────────────────────────────────────┘\n```\n\n#### 5.3 Regression Prevention\n\n```markdown\n## Regression Checklist\n\n□ Write a test that fails with the bug\n□ Apply the fix\n□ Verify the test passes\n□ Run full test suite\n□ Test related functionality manually\n□ Consider edge cases\n□ Document the fix\n```\n\n## The Debug Session Protocol\n\n### Step-by-Step Workflow\n\n```\n┌─────────────────────────────────────────────────────────────┐\n│                    DEBUG SESSION WORKFLOW                    │\n│                                                             │\n│  1. REPRODUCE                                              │\n│     └─► Gather exact error message                         │\n│     └─► List exact steps to reproduce                     │\n│     └─► Create minimal reproduction case                   │\n│                                                             │\n│  2. UNDERSTAND                                            │\n│     └─► Parse the error message                            │\n│     └─► Read the stack trace                               │\n│     └─► Identify WHERE the error occurs                     │\n│                                                             │\n│  3. TRACE                                                 │\n│     └─► Follow data flow backward                          │\n│     └─► Identify potential failure points                   │\n│     └─► Set strategic breakpoints                           │\n│                                                             │\n│  4. HYPOTHESIZE                                           │\n│     └─► Form specific hypothesis                            │\n│     └─► Identify how to verify                              │\n│     └─► Test the hypothesis                                 │\n│                                                             │\n│  5. FIX                                                   │\n│     └─► Fix root cause, not symptoms                        │\n│     └─► Keep fix minimal                                   │\n│     └─► Write regression test                               │\n│                                                             │\n│  6. VERIFY                                                │\n│     └─► Original bug is fixed                               │\n│     └─► No new bugs introduced                             │\n│     └─► All tests pass                                     │\n└─────────────────────────────────────────────────────────────┘\n```\n\n## Common Debugging Scenarios\n\n### Scenario 1: \"TypeError: Cannot read property 'x' of undefined\"\n\n```markdown\nAnalysis:\n1. The object 'x' is being accessed on is undefined\n2. Either it was never set, or set to undefined\n3. Need to trace where it should have been assigned\n\nSteps:\n1. Check where object should be created\n2. Add breakpoint or log there\n3. Verify object exists\n4. If not, trace back further\n5. Find where it should come from\n6. Check why it's not being passed\u002Freturned\n```\n\n### Scenario 2: \"Race condition — sometimes works, sometimes doesn't\"\n\n```markdown\nAnalysis:\n1. Non-deterministic behavior suggests timing issue\n2. Usually async-related\n\nSteps:\n1. Identify async operations in the flow\n2. Check for missing await\n3. Check for state updates after async calls\n4. Add logging at each async step\n5. Reproduce consistently by adding delays\n6. Fix the timing issue (usually proper await or reordering)\n```\n\n### Scenario 3: \"It's not working, no error message\"\n\n```markdown\nAnalysis:\n1. Silent failure is harder to debug\n2. Usually caught in try\u002Fcatch or returning wrong value\n\nSteps:\n1. Check for try\u002Fcatch that swallows errors\n2. Add explicit error logging\n3. Check return values for error indicators\n4. Add console.log at key points\n5. Verify function is actually being called\n6. Check for early returns\n```\n\n## Debugging Anti-Patterns\n\n### 1. Shooting in the Dark\n\n```typescript\n\u002F\u002F BAD: Random changes\nconst x = result?.data?.value ?? \"default\";\nconst y = result?.data?.value || \"default\";\nconst z = result && result.data && result.data.value;\n\n\u002F\u002F GOOD: Understand why x is undefined\nif (!result?.data?.value) {\n  console.log(\"result:\", result);  \u002F\u002F NOW you can see\n  console.log(\"result.data:\", result?.data);\n}\n```\n\n### 2. Premature Optimization\n\n```typescript\n\u002F\u002F BAD: \"Maybe if I cache it...\"\ncache.set(key, computeExpensiveValue());\n\n\u002F\u002F GOOD: First reproduce, understand, THEN optimize\nconsole.log(\"Computing for:\", input); \u002F\u002F Understand first\n```\n\n### 3. Ignoring the Stack Trace\n\n```markdown\n\u002F\u002F BAD: \"I have no idea why this error happens\"\nTypeError at line 45\n\n\u002F\u002F GOOD: Read it!\n\u002F\u002F \"Error at getFullName called from UserController line 89\"\n```\n\n### 4. Not Testing the Fix\n\n```typescript\n\u002F\u002F BAD: \"It seems to work now\"\nconst result = fix();\nif (result) console.log(\"Fixed!\");\n\n\u002F\u002F GOOD: Write a test\nit(\"should handle empty user gracefully\", () => {\n  const result = processUser(undefined);\n  expect(result).toEqual({ error: \"No user provided\" });\n});\n```\n\n## Key Principles\n\n### 1. Reproduce Before Fix\n\nIf you can't make it fail reliably, you can't know if you fixed it.\n\n### 2. One Variable at a Time\n\nChange one thing, test, repeat. Multiple changes = confusing results.\n\n### 3. Rubber Duck Debugging\n\nExplain the problem out loud. The act of explaining forces clarity.\n\n### 4. Trust the Evidence\n\nNot your intuition, not your assumptions — the actual evidence from the code.\n\n### 5. When Stuck, Go to the Source\n\nRead the framework\u002Flibrary source. The bug is almost never there, but understanding leads to answers.\n\n## Relationship to Other Skills\n\n- `debug-expert` — Core debugging methodology\n- `reproduce-bug` — Bug reproduction framework\n- `understand-error` — Error message interpretation\n- `trace-execution` — Execution path tracking\n- `test-think` — Writing regression tests after fix\n- `safe-refactor` — If fix requires structural changes\n","# Debug Session — Systematic Bug Resolution Framework\n\n## Overview\n\nDebug-session is a **chain-combined behavioral specification skill** that merges:\n\n- `debug-expert` — Expert debugging methodology\n- `reproduce-bug` — Reliable bug reproduction\n- `understand-error` — Error message interpretation\n- `trace-execution` — Execution path tracking\n\nThe core judgment it encapsulates: **\"How do I systematically find and fix this bug without introducing new ones?\"**\n\nThis skill embodies the disciplined approach of an expert debugger: reproducible steps, systematic elimination, and verified fixes.\n\n## Core Philosophy\n\n### The Debugging Paradox\n\n> \"The bug is usually where you least expect it — which is exactly why you need to expect it everywhere.\"\n\nThe first rule of debugging: **Assume nothing.** The bug is in the code you wrote, not in the framework, the language, or cosmic rays.\n\n### The Debugging Mindset\n\n```\n┌─────────────────────────────────────────────────────────────┐\n│                    DEBUGGING MINDSET                        │\n│                                                             │\n│    MYSTERIOUS                       SYSTEMATIC               │\n│         │                                │                  │\n│         ▼                                ▼                  │\n│    ┌─────────┐                    ┌─────────────┐           │\n│    │ \"How did│                    │ Facts first │           │\n│    │  this   │                    │ Hypothesis  │           │\n│    │  happen?\"│                   │ then verify │           │\n│    └─────────┘                    └─────────────┘           │\n│         │                                │                  │\n│         ▼                                ▼                  │\n│    ┌─────────┐                    ┌─────────────┐           │\n│    │ Random  │                    │  Root cause │           │\n│    │ poking   │                    │  identified │           │\n│    └─────────┘                    └─────────────┘           │\n└─────────────────────────────────────────────────────────────┘\n```\n\n## Behavioral Specification\n\n### Phase 1: Reproduce the Bug\n\n**Rule #1: If you can't reproduce it, you can't fix it.**\n\n#### 1.1 Gather Information\n\nBefore anything else, collect:\n\n```markdown\n## Bug Report Summary\n\n| Field | Value |\n|-------|-------|\n| Error message | [exact text] |\n| When does it occur? | [steps to reproduce] |\n| Frequency | [always\u002Fsometimes\u002Fonce] |\n| Environment | [dev\u002Fprod\u002Fbrowser\u002Fnode] |\n| Version | [git commit or version] |\n```\n\n#### 1.2 Create Minimal Reproduction\n\n```markdown\n## Reproduction Steps\n\n1. [Step 1 - specific action]\n2. [Step 2 - specific action]\n3. [Step 3 - specific action]\n\nExpected: [what should happen]\nActual: [what happens instead]\n```\n\n**The ideal reproduction:**\n- Minimal code\n- No unrelated code\n- Same environment as production\n- Can be shared with others\n\n#### 1.3 Verify Reproduction\n\nBefore fixing, confirm you can:\n- [ ] Make it happen on demand\n- [ ] Make it NOT happen when you change something specific\n- [ ] Run the exact same steps in a fresh environment\n\n### Phase 2: Understand the Error\n\n#### 2.1 Error Message Analysis\n\n```\n┌─────────────────────────────────────────────────────────────┐\n│                 ERROR MESSAGE DECODER                       │\n│                                                             │\n│  Error: \"Cannot read property 'name' of undefined\"         │\n│                                                             │\n│  ┌─────────────────────────────────────────────────────┐   │\n│  │ WHERE │ WHAT │ WHY                                  │   │\n│  ├───────┼──────┼──────────────────────────────────────┤   │\n│  │ Line# │ 'name'│ 'name' property                     │   │\n│  │       │       │ doesn't exist on                    │   │\n│  │       │       │ the object                          │   │\n│  │       │       │ returned from                        │   │\n│  │       │       │ previous function                   │   │\n│  └─────────────────────────────────────────────────────┘   │\n│                                                             │\n│  Question: Why is the object undefined?                    │\n│  Next: Trace back to find where it should have a value     │\n└─────────────────────────────────────────────────────────────┘\n```\n\n#### 2.2 Stack Trace Reading\n\n```markdown\n## Stack Trace Analysis\n\nError: TypeError: Cannot read property 'name'\n\nat User.getFullName (User.ts:45)\n    └── WHERE: Line 45 of User.ts\n\nat UserController.handleRequest (UserController.ts:89)\n    └── WHO CALLED: Line 89 of UserController\n\nat Router.dispatch (Router.ts:123)\n    └── HOW WE GOT HERE: ...\n\n---\n\nQuestion to ask: \"What should be on line 45?\"\nAnswer: A User object with a 'name' property\n\nQuestion: \"Where does the User come from?\"\nAnswer: It's returned from UserController.handleRequest\n\nConclusion: UserController is passing undefined instead of a User\n```\n\n### Phase 3: Trace the Execution\n\n#### 3.1 Follow the Data\n\n```bash\n# Find where data is created\ngrep -r \"createUser\" --include=\"*.ts\" src\u002F\n\n# Find where data flows\ngrep -r \"getFullName\" --include=\"*.ts\" src\u002F\n```\n\n#### 3.2 State Inspection Points\n\n```markdown\n## Data Flow Map\n\nRouter ──► Controller ──► Service ──► Database\n              │\n              ▼\n         [User object]\n              │\n              ▼\n         [Middleware?] ──► Adds auth?\n              │\n              ▼\n         [Handler] ──► Line 45: user.getFullName()\n              │\n              ▼\n         ERROR: user is undefined\n              │\n              ▼\n         WHY: Middleware didn't run?\n         WHY: Service returned null?\n         WHY: Database query failed?\n```\n\n#### 3.3 Breakpoint Strategy\n\n**Where to break:**\n1. Where the error occurs (line 45)\n2. One step before (Controller line 89)\n3. Where the data is created (Service)\n4. Entry point (Router)\n\n**What to check at each:**\n- Variables exist\n- Variables have expected values\n- Functions return expected types\n\n### Phase 4: Form Hypothesis\n\n**Rule #2: If you think you found it, prove it.**\n\n#### 4.1 Hypothesis Template\n\n```markdown\n## Hypothesis\n\nI believe the bug is caused by:\n[Specific code or condition]\n\nMy reasoning:\n1. [Observation 1]\n2. [Observation 2]\n3. [Conclusion]\n\nTo verify this hypothesis, I will:\n[Specific test or check]\n\nIf I'm right, [expected outcome]\nIf I'm wrong, [expected different outcome]\n```\n\n#### 4.2 Common Root Causes\n\n| Category | Common Culprits |\n|-----------|-----------------|\n| Null\u002FUndefined | Missing null checks, failed queries |\n| Async | Race conditions, missing await |\n| Types | Wrong type assumptions, missing casting |\n| Scope | Closures, callbacks, this binding |\n| State | Stale state, update timing, mutations |\n| I\u002FO | Network failures, file not found |\n\n### Phase 5: Fix and Verify\n\n#### 5.1 The Fix\n\n**Rule #3: Fix the root cause, not the symptom.**\n\n```markdown\n## Bug Fix Analysis\n\nSYMPTOM: \"user.getFullName is not a function\"\n\nWRONG FIX:\nuser.getFullName?.()  \u002F\u002F Masks the real problem\n\nRIGHT FIX:\nUnderstand WHY user is undefined\nFix THAT\nThen user.getFullName() works naturally\n```\n\n#### 5.2 Verification Protocol\n\n```\n┌─────────────────────────────────────────────────────────────┐\n│                   FIX VERIFICATION                           │\n│                                                             │\n│  1. Does the original bug still occur? (NO should be answer)│\n│  2. Do existing tests still pass?                           │\n│  3. Did I introduce any new bugs?                            │\n│  4. Is the fix minimal? (No over-engineering)                │\n│  5. Can I explain the fix in one sentence?                   │\n│                                                             │\n│  If all YES → Proceed                                       │\n│  If any NO → Revert and reconsider                          │\n└─────────────────────────────────────────────────────────────┘\n```\n\n#### 5.3 Regression Prevention\n\n```markdown\n## Regression Checklist\n\n□ Write a test that fails with the bug\n□ Apply the fix\n□ Verify the test passes\n□ Run full test suite\n□ Test related functionality manually\n□ Consider edge cases\n□ Document the fix\n```\n\n## The Debug Session Protocol\n\n### Step-by-Step Workflow\n\n```\n┌─────────────────────────────────────────────────────────────┐\n│                    DEBUG SESSION WORKFLOW                    │\n│                                                             │\n│  1. REPRODUCE                                              │\n│     └─► Gather exact error message                         │\n│     └─► List exact steps to reproduce                     │\n│     └─► Create minimal reproduction case                   │\n│                                                             │\n│  2. UNDERSTAND                                            │\n│     └─► Parse the error message                            │\n│     └─► Read the stack trace                               │\n│     └─► Identify WHERE the error occurs                     │\n│                                                             │\n│  3. TRACE                                                 │\n│     └─► Follow data flow backward                          │\n│     └─► Identify potential failure points                   │\n│     └─► Set strategic breakpoints                           │\n│                                                             │\n│  4. HYPOTHESIZE                                           │\n│     └─► Form specific hypothesis                            │\n│     └─► Identify how to verify                              │\n│     └─► Test the hypothesis                                 │\n│                                                             │\n│  5. FIX                                                   │\n│     └─► Fix root cause, not symptoms                        │\n│     └─► Keep fix minimal                                   │\n│     └─► Write regression test                               │\n│                                                             │\n│  6. VERIFY                                                │\n│     └─► Original bug is fixed                               │\n│     └─► No new bugs introduced                             │\n│     └─► All tests pass                                     │\n└─────────────────────────────────────────────────────────────┘\n```\n\n## Common Debugging Scenarios\n\n### Scenario 1: \"TypeError: Cannot read property 'x' of undefined\"\n\n```markdown\nAnalysis:\n1. The object 'x' is being accessed on is undefined\n2. Either it was never set, or set to undefined\n3. Need to trace where it should have been assigned\n\nSteps:\n1. Check where object should be created\n2. Add breakpoint or log there\n3. Verify object exists\n4. If not, trace back further\n5. Find where it should come from\n6. Check why it's not being passed\u002Freturned\n```\n\n### Scenario 2: \"Race condition — sometimes works, sometimes doesn't\"\n\n```markdown\nAnalysis:\n1. Non-deterministic behavior suggests timing issue\n2. Usually async-related\n\nSteps:\n1. Identify async operations in the flow\n2. Check for missing await\n3. Check for state updates after async calls\n4. Add logging at each async step\n5. Reproduce consistently by adding delays\n6. Fix the timing issue (usually proper await or reordering)\n```\n\n### Scenario 3: \"It's not working, no error message\"\n\n```markdown\nAnalysis:\n1. Silent failure is harder to debug\n2. Usually caught in try\u002Fcatch or returning wrong value\n\nSteps:\n1. Check for try\u002Fcatch that swallows errors\n2. Add explicit error logging\n3. Check return values for error indicators\n4. Add console.log at key points\n5. Verify function is actually being called\n6. Check for early returns\n```\n\n## Debugging Anti-Patterns\n\n### 1. Shooting in the Dark\n\n```typescript\n\u002F\u002F BAD: Random changes\nconst x = result?.data?.value ?? \"default\";\nconst y = result?.data?.value || \"default\";\nconst z = result && result.data && result.data.value;\n\n\u002F\u002F GOOD: Understand why x is undefined\nif (!result?.data?.value) {\n  console.log(\"result:\", result);  \u002F\u002F NOW you can see\n  console.log(\"result.data:\", result?.data);\n}\n```\n\n### 2. Premature Optimization\n\n```typescript\n\u002F\u002F BAD: \"Maybe if I cache it...\"\ncache.set(key, computeExpensiveValue());\n\n\u002F\u002F GOOD: First reproduce, understand, THEN optimize\nconsole.log(\"Computing for:\", input); \u002F\u002F Understand first\n```\n\n### 3. Ignoring the Stack Trace\n\n```markdown\n\u002F\u002F BAD: \"I have no idea why this error happens\"\nTypeError at line 45\n\n\u002F\u002F GOOD: Read it!\n\u002F\u002F \"Error at getFullName called from UserController line 89\"\n```\n\n### 4. Not Testing the Fix\n\n```typescript\n\u002F\u002F BAD: \"It seems to work now\"\nconst result = fix();\nif (result) console.log(\"Fixed!\");\n\n\u002F\u002F GOOD: Write a test\nit(\"should handle empty user gracefully\", () => {\n  const result = processUser(undefined);\n  expect(result).toEqual({ error: \"No user provided\" });\n});\n```\n\n## Key Principles\n\n### 1. Reproduce Before Fix\n\nIf you can't make it fail reliably, you can't know if you fixed it.\n\n### 2. One Variable at a Time\n\nChange one thing, test, repeat. Multiple changes = confusing results.\n\n### 3. Rubber Duck Debugging\n\nExplain the problem out loud. The act of explaining forces clarity.\n\n### 4. Trust the Evidence\n\nNot your intuition, not your assumptions — the actual evidence from the code.\n\n### 5. When Stuck, Go to the Source\n\nRead the framework\u002Flibrary source. The bug is almost never there, but understanding leads to answers.\n\n## Relationship to Other Skills\n\n- `debug-expert` — Core debugging methodology\n- `reproduce-bug` — Bug reproduction framework\n- `understand-error` — Error message interpretation\n- `trace-execution` — Execution path tracking\n- `test-think` — Writing regression tests after fix\n- `safe-refactor` — If fix requires structural changes\n",{"name":5,"category":53,"combines":54,"priority":59,"description":7,"trigger_patterns":60},"coding",[55,56,57,58],"debug-expert","reproduce-bug","understand-error","trace-execution","P0",[61,62,63,64,65,66,47,67,68,69],"debug this","why is this broken","not working","error message","something went wrong","find the bug","it's throwing an error","null is not","cannot read property","main","b9a52d8e27455bdad953d64928696d028223ea1b","skills\u002Fcoding\u002Fdebug-session","https:\u002F\u002Fgithub.com\u002FImaginerLabs\u002Fskill-manager","https:\u002F\u002Fgithub.com\u002FImaginerLabs","2026-04-18 16:27:13",{"source":8,"skillName":5,"commands":77,"prompt":87,"zipAvailable":88},[78,81,84],{"tool":79,"command":80},"npx","npx skills add ImaginerLabs\u002Fskill-manager --skill debug-session",{"tool":82,"command":83},"bunx","bunx skills add ImaginerLabs\u002Fskill-manager --skill debug-session",{"tool":85,"command":86},"pnpm","pnpm dlx skills add ImaginerLabs\u002Fskill-manager --skill debug-session","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FImaginerLabs\u002Fskill-manager\u002Fblob\u002Fmain\u002Fskills\u002Fcoding\u002Fdebug-session\u002FSKILL.md",true,[],[91,120,140,167,199,225],{"skillNo":92,"name":93,"nameZh":6,"description":94,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":95,"categories":96,"keywords":101,"publishedAt":48},"01M6QJCB2SD5KHC41ZDQC0GA1T","meeting-minutes","Generate concise, actionable meeting minutes for internal meetings. Includes metadata, attendees, agenda, decisions, action items (owner + due date), and follow-up steps.","https:\u002F\u002Fgithub.com\u002FImaginerLabs\u002Fskill-manager\u002Fblob\u002Fmain\u002Fskills\u002Fwriting\u002Fmeeting-minutes\u002FSKILL.md",[97,98],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},{"categoryNo":99,"categoryName":100,"taxonomyType":25,"taxonomyTypeDesc":26},"01JBSEEDCAT000000000000034","行政与办公人员",[102,103,104,105,106,107,108,109,110,111,93,70,112,113,114,115,116,117,118,119],"meeting minutes","meeting","minutes","writing","github","copilot","generate","decisions","meetings","up","agenda","actionable","concise","follow-up","tree","true","action","for",{"skillNo":121,"name":122,"nameZh":6,"description":123,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":124,"categories":125,"keywords":126,"publishedAt":48},"01M6QJC71RRGTGNNFEHJG6S20G","documentation-writer","Diátaxis Documentation Expert. An expert technical writer specializing in creating high-quality software documentation, guided by the principles and structure of the Diátaxis technical documentation authoring framework.","https:\u002F\u002Fgithub.com\u002FImaginerLabs\u002Fskill-manager\u002Fblob\u002Fmain\u002Fskills\u002Fwriting\u002Fdocumentation-writer\u002FSKILL.md",[],[127,128,129,105,106,107,130,131,132,133,31,134,70,135,136,137,138,116,117,139],"documentation","documentation writer","writer","https","quality","technical","technical writer","documentation expert","structure","authoring","software","principles","high",{"skillNo":141,"name":142,"nameZh":6,"description":143,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":144,"categories":145,"keywords":153,"publishedAt":48},"01M6QJC0V3C7C4R9768J1AJYWY","doc-coauthoring","Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision docs, or similar structured content. This workflow helps users efficiently transfer context, refine content through iteration, and verify the doc works for readers. Trigger when user mentions writing docs, creating proposals, drafting specs, or similar documentation tasks.","https:\u002F\u002Fgithub.com\u002FImaginerLabs\u002Fskill-manager\u002Fblob\u002Fmain\u002Fskills\u002Fwriting\u002Fdoc-coauthoring\u002FSKILL.md",[146,149,150],{"categoryNo":147,"categoryName":148,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000018","写作与文案",{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},{"categoryNo":151,"categoryName":152,"taxonomyType":25,"taxonomyTypeDesc":26},"01JBSEEDCAT000000000000036","内容创作者",[154,155,105,40,156,127,157,158,159,160,161,162,70,163,164,136,165,166,116,119],"doc coauthoring","doc","official","tasks","decision","write","context","proposals","guide","refine","iteration","trigger","co",{"skillNo":168,"name":169,"nameZh":6,"description":170,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":171,"categories":172,"keywords":181,"publishedAt":48},"01M6QJBJ0YPVEWGEXZH3PJRRTT","code-review-workflow","Executes comprehensive 4-phase code review: basic review, quality check, bundle analysis, and test coverage. Should be used when the user mentions comprehensive code review, checking code quality, or reviewing staged changes with multi-phase analysis. This is the comprehensive review workflow, distinct from focused skills like frontend-code-review, staged-code-review, or code-change-test-designer.","https:\u002F\u002Fgithub.com\u002FImaginerLabs\u002Fskill-manager\u002Fblob\u002Fmain\u002Fskills\u002Ftesting\u002Fcode-review-workflow\u002FSKILL.md",[173,176,179,180],{"categoryNo":174,"categoryName":175,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000007","代码审查",{"categoryNo":177,"categoryName":178,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000008","测试与质量",{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},{"categoryNo":23,"categoryName":24,"taxonomyType":25,"taxonomyTypeDesc":26},[182,183,40,46,184,185,186,187,188,189,190,44,191,192,193,194,195,196,197,198],"code review","review","code review workflow","testing","frontend","test","change","code quality","code-review","check","coverage","quality check","basic","multi","comprehensive code review","with","phase",{"skillNo":200,"name":201,"nameZh":6,"description":202,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":203,"categories":204,"keywords":214,"publishedAt":48},"01M6QJB7XNHV3VEEQF4W7FMWF6","code-change-test-designer","Analyzes code changes and designs comprehensive test cases. Reads diffs, summarizes capability changes, and designs test cases covering main flows and edge cases. Should be used when the user mentions test coverage, designing tests for code changes, or analyzing diff\u002Fcommit for testing purposes. Distinguished from code-review-workflow which provides comprehensive review, this skill focuses on test case design for code changes.","https:\u002F\u002Fgithub.com\u002FImaginerLabs\u002Fskill-manager\u002Fblob\u002Fmain\u002Fskills\u002Ftesting\u002Fcode-change-test-designer\u002FSKILL.md",[205,206,209,210,211],{"categoryNo":177,"categoryName":178,"taxonomyType":20,"taxonomyTypeDesc":21},{"categoryNo":207,"categoryName":208,"taxonomyType":20,"taxonomyTypeDesc":21},"01JBSEEDCAT000000000000015","视觉设计",{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},{"categoryNo":23,"categoryName":24,"taxonomyType":25,"taxonomyTypeDesc":26},{"categoryNo":212,"categoryName":213,"taxonomyType":25,"taxonomyTypeDesc":26},"01JBSEEDCAT000000000000032","设计师",[187,188,46,215,216,185,217,218,40,219,190,220,192,221,70,222,223,224,119,198],"designer","code change test designer","design","diffs","commit","edge","diff","tests","flows","which",{"skillNo":226,"name":227,"nameZh":6,"description":228,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":6,"repositoryNo":12,"starsCount":13,"licenseSpdxId":14,"licenseFileUrl":6,"sourceHtmlUrl":229,"categories":230,"keywords":232,"publishedAt":48},"01M6QJB195WD7DCJWDMKWKB29S","skill-creator","Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.","https:\u002F\u002Fgithub.com\u002FImaginerLabs\u002Fskill-manager\u002Fblob\u002Fmain\u002Fskills\u002Fmeta-skills\u002Fskill-creator\u002FSKILL.md",[231],{"categoryNo":18,"categoryName":19,"taxonomyType":20,"taxonomyTypeDesc":21},[233,234,235,236,156,237,238,239,240,241,44,242,243,244,70,245,246,116,119,227],"skill creator","creator","performance","run evals","variance analysis","create","run","benchmark","Meta","improve","edit","evals","optimize","existing skill"]