skillstore-cli 1.0.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 (231) hide show
  1. package/README.md +95 -0
  2. package/data/bundles/devflow-complete.json +19 -0
  3. package/data/free-skills/devflow-agile/manifest.json +19 -0
  4. package/data/free-skills/devflow-agile/plugin/commands/agile/retro.md +23 -0
  5. package/data/free-skills/devflow-agile/plugin/commands/agile/review.md +21 -0
  6. package/data/free-skills/devflow-agile/plugin/commands/agile/sprint.md +30 -0
  7. package/data/free-skills/devflow-agile/plugin/commands/agile/standup.md +20 -0
  8. package/data/free-skills/devflow-agile/plugin/commands/agile.md +35 -0
  9. package/data/free-skills/devflow-agile/plugin/commands/devflow.md +42 -0
  10. package/data/free-skills/devflow-agile/plugin/skills/developer/SKILL.md +93 -0
  11. package/data/free-skills/devflow-agile/plugin/skills/developer/assets/sample-output.md +182 -0
  12. package/data/free-skills/devflow-agile/plugin/skills/developer/references/clean-architecture.md +361 -0
  13. package/data/free-skills/devflow-agile/plugin/skills/developer/references/clean-code-guide.md +207 -0
  14. package/data/free-skills/devflow-agile/plugin/skills/developer/references/debugging-methodology.md +191 -0
  15. package/data/free-skills/devflow-agile/template/agents/agile-coach.md +76 -0
  16. package/data/free-skills/devflow-agile/template/workflows/agile-sprint-workflow.md +81 -0
  17. package/data/free-skills/devflow-bootstrap/manifest.json +8 -0
  18. package/data/free-skills/devflow-bootstrap/plugin/commands/bootstrap/auto.md +31 -0
  19. package/data/free-skills/devflow-bootstrap/plugin/commands/bootstrap.md +38 -0
  20. package/data/free-skills/devflow-bootstrap/plugin/commands/devflow.md +20 -0
  21. package/data/free-skills/devflow-bootstrap/plugin/skills/project-scaffold/SKILL.md +56 -0
  22. package/data/free-skills/devflow-bootstrap/plugin/skills/project-scaffold/assets/sample-output.md +216 -0
  23. package/data/free-skills/devflow-bootstrap/plugin/skills/project-scaffold/references/architecture-decisions.md +254 -0
  24. package/data/free-skills/devflow-bootstrap/plugin/skills/project-scaffold/references/stack-templates.md +400 -0
  25. package/data/free-skills/devflow-bootstrap/template/agents/bootstrap-specialist.md +56 -0
  26. package/data/free-skills/devflow-bootstrap/template/workflows/bootstrap-workflow.md +70 -0
  27. package/data/free-skills/devflow-docs/manifest.json +8 -0
  28. package/data/free-skills/devflow-docs/plugin/commands/devflow.md +20 -0
  29. package/data/free-skills/devflow-docs/plugin/commands/docs/generate.md +17 -0
  30. package/data/free-skills/devflow-docs/plugin/commands/docs/parse.md +19 -0
  31. package/data/free-skills/devflow-docs/plugin/commands/docs.md +26 -0
  32. package/data/free-skills/devflow-docs/plugin/skills/pdf-processor/SKILL.md +59 -0
  33. package/data/free-skills/devflow-docs/plugin/skills/pdf-processor/assets/sample-output.md +114 -0
  34. package/data/free-skills/devflow-docs/plugin/skills/pdf-processor/references/extraction-techniques.md +115 -0
  35. package/data/free-skills/devflow-docs/plugin/skills/pdf-processor/references/ocr-strategies.md +167 -0
  36. package/data/free-skills/devflow-docs/template/agents/docs-specialist.md +35 -0
  37. package/data/free-skills/devflow-docs/template/workflows/docs-workflow.md +70 -0
  38. package/data/free-skills/devflow-postproject/manifest.json +13 -0
  39. package/data/free-skills/devflow-postproject/plugin/commands/devflow.md +34 -0
  40. package/data/free-skills/devflow-postproject/plugin/commands/postproject/handover.md +21 -0
  41. package/data/free-skills/devflow-postproject/plugin/commands/postproject/retro.md +21 -0
  42. package/data/free-skills/devflow-postproject/plugin/commands/postproject/support.md +21 -0
  43. package/data/free-skills/devflow-postproject/plugin/commands/postproject.md +32 -0
  44. package/data/free-skills/devflow-postproject/plugin/skills/retrospective/SKILL.md +70 -0
  45. package/data/free-skills/devflow-postproject/plugin/skills/retrospective/assets/sample-output.md +79 -0
  46. package/data/free-skills/devflow-postproject/plugin/skills/retrospective/references/facilitation-techniques.md +178 -0
  47. package/data/free-skills/devflow-postproject/plugin/skills/retrospective/references/lessons-learned-template.md +118 -0
  48. package/data/free-skills/devflow-postproject/plugin/skills/retrospective/references/retro-techniques.md +100 -0
  49. package/data/free-skills/devflow-postproject/template/agents/transition-manager.md +71 -0
  50. package/data/free-skills/devflow-postproject/template/workflows/transition-workflow.md +72 -0
  51. package/data/free-skills/devflow-presale/manifest.json +15 -0
  52. package/data/free-skills/devflow-presale/plugin/commands/devflow.md +47 -0
  53. package/data/free-skills/devflow-presale/plugin/commands/presale/analyze.md +30 -0
  54. package/data/free-skills/devflow-presale/plugin/commands/presale/estimate.md +30 -0
  55. package/data/free-skills/devflow-presale/plugin/commands/presale/price.md +30 -0
  56. package/data/free-skills/devflow-presale/plugin/commands/presale/propose.md +30 -0
  57. package/data/free-skills/devflow-presale/plugin/commands/presale.md +42 -0
  58. package/data/free-skills/devflow-presale/plugin/skills/requirement-analysis/SKILL.md +63 -0
  59. package/data/free-skills/devflow-presale/plugin/skills/requirement-analysis/assets/sample-output.md +129 -0
  60. package/data/free-skills/devflow-presale/plugin/skills/requirement-analysis/references/extraction-framework.md +140 -0
  61. package/data/free-skills/devflow-presale/plugin/skills/requirement-analysis/references/output-template.md +132 -0
  62. package/data/free-skills/devflow-presale/template/agents/presale-lead.md +83 -0
  63. package/data/free-skills/devflow-presale/template/agents/proposal-reviewer.md +63 -0
  64. package/data/free-skills/devflow-presale/template/workflows/presale-workflow.md +70 -0
  65. package/data/registry/categories.json +7 -0
  66. package/data/registry/packages.json +184 -0
  67. package/data/shared/framework/agents/brainstormer.md +74 -0
  68. package/data/shared/framework/agents/code-reviewer.md +87 -0
  69. package/data/shared/framework/agents/debugger.md +84 -0
  70. package/data/shared/framework/agents/docs-manager.md +55 -0
  71. package/data/shared/framework/agents/git-manager.md +59 -0
  72. package/data/shared/framework/agents/planner.md +68 -0
  73. package/data/shared/framework/agents/researcher.md +66 -0
  74. package/data/shared/framework/agents/tester.md +65 -0
  75. package/data/shared/framework/commands/cook/auto.md +27 -0
  76. package/data/shared/framework/commands/cook.md +45 -0
  77. package/data/shared/framework/commands/fix/ci.md +21 -0
  78. package/data/shared/framework/commands/fix/test.md +26 -0
  79. package/data/shared/framework/commands/fix/types.md +29 -0
  80. package/data/shared/framework/commands/fix.md +26 -0
  81. package/data/shared/framework/commands/git/cm.md +37 -0
  82. package/data/shared/framework/commands/git/pr.md +40 -0
  83. package/data/shared/framework/config/CLAUDE.md.template +26 -0
  84. package/data/shared/framework/config/settings.json +41 -0
  85. package/data/shared/framework/config/skillstore.config.json +29 -0
  86. package/data/shared/framework/hooks/discord-notify.sh +85 -0
  87. package/data/shared/framework/hooks/docs-sync.sh +53 -0
  88. package/data/shared/framework/hooks/modularization-hook.js +103 -0
  89. package/data/shared/framework/hooks/notification.js +94 -0
  90. package/data/shared/framework/hooks/quality-gate.js +109 -0
  91. package/data/shared/framework/hooks/scout-block.js +77 -0
  92. package/data/shared/framework/hooks/telegram-notify.sh +77 -0
  93. package/data/shared/framework/protocols/error-recovery.md +80 -0
  94. package/data/shared/framework/protocols/orchestration-protocol.md +112 -0
  95. package/data/shared/framework/quality/review-protocol.md +76 -0
  96. package/data/shared/framework/quality/verification-protocol.md +66 -0
  97. package/data/shared/framework/rules/development-rules.md +75 -0
  98. package/data/shared/framework/skills/backend-development/SKILL.md +77 -0
  99. package/data/shared/framework/skills/backend-development/assets/sample-output.md +175 -0
  100. package/data/shared/framework/skills/backend-development/references/advanced-patterns.md +180 -0
  101. package/data/shared/framework/skills/backend-development/references/api-design-guide.md +160 -0
  102. package/data/shared/framework/skills/backend-development/references/architecture-patterns.md +183 -0
  103. package/data/shared/framework/skills/backend-development/references/observability-resilience.md +155 -0
  104. package/data/shared/framework/skills/backend-development/references/troubleshooting.md +199 -0
  105. package/data/shared/framework/skills/codebase-analysis/SKILL.md +72 -0
  106. package/data/shared/framework/skills/codebase-analysis/assets/sample-output.md +263 -0
  107. package/data/shared/framework/skills/codebase-analysis/references/analysis-techniques.md +241 -0
  108. package/data/shared/framework/skills/codebase-analysis/references/dependency-mapping.md +280 -0
  109. package/data/shared/framework/skills/codebase-analysis/references/tech-debt-assessment.md +208 -0
  110. package/data/shared/framework/skills/databases/SKILL.md +72 -0
  111. package/data/shared/framework/skills/databases/assets/sample-output.md +212 -0
  112. package/data/shared/framework/skills/databases/references/advanced-data-patterns.md +259 -0
  113. package/data/shared/framework/skills/databases/references/query-optimization.md +214 -0
  114. package/data/shared/framework/skills/databases/references/schema-design.md +159 -0
  115. package/data/shared/framework/skills/databases/references/troubleshooting.md +214 -0
  116. package/data/shared/framework/skills/debugging-investigation/SKILL.md +84 -0
  117. package/data/shared/framework/skills/debugging-investigation/assets/sample-output.md +314 -0
  118. package/data/shared/framework/skills/debugging-investigation/references/systematic-debugging.md +197 -0
  119. package/data/shared/framework/skills/debugging-investigation/references/tool-specific-guides.md +202 -0
  120. package/data/shared/framework/skills/debugging-investigation/references/troubleshooting-patterns.md +196 -0
  121. package/data/shared/framework/skills/frontend-development/SKILL.md +67 -0
  122. package/data/shared/framework/skills/frontend-development/assets/sample-output.md +110 -0
  123. package/data/shared/framework/skills/frontend-development/references/component-patterns.md +112 -0
  124. package/data/shared/framework/skills/frontend-development/references/performance-guide.md +169 -0
  125. package/data/shared/framework/skills/frontend-development/references/routing-forms-realtime.md +374 -0
  126. package/data/shared/framework/skills/frontend-development/references/ssr-rsc-patterns.md +284 -0
  127. package/data/shared/framework/skills/frontend-development/references/troubleshooting.md +154 -0
  128. package/data/shared/framework/skills/mobile-development/SKILL.md +67 -0
  129. package/data/shared/framework/skills/mobile-development/assets/sample-output.md +382 -0
  130. package/data/shared/framework/skills/mobile-development/references/mobile-patterns.md +681 -0
  131. package/data/shared/framework/skills/mobile-development/references/mobile-performance.md +524 -0
  132. package/data/shared/framework/skills/mobile-development/references/troubleshooting.md +158 -0
  133. package/data/shared/framework/skills/security-audit/SKILL.md +83 -0
  134. package/data/shared/framework/skills/security-audit/assets/sample-output.md +451 -0
  135. package/data/shared/framework/skills/security-audit/references/owasp-checklist.md +580 -0
  136. package/data/shared/framework/skills/security-audit/references/secure-coding-patterns.md +433 -0
  137. package/data/shared/framework/skills/security-audit/references/vulnerability-remediation.md +331 -0
  138. package/data/shared/framework/skills/ui-generation/SKILL.md +70 -0
  139. package/data/shared/framework/skills/ui-generation/assets/sample-output.md +139 -0
  140. package/data/shared/framework/skills/ui-generation/references/accessibility-responsive.md +127 -0
  141. package/data/shared/framework/skills/ui-generation/references/compound-components.md +252 -0
  142. package/data/shared/framework/skills/ui-generation/references/generation-patterns.md +110 -0
  143. package/data/shared/framework/skills/ui-generation/references/storybook-design-system.md +278 -0
  144. package/data/shared/framework/skills/ui-generation/references/troubleshooting.md +198 -0
  145. package/data/shared/framework/workflows/documentation-management.md +58 -0
  146. package/data/shared/framework/workflows/primary-workflow.md +88 -0
  147. package/dist/commands/activate.d.ts +3 -0
  148. package/dist/commands/activate.d.ts.map +1 -0
  149. package/dist/commands/activate.js +34 -0
  150. package/dist/commands/activate.js.map +1 -0
  151. package/dist/commands/bundle.d.ts +3 -0
  152. package/dist/commands/bundle.d.ts.map +1 -0
  153. package/dist/commands/bundle.js +64 -0
  154. package/dist/commands/bundle.js.map +1 -0
  155. package/dist/commands/install.d.ts +3 -0
  156. package/dist/commands/install.d.ts.map +1 -0
  157. package/dist/commands/install.js +99 -0
  158. package/dist/commands/install.js.map +1 -0
  159. package/dist/commands/list.d.ts +3 -0
  160. package/dist/commands/list.d.ts.map +1 -0
  161. package/dist/commands/list.js +37 -0
  162. package/dist/commands/list.js.map +1 -0
  163. package/dist/commands/search.d.ts +3 -0
  164. package/dist/commands/search.d.ts.map +1 -0
  165. package/dist/commands/search.js +30 -0
  166. package/dist/commands/search.js.map +1 -0
  167. package/dist/commands/status.d.ts +3 -0
  168. package/dist/commands/status.d.ts.map +1 -0
  169. package/dist/commands/status.js +35 -0
  170. package/dist/commands/status.js.map +1 -0
  171. package/dist/commands/update.d.ts +3 -0
  172. package/dist/commands/update.d.ts.map +1 -0
  173. package/dist/commands/update.js +68 -0
  174. package/dist/commands/update.js.map +1 -0
  175. package/dist/download/cache.d.ts +3 -0
  176. package/dist/download/cache.d.ts.map +1 -0
  177. package/dist/download/cache.js +18 -0
  178. package/dist/download/cache.js.map +1 -0
  179. package/dist/download/client.d.ts +2 -0
  180. package/dist/download/client.d.ts.map +1 -0
  181. package/dist/download/client.js +58 -0
  182. package/dist/download/client.js.map +1 -0
  183. package/dist/index.d.ts +3 -0
  184. package/dist/index.d.ts.map +1 -0
  185. package/dist/index.js +23 -0
  186. package/dist/index.js.map +1 -0
  187. package/dist/installer/file-copier.d.ts +6 -0
  188. package/dist/installer/file-copier.d.ts.map +1 -0
  189. package/dist/installer/file-copier.js +32 -0
  190. package/dist/installer/file-copier.js.map +1 -0
  191. package/dist/installer/plugin-installer.d.ts +12 -0
  192. package/dist/installer/plugin-installer.d.ts.map +1 -0
  193. package/dist/installer/plugin-installer.js +33 -0
  194. package/dist/installer/plugin-installer.js.map +1 -0
  195. package/dist/installer/template-installer.d.ts +12 -0
  196. package/dist/installer/template-installer.d.ts.map +1 -0
  197. package/dist/installer/template-installer.js +45 -0
  198. package/dist/installer/template-installer.js.map +1 -0
  199. package/dist/license/crypto.d.ts +16 -0
  200. package/dist/license/crypto.d.ts.map +1 -0
  201. package/dist/license/crypto.js +50 -0
  202. package/dist/license/crypto.js.map +1 -0
  203. package/dist/license/license-store.d.ts +19 -0
  204. package/dist/license/license-store.d.ts.map +1 -0
  205. package/dist/license/license-store.js +99 -0
  206. package/dist/license/license-store.js.map +1 -0
  207. package/dist/license/validator.d.ts +32 -0
  208. package/dist/license/validator.d.ts.map +1 -0
  209. package/dist/license/validator.js +81 -0
  210. package/dist/license/validator.js.map +1 -0
  211. package/dist/registry/loader.d.ts +30 -0
  212. package/dist/registry/loader.d.ts.map +1 -0
  213. package/dist/registry/loader.js +22 -0
  214. package/dist/registry/loader.js.map +1 -0
  215. package/dist/registry/search-engine.d.ts +9 -0
  216. package/dist/registry/search-engine.d.ts.map +1 -0
  217. package/dist/registry/search-engine.js +30 -0
  218. package/dist/registry/search-engine.js.map +1 -0
  219. package/dist/utils/config.d.ts +14 -0
  220. package/dist/utils/config.d.ts.map +1 -0
  221. package/dist/utils/config.js +28 -0
  222. package/dist/utils/config.js.map +1 -0
  223. package/dist/utils/logger.d.ts +9 -0
  224. package/dist/utils/logger.d.ts.map +1 -0
  225. package/dist/utils/logger.js +22 -0
  226. package/dist/utils/logger.js.map +1 -0
  227. package/dist/utils/paths.d.ts +20 -0
  228. package/dist/utils/paths.d.ts.map +1 -0
  229. package/dist/utils/paths.js +79 -0
  230. package/dist/utils/paths.js.map +1 -0
  231. package/package.json +54 -0
