@kata-sh/cli 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +156 -0
- package/dist/app-paths.d.ts +4 -0
- package/dist/app-paths.js +6 -0
- package/dist/cli.d.ts +1 -0
- package/dist/cli.js +56 -0
- package/dist/loader.d.ts +2 -0
- package/dist/loader.js +95 -0
- package/dist/resource-loader.d.ts +18 -0
- package/dist/resource-loader.js +50 -0
- package/dist/wizard.d.ts +15 -0
- package/dist/wizard.js +159 -0
- package/package.json +50 -21
- package/pkg/dist/modes/interactive/theme/dark.json +85 -0
- package/pkg/dist/modes/interactive/theme/light.json +84 -0
- package/pkg/dist/modes/interactive/theme/theme-schema.json +335 -0
- package/pkg/dist/modes/interactive/theme/theme.d.ts +78 -0
- package/pkg/dist/modes/interactive/theme/theme.d.ts.map +1 -0
- package/pkg/dist/modes/interactive/theme/theme.js +949 -0
- package/pkg/dist/modes/interactive/theme/theme.js.map +1 -0
- package/pkg/package.json +8 -0
- package/scripts/postinstall.js +45 -0
- package/src/resources/AGENTS.md +108 -0
- package/src/resources/KATA-WORKFLOW.md +661 -0
- package/src/resources/agents/researcher.md +29 -0
- package/src/resources/agents/scout.md +56 -0
- package/src/resources/agents/worker.md +31 -0
- package/src/resources/extensions/ask-user-questions.ts +200 -0
- package/src/resources/extensions/bg-shell/index.ts +2758 -0
- package/src/resources/extensions/browser-tools/BROWSER-TOOLS-V2-PROPOSAL.md +1277 -0
- package/src/resources/extensions/browser-tools/core.js +1057 -0
- package/src/resources/extensions/browser-tools/index.ts +4916 -0
- package/src/resources/extensions/browser-tools/package.json +20 -0
- package/src/resources/extensions/context7/index.ts +428 -0
- package/src/resources/extensions/context7/package.json +11 -0
- package/src/resources/extensions/get-secrets-from-user.ts +352 -0
- package/src/resources/extensions/github/formatters.ts +207 -0
- package/src/resources/extensions/github/gh-api.ts +537 -0
- package/src/resources/extensions/github/index.ts +778 -0
- package/src/resources/extensions/kata/activity-log.ts +88 -0
- package/src/resources/extensions/kata/auto.ts +2786 -0
- package/src/resources/extensions/kata/commands.ts +355 -0
- package/src/resources/extensions/kata/crash-recovery.ts +85 -0
- package/src/resources/extensions/kata/dashboard-overlay.ts +516 -0
- package/src/resources/extensions/kata/docs/preferences-reference.md +103 -0
- package/src/resources/extensions/kata/doctor.ts +683 -0
- package/src/resources/extensions/kata/files.ts +730 -0
- package/src/resources/extensions/kata/gitignore.ts +165 -0
- package/src/resources/extensions/kata/guided-flow.ts +976 -0
- package/src/resources/extensions/kata/index.ts +556 -0
- package/src/resources/extensions/kata/metrics.ts +397 -0
- package/src/resources/extensions/kata/observability-validator.ts +408 -0
- package/src/resources/extensions/kata/package.json +11 -0
- package/src/resources/extensions/kata/paths.ts +346 -0
- package/src/resources/extensions/kata/preferences.ts +695 -0
- package/src/resources/extensions/kata/prompt-loader.ts +50 -0
- package/src/resources/extensions/kata/prompts/complete-milestone.md +25 -0
- package/src/resources/extensions/kata/prompts/complete-slice.md +27 -0
- package/src/resources/extensions/kata/prompts/discuss.md +151 -0
- package/src/resources/extensions/kata/prompts/doctor-heal.md +29 -0
- package/src/resources/extensions/kata/prompts/execute-task.md +64 -0
- package/src/resources/extensions/kata/prompts/guided-complete-slice.md +1 -0
- package/src/resources/extensions/kata/prompts/guided-discuss-milestone.md +3 -0
- package/src/resources/extensions/kata/prompts/guided-discuss-slice.md +59 -0
- package/src/resources/extensions/kata/prompts/guided-execute-task.md +1 -0
- package/src/resources/extensions/kata/prompts/guided-plan-milestone.md +23 -0
- package/src/resources/extensions/kata/prompts/guided-plan-slice.md +1 -0
- package/src/resources/extensions/kata/prompts/guided-research-slice.md +11 -0
- package/src/resources/extensions/kata/prompts/guided-resume-task.md +1 -0
- package/src/resources/extensions/kata/prompts/plan-milestone.md +47 -0
- package/src/resources/extensions/kata/prompts/plan-slice.md +63 -0
- package/src/resources/extensions/kata/prompts/queue.md +85 -0
- package/src/resources/extensions/kata/prompts/reassess-roadmap.md +48 -0
- package/src/resources/extensions/kata/prompts/replan-slice.md +39 -0
- package/src/resources/extensions/kata/prompts/research-milestone.md +37 -0
- package/src/resources/extensions/kata/prompts/research-slice.md +28 -0
- package/src/resources/extensions/kata/prompts/run-uat.md +109 -0
- package/src/resources/extensions/kata/prompts/system.md +341 -0
- package/src/resources/extensions/kata/session-forensics.ts +550 -0
- package/src/resources/extensions/kata/skill-discovery.ts +137 -0
- package/src/resources/extensions/kata/state.ts +509 -0
- package/src/resources/extensions/kata/templates/context.md +76 -0
- package/src/resources/extensions/kata/templates/decisions.md +8 -0
- package/src/resources/extensions/kata/templates/milestone-summary.md +73 -0
- package/src/resources/extensions/kata/templates/plan.md +133 -0
- package/src/resources/extensions/kata/templates/preferences.md +15 -0
- package/src/resources/extensions/kata/templates/project.md +31 -0
- package/src/resources/extensions/kata/templates/reassessment.md +28 -0
- package/src/resources/extensions/kata/templates/requirements.md +81 -0
- package/src/resources/extensions/kata/templates/research.md +46 -0
- package/src/resources/extensions/kata/templates/roadmap.md +118 -0
- package/src/resources/extensions/kata/templates/slice-context.md +58 -0
- package/src/resources/extensions/kata/templates/slice-summary.md +99 -0
- package/src/resources/extensions/kata/templates/state.md +19 -0
- package/src/resources/extensions/kata/templates/task-plan.md +52 -0
- package/src/resources/extensions/kata/templates/task-summary.md +57 -0
- package/src/resources/extensions/kata/templates/uat.md +54 -0
- package/src/resources/extensions/kata/tests/activity-log-prune.test.ts +327 -0
- package/src/resources/extensions/kata/tests/auto-preflight.test.ts +97 -0
- package/src/resources/extensions/kata/tests/auto-supervisor.test.mjs +53 -0
- package/src/resources/extensions/kata/tests/complete-milestone.test.ts +317 -0
- package/src/resources/extensions/kata/tests/cost-projection.test.ts +160 -0
- package/src/resources/extensions/kata/tests/derive-state-deps.test.ts +477 -0
- package/src/resources/extensions/kata/tests/derive-state.test.ts +1013 -0
- package/src/resources/extensions/kata/tests/doctor.test.ts +718 -0
- package/src/resources/extensions/kata/tests/idle-recovery.test.ts +490 -0
- package/src/resources/extensions/kata/tests/metrics-io.test.ts +254 -0
- package/src/resources/extensions/kata/tests/metrics.test.ts +217 -0
- package/src/resources/extensions/kata/tests/must-have-parser.test.ts +309 -0
- package/src/resources/extensions/kata/tests/parsers.test.ts +1257 -0
- package/src/resources/extensions/kata/tests/plan-milestone.test.ts +185 -0
- package/src/resources/extensions/kata/tests/plan-quality-validator.test.ts +386 -0
- package/src/resources/extensions/kata/tests/reassess-prompt.test.ts +208 -0
- package/src/resources/extensions/kata/tests/replan-slice.test.ts +686 -0
- package/src/resources/extensions/kata/tests/requirements.test.ts +151 -0
- package/src/resources/extensions/kata/tests/resolve-ts-hooks.mjs +17 -0
- package/src/resources/extensions/kata/tests/resolve-ts.mjs +11 -0
- package/src/resources/extensions/kata/tests/run-uat.test.ts +383 -0
- package/src/resources/extensions/kata/tests/unit-runtime.test.ts +388 -0
- package/src/resources/extensions/kata/tests/workspace-index.test.ts +118 -0
- package/src/resources/extensions/kata/tests/worktree.test.ts +222 -0
- package/src/resources/extensions/kata/types.ts +159 -0
- package/src/resources/extensions/kata/unit-runtime.ts +163 -0
- package/src/resources/extensions/kata/workspace-index.ts +203 -0
- package/src/resources/extensions/kata/worktree.ts +182 -0
- package/src/resources/extensions/mac-tools/index.ts +852 -0
- package/src/resources/extensions/mac-tools/swift-cli/Package.swift +22 -0
- package/src/resources/extensions/mac-tools/swift-cli/Sources/main.swift +1318 -0
- package/src/resources/extensions/search-the-web/cache.ts +78 -0
- package/src/resources/extensions/search-the-web/format.ts +258 -0
- package/src/resources/extensions/search-the-web/http.ts +238 -0
- package/src/resources/extensions/search-the-web/index.ts +68 -0
- package/src/resources/extensions/search-the-web/tool-fetch-page.ts +519 -0
- package/src/resources/extensions/search-the-web/tool-llm-context.ts +404 -0
- package/src/resources/extensions/search-the-web/tool-search.ts +503 -0
- package/src/resources/extensions/search-the-web/url-utils.ts +91 -0
- package/src/resources/extensions/shared/confirm-ui.ts +126 -0
- package/src/resources/extensions/shared/interview-ui.ts +822 -0
- package/src/resources/extensions/shared/next-action-ui.ts +235 -0
- package/src/resources/extensions/shared/progress-widget.ts +282 -0
- package/src/resources/extensions/shared/thinking-widget.ts +107 -0
- package/src/resources/extensions/shared/ui.ts +400 -0
- package/src/resources/extensions/shared/wizard-ui.ts +551 -0
- package/src/resources/extensions/slash-commands/audit.ts +92 -0
- package/src/resources/extensions/slash-commands/create-extension.ts +375 -0
- package/src/resources/extensions/slash-commands/create-slash-command.ts +280 -0
- package/src/resources/extensions/slash-commands/index.ts +12 -0
- package/src/resources/extensions/slash-commands/kata-run.ts +34 -0
- package/src/resources/extensions/subagent/agents.ts +126 -0
- package/src/resources/extensions/subagent/index.ts +1293 -0
- package/src/resources/skills/debug-like-expert/SKILL.md +231 -0
- package/src/resources/skills/debug-like-expert/references/debugging-mindset.md +253 -0
- package/src/resources/skills/debug-like-expert/references/hypothesis-testing.md +373 -0
- package/src/resources/skills/debug-like-expert/references/investigation-techniques.md +337 -0
- package/src/resources/skills/debug-like-expert/references/verification-patterns.md +425 -0
- package/src/resources/skills/debug-like-expert/references/when-to-research.md +361 -0
- package/src/resources/skills/frontend-design/SKILL.md +45 -0
- package/src/resources/skills/swiftui/SKILL.md +208 -0
- package/src/resources/skills/swiftui/references/animations.md +921 -0
- package/src/resources/skills/swiftui/references/architecture.md +1561 -0
- package/src/resources/skills/swiftui/references/layout-system.md +1186 -0
- package/src/resources/skills/swiftui/references/navigation.md +1492 -0
- package/src/resources/skills/swiftui/references/networking-async.md +214 -0
- package/src/resources/skills/swiftui/references/performance.md +1706 -0
- package/src/resources/skills/swiftui/references/platform-integration.md +204 -0
- package/src/resources/skills/swiftui/references/state-management.md +1443 -0
- package/src/resources/skills/swiftui/references/swiftdata.md +297 -0
- package/src/resources/skills/swiftui/references/testing-debugging.md +247 -0
- package/src/resources/skills/swiftui/references/uikit-appkit-interop.md +218 -0
- package/src/resources/skills/swiftui/workflows/add-feature.md +191 -0
- package/src/resources/skills/swiftui/workflows/build-new-app.md +311 -0
- package/src/resources/skills/swiftui/workflows/debug-swiftui.md +192 -0
- package/src/resources/skills/swiftui/workflows/optimize-performance.md +197 -0
- package/src/resources/skills/swiftui/workflows/ship-app.md +203 -0
- package/src/resources/skills/swiftui/workflows/write-tests.md +235 -0
- package/dist/commands/task.d.ts +0 -9
- package/dist/commands/task.d.ts.map +0 -1
- package/dist/commands/task.js +0 -129
- package/dist/commands/task.js.map +0 -1
- package/dist/commands/task.test.d.ts +0 -2
- package/dist/commands/task.test.d.ts.map +0 -1
- package/dist/commands/task.test.js +0 -169
- package/dist/commands/task.test.js.map +0 -1
- package/dist/e2e/task-e2e.test.d.ts +0 -2
- package/dist/e2e/task-e2e.test.d.ts.map +0 -1
- package/dist/e2e/task-e2e.test.js +0 -173
- package/dist/e2e/task-e2e.test.js.map +0 -1
- package/dist/index.d.ts +0 -3
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -93
- package/dist/index.js.map +0 -1
- package/dist/slug.d.ts +0 -2
- package/dist/slug.d.ts.map +0 -1
- package/dist/slug.js +0 -12
- package/dist/slug.js.map +0 -1
- package/dist/slug.test.d.ts +0 -2
- package/dist/slug.test.d.ts.map +0 -1
- package/dist/slug.test.js +0 -32
- package/dist/slug.test.js.map +0 -1
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: debug-like-expert
|
|
3
|
+
description: Deep analysis debugging mode for complex issues. Activates methodical investigation protocol with evidence gathering, hypothesis testing, and rigorous verification. Use when standard troubleshooting fails or when issues require systematic root cause analysis.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<objective>
|
|
7
|
+
Deep analysis debugging mode for complex issues. This skill activates methodical investigation protocols with evidence gathering, hypothesis testing, and rigorous verification when standard troubleshooting has failed.
|
|
8
|
+
|
|
9
|
+
The skill emphasizes treating code you wrote with MORE skepticism than unfamiliar code, as cognitive biases about "how it should work" can blind you to actual implementation errors. Use scientific method to systematically identify root causes rather than applying quick fixes.
|
|
10
|
+
</objective>
|
|
11
|
+
|
|
12
|
+
<context>
|
|
13
|
+
This skill activates when standard troubleshooting has failed. The issue requires methodical investigation, not quick fixes. You are entering the mindset of a senior engineer who debugs with scientific rigor.
|
|
14
|
+
|
|
15
|
+
**Important**: If you wrote or modified any of the code being debugged, you have cognitive biases about how it works. Your mental model of "how it should work" may be wrong. Treat code you wrote with MORE skepticism than unfamiliar code - you're blind to your own assumptions.
|
|
16
|
+
</context>
|
|
17
|
+
|
|
18
|
+
<core_principle>
|
|
19
|
+
**VERIFY, DON'T ASSUME.** Every hypothesis must be tested. Every "fix" must be validated. No solutions without evidence.
|
|
20
|
+
|
|
21
|
+
**ESPECIALLY**: Code you designed or implemented is guilty until proven innocent. Your intent doesn't matter - only the code's actual behavior matters. Question your own design decisions as rigorously as you'd question anyone else's.
|
|
22
|
+
</core_principle>
|
|
23
|
+
|
|
24
|
+
<analysis_only_rule>
|
|
25
|
+
**THIS SKILL IS READ-ONLY. DO NOT MODIFY CODE.**
|
|
26
|
+
|
|
27
|
+
The entire purpose is deep analysis and diagnosis. Making changes during investigation:
|
|
28
|
+
- Pollutes the evidence
|
|
29
|
+
- Introduces new variables
|
|
30
|
+
- Makes root cause harder to isolate
|
|
31
|
+
|
|
32
|
+
You are a diagnostician, not a surgeon. Present findings, then let the user decide.
|
|
33
|
+
</analysis_only_rule>
|
|
34
|
+
|
|
35
|
+
<quick_start>
|
|
36
|
+
|
|
37
|
+
<evidence_gathering>
|
|
38
|
+
|
|
39
|
+
Before proposing any solution:
|
|
40
|
+
|
|
41
|
+
**A. Document Current State**
|
|
42
|
+
- What is the EXACT error message or unexpected behavior?
|
|
43
|
+
- What are the EXACT steps to reproduce?
|
|
44
|
+
- What is the ACTUAL output vs EXPECTED output?
|
|
45
|
+
- When did this start working incorrectly (if known)?
|
|
46
|
+
|
|
47
|
+
**B. Map the System**
|
|
48
|
+
- Trace the execution path from entry point to failure point
|
|
49
|
+
- Identify all components involved
|
|
50
|
+
- Read relevant source files completely, not just scanning
|
|
51
|
+
- Note dependencies, imports, configurations affecting this area
|
|
52
|
+
|
|
53
|
+
**C. Gather External Knowledge (when needed)**
|
|
54
|
+
- Use MCP servers for API documentation, library details, or domain knowledge
|
|
55
|
+
- Use web search for error messages, framework-specific behaviors, or recent changes
|
|
56
|
+
- Check official docs for intended behavior vs what you observe
|
|
57
|
+
- Look for known issues, breaking changes, or version-specific quirks
|
|
58
|
+
|
|
59
|
+
See [references/when-to-research.md](references/when-to-research.md) for detailed guidance on research strategy.
|
|
60
|
+
|
|
61
|
+
</evidence_gathering>
|
|
62
|
+
|
|
63
|
+
<root_cause_analysis>
|
|
64
|
+
|
|
65
|
+
**A. Form Hypotheses**
|
|
66
|
+
|
|
67
|
+
Based on evidence, list possible causes:
|
|
68
|
+
1. [Hypothesis 1] - because [specific evidence]
|
|
69
|
+
2. [Hypothesis 2] - because [specific evidence]
|
|
70
|
+
3. [Hypothesis 3] - because [specific evidence]
|
|
71
|
+
|
|
72
|
+
**B. Test Each Hypothesis**
|
|
73
|
+
|
|
74
|
+
For each hypothesis:
|
|
75
|
+
- What would prove this true?
|
|
76
|
+
- What would prove this false?
|
|
77
|
+
- Design a minimal test
|
|
78
|
+
- Execute and document results
|
|
79
|
+
|
|
80
|
+
See [references/hypothesis-testing.md](references/hypothesis-testing.md) for scientific method application.
|
|
81
|
+
|
|
82
|
+
**C. Eliminate or Confirm**
|
|
83
|
+
|
|
84
|
+
Don't move forward until you can answer:
|
|
85
|
+
- Which hypothesis is supported by evidence?
|
|
86
|
+
- What evidence contradicts other hypotheses?
|
|
87
|
+
- What additional information is needed?
|
|
88
|
+
|
|
89
|
+
</root_cause_analysis>
|
|
90
|
+
|
|
91
|
+
<solution_proposal>
|
|
92
|
+
|
|
93
|
+
**Only after confirming root cause:**
|
|
94
|
+
|
|
95
|
+
**A. Design Recommended Fix**
|
|
96
|
+
- What is the MINIMAL change that would address the root cause?
|
|
97
|
+
- What are potential side effects?
|
|
98
|
+
- What could this break?
|
|
99
|
+
- What tests should run after implementation?
|
|
100
|
+
|
|
101
|
+
**B. Document, Don't Implement**
|
|
102
|
+
- Describe the fix with enough detail for implementation
|
|
103
|
+
- Include specific file paths, line numbers, and code snippets
|
|
104
|
+
- Explain WHY this addresses the root cause
|
|
105
|
+
- Note any prerequisites or dependencies
|
|
106
|
+
|
|
107
|
+
**DO NOT make any code changes. Present your recommendations only.**
|
|
108
|
+
|
|
109
|
+
See [references/verification-patterns.md](references/verification-patterns.md) for verification approaches to use after implementation.
|
|
110
|
+
|
|
111
|
+
</solution_proposal>
|
|
112
|
+
|
|
113
|
+
</quick_start>
|
|
114
|
+
|
|
115
|
+
<critical_rules>
|
|
116
|
+
|
|
117
|
+
1. **NO DRIVE-BY FIXES**: If you can't explain WHY a change works, don't make it
|
|
118
|
+
2. **VERIFY EVERYTHING**: Test your assumptions. Read the actual code. Check the actual behavior
|
|
119
|
+
3. **USE ALL TOOLS**:
|
|
120
|
+
- MCP servers for external knowledge
|
|
121
|
+
- Web search for error messages, docs, known issues
|
|
122
|
+
- Extended thinking ("think deeply") for complex reasoning
|
|
123
|
+
- File reading for complete context
|
|
124
|
+
4. **THINK OUT LOUD**: Document your reasoning at each step
|
|
125
|
+
5. **ONE VARIABLE**: Change one thing at a time, verify, then proceed
|
|
126
|
+
6. **COMPLETE READS**: Don't skim code. Read entire relevant files
|
|
127
|
+
7. **CHASE DEPENDENCIES**: If the issue involves libraries, configs, or external systems, investigate those too
|
|
128
|
+
8. **QUESTION PREVIOUS WORK**: Maybe the earlier "fix" was wrong. Re-examine with fresh eyes
|
|
129
|
+
|
|
130
|
+
</critical_rules>
|
|
131
|
+
|
|
132
|
+
<success_criteria>
|
|
133
|
+
|
|
134
|
+
Before completing:
|
|
135
|
+
- [ ] Do you understand WHY the issue occurred?
|
|
136
|
+
- [ ] Have you identified a root cause with evidence?
|
|
137
|
+
- [ ] Have you documented your reasoning?
|
|
138
|
+
- [ ] Can you explain the issue to someone else?
|
|
139
|
+
- [ ] Is your recommended fix specific and actionable?
|
|
140
|
+
|
|
141
|
+
If you can't answer "yes" to all of these, keep investigating.
|
|
142
|
+
|
|
143
|
+
**CRITICAL**: Present findings via decision gate. Do NOT implement changes.
|
|
144
|
+
|
|
145
|
+
</success_criteria>
|
|
146
|
+
|
|
147
|
+
<output_format>
|
|
148
|
+
|
|
149
|
+
```markdown
|
|
150
|
+
## Issue: [Problem Description]
|
|
151
|
+
|
|
152
|
+
### Evidence
|
|
153
|
+
[What you observed - exact errors, behaviors, outputs]
|
|
154
|
+
|
|
155
|
+
### Investigation
|
|
156
|
+
[What you checked, what you found, what you ruled out]
|
|
157
|
+
|
|
158
|
+
### Root Cause
|
|
159
|
+
[The actual underlying problem with evidence]
|
|
160
|
+
|
|
161
|
+
### Recommended Fix
|
|
162
|
+
[What SHOULD be changed and WHY - specific files, lines, code]
|
|
163
|
+
|
|
164
|
+
### Verification Plan
|
|
165
|
+
[How to confirm the fix works after implementation]
|
|
166
|
+
|
|
167
|
+
### Risk Assessment
|
|
168
|
+
[Potential side effects, what could break, confidence level]
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
</output_format>
|
|
172
|
+
|
|
173
|
+
<advanced_topics>
|
|
174
|
+
|
|
175
|
+
For deeper topics, see reference files:
|
|
176
|
+
|
|
177
|
+
**Debugging mindset**: [references/debugging-mindset.md](references/debugging-mindset.md)
|
|
178
|
+
- First principles thinking applied to debugging
|
|
179
|
+
- Cognitive biases that lead to bad fixes
|
|
180
|
+
- The discipline of systematic investigation
|
|
181
|
+
- When to stop and restart with fresh assumptions
|
|
182
|
+
|
|
183
|
+
**Investigation techniques**: [references/investigation-techniques.md](references/investigation-techniques.md)
|
|
184
|
+
- Binary search / divide and conquer
|
|
185
|
+
- Rubber duck debugging
|
|
186
|
+
- Minimal reproduction
|
|
187
|
+
- Working backwards from desired state
|
|
188
|
+
- Adding observability before changing code
|
|
189
|
+
|
|
190
|
+
**Hypothesis testing**: [references/hypothesis-testing.md](references/hypothesis-testing.md)
|
|
191
|
+
- Forming falsifiable hypotheses
|
|
192
|
+
- Designing experiments that prove/disprove
|
|
193
|
+
- What makes evidence strong vs weak
|
|
194
|
+
- Recovering from wrong hypotheses gracefully
|
|
195
|
+
|
|
196
|
+
**Verification patterns**: [references/verification-patterns.md](references/verification-patterns.md)
|
|
197
|
+
- Definition of "verified" (not just "it ran")
|
|
198
|
+
- Testing reproduction steps
|
|
199
|
+
- Regression testing adjacent functionality
|
|
200
|
+
- When to write tests before fixing
|
|
201
|
+
|
|
202
|
+
**Research strategy**: [references/when-to-research.md](references/when-to-research.md)
|
|
203
|
+
- Signals that you need external knowledge
|
|
204
|
+
- What to search for vs what to reason about
|
|
205
|
+
- Balancing research time vs experimentation
|
|
206
|
+
|
|
207
|
+
</advanced_topics>
|
|
208
|
+
|
|
209
|
+
<decision_gate>
|
|
210
|
+
|
|
211
|
+
**After presenting findings, ALWAYS offer these options:**
|
|
212
|
+
|
|
213
|
+
```
|
|
214
|
+
─────────────────────────────────────────
|
|
215
|
+
ANALYSIS COMPLETE
|
|
216
|
+
|
|
217
|
+
What would you like to do?
|
|
218
|
+
|
|
219
|
+
1. **Fix it now** - I'll implement the recommended changes
|
|
220
|
+
2. **Create findings document** - Save analysis to a markdown file
|
|
221
|
+
3. **Explore further** - Investigate additional hypotheses
|
|
222
|
+
4. **Get second opinion** - Review with different assumptions
|
|
223
|
+
5. **Other** - Tell me what you need
|
|
224
|
+
─────────────────────────────────────────
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
**Wait for user response before taking any action.**
|
|
228
|
+
|
|
229
|
+
This gate is MANDATORY. Never skip it. Never auto-implement.
|
|
230
|
+
|
|
231
|
+
</decision_gate>
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
<philosophy>
|
|
2
|
+
Debugging is applied epistemology. You're investigating a system to discover truth about its behavior. The difference between junior and senior debugging is not knowledge of frameworks - it's the discipline of systematic investigation.
|
|
3
|
+
</philosophy>
|
|
4
|
+
|
|
5
|
+
<meta_debugging>
|
|
6
|
+
**Special challenge**: When you're debugging code you wrote or modified, you're fighting your own mental model.
|
|
7
|
+
|
|
8
|
+
**Why this is harder**:
|
|
9
|
+
- You made the design decisions - they feel obviously correct
|
|
10
|
+
- You remember your intent, not what you actually implemented
|
|
11
|
+
- You see what you meant to write, not what's there
|
|
12
|
+
- Familiarity breeds blindness to bugs
|
|
13
|
+
|
|
14
|
+
**The trap**:
|
|
15
|
+
- "I know this works because I implemented it correctly"
|
|
16
|
+
- "The bug must be elsewhere - I designed this part"
|
|
17
|
+
- "I tested this approach"
|
|
18
|
+
- These thoughts are red flags. Code you wrote is guilty until proven innocent.
|
|
19
|
+
|
|
20
|
+
**The discipline**:
|
|
21
|
+
|
|
22
|
+
**1. Treat your own code as foreign**
|
|
23
|
+
- Read it as if someone else wrote it
|
|
24
|
+
- Don't assume it does what you intended
|
|
25
|
+
- Verify what it actually does, not what you think it does
|
|
26
|
+
- Fresh eyes see bugs; familiar eyes see intent
|
|
27
|
+
|
|
28
|
+
**2. Question your own design decisions**
|
|
29
|
+
- "I chose approach X because..." - Was that reasoning sound?
|
|
30
|
+
- "I assumed Y would..." - Have you verified Y actually does that?
|
|
31
|
+
- Your implementation decisions are hypotheses, not facts
|
|
32
|
+
|
|
33
|
+
**3. Admit your mental model might be wrong**
|
|
34
|
+
- You built a mental model of how this works
|
|
35
|
+
- That model might be incomplete or incorrect
|
|
36
|
+
- The code's behavior is truth; your model is just a guess
|
|
37
|
+
- Be willing to discover you misunderstood the problem
|
|
38
|
+
|
|
39
|
+
**4. Prioritize code you touched**
|
|
40
|
+
- If you modified 100 lines and something breaks
|
|
41
|
+
- Those 100 lines are the prime suspects
|
|
42
|
+
- Don't assume the bug is in the framework or existing code
|
|
43
|
+
- Start investigating where you made changes
|
|
44
|
+
|
|
45
|
+
<example>
|
|
46
|
+
❌ "I implemented the auth flow correctly, the bug must be in the existing user service"
|
|
47
|
+
|
|
48
|
+
✅ "I implemented the auth flow. Let me verify each part:
|
|
49
|
+
- Does login actually set the token? [test it]
|
|
50
|
+
- Does the middleware actually validate it? [test it]
|
|
51
|
+
- Does logout actually clear it? [test it]
|
|
52
|
+
- One of these is probably wrong"
|
|
53
|
+
|
|
54
|
+
The second approach found that logout wasn't clearing the token from localStorage, only from memory.
|
|
55
|
+
</example>
|
|
56
|
+
|
|
57
|
+
**The hardest admission**: "I implemented this wrong."
|
|
58
|
+
|
|
59
|
+
Not "the requirements were unclear" or "the library is confusing" - YOU made an error. Whether it was 5 minutes ago or 5 days ago doesn't matter. Your code, your responsibility, your bug to find.
|
|
60
|
+
|
|
61
|
+
This intellectual honesty is the difference between debugging for hours and finding bugs quickly.
|
|
62
|
+
</meta_debugging>
|
|
63
|
+
|
|
64
|
+
<foundation>
|
|
65
|
+
When debugging, return to foundational truths:
|
|
66
|
+
|
|
67
|
+
**What do you know for certain?**
|
|
68
|
+
- What have you directly observed (not assumed)?
|
|
69
|
+
- What can you prove with a test right now?
|
|
70
|
+
- What is speculation vs evidence?
|
|
71
|
+
|
|
72
|
+
**What are you assuming?**
|
|
73
|
+
- "This library should work this way" - Have you verified?
|
|
74
|
+
- "The docs say X" - Have you tested that X actually happens?
|
|
75
|
+
- "This worked before" - Can you prove when it worked and what changed?
|
|
76
|
+
|
|
77
|
+
Strip away everything you think you know. Build understanding from observable facts.
|
|
78
|
+
</foundation>
|
|
79
|
+
|
|
80
|
+
<example>
|
|
81
|
+
❌ "React state updates should be synchronous here"
|
|
82
|
+
✅ "Let me add a console.log to observe when state actually updates"
|
|
83
|
+
|
|
84
|
+
❌ "The API must be returning bad data"
|
|
85
|
+
✅ "Let me log the exact response payload to see what's actually being returned"
|
|
86
|
+
|
|
87
|
+
❌ "This database query should be fast"
|
|
88
|
+
✅ "Let me run EXPLAIN to see the actual execution plan"
|
|
89
|
+
</example>
|
|
90
|
+
|
|
91
|
+
<cognitive_biases>
|
|
92
|
+
|
|
93
|
+
<bias name="confirmation_bias">
|
|
94
|
+
**The problem**: You form a hypothesis and only look for evidence that confirms it.
|
|
95
|
+
|
|
96
|
+
**The trap**: "I think it's a race condition" → You only look for async code, missing the actual typo in a variable name.
|
|
97
|
+
|
|
98
|
+
**The antidote**: Actively seek evidence that disproves your hypothesis. Ask "What would prove me wrong?"
|
|
99
|
+
</bias>
|
|
100
|
+
|
|
101
|
+
<bias name="anchoring">
|
|
102
|
+
**The problem**: The first explanation you encounter becomes your anchor, and you adjust from there instead of considering alternatives.
|
|
103
|
+
|
|
104
|
+
**The trap**: Error message mentions "timeout" → You assume it's a network issue, when it's actually a deadlock.
|
|
105
|
+
|
|
106
|
+
**The antidote**: Generate multiple independent hypotheses before investigating any single one. Force yourself to list 3+ possible causes.
|
|
107
|
+
</bias>
|
|
108
|
+
|
|
109
|
+
<bias name="availability_heuristic">
|
|
110
|
+
**The problem**: You remember recent bugs and assume similar symptoms mean the same cause.
|
|
111
|
+
|
|
112
|
+
**The trap**: "We had a caching issue last week, this must be caching too."
|
|
113
|
+
|
|
114
|
+
**The antidote**: Treat each bug as novel until evidence suggests otherwise. Recent memory is not evidence.
|
|
115
|
+
</bias>
|
|
116
|
+
|
|
117
|
+
<bias name="sunk_cost_fallacy">
|
|
118
|
+
**The problem**: You've spent 2 hours debugging down one path, so you keep going even when evidence suggests it's wrong.
|
|
119
|
+
|
|
120
|
+
**The trap**: "I've almost figured out this state management issue" - when the actual bug is in the API layer.
|
|
121
|
+
|
|
122
|
+
**The antidote**: Set checkpoints. Every 30 minutes, ask: "If I started fresh right now, is this still the path I'd take?"
|
|
123
|
+
</bias>
|
|
124
|
+
|
|
125
|
+
</cognitive_biases>
|
|
126
|
+
|
|
127
|
+
<systematic_investigation>
|
|
128
|
+
|
|
129
|
+
<discipline name="change_one_variable">
|
|
130
|
+
**Why it matters**: If you change multiple things at once, you don't know which one fixed (or broke) it.
|
|
131
|
+
|
|
132
|
+
**In practice**:
|
|
133
|
+
1. Make one change
|
|
134
|
+
2. Test
|
|
135
|
+
3. Observe result
|
|
136
|
+
4. Document
|
|
137
|
+
5. Repeat
|
|
138
|
+
|
|
139
|
+
**The temptation**: "Let me also update this dependency and refactor this function and change this config..."
|
|
140
|
+
|
|
141
|
+
**The reality**: Now you have no idea what actually mattered.
|
|
142
|
+
</discipline>
|
|
143
|
+
|
|
144
|
+
<discipline name="complete_reading">
|
|
145
|
+
**Why it matters**: Skimming code causes you to miss crucial details. You see what you expect to see, not what's there.
|
|
146
|
+
|
|
147
|
+
**In practice**:
|
|
148
|
+
- Read entire functions, not just the "relevant" lines
|
|
149
|
+
- Read imports and dependencies
|
|
150
|
+
- Read configuration files completely
|
|
151
|
+
- Read test files to understand intended behavior
|
|
152
|
+
|
|
153
|
+
**The shortcut**: "This function is long, I'll just read the part where the error happens"
|
|
154
|
+
|
|
155
|
+
**The miss**: The bug is actually in how the function is called 50 lines up.
|
|
156
|
+
</discipline>
|
|
157
|
+
|
|
158
|
+
<discipline name="embrace_not_knowing">
|
|
159
|
+
**Why it matters**: Premature certainty stops investigation. "I don't know" is a position of strength.
|
|
160
|
+
|
|
161
|
+
**In practice**:
|
|
162
|
+
- "I don't know why this fails" - Good. Now you can investigate.
|
|
163
|
+
- "It must be X" - Dangerous. You've stopped thinking.
|
|
164
|
+
|
|
165
|
+
**The pressure**: Users want answers. Managers want ETAs. Your ego wants to look smart.
|
|
166
|
+
|
|
167
|
+
**The truth**: "I need to investigate further" is more professional than a wrong fix.
|
|
168
|
+
</discipline>
|
|
169
|
+
|
|
170
|
+
</systematic_investigation>
|
|
171
|
+
|
|
172
|
+
<when_to_restart>
|
|
173
|
+
|
|
174
|
+
<restart_signals>
|
|
175
|
+
You should consider starting over when:
|
|
176
|
+
|
|
177
|
+
1. **You've been investigating for 2+ hours with no progress**
|
|
178
|
+
- You're likely tunnel-visioned
|
|
179
|
+
- Take a break, then restart from evidence gathering
|
|
180
|
+
|
|
181
|
+
2. **You've made 3+ "fixes" that didn't work**
|
|
182
|
+
- Your mental model is wrong
|
|
183
|
+
- Go back to first principles
|
|
184
|
+
|
|
185
|
+
3. **You can't explain the current behavior**
|
|
186
|
+
- Don't add more changes on top of confusion
|
|
187
|
+
- First understand what's happening, then fix it
|
|
188
|
+
|
|
189
|
+
4. **You're debugging the debugger**
|
|
190
|
+
- "Is my logging broken? Is the debugger lying?"
|
|
191
|
+
- Step back. Something fundamental is wrong.
|
|
192
|
+
|
|
193
|
+
5. **The fix works but you don't know why**
|
|
194
|
+
- This isn't fixed. This is luck.
|
|
195
|
+
- Investigate until you understand, or revert the change
|
|
196
|
+
</restart_signals>
|
|
197
|
+
|
|
198
|
+
<restart_protocol>
|
|
199
|
+
When restarting:
|
|
200
|
+
|
|
201
|
+
1. **Close all files and terminals**
|
|
202
|
+
2. **Write down what you know for certain** (not what you think)
|
|
203
|
+
3. **Write down what you've ruled out**
|
|
204
|
+
4. **List new hypotheses** (different from before)
|
|
205
|
+
5. **Begin again from Phase 1: Evidence Gathering**
|
|
206
|
+
|
|
207
|
+
This isn't failure. This is professionalism.
|
|
208
|
+
</restart_protocol>
|
|
209
|
+
|
|
210
|
+
</when_to_restart>
|
|
211
|
+
|
|
212
|
+
<humility>
|
|
213
|
+
The best debuggers have deep humility about their mental models:
|
|
214
|
+
|
|
215
|
+
**They know**:
|
|
216
|
+
- Their understanding of the system is incomplete
|
|
217
|
+
- Documentation can be wrong or outdated
|
|
218
|
+
- Their memory of "how this works" may be faulty
|
|
219
|
+
- The system's behavior is the only truth
|
|
220
|
+
|
|
221
|
+
**They don't**:
|
|
222
|
+
- Trust their first instinct
|
|
223
|
+
- Assume anything works as designed
|
|
224
|
+
- Skip verification steps
|
|
225
|
+
- Declare victory without proof
|
|
226
|
+
|
|
227
|
+
**They ask**:
|
|
228
|
+
- "What am I missing?"
|
|
229
|
+
- "What am I wrong about?"
|
|
230
|
+
- "What haven't I tested?"
|
|
231
|
+
- "What does the evidence actually say?"
|
|
232
|
+
</humility>
|
|
233
|
+
|
|
234
|
+
<craft>
|
|
235
|
+
Debugging is a craft that improves with practice:
|
|
236
|
+
|
|
237
|
+
**Novice debuggers**:
|
|
238
|
+
- Try random things hoping something works
|
|
239
|
+
- Skip reading code carefully
|
|
240
|
+
- Don't test their hypotheses
|
|
241
|
+
- Declare success too early
|
|
242
|
+
|
|
243
|
+
**Expert debuggers**:
|
|
244
|
+
- Form hypotheses explicitly
|
|
245
|
+
- Test hypotheses systematically
|
|
246
|
+
- Read code like literature
|
|
247
|
+
- Verify fixes rigorously
|
|
248
|
+
- Learn from each investigation
|
|
249
|
+
|
|
250
|
+
**The difference**: Not intelligence. Not knowledge. Discipline.
|
|
251
|
+
|
|
252
|
+
Practice the discipline of systematic investigation, and debugging becomes a strength.
|
|
253
|
+
</craft>
|