@neyugn/agent-kits 0.1.0

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.
Files changed (158) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +514 -0
  3. package/README.vi.md +410 -0
  4. package/README.zh.md +410 -0
  5. package/dist/cli.d.ts +1 -0
  6. package/dist/cli.js +422 -0
  7. package/kits/coder/ARCHITECTURE.md +289 -0
  8. package/kits/coder/agents/ai-engineer.md +344 -0
  9. package/kits/coder/agents/backend-specialist.md +270 -0
  10. package/kits/coder/agents/cloud-architect.md +363 -0
  11. package/kits/coder/agents/code-reviewer.md +284 -0
  12. package/kits/coder/agents/data-engineer.md +401 -0
  13. package/kits/coder/agents/database-specialist.md +251 -0
  14. package/kits/coder/agents/debugger.md +209 -0
  15. package/kits/coder/agents/devops-engineer.md +281 -0
  16. package/kits/coder/agents/documentation-writer.md +296 -0
  17. package/kits/coder/agents/frontend-specialist.md +298 -0
  18. package/kits/coder/agents/i18n-specialist.md +348 -0
  19. package/kits/coder/agents/integration-specialist.md +314 -0
  20. package/kits/coder/agents/mobile-developer.md +271 -0
  21. package/kits/coder/agents/multi-tenant-architect.md +281 -0
  22. package/kits/coder/agents/orchestrator.md +263 -0
  23. package/kits/coder/agents/performance-analyst.md +327 -0
  24. package/kits/coder/agents/project-planner.md +277 -0
  25. package/kits/coder/agents/queue-specialist.md +282 -0
  26. package/kits/coder/agents/realtime-specialist.md +267 -0
  27. package/kits/coder/agents/security-auditor.md +253 -0
  28. package/kits/coder/agents/test-engineer.md +315 -0
  29. package/kits/coder/agents/ux-researcher.md +388 -0
  30. package/kits/coder/rules/.cursorrules +287 -0
  31. package/kits/coder/rules/CLAUDE.md +287 -0
  32. package/kits/coder/rules/CODEX.md +287 -0
  33. package/kits/coder/rules/GEMINI.md +287 -0
  34. package/kits/coder/scripts/checklist.py +318 -0
  35. package/kits/coder/scripts/kit_status.py +292 -0
  36. package/kits/coder/scripts/skills_manager.py +243 -0
  37. package/kits/coder/scripts/verify_all.py +391 -0
  38. package/kits/coder/skills/accessibility-patterns/SKILL.md +372 -0
  39. package/kits/coder/skills/accessibility-patterns/scripts/a11y_checker.py +211 -0
  40. package/kits/coder/skills/ai-rag-patterns/SKILL.md +444 -0
  41. package/kits/coder/skills/api-patterns/SKILL.md +316 -0
  42. package/kits/coder/skills/api-patterns/assets/.gitkeep +1 -0
  43. package/kits/coder/skills/api-patterns/references/deep-dive.md +21 -0
  44. package/kits/coder/skills/api-patterns/scripts/api_validator.py +253 -0
  45. package/kits/coder/skills/api-patterns/scripts/validate.py +56 -0
  46. package/kits/coder/skills/auth-patterns/SKILL.md +267 -0
  47. package/kits/coder/skills/aws-patterns/SKILL.md +576 -0
  48. package/kits/coder/skills/brainstorming/SKILL.md +370 -0
  49. package/kits/coder/skills/brainstorming/assets/.gitkeep +1 -0
  50. package/kits/coder/skills/brainstorming/references/deep-dive.md +21 -0
  51. package/kits/coder/skills/brainstorming/scripts/validate.py +56 -0
  52. package/kits/coder/skills/clean-code/SKILL.md +240 -0
  53. package/kits/coder/skills/clean-code/assets/.gitkeep +1 -0
  54. package/kits/coder/skills/clean-code/references/deep-dive.md +21 -0
  55. package/kits/coder/skills/clean-code/scripts/lint_runner.py +186 -0
  56. package/kits/coder/skills/clean-code/scripts/validate.py +56 -0
  57. package/kits/coder/skills/database-design/SKILL.md +255 -0
  58. package/kits/coder/skills/database-design/assets/.gitkeep +1 -0
  59. package/kits/coder/skills/database-design/references/deep-dive.md +21 -0
  60. package/kits/coder/skills/database-design/scripts/schema_validator.py +272 -0
  61. package/kits/coder/skills/database-design/scripts/validate.py +56 -0
  62. package/kits/coder/skills/docker-patterns/SKILL.md +240 -0
  63. package/kits/coder/skills/documentation-templates/SKILL.md +441 -0
  64. package/kits/coder/skills/e2e-testing/SKILL.md +457 -0
  65. package/kits/coder/skills/flutter-patterns/SKILL.md +330 -0
  66. package/kits/coder/skills/frontend-design/SKILL.md +127 -0
  67. package/kits/coder/skills/github-actions/SKILL.md +349 -0
  68. package/kits/coder/skills/gitlab-ci-patterns/SKILL.md +466 -0
  69. package/kits/coder/skills/graphql-patterns/SKILL.md +558 -0
  70. package/kits/coder/skills/i18n-localization/SKILL.md +345 -0
  71. package/kits/coder/skills/i18n-localization/scripts/i18n_checker.py +267 -0
  72. package/kits/coder/skills/kubernetes-patterns/SKILL.md +357 -0
  73. package/kits/coder/skills/mermaid-diagrams/SKILL.md +351 -0
  74. package/kits/coder/skills/mobile-design/SKILL.md +305 -0
  75. package/kits/coder/skills/monitoring-observability/SKILL.md +458 -0
  76. package/kits/coder/skills/multi-tenancy/SKILL.md +317 -0
  77. package/kits/coder/skills/multi-tenancy/assets/.gitkeep +1 -0
  78. package/kits/coder/skills/multi-tenancy/references/deep-dive.md +21 -0
  79. package/kits/coder/skills/multi-tenancy/scripts/validate.py +56 -0
  80. package/kits/coder/skills/nodejs-best-practices/SKILL.md +220 -0
  81. package/kits/coder/skills/performance-profiling/SKILL.md +333 -0
  82. package/kits/coder/skills/performance-profiling/assets/.gitkeep +1 -0
  83. package/kits/coder/skills/performance-profiling/references/deep-dive.md +21 -0
  84. package/kits/coder/skills/performance-profiling/scripts/validate.py +56 -0
  85. package/kits/coder/skills/plan-writing/SKILL.md +360 -0
  86. package/kits/coder/skills/plan-writing/assets/.gitkeep +1 -0
  87. package/kits/coder/skills/plan-writing/references/deep-dive.md +21 -0
  88. package/kits/coder/skills/plan-writing/scripts/validate.py +56 -0
  89. package/kits/coder/skills/postgres-patterns/SKILL.md +361 -0
  90. package/kits/coder/skills/prompt-engineering/SKILL.md +277 -0
  91. package/kits/coder/skills/queue-patterns/SKILL.md +359 -0
  92. package/kits/coder/skills/queue-patterns/assets/.gitkeep +1 -0
  93. package/kits/coder/skills/queue-patterns/references/deep-dive.md +21 -0
  94. package/kits/coder/skills/queue-patterns/scripts/validate.py +56 -0
  95. package/kits/coder/skills/react-native-patterns/SKILL.md +393 -0
  96. package/kits/coder/skills/react-patterns/SKILL.md +319 -0
  97. package/kits/coder/skills/realtime-patterns/SKILL.md +506 -0
  98. package/kits/coder/skills/realtime-patterns/assets/.gitkeep +1 -0
  99. package/kits/coder/skills/realtime-patterns/references/deep-dive.md +21 -0
  100. package/kits/coder/skills/realtime-patterns/scripts/validate.py +56 -0
  101. package/kits/coder/skills/redis-patterns/SKILL.md +484 -0
  102. package/kits/coder/skills/security-fundamentals/SKILL.md +363 -0
  103. package/kits/coder/skills/security-fundamentals/assets/.gitkeep +1 -0
  104. package/kits/coder/skills/security-fundamentals/references/deep-dive.md +21 -0
  105. package/kits/coder/skills/security-fundamentals/scripts/security_scan.py +326 -0
  106. package/kits/coder/skills/security-fundamentals/scripts/validate.py +56 -0
  107. package/kits/coder/skills/seo-patterns/SKILL.md +262 -0
  108. package/kits/coder/skills/seo-patterns/scripts/seo_checker.py +211 -0
  109. package/kits/coder/skills/systematic-debugging/SKILL.md +478 -0
  110. package/kits/coder/skills/systematic-debugging/assets/.gitkeep +1 -0
  111. package/kits/coder/skills/systematic-debugging/references/deep-dive.md +21 -0
  112. package/kits/coder/skills/systematic-debugging/scripts/validate.py +56 -0
  113. package/kits/coder/skills/tailwind-patterns/SKILL.md +395 -0
  114. package/kits/coder/skills/terraform-patterns/SKILL.md +470 -0
  115. package/kits/coder/skills/testing-patterns/SKILL.md +285 -0
  116. package/kits/coder/skills/testing-patterns/assets/.gitkeep +1 -0
  117. package/kits/coder/skills/testing-patterns/references/deep-dive.md +21 -0
  118. package/kits/coder/skills/testing-patterns/scripts/test_runner.py +219 -0
  119. package/kits/coder/skills/testing-patterns/scripts/validate.py +56 -0
  120. package/kits/coder/skills/typescript-patterns/SKILL.md +417 -0
  121. package/kits/coder/skills/ui-ux-pro-max/SKILL.md +364 -0
  122. package/kits/coder/skills/ui-ux-pro-max/data/charts.csv +26 -0
  123. package/kits/coder/skills/ui-ux-pro-max/data/colors.csv +97 -0
  124. package/kits/coder/skills/ui-ux-pro-max/data/icons.csv +101 -0
  125. package/kits/coder/skills/ui-ux-pro-max/data/landing.csv +31 -0
  126. package/kits/coder/skills/ui-ux-pro-max/data/products.csv +97 -0
  127. package/kits/coder/skills/ui-ux-pro-max/data/prompts.csv +24 -0
  128. package/kits/coder/skills/ui-ux-pro-max/data/react-performance.csv +45 -0
  129. package/kits/coder/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
  130. package/kits/coder/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
  131. package/kits/coder/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
  132. package/kits/coder/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
  133. package/kits/coder/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
  134. package/kits/coder/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
  135. package/kits/coder/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
  136. package/kits/coder/skills/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
  137. package/kits/coder/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
  138. package/kits/coder/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
  139. package/kits/coder/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
  140. package/kits/coder/skills/ui-ux-pro-max/data/styles.csv +59 -0
  141. package/kits/coder/skills/ui-ux-pro-max/data/typography.csv +58 -0
  142. package/kits/coder/skills/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
  143. package/kits/coder/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
  144. package/kits/coder/skills/ui-ux-pro-max/data/web-interface.csv +31 -0
  145. package/kits/coder/skills/ui-ux-pro-max/scripts/__pycache__/core.cpython-314.pyc +0 -0
  146. package/kits/coder/skills/ui-ux-pro-max/scripts/__pycache__/design_system.cpython-314.pyc +0 -0
  147. package/kits/coder/skills/ui-ux-pro-max/scripts/core.py +257 -0
  148. package/kits/coder/skills/ui-ux-pro-max/scripts/design_system.py +488 -0
  149. package/kits/coder/skills/ui-ux-pro-max/scripts/search.py +76 -0
  150. package/kits/coder/workflows/.gitkeep +20 -0
  151. package/kits/coder/workflows/create.md +152 -0
  152. package/kits/coder/workflows/debug.md +223 -0
  153. package/kits/coder/workflows/deploy.md +283 -0
  154. package/kits/coder/workflows/orchestrate.md +243 -0
  155. package/kits/coder/workflows/plan.md +134 -0
  156. package/kits/coder/workflows/test.md +237 -0
  157. package/kits/coder/workflows/ui-ux-pro-max.md +109 -0
  158. package/package.json +49 -0