@@ -0,0 +1,197 @@
1
+ # Systematic Debugging Techniques
2
+
3
+ ## The Scientific Method Applied to Debugging
4
+
5
+ Every debugging session should follow the scientific method. This prevents random code changes and keeps investigation focused.
6
+
7
+ ```
8
+ 1. OBSERVE — Collect symptoms, logs, error messages, reproduction steps
9
+ 2. HYPOTHESIZE — Form 2-4 ranked explanations for the observed behavior
10
+ 3. PREDICT — For each hypothesis, predict what evidence you'd find if it's true
11
+ 4. TEST — Gather that evidence (logs, breakpoints, profiling, experiments)
12
+ 5. CONCLUDE — Accept or reject each hypothesis based on evidence
13
+ 6. REPEAT — If all hypotheses rejected, return to step 1 with new information
14
+ ```
15
+
16
+ ### Hypothesis Template
17
+
18
+ ```
19
+ Hypothesis: [Description of suspected root cause]
20
+ If true, I expect: [Observable prediction]
21
+ Test: [How to verify the prediction]
22
+ Result: [What was actually observed]
23
+ Verdict: CONFIRMED / REFUTED / INCONCLUSIVE
24
+ ```
25
+
26
+ Always test at least 2 hypotheses. If you only have one, you're likely anchored to it.
27
+
28
+ ## Binary Search Debugging (Bisecting the Problem Space)
29
+
30
+ The most efficient general-purpose technique. Divide the problem space in half repeatedly to locate the fault.
31
+
32
+ ### Code Bisection
33
+ - Comment out half the code path, see if the bug persists
34
+ - If yes: bug is in the remaining half. Repeat.
35
+ - If no: bug is in the removed half. Restore and bisect that half.
36
+ - Converges in O(log n) steps instead of O(n)
37
+
38
+ ### Git Bisect
39
+ ```bash
40
+ git bisect start
41
+ git bisect bad # current commit has the bug
42
+ git bisect good <known-good-sha> # this commit was fine
43
+ # Git checks out a midpoint. Test it, then:
44
+ git bisect good # or git bisect bad
45
+ # Repeat until git identifies the first bad commit
46
+ git bisect reset # return to original HEAD
47
+ ```
48
+
49
+ Automate with a test script:
50
+ ```bash
51
+ git bisect run npm test -- --grep "failing test name"
52
+ ```
53
+
54
+ ### Data Bisection
55
+ - For data-dependent bugs, bisect the input data
56
+ - Process first half of records — bug present? Then it's in that half.
57
+ - Useful for CSV imports, batch jobs, migration scripts
58
+
59
+ ### Configuration Bisection
60
+ - Revert half the config changes between working and broken state
61
+ - Especially useful for webpack/vite/bundler config debugging
62
+
63
+ ## Rubber Duck Debugging (Structured Articulation)
64
+
65
+ Explaining the problem forces you to organize your understanding and often reveals gaps.
66
+
67
+ ### The Protocol
68
+ 1. State the expected behavior in one sentence
69
+ 2. State the actual behavior in one sentence
70
+ 3. Explain the code path from input to output, step by step
71
+ 4. At each step, state what you KNOW vs. what you ASSUME
72
+ 5. The bug is usually hiding in an assumption
73
+
74
+ ### When to Use
75
+ - You've been staring at the code for more than 20 minutes
76
+ - The bug "makes no sense" — this means your mental model is wrong
77
+ - Before asking for help — articulate first, then ask
78
+
79
+ ### Written Variant
80
+ Write a detailed bug report to yourself. Include:
81
+ - Exact inputs that trigger the bug
82
+ - Exact output (including off-by-one specifics)
83
+ - The 3 most relevant code snippets
84
+ - What you've already tried and ruled out
85
+
86
+ ## Time-Travel Debugging (Replay-Based Investigation)
87
+
88
+ Record program execution and replay it backwards from the failure point.
89
+
90
+ ### Tools
91
+ - **rr** (Linux): Record and replay with GDB. Step backwards through execution.
92
+ - **Replay.io**: Record browser sessions, step through with DevTools retroactively
93
+ - **Redux DevTools**: Time-travel through state changes in Redux apps
94
+ - **Flutter DevTools Timeline**: Scrub through frame-by-frame rendering
95
+
96
+ ### When to Use
97
+ - Bug that's hard to reproduce — record it once, replay many times
98
+ - Bug that disappears when you add logging (Heisenbug)
99
+ - Race condition where execution order matters
100
+ - Understanding complex state transitions
101
+
102
+ ### Strategy
103
+ 1. Record the failing execution
104
+ 2. Start at the failure point (crash, wrong value, bad state)
105
+ 3. Work backwards: where did this wrong value come from?
106
+ 4. Follow the chain of causation to the root
107
+
108
+ ## Differential Debugging (What Changed?)
109
+
110
+ Compare the working state against the broken state to isolate the change that caused the bug.
111
+
112
+ ### Git-Based Differential
113
+ ```bash
114
+ # What changed since last known-good state?
115
+ git diff <good-sha>..HEAD --stat
116
+ git diff <good-sha>..HEAD -- src/
117
+
118
+ # What was deployed?
119
+ git log <deployed-sha>..HEAD --oneline
120
+
121
+ # What dependencies changed?
122
+ diff <(git show <good-sha>:package-lock.json) <(cat package-lock.json)
123
+ ```
124
+
125
+ ### Environment Differential
126
+ - Compare environment variables between working and broken environments
127
+ - Compare package versions (lock files)
128
+ - Compare runtime versions (Node, Python, Java)
129
+ - Compare OS-level differences (locale, timezone, file system)
130
+
131
+ ### Request Differential
132
+ - Compare a working request vs. a failing request (headers, body, auth tokens)
133
+ - Use diff on curl verbose output or HAR file exports
134
+
135
+ ## Decision Tree: Which Technique for Which Bug Type
136
+
137
+ ### Timing / Race Condition Bugs
138
+ 1. Add logging with timestamps to suspect operations
139
+ 2. Use time-travel debugging if available
140
+ 3. Introduce artificial delays to amplify the race
141
+ 4. Look for missing locks, unguarded shared state, or non-atomic operations
142
+
143
+ ### State / Data Bugs
144
+ 1. Trace the data from input to the point where it's wrong
145
+ 2. Binary search on the code path (where does the value diverge from expected?)
146
+ 3. Check boundary conditions: null, empty, zero, negative, max-int, unicode
147
+ 4. Compare working vs. broken request payloads
148
+
149
+ ### Rendering / Layout Bugs
150
+ 1. Inspect with browser DevTools Elements panel
151
+ 2. Disable CSS one section at a time (binary search)
152
+ 3. Check computed styles vs. expected styles
153
+ 4. Test in isolation: does the component work outside its parent?
154
+
155
+ ### Network / API Bugs
156
+ 1. Inspect actual request/response in Network panel or proxy
157
+ 2. Compare against API documentation
158
+ 3. Check headers: Content-Type, Authorization, CORS
159
+ 4. Test with curl to eliminate client-side code as a variable
160
+
161
+ ### Authentication / Authorization Bugs
162
+ 1. Decode and inspect tokens (JWT claims, expiry)
163
+ 2. Check clock skew between client and server
164
+ 3. Verify token refresh flow
165
+ 4. Compare request headers for working vs. failing calls
166
+
167
+ ### Performance Bugs
168
+ 1. Profile first, optimize second — never guess where the bottleneck is
169
+ 2. Use flame charts to identify the hot path
170
+ 3. Check for N+1 queries with query logging
171
+ 4. Measure: wall time, CPU time, memory allocation, I/O wait
172
+
173
+ ## Common Cognitive Biases in Debugging
174
+
175
+ ### Confirmation Bias
176
+ - **Trap**: You decide it's a caching issue, then only look for cache-related evidence
177
+ - **Fix**: Actively try to DISPROVE your hypothesis. What evidence would refute it?
178
+
179
+ ### Anchoring Bias
180
+ - **Trap**: The first clue you find dominates your thinking, even if it's misleading
181
+ - **Fix**: Always maintain 2+ hypotheses. Force yourself to investigate the less likely one too.
182
+
183
+ ### Recency Bias
184
+ - **Trap**: You blame the most recent change, even if the bug was latent
185
+ - **Fix**: Check: could this bug have existed before the recent change? Write a test and run it against an older commit.
186
+
187
+ ### Availability Bias
188
+ - **Trap**: "Last time it was a database issue, so this must be too"
189
+ - **Fix**: Let the symptoms drive the investigation, not past experience alone.
190
+
191
+ ### Sunk Cost Bias
192
+ - **Trap**: You've spent 2 hours on one hypothesis and refuse to abandon it
193
+ - **Fix**: Set a timebox (30 minutes). If no progress, switch hypotheses. Your time spent is gone either way.
194
+
195
+ ### The Heisenbug Trap
196
+ - **Trap**: Adding debug logging changes the timing and makes the bug disappear
197
+ - **Fix**: Use non-invasive observation (profilers, replay tools, OS-level tracing). Or add logging and look for a DIFFERENT failure mode.
@@ -0,0 +1,202 @@
1
+ # Tool-Specific Debugging Guides
2
+
3
+ ## Chrome DevTools
4
+
5
+ ### Performance Panel
6
+ - **Recording**: Click record, reproduce the issue, stop. Shorter recordings are easier to analyze.
7
+ - **Flame Chart**: Read top-down. Wide bars = long tasks. Look for unexpected width (blocking calls).
8
+ - **Main Thread**: Yellow = scripting, purple = rendering, green = painting. A wall of yellow means JavaScript is blocking.
9
+ - **Long Tasks**: Any task >50ms blocks the main thread. Look for these as the cause of janky UI.
10
+ - **Bottom-Up Tab**: Sort by "Self Time" to find the actual functions consuming CPU, not just callers.
11
+ - **User Timing marks**: Add `performance.mark('start')` and `performance.measure('operation', 'start')` to your code for custom markers in the timeline.
12
+
13
+ ### Memory Panel
14
+ - **Heap Snapshot**: Take two snapshots (before and after the suspected leak). Use "Comparison" view to see what was allocated between them.
15
+ - **Allocation Timeline**: Shows allocations over time. Blue bars that persist = potential leaks. Grey bars = garbage collected (fine).
16
+ - **Retained Size vs Shallow Size**: Retained size includes all objects kept alive by this reference. A small object with huge retained size is holding a reference chain.
17
+ - **Detached DOM nodes**: Filter by "Detached" in the snapshot. These are DOM nodes removed from the tree but still referenced in JavaScript.
18
+
19
+ ### Network Panel
20
+ - **Waterfall**: Long blue bars = waiting for server (TTFB). Long green bars = downloading (payload size).
21
+ - **Throttling**: Simulate slow connections to find race conditions hidden by fast local networks.
22
+ - **Request Blocking**: Right-click a domain to block it. Useful for testing fallback behavior and third-party impact.
23
+ - **Copy as cURL**: Right-click any request to get an exact curl command for reproduction outside the browser.
24
+ - **Preserve log**: Enable to keep requests across page navigations — essential for debugging redirects.
25
+
26
+ ### Sources Panel
27
+ - **Conditional Breakpoints**: Right-click line number → "Add conditional breakpoint". Only breaks when expression is true. Example: `userId === 'abc123'`.
28
+ - **Logpoints**: Right-click → "Add logpoint". Logs without modifying code or pausing execution. Example: `'Request:', JSON.stringify(req.body)`.
29
+ - **XHR Breakpoints**: Break on any request matching a URL pattern. Useful for finding which code triggers an API call.
30
+ - **Event Listener Breakpoints**: Under "Event Listener Breakpoints" panel, expand categories (Mouse, Keyboard, Timer). Breaks when events fire.
31
+ - **Blackboxing**: Right-click a library file → "Add script to ignore list". Debugger skips over blackboxed code when stepping.
32
+
33
+ ## Node.js Debugging
34
+
35
+ ### Built-in Inspector
36
+ ```bash
37
+ # Start with inspector
38
+ node --inspect src/server.js
39
+
40
+ # Break on first line
41
+ node --inspect-brk src/server.js
42
+
43
+ # Then open chrome://inspect in Chrome and connect
44
+ ```
45
+
46
+ ### Clinic.js Suite
47
+ ```bash
48
+ # Doctor — overall health check (event loop, CPU, memory, I/O)
49
+ npx clinic doctor -- node src/server.js
50
+ # Then generate load with autocannon or ab, and stop the process. Opens HTML report.
51
+
52
+ # Flame — CPU profiling as flame graph
53
+ npx clinic flame -- node src/server.js
54
+ # Wide bars at the bottom = hot path. Look for your code, not Node internals.
55
+
56
+ # Bubbleprof — async flow visualization
57
+ npx clinic bubbleprof -- node src/server.js
58
+ # Shows async operation relationships. Large bubbles = long async delays.
59
+ ```
60
+
61
+ ### 0x Flame Graphs
62
+ ```bash
63
+ npx 0x src/server.js
64
+ # Generate load, then Ctrl+C. Opens interactive flame graph in browser.
65
+ # Click to zoom into stack frames. Look for "plateaus" — flat wide areas are bottlenecks.
66
+ ```
67
+
68
+ ### Useful Flags
69
+ ```bash
70
+ # Trace warnings with stack traces
71
+ node --trace-warnings src/server.js
72
+
73
+ # Track promise rejections
74
+ node --unhandled-rejections=strict src/server.js
75
+
76
+ # Expose GC for memory debugging
77
+ node --expose-gc --inspect src/server.js
78
+ ```
79
+
80
+ ## React DevTools
81
+
82
+ ### Profiler
83
+ - **Commit Chart**: Each bar is a render commit. Tall bars = slow renders. Click to see which components rendered.
84
+ - **Ranked Chart**: Components sorted by render time. Focus optimization on the top items.
85
+ - **"Why did this render?"**: Enable in Profiler settings. Shows whether a render was caused by props change, state change, hooks change, or parent re-render.
86
+ - **Highlight Updates**: In settings, enable "Highlight updates when components render". Blue = infrequent, yellow/red = too frequent.
87
+
88
+ ### Component Inspector
89
+ - Click any component to see current props, state, and hooks values
90
+ - Edit props/state live to test different scenarios without changing code
91
+ - "Rendered by" shows the parent chain — useful for understanding why something re-rendered
92
+ - "Source" link jumps to the component definition in the Sources panel
93
+
94
+ ### why-did-you-render (Library)
95
+ ```javascript
96
+ // In development entry point:
97
+ import React from 'react';
98
+ if (process.env.NODE_ENV === 'development') {
99
+ const whyDidYouRender = require('@welldone-software/why-did-you-render');
100
+ whyDidYouRender(React, { trackAllPureComponents: true });
101
+ }
102
+ ```
103
+ Logs to console when a component re-renders with unchanged props (wasted render).
104
+
105
+ ## Flutter DevTools
106
+
107
+ ### Widget Inspector
108
+ - Select widgets in the app to see the widget tree, render object properties, and constraints
109
+ - "Select Widget Mode": tap on any widget in the running app to jump to it in the inspector
110
+ - Layout explorer: visualize flex layouts, see main axis / cross axis alignment and overflow
111
+
112
+ ### Timeline (Performance)
113
+ - **Frame Chart**: Each bar is a frame. Bars exceeding 16ms (for 60fps) cause jank.
114
+ - **UI thread vs Raster thread**: UI = widget build/layout. Raster = painting to GPU. Identify which thread is the bottleneck.
115
+ - **Shader compilation jank**: First-run jank often caused by shader compilation. Use `flutter run --profile --cache-sksl` to warm shaders.
116
+
117
+ ### Memory
118
+ - **Dart heap**: Shows current allocations. Take snapshots to compare over time.
119
+ - **GC events**: Frequent GC = high allocation rate. Reduce object churn.
120
+ - **Leaks**: Objects that survive multiple GC cycles and keep growing indicate leaks. Check for undisposed controllers, streams, and animation controllers.
121
+
122
+ ### CPU Profiler
123
+ - Record CPU profile during a specific interaction
124
+ - Bottom-up view shows which Dart functions consumed the most CPU
125
+ - Filter to "My Code" to hide framework internals
126
+
127
+ ## Database Debugging
128
+
129
+ ### EXPLAIN ANALYZE (PostgreSQL)
130
+ ```sql
131
+ EXPLAIN (ANALYZE, BUFFERS, FORMAT TEXT) SELECT ...;
132
+ ```
133
+ - **Seq Scan**: Full table scan. Fine for small tables, problematic for large ones. Consider adding an index.
134
+ - **Nested Loop**: For each row in outer, scans inner. Acceptable for small sets, disastrous for large ones (N+1 at DB level).
135
+ - **actual time**: First number = time to first row, second = time to all rows. Large gap means streaming is possible.
136
+ - **Buffers: shared hit vs read**: Hit = in cache, read = from disk. High read count = cold cache or working set exceeds memory.
137
+ - **rows=X vs actual rows=Y**: Large discrepancy means stale statistics. Run `ANALYZE tablename`.
138
+
139
+ ### pg_stat_statements
140
+ ```sql
141
+ SELECT query, calls, mean_exec_time, total_exec_time
142
+ FROM pg_stat_statements
143
+ ORDER BY total_exec_time DESC
144
+ LIMIT 20;
145
+ ```
146
+ Shows the most expensive queries across the entire database.
147
+
148
+ ### Slow Query Log (MySQL)
149
+ ```ini
150
+ # my.cnf
151
+ slow_query_log = 1
152
+ long_query_time = 1 # seconds
153
+ log_queries_not_using_indexes = 1
154
+ ```
155
+ Then analyze with `mysqldumpslow` or `pt-query-digest`.
156
+
157
+ ## VS Code Debugger
158
+
159
+ ### Node.js launch.json
160
+ ```jsonc
161
+ {
162
+ "version": "0.2.0",
163
+ "configurations": [
164
+ {
165
+ "name": "Debug Server",
166
+ "type": "node",
167
+ "request": "launch",
168
+ "program": "${workspaceFolder}/src/server.js",
169
+ "env": { "NODE_ENV": "development" },
170
+ "console": "integratedTerminal"
171
+ },
172
+ {
173
+ "name": "Debug Current Test",
174
+ "type": "node",
175
+ "request": "launch",
176
+ "program": "${workspaceFolder}/node_modules/.bin/jest",
177
+ "args": ["--runInBand", "--no-coverage", "${relativeFile}"],
178
+ "console": "integratedTerminal"
179
+ }
180
+ ]
181
+ }
182
+ ```
183
+
184
+ ### Compound Debugging (Frontend + Backend)
185
+ ```jsonc
186
+ {
187
+ "compounds": [
188
+ {
189
+ "name": "Full Stack",
190
+ "configurations": ["Debug Server", "Debug Client"],
191
+ "stopAll": true
192
+ }
193
+ ]
194
+ }
195
+ ```
196
+ Launches both debuggers simultaneously. Set breakpoints across client and server code in one session.
197
+
198
+ ### Useful Features
199
+ - **Data Breakpoints**: Right-click a variable in the Variables panel → "Break on Value Change". Stops when the value changes anywhere.
200
+ - **Inline Values**: Shows variable values inline in the editor during debugging (enabled by default).
201
+ - **Debug Console**: Evaluate expressions in the current scope. Full REPL access at breakpoints.
202
+ - **Call Stack**: Click frames to jump between call sites. "Restart Frame" re-executes from that point.
@@ -0,0 +1,196 @@
1
+ # Troubleshooting Patterns
2
+
3
+ Common bug patterns with their symptoms, diagnosis strategies, and fixes.
4
+
5
+ ## Race Conditions
6
+
7
+ ### Symptoms
8
+ - Bug is intermittent — works most of the time, fails unpredictably
9
+ - Bug disappears when you add logging or use a debugger (timing changes)
10
+ - Different results on fast vs. slow machines or under load
11
+ - "It works on my machine" across team members
12
+
13
+ ### Diagnosis
14
+ 1. Add timestamps to all operations in the suspect area
15
+ 2. Introduce artificial delays (`setTimeout`, `sleep`) to amplify the race window
16
+ 3. Run under high concurrency: `autocannon -c 50 -d 10 http://localhost:3000/api/endpoint`
17
+ 4. Use thread/race sanitizers when available (`go run -race`, `tsc --strict`)
18
+ 5. Search for shared mutable state accessed without synchronization
19
+
20
+ ### Fix Patterns
21
+ - **Mutex/Lock**: Serialize access to shared state. Use `async-mutex` for Node.js, `synchronized` for Java, `sync.Mutex` for Go.
22
+ - **Atomic Operations**: For simple counters/flags, use atomic primitives instead of locks.
23
+ - **Idempotent Operations**: Design operations so running them twice produces the same result (database upserts, unique constraints).
24
+ - **Optimistic Concurrency**: Use version columns or ETags. Retry on conflict instead of locking.
25
+
26
+ ## Memory Leaks
27
+
28
+ ### Symptoms
29
+ - Application memory grows steadily over hours/days
30
+ - Garbage collection pauses become longer and more frequent
31
+ - Eventually: OOM kills, process restarts, or swap thrashing
32
+ - Performance degrades proportionally to uptime
33
+
34
+ ### Diagnosis
35
+ 1. Take heap snapshots at regular intervals (e.g., every 30 minutes)
36
+ 2. Compare snapshots: sort by "Delta" to find growing object types
37
+ 3. Check event listener counts: `require('events').EventEmitter.listenerCount(emitter, 'event')`
38
+ 4. Look for detached DOM nodes (browser) or orphaned references (server)
39
+ 5. Check for growing caches, maps, or arrays without eviction
40
+
41
+ ### Fix Patterns
42
+ - **Event Listeners**: Always `removeEventListener` or use `{ once: true }`. In React, clean up in `useEffect` return.
43
+ - **Closures**: Beware closures in long-lived callbacks that capture large scopes. Nullify references when done.
44
+ - **Caches**: Always implement a max size or TTL eviction. Use `lru-cache` or `Map` with periodic cleanup.
45
+ - **Timers**: Clear intervals/timeouts when the owner is destroyed. `clearInterval(id)` in cleanup.
46
+ - **Streams**: Always handle `error` events on streams. Unpipe/destroy streams when no longer needed.
47
+
48
+ ## Deadlocks
49
+
50
+ ### Symptoms
51
+ - Application hangs — no errors, no progress, no CPU usage
52
+ - Database queries that never return
53
+ - Threads/goroutines stuck in waiting state
54
+ - Timeouts that all trigger simultaneously
55
+
56
+ ### Diagnosis
57
+ ```sql
58
+ -- PostgreSQL: Find blocked queries
59
+ SELECT pid, state, query, wait_event_type, wait_event
60
+ FROM pg_stat_activity
61
+ WHERE state = 'active' AND wait_event IS NOT NULL;
62
+
63
+ -- PostgreSQL: Find lock dependencies
64
+ SELECT blocked.pid AS blocked_pid, blocked.query AS blocked_query,
65
+ blocking.pid AS blocking_pid, blocking.query AS blocking_query
66
+ FROM pg_stat_activity blocked
67
+ JOIN pg_locks bl ON bl.pid = blocked.pid
68
+ JOIN pg_locks kl ON kl.locktype = bl.locktype AND kl.relation = bl.relation AND kl.pid != bl.pid
69
+ JOIN pg_stat_activity blocking ON blocking.pid = kl.pid
70
+ WHERE NOT bl.granted;
71
+ ```
72
+
73
+ ### Fix Patterns
74
+ - **Consistent Lock Ordering**: Always acquire locks in the same global order (e.g., alphabetically by table name).
75
+ - **Lock Timeouts**: Set `SET lock_timeout = '5s'` to fail fast instead of hanging forever.
76
+ - **Reduce Lock Scope**: Hold locks for the shortest time possible. Do computation outside the lock, only lock for the mutation.
77
+ - **Advisory Locks**: Use application-level locks (`pg_advisory_lock`) for business-logic-level serialization.
78
+
79
+ ## N+1 Queries
80
+
81
+ ### Symptoms
82
+ - Page load has dozens or hundreds of identical queries differing only by ID
83
+ - Response time scales linearly with the number of records
84
+ - Database shows high query count but each query is individually fast
85
+
86
+ ### Diagnosis
87
+ 1. Enable query logging and count queries per request
88
+ 2. Search for queries inside loops: `for (const item of items) { await db.query(...) }`
89
+ 3. Use ORM-level logging: Prisma (`DEBUG="prisma:query"`), Sequelize (`logging: console.log`)
90
+ 4. Monitor with `pg_stat_statements`: sort by `calls` column
91
+
92
+ ### Fix Patterns
93
+ - **Eager Loading**: Include related data in the initial query. `User.findAll({ include: [Post] })` instead of loading posts separately.
94
+ - **DataLoader**: Batch and deduplicate requests within a single tick. Ideal for GraphQL resolvers.
95
+ - **JOIN**: Replace N+1 SELECT with a single JOIN or subquery.
96
+ - **WHERE IN**: Collect IDs first, then fetch all at once: `WHERE id = ANY($1::int[])`
97
+
98
+ ## Infinite Loops / Re-renders
99
+
100
+ ### Symptoms
101
+ - Browser tab freezes or shows "page unresponsive"
102
+ - 100% CPU usage on one core
103
+ - React DevTools shows thousands of renders per second
104
+ - Console fills with repeated log messages
105
+
106
+ ### Diagnosis
107
+ 1. **Infinite Loop**: Add a counter inside the loop. If it exceeds a threshold, break and log the state.
108
+ 2. **React Re-renders**: Enable "Highlight updates" in React DevTools. Components flashing rapidly are the problem.
109
+ 3. **useEffect Dependency Loop**: An effect updates state that's in its own dependency array.
110
+ 4. **Redux**: Check for actions dispatching in a cycle (action A triggers reducer that dispatches action B that triggers action A).
111
+
112
+ ### Fix Patterns
113
+ - **useEffect Dependencies**: Never include objects/arrays created during render in deps. Memoize with `useMemo` or extract to `useRef`.
114
+ - **State Update Guards**: Add a condition before `setState`: `if (newValue !== currentValue)`.
115
+ - **useMemo / useCallback**: Stabilize references passed as props or effect dependencies.
116
+ - **Break Cycles**: If A triggers B triggers A, introduce a flag or refactor to a single combined state update.
117
+
118
+ ## Async/Await Pitfalls
119
+
120
+ ### Symptoms
121
+ - `UnhandledPromiseRejection` warnings or crashes
122
+ - Operations silently fail with no error logs
123
+ - Data corruption from concurrent mutations
124
+ - Stale state in closures (React, event handlers)
125
+
126
+ ### Diagnosis
127
+ 1. Search for `async` functions without `try/catch` or `.catch()`
128
+ 2. Search for `Promise.all` without error handling on individual items
129
+ 3. Check for `await` inside loops that should run concurrently
130
+ 4. Look for closures capturing variables that change between `await` points
131
+
132
+ ### Fix Patterns
133
+ - **Always Handle Rejections**: Wrap `await` in `try/catch`. Use global handler: `process.on('unhandledRejection', handler)`.
134
+ - **Concurrent Mutations**: Use transactions or optimistic locking when multiple async operations modify the same data.
135
+ - **Stale Closures**: In React, use `useRef` for values that change between renders but are read in async callbacks.
136
+ - **Sequential vs Parallel**: Use `Promise.all([a(), b()])` for independent operations, `await a(); await b()` only when b depends on a.
137
+
138
+ ## Timezone Bugs
139
+
140
+ ### Symptoms
141
+ - Dates off by hours (often exactly N hours where N is UTC offset)
142
+ - Bugs that appear only for users in certain timezones
143
+ - Daylight saving transitions cause records to duplicate or disappear
144
+ - Date comparisons fail near midnight
145
+
146
+ ### Diagnosis
147
+ 1. Log the raw date value, its timezone, and the formatted output at each transformation point
148
+ 2. Check database column type: `TIMESTAMP` (no timezone) vs `TIMESTAMPTZ` (with timezone)
149
+ 3. Test with dates near DST transitions (March, November in US; last Sunday of March/October in EU)
150
+ 4. Compare server timezone (`TZ` env var) with database timezone and client timezone
151
+
152
+ ### Fix Patterns
153
+ - **Store UTC**: Always store dates in UTC. Convert to local timezone only at the display layer.
154
+ - **Use TIMESTAMPTZ**: In PostgreSQL, always prefer `TIMESTAMPTZ` over `TIMESTAMP`.
155
+ - **Explicit Timezones**: Never rely on system timezone. Pass timezone explicitly: `dayjs.tz(date, 'America/New_York')`.
156
+ - **Test DST**: Include DST boundary dates in your test suite.
157
+
158
+ ## Encoding Issues
159
+
160
+ ### Symptoms
161
+ - Characters display as `?`, `???`, or `\ufffd` (replacement character)
162
+ - Emoji breaks string operations or database inserts
163
+ - URL parameters with special characters cause 400 errors
164
+ - File content looks correct in one editor but corrupted in another
165
+
166
+ ### Diagnosis
167
+ 1. Check the raw bytes: `hexdump -C file.txt | head` or inspect with a hex editor
168
+ 2. Verify Content-Type headers include charset: `Content-Type: application/json; charset=utf-8`
169
+ 3. Check database column collation and charset: `SHOW CREATE TABLE tablename`
170
+ 4. Test with known problematic inputs: emoji, CJK characters, RTL text, combining characters
171
+
172
+ ### Fix Patterns
173
+ - **UTF-8 Everywhere**: Set UTF-8 at every layer: database, connection string, HTTP headers, HTML meta.
174
+ - **BOM**: Remove BOM from files (`sed -i '1s/^\xEF\xBB\xBF//' file.txt`). Some parsers choke on it.
175
+ - **URL Encoding**: Use `encodeURIComponent()` for query parameters, not `encodeURI()`.
176
+ - **Database**: Use `utf8mb4` in MySQL (not `utf8` which only supports 3-byte sequences, breaking emoji).
177
+
178
+ ## Floating Point Precision
179
+
180
+ ### Symptoms
181
+ - `0.1 + 0.2 !== 0.3` — equality checks on decimal results fail
182
+ - Money calculations are off by fractions of a cent
183
+ - Accumulating rounding errors over many iterations
184
+ - Different results on different platforms for the same calculation
185
+
186
+ ### Diagnosis
187
+ 1. Log the full-precision value: `console.log(value.toPrecision(20))`
188
+ 2. Check for equality comparisons on floats (`===` instead of tolerance check)
189
+ 3. Look for money stored as float instead of integer cents
190
+ 4. Check for mixed integer/float arithmetic in accumulated calculations
191
+
192
+ ### Fix Patterns
193
+ - **Integer Cents**: Store money as integer cents (or smallest currency unit). $19.99 = 1999. Do arithmetic on integers.
194
+ - **Decimal Libraries**: Use `decimal.js`, `big.js`, or `Decimal` types in languages that support them.
195
+ - **Epsilon Comparison**: `Math.abs(a - b) < Number.EPSILON` for float equality, or a domain-appropriate tolerance.
196
+ - **Database NUMERIC**: Use `NUMERIC(10,2)` or `DECIMAL` types, never `FLOAT` or `DOUBLE` for money.
@@ -0,0 +1,67 @@
1
+ ---
2
+ name: frontend-development
3
+ description: React/Vue/Svelte development — component design, state management, performance optimization, responsive design, debugging
4
+ ---
5
+
6
+ # Frontend Development
7
+
8
+ ## Triggers
9
+
10
+ Activate this skill when:
11
+ - Building or refactoring UI components
12
+ - Fixing frontend bugs (rendering, state, layout)
13
+ - Optimizing frontend performance (bundle size, Core Web Vitals)
14
+ - Implementing responsive or accessible design
15
+ - Setting up state management (local, global, server state)
16
+ - Integrating data fetching or caching layers
17
+ - Working with SSR, RSC (React Server Components), or streaming patterns
18
+ - Configuring routing (file-based or config-based), layouts, or navigation
19
+ - Implementing real-time features (WebSocket, SSE, polling)
20
+ - Building forms with validation (React Hook Form, VeeValidate)
21
+ - Setting up tRPC or optimistic UI updates
22
+
23
+ ## Process
24
+
25
+ ### 1. Requirement Review
26
+ - Clarify the UI spec: wireframe, Figma, or written description
27
+ - Identify target browsers/devices and breakpoints
28
+ - List data dependencies (API endpoints, real-time feeds)
29
+ - Note accessibility requirements (WCAG level)
30
+
31
+ ### 2. Component Design
32
+ - Break the UI into a component tree (container vs. presentational)
33
+ - Define props, events, and slots/children for each component
34
+ - Choose state strategy: local state, lifted state, context/store, or server state
35
+ - Identify shared components that belong in a design system
36
+
37
+ ### 3. Implementation
38
+ - Scaffold components with TypeScript types/interfaces
39
+ - Implement data fetching with loading, error, and empty states
40
+ - Apply styling approach (CSS Modules, Tailwind, styled-components)
41
+ - Wire up routing and navigation
42
+ - Add form validation (client-side + server-side error display)
43
+
44
+ ### 4. Testing
45
+ - Unit test pure logic and utility functions
46
+ - Component tests with Testing Library (render, interaction, assertion)
47
+ - Visual regression tests for key layouts (Chromatic, Percy)
48
+ - E2E smoke tests for critical user flows (Cypress, Playwright)
49
+
50
+ ### 5. Optimization
51
+ - Audit bundle with `webpack-bundle-analyzer` or `source-map-explorer`
52
+ - Apply code splitting at route and feature level
53
+ - Optimize images (responsive `srcset`, WebP/AVIF, lazy loading)
54
+ - Measure Core Web Vitals (LCP < 2.5s, FID < 100ms, CLS < 0.1)
55
+ - Set up performance budgets in CI
56
+
57
+ ## References
58
+
59
+ - [Component Patterns](references/component-patterns.md) — design principles, hooks, composition API, state strategies
60
+ - [Performance Guide](references/performance-guide.md) — Core Web Vitals, bundle optimization, rendering, caching
61
+ - [SSR & RSC Patterns](references/ssr-rsc-patterns.md) — Server Components, Server Actions, streaming, ISR, middleware
62
+ - [Routing, Forms & Real-Time](references/routing-forms-realtime.md) — file-based routing, form validation, WebSocket/SSE, tRPC
63
+ - [Troubleshooting](references/troubleshooting.md) — hydration errors, re-render storms, memory leaks, CORS, bundle bloat, performance regression
64
+
65
+ ## Assets
66
+
67
+ - [Sample Output](assets/sample-output.md) — example component implementation plan