@@ -0,0 +1,211 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ SEO Checker - SEO and GEO audit for AGT-Kit
4
+ ============================================
5
+
6
+ Checks pages for SEO best practices and AI citation readiness (GEO).
7
+
8
+ Usage:
9
+ python3 .agent/skills/seo-patterns/scripts/seo_checker.py <project_path>
10
+
11
+ Checks:
12
+ - JSON-LD structured data
13
+ - Meta tags (title, description, og:*)
14
+ - Heading structure (H1, H2)
15
+ - E-E-A-T signals (author, dates)
16
+ - FAQ sections (AI-citable)
17
+ """
18
+
19
+ import sys
20
+ import re
21
+ import json
22
+ from pathlib import Path
23
+ from datetime import datetime
24
+ from typing import Dict, List, Any
25
+
26
+ # Fix console encoding
27
+ try:
28
+ sys.stdout.reconfigure(encoding='utf-8', errors='replace')
29
+ except:
30
+ pass
31
+
32
+ SKIP_DIRS = {'node_modules', '.git', 'dist', 'build', '__pycache__', '.next', 'venv', 'test', 'tests'}
33
+
34
+
35
+ def find_pages(project_path: Path) -> List[Path]:
36
+ """Find public-facing web pages."""
37
+ patterns = ['**/*.html', '**/pages/**/*.tsx', '**/app/**/*.tsx', '**/app/**/*.jsx']
38
+
39
+ files = []
40
+ for pattern in patterns:
41
+ for f in project_path.glob(pattern):
42
+ if not any(skip in f.parts for skip in SKIP_DIRS):
43
+ # Filter to likely page files
44
+ name = f.stem.lower()
45
+ if any(x in name for x in ['page', 'index', 'home', 'about', 'blog', 'post', 'product']):
46
+ files.append(f)
47
+ elif 'pages' in f.parts or 'app' in f.parts:
48
+ files.append(f)
49
+
50
+ return files[:20] # Limit
51
+
52
+
53
+ def check_page(file_path: Path) -> Dict[str, Any]:
54
+ """Check a single page for SEO elements."""
55
+ try:
56
+ content = file_path.read_text(encoding='utf-8', errors='ignore')
57
+ except:
58
+ return {'file': file_path.name, 'passed': [], 'issues': ['Read error'], 'score': 0}
59
+
60
+ passed = []
61
+ issues = []
62
+
63
+ # 1. JSON-LD Structured Data
64
+ if 'application/ld+json' in content:
65
+ passed.append("JSON-LD structured data")
66
+ if '"@type"' in content:
67
+ if 'Article' in content:
68
+ passed.append("Article schema")
69
+ if 'FAQPage' in content:
70
+ passed.append("FAQ schema (highly citable)")
71
+ else:
72
+ issues.append("No JSON-LD structured data")
73
+
74
+ # 2. Heading Structure
75
+ h1_count = len(re.findall(r'<h1[^>]*>', content, re.I))
76
+ h2_count = len(re.findall(r'<h2[^>]*>', content, re.I))
77
+
78
+ if h1_count == 1:
79
+ passed.append("Single H1 heading")
80
+ elif h1_count == 0:
81
+ issues.append("No H1 heading")
82
+ else:
83
+ issues.append(f"Multiple H1 headings ({h1_count})")
84
+
85
+ if h2_count >= 2:
86
+ passed.append(f"{h2_count} H2 subheadings")
87
+ else:
88
+ issues.append("Add more H2 subheadings")
89
+
90
+ # 3. Meta Tags
91
+ if '<title>' in content or 'title=' in content:
92
+ passed.append("Title tag found")
93
+ else:
94
+ issues.append("Missing title tag")
95
+
96
+ if 'meta' in content.lower() and 'description' in content.lower():
97
+ passed.append("Meta description")
98
+ else:
99
+ issues.append("Missing meta description")
100
+
101
+ # 4. Author Attribution (E-E-A-T)
102
+ author_patterns = ['author', 'byline', 'written-by', 'rel="author"']
103
+ if any(p in content.lower() for p in author_patterns):
104
+ passed.append("Author attribution")
105
+ else:
106
+ issues.append("No author info (E-E-A-T)")
107
+
108
+ # 5. Publication Date
109
+ date_patterns = ['datePublished', 'dateModified', 'datetime=', 'pubdate']
110
+ if any(re.search(p, content, re.I) for p in date_patterns):
111
+ passed.append("Publication date")
112
+ else:
113
+ issues.append("No publication date")
114
+
115
+ # 6. Open Graph
116
+ if 'og:' in content or 'property="og:' in content:
117
+ passed.append("Open Graph tags")
118
+
119
+ # 7. Lists and Tables (structured content)
120
+ list_count = len(re.findall(r'<(ul|ol)[^>]*>', content, re.I))
121
+ table_count = len(re.findall(r'<table[^>]*>', content, re.I))
122
+
123
+ if list_count >= 2:
124
+ passed.append(f"{list_count} lists")
125
+ if table_count >= 1:
126
+ passed.append(f"{table_count} table(s)")
127
+
128
+ # Calculate score
129
+ total = len(passed) + len(issues)
130
+ score = (len(passed) / total * 100) if total > 0 else 0
131
+
132
+ return {
133
+ 'file': file_path.name,
134
+ 'passed': passed,
135
+ 'issues': issues,
136
+ 'score': round(score)
137
+ }
138
+
139
+
140
+ def main():
141
+ project_path = Path(sys.argv[1] if len(sys.argv) > 1 else ".").resolve()
142
+
143
+ print(f"\n{'='*60}")
144
+ print(f"[AGT-KIT SEO CHECKER] SEO & GEO Audit")
145
+ print(f"{'='*60}")
146
+ print(f"Project: {project_path}")
147
+ print(f"Time: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}")
148
+ print("-"*60)
149
+
150
+ pages = find_pages(project_path)
151
+
152
+ if not pages:
153
+ print("\nNo public pages found.")
154
+ print("Looking for: HTML files, pages/, app/ directories")
155
+ output = {
156
+ "script": "seo_checker",
157
+ "skill": "seo-patterns",
158
+ "project": str(project_path),
159
+ "pages_checked": 0,
160
+ "passed": True,
161
+ "message": "No pages found"
162
+ }
163
+ print(json.dumps(output, indent=2))
164
+ sys.exit(0)
165
+
166
+ print(f"Found {len(pages)} pages to analyze\n")
167
+
168
+ results = []
169
+ for page in pages:
170
+ result = check_page(page)
171
+ results.append(result)
172
+
173
+ # Print summary
174
+ status = "✅" if result['score'] >= 60 else "⚠️"
175
+ print(f"{status} {result['file']}: {result['score']}%")
176
+
177
+ if result['score'] < 60:
178
+ for issue in result['issues'][:2]:
179
+ print(f" - {issue}")
180
+
181
+ # Average score
182
+ avg_score = sum(r['score'] for r in results) / len(results) if results else 0
183
+
184
+ print("\n" + "="*60)
185
+ print(f"AVERAGE SEO SCORE: {avg_score:.0f}%")
186
+ print("="*60)
187
+
188
+ if avg_score >= 80:
189
+ print("✅ Excellent - Well optimized for search & AI")
190
+ elif avg_score >= 60:
191
+ print("✅ Good - Some improvements recommended")
192
+ elif avg_score >= 40:
193
+ print("⚠️ Needs work - Add structured elements")
194
+ else:
195
+ print("❌ Poor - SEO optimization needed")
196
+
197
+ output = {
198
+ "script": "seo_checker",
199
+ "skill": "seo-patterns",
200
+ "project": str(project_path),
201
+ "pages_checked": len(results),
202
+ "average_score": round(avg_score),
203
+ "passed": avg_score >= 60
204
+ }
205
+
206
+ print("\n" + json.dumps(output, indent=2))
207
+ sys.exit(0 if avg_score >= 60 else 1)
208
+
209
+
210
+ if __name__ == "__main__":
211
+ main()
@@ -0,0 +1,478 @@
1
+ ---
2
+ name: systematic-debugging
3
+ description: 4-phase systematic debugging methodology with root cause analysis and evidence-based verification. Use when debugging complex issues, investigating production bugs, or when trial-and-error is failing.
4
+ allowed-tools: Read, Write, Edit, Bash, Grep
5
+ ---
6
+
7
+ # Systematic Debugging - Scientific Defect Resolution
8
+
9
+ > **Philosophy:** Debugging is detective work. Gather evidence, form hypotheses, test systematically.
10
+
11
+ ---
12
+
13
+ ## 🎯 Core Principle: Scientific Method for Bugs
14
+
15
+ ```
16
+ ❌ WRONG: Change random things → Hope it works → Repeat
17
+ ✅ CORRECT: Observe → Hypothesize → Predict → Test → Verify
18
+ ```
19
+
20
+ **The Scientific Debugging Approach:**
21
+
22
+ - Every change must be driven by a testable hypothesis
23
+ - One variable at a time
24
+ - Document evidence and outcomes
25
+ - Root cause, not symptom treatment
26
+
27
+ ---
28
+
29
+ ## 🔄 The 4-Phase Debugging Workflow
30
+
31
+ ### Phase Overview
32
+
33
+ ```
34
+ PHASE 1: REPRODUCE → Reliably trigger the bug
35
+
36
+ PHASE 2: DIAGNOSE → Gather evidence, form hypotheses
37
+
38
+ PHASE 3: FIX → Apply targeted fix
39
+
40
+ PHASE 4: VERIFY → Confirm fix, prevent regression
41
+ ```
42
+
43
+ ---
44
+
45
+ ## 📍 Phase 1: Reproduce
46
+
47
+ ### Goal: Create a Minimal, Reliable Reproduction
48
+
49
+ **Without reliable reproduction, debugging is guessing.**
50
+
51
+ ### Reproduction Checklist
52
+
53
+ ```markdown
54
+ - [ ] Can trigger bug consistently (>90% success rate)
55
+ - [ ] Identified minimum steps to reproduce
56
+ - [ ] Know environment conditions (OS, browser, versions)
57
+ - [ ] Have isolated from unrelated factors
58
+ - [ ] Created automated test case if possible
59
+ ```
60
+
61
+ ### Information Gathering Template
62
+
63
+ ```markdown
64
+ ## Bug Reproduction Details
65
+
66
+ **Reported Behavior:** [What user/test observed]
67
+
68
+ **Expected Behavior:** [What should happen]
69
+
70
+ **Environment:**
71
+
72
+ - OS: [e.g., macOS 14.2]
73
+ - Runtime: [e.g., Node 20.10.0]
74
+ - Dependencies: [Key versions]
75
+
76
+ **Reproduction Steps:**
77
+
78
+ 1. [Step 1]
79
+ 2. [Step 2]
80
+ 3. [Observe: Expected X, Got Y]
81
+
82
+ **Frequency:** [Always / Intermittent / Random]
83
+
84
+ **First Occurred:** [When / after what change]
85
+ ```
86
+
87
+ ### Handling Intermittent Bugs
88
+
89
+ | Pattern | Investigation Approach |
90
+ | -------------------- | --------------------------------------- |
91
+ | Race condition | Add timing logs, check for async issues |
92
+ | Memory-related | Check for uninitialized variables |
93
+ | State-dependent | Log state at failure points |
94
+ | Environment-specific | Compare configurations |
95
+ | Load-dependent | Test under high load/concurrency |
96
+
97
+ ### If Bug Won't Reproduce
98
+
99
+ 1. Check if bug is already fixed
100
+ 2. Review recent code changes (git log)
101
+ 3. Compare environments in detail
102
+ 4. Add defensive logging for next occurrence
103
+ 5. Set up alerts to capture live failure
104
+
105
+ ---
106
+
107
+ ## 🔬 Phase 2: Diagnose
108
+
109
+ ### Goal: Identify Root Cause Through Evidence
110
+
111
+ ### The Hypothesis Cycle
112
+
113
+ ```
114
+ ┌────────────────────────────────┐
115
+ │ OBSERVE │
116
+ │ (Gather evidence/data) │
117
+ └──────────────┬─────────────────┘
118
+
119
+ ┌────────────────────────────────┐
120
+ │ HYPOTHESIZE │
121
+ │ (What could cause this?) │
122
+ └──────────────┬─────────────────┘
123
+
124
+ ┌────────────────────────────────┐
125
+ │ PREDICT │
126
+ │ (If hypothesis true, then..) │
127
+ └──────────────┬─────────────────┘
128
+
129
+ ┌────────────────────────────────┐
130
+ │ TEST │
131
+ │ (Run experiment) │
132
+ └──────────────┬─────────────────┘
133
+
134
+ ┌─────┴─────┐
135
+ Confirmed? Refuted?
136
+ ↓ ↓
137
+ Refine New Hypothesis
138
+ ```
139
+
140
+ ### Evidence Gathering Techniques
141
+
142
+ | Technique | When to Use | How |
143
+ | ------------------------ | ---------------------------------- | ------------------------------- |
144
+ | **Strategic Logging** | Understanding execution flow | Add logs at decision points |
145
+ | **Debugger Breakpoints** | Inspecting state at specific point | Set conditional breakpoints |
146
+ | **Binary Search** | Large codebase, unclear location | Comment out half, narrow down |
147
+ | **Stack Trace Analysis** | Exception/crash occurred | Read trace bottom-up |
148
+ | **Git Bisect** | Bug appeared in recent commits | Automate finding bad commit |
149
+ | **Diff Analysis** | Recently working code broke | Compare working vs broken code |
150
+ | **Rubber Duck** | Logic seems correct but isn't | Explain code line by line aloud |
151
+
152
+ ### Hypothesis Documentation
153
+
154
+ ```markdown
155
+ ## Hypothesis #1: [Title]
156
+
157
+ **Statement:** [What you think is wrong]
158
+
159
+ **Evidence For:**
160
+
161
+ - [Supporting observation 1]
162
+ - [Supporting observation 2]
163
+
164
+ **Evidence Against:**
165
+
166
+ - [Contradicting observation if any]
167
+
168
+ **Test Plan:**
169
+
170
+ - [How to confirm or refute this]
171
+
172
+ **Prediction:**
173
+
174
+ - If true: [Expected observation]
175
+ - If false: [What we'd see instead]
176
+
177
+ **Result:** ✅ Confirmed / ❌ Refuted / 🔄 Needs more data
178
+ ```
179
+
180
+ ### Root Cause Categories
181
+
182
+ | Category | Examples | Investigation Focus |
183
+ | ----------------- | ------------------------------------- | ----------------------------- |
184
+ | **Logic Error** | Wrong condition, off-by-one | Step through logic carefully |
185
+ | **State Problem** | Race condition, stale cache | Track state changes over time |
186
+ | **Data Issue** | Invalid input, null reference | Inspect data at boundaries |
187
+ | **Integration** | API contract broken, version mismatch | Check integration points |
188
+ | **Resource** | Leak, exhaustion, timeout | Monitor resource usage |
189
+ | **Configuration** | Wrong env var, missing setting | Compare environments |
190
+
191
+ ### 5 Whys Analysis
192
+
193
+ ```markdown
194
+ ## 5 Whys: [Bug Title]
195
+
196
+ 1. **Why** did [observed failure occur]?
197
+ → Because [immediate cause]
198
+
199
+ 2. **Why** did [immediate cause] happen?
200
+ → Because [deeper cause]
201
+
202
+ 3. **Why** did [deeper cause] happen?
203
+ → Because [even deeper cause]
204
+
205
+ 4. **Why** did [even deeper cause] happen?
206
+ → Because [near root cause]
207
+
208
+ 5. **Why** did [near root cause] happen?
209
+ → Because [ROOT CAUSE]
210
+
211
+ **Root Cause:** [Final answer]
212
+ ```
213
+
214
+ ---
215
+
216
+ ## 🔧 Phase 3: Fix
217
+
218
+ ### Goal: Apply Targeted, Minimal Fix
219
+
220
+ ### Pre-Fix Checklist
221
+
222
+ ```markdown
223
+ - [ ] Root cause is identified and documented
224
+ - [ ] Hypothesis has been tested and confirmed
225
+ - [ ] Understand the full impact of the fix
226
+ - [ ] Fix addresses root cause, not just symptom
227
+ - [ ] Have a test that will prove the fix works
228
+ ```
229
+
230
+ ### Fix Quality Criteria
231
+
232
+ | Criterion | Description |
233
+ | -------------- | --------------------------------------- |
234
+ | **Targeted** | Changes only what's necessary |
235
+ | **Root-Cause** | Fixes the cause, not the symptom |
236
+ | **Safe** | Doesn't introduce new bugs |
237
+ | **Readable** | Future developers can understand why |
238
+ | **Testable** | Can verify it works with automated test |
239
+
240
+ ### Fix Documentation
241
+
242
+ ```markdown
243
+ ## Fix Applied
244
+
245
+ **Root Cause:** [What was actually wrong]
246
+
247
+ **Solution:** [What change was made]
248
+
249
+ **Files Modified:**
250
+
251
+ - `path/to/file.ts` - [Description of change]
252
+
253
+ **Why This Fix:**
254
+
255
+ - [Rationale for this approach]
256
+
257
+ **Alternative Considered:**
258
+
259
+ - [Other option] - Not chosen because [reason]
260
+
261
+ **Risk Assessment:**
262
+
263
+ - [Low/Medium/High] - [Justification]
264
+ ```
265
+
266
+ ### Common Fix Patterns
267
+
268
+ | Bug Type | Fix Pattern |
269
+ | ---------------- | --------------------------------------- |
270
+ | Null reference | Add null check + handle gracefully |
271
+ | Race condition | Add synchronization/locking |
272
+ | Off-by-one | Adjust boundary condition |
273
+ | State corruption | Reset or validate state at entry points |
274
+ | Memory leak | Ensure resources are cleaned up |
275
+ | Timeout | Adjust timeout + add retry logic |
276
+
277
+ ---
278
+
279
+ ## ✅ Phase 4: Verify
280
+
281
+ ### Goal: Confirm Fix Works, Prevent Regression
282
+
283
+ ### Verification Checklist
284
+
285
+ ```markdown
286
+ ## Verification Steps
287
+
288
+ ### Immediate Verification
289
+
290
+ - [ ] Original reproduction steps no longer trigger bug
291
+ - [ ] Automated test for this bug passes
292
+ - [ ] Related functionality still works
293
+ - [ ] No new warnings/errors introduced
294
+
295
+ ### Regression Prevention
296
+
297
+ - [ ] Unit test added for the specific case
298
+ - [ ] Edge cases tested
299
+ - [ ] Integration tests pass
300
+ - [ ] Code reviewed by another person
301
+
302
+ ### Documentation
303
+
304
+ - [ ] Root cause documented (for future learning)
305
+ - [ ] Commit message explains the fix
306
+ - [ ] Ticket/issue updated with resolution
307
+ ```
308
+
309
+ ### Test Case Template
310
+
311
+ ```markdown
312
+ ## Regression Test: [Bug ID/Title]
313
+
314
+ **Purpose:** Prevent recurrence of [bug description]
315
+
316
+ **Test:**
317
+ ```
318
+
319
+ // Test code or test case description
320
+ expect(buggyFunction(problematicInput)).toBe(correctOutput);
321
+
322
+ ```
323
+
324
+ **Covers:**
325
+ - [x] The exact failure case
326
+ - [x] Similar edge cases: [list them]
327
+ ```
328
+
329
+ ### Rollback Strategy
330
+
331
+ ```markdown
332
+ ## Rollback Plan
333
+
334
+ **If fix causes issues:**
335
+
336
+ 1. Revert commit: `git revert [commit-hash]`
337
+ 2. Deploy previous version
338
+ 3. Notify stakeholders
339
+ 4. Document what went wrong with fix
340
+
341
+ **Monitoring:**
342
+
343
+ - [What metrics to watch]
344
+ - [Alert thresholds]
345
+ - [Duration of elevated monitoring]
346
+ ```
347
+
348
+ ---
349
+
350
+ ## 🛠️ Debugging Tools & Techniques
351
+
352
+ ### Tool Selection Guide
353
+
354
+ | Situation | Tool/Technique | Command/Usage |
355
+ | ---------------------- | -------------- | ---------------------------------- |
356
+ | Find when bug appeared | Git Bisect | `git bisect start; git bisect bad` |
357
+ | Trace execution path | Debugger | Set breakpoints, step through |
358
+ | Find pattern in code | Grep/Ripgrep | `rg "pattern" --type ts` |
359
+ | Profile performance | Profiler | Chrome DevTools, `node --prof` |
360
+ | Monitor network | Network tab | Check request/response |
361
+ | Find recent changes | Git log/blame | `git log -p --since="2 days ago"` |
362
+
363
+ ### Strategic Logging
364
+
365
+ ```typescript
366
+ // Good: Context-rich, actionable logs
367
+ logger.debug("Processing order", {
368
+ orderId,
369
+ userId,
370
+ itemCount: items.length,
371
+ totalAmount,
372
+ });
373
+
374
+ // Bad: Vague, unhelpful
375
+ console.log("here"); // ❌
376
+ console.log(data); // ❌ No context
377
+ ```
378
+
379
+ ### Binary Search Debugging
380
+
381
+ ```
382
+ Step 1: Identify a working point and broken point
383
+ Step 2: Test the midpoint
384
+ Step 3: If midpoint works → bug is after
385
+ If midpoint broken → bug is before
386
+ Step 4: Repeat until bug location is isolated
387
+ ```
388
+
389
+ ---
390
+
391
+ ## 🚨 Anti-Patterns
392
+
393
+ | ❌ Don't | ✅ Do |
394
+ | -------------------------- | ------------------------------------------- |
395
+ | Change random things | Test one hypothesis at a time |
396
+ | Fix the symptom | Find and fix root cause |
397
+ | Skip reproduction | Establish reliable repro first |
398
+ | Hope it's fixed | Verify with tests |
399
+ | Fix and forget | Document and add regression test |
400
+ | Debug in production | Reproduce in safe environment when possible |
401
+ | Remove code until it works | Understand why code was there |
402
+ | Assume the obvious cause | Test each hypothesis with evidence |
403
+
404
+ ---
405
+
406
+ ## 📋 Debugging Session Template
407
+
408
+ ```markdown
409
+ # Debug Session: [Issue Title]
410
+
411
+ **Date:** YYYY-MM-DD
412
+ **Status:** 🔄 In Progress | ✅ Resolved | ❌ Blocked
413
+
414
+ ---
415
+
416
+ ## Symptoms
417
+
418
+ [What's happening]
419
+
420
+ ## Reproduction
421
+
422
+ [Steps to reproduce reliably]
423
+
424
+ ---
425
+
426
+ ## Diagnosis
427
+
428
+ ### Hypothesis 1: [Title]
429
+
430
+ - **Test:** [How to test]
431
+ - **Result:** ❌ Refuted / ✅ Confirmed
432
+
433
+ ### Hypothesis 2: [Title]
434
+
435
+ - **Test:** [How to test]
436
+ - **Result:** ❌ Refuted / ✅ Confirmed
437
+
438
+ ---
439
+
440
+ ## Root Cause
441
+
442
+ [What is actually wrong and why it causes the symptom]
443
+
444
+ ---
445
+
446
+ ## Fix
447
+
448
+ [What was changed]
449
+
450
+ ---
451
+
452
+ ## Verification
453
+
454
+ - [ ] Reproduction no longer triggers bug
455
+ - [ ] Regression test added
456
+ - [ ] Related functionality verified
457
+
458
+ ---
459
+
460
+ ## Lessons Learned
461
+
462
+ [What can prevent similar bugs in the future]
463
+ ```
464
+
465
+ ---
466
+
467
+ ## 🔗 Related Skills
468
+
469
+ | Need | Skill |
470
+ | ------------------------ | ------------------ |
471
+ | Understanding before fix | `brainstorming` |
472
+ | Planning complex fixes | `plan-writing` |
473
+ | Writing regression tests | `testing-patterns` |
474
+ | Clean fix code | `clean-code` |
475
+
476
+ ---
477
+
478
+ > **Remember:** The most expensive bugs are those that keep coming back. Invest in understanding the root cause, and your fix will stick.
@@ -0,0 +1 @@
1
+ # Assets directory - add templates, images, etc.
@@ -0,0 +1,21 @@
1
+ # Reference Documentation for Systematic Debugging
2
+
3
+ [TODO: Add detailed reference content here]
4
+
5
+ ## Overview
6
+
7
+ [Detailed explanation of concepts]
8
+
9
+ ## Deep Dive Topics
10
+
11
+ ### Topic 1
12
+
13
+ [Content]
14
+
15
+ ### Topic 2
16
+
17
+ [Content]
18
+
19
+ ## Examples
20
+
21
+ [Real-world examples]