@cloudstreamsoftware/claude-tools 1.0.0 → 1.2.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 (190) hide show
  1. package/README.md +152 -37
  2. package/agents/INDEX.md +183 -0
  3. package/agents/architect.md +247 -0
  4. package/agents/build-error-resolver.md +555 -0
  5. package/agents/catalyst-deployer.md +132 -0
  6. package/agents/code-reviewer.md +121 -0
  7. package/agents/compliance-auditor.md +148 -0
  8. package/agents/creator-architect.md +395 -0
  9. package/agents/deluge-reviewer.md +98 -0
  10. package/agents/doc-updater.md +471 -0
  11. package/agents/e2e-runner.md +711 -0
  12. package/agents/planner.md +122 -0
  13. package/agents/refactor-cleaner.md +309 -0
  14. package/agents/security-reviewer.md +582 -0
  15. package/agents/tdd-guide.md +302 -0
  16. package/bin/cloudstream-setup.js +16 -6
  17. package/config/versions.json +63 -0
  18. package/dist/hooks/hooks.json +209 -0
  19. package/dist/index.js +47 -0
  20. package/dist/lib/asset-value.js +609 -0
  21. package/dist/lib/client-manager.js +300 -0
  22. package/dist/lib/command-matcher.js +242 -0
  23. package/dist/lib/cross-session-patterns.js +754 -0
  24. package/dist/lib/intent-classifier.js +1075 -0
  25. package/dist/lib/package-manager.js +374 -0
  26. package/dist/lib/recommendation-engine.js +597 -0
  27. package/dist/lib/session-memory.js +489 -0
  28. package/dist/lib/skill-effectiveness.js +486 -0
  29. package/dist/lib/skill-matcher.js +595 -0
  30. package/dist/lib/tutorial-metrics.js +242 -0
  31. package/dist/lib/tutorial-progress.js +209 -0
  32. package/dist/lib/tutorial-renderer.js +431 -0
  33. package/dist/lib/utils.js +380 -0
  34. package/dist/lib/verify-formatter.js +143 -0
  35. package/dist/lib/workflow-state.js +249 -0
  36. package/hooks/hooks.json +209 -0
  37. package/package.json +5 -1
  38. package/scripts/aggregate-sessions.js +290 -0
  39. package/scripts/branch-name-validator.js +291 -0
  40. package/scripts/build.js +101 -0
  41. package/scripts/commands/client-switch.js +231 -0
  42. package/scripts/deprecate-skill.js +610 -0
  43. package/scripts/diagnose.js +324 -0
  44. package/scripts/doc-freshness.js +168 -0
  45. package/scripts/generate-weekly-digest.js +393 -0
  46. package/scripts/health-check.js +270 -0
  47. package/scripts/hooks/credential-check.js +101 -0
  48. package/scripts/hooks/evaluate-session.js +81 -0
  49. package/scripts/hooks/pre-compact.js +66 -0
  50. package/scripts/hooks/prompt-analyzer.js +276 -0
  51. package/scripts/hooks/prompt-router.js +422 -0
  52. package/scripts/hooks/quality-gate-enforcer.js +371 -0
  53. package/scripts/hooks/session-end.js +156 -0
  54. package/scripts/hooks/session-start.js +195 -0
  55. package/scripts/hooks/skill-injector.js +333 -0
  56. package/scripts/hooks/suggest-compact.js +58 -0
  57. package/scripts/lib/asset-value.js +609 -0
  58. package/scripts/lib/client-manager.js +300 -0
  59. package/scripts/lib/command-matcher.js +242 -0
  60. package/scripts/lib/cross-session-patterns.js +754 -0
  61. package/scripts/lib/intent-classifier.js +1075 -0
  62. package/scripts/lib/package-manager.js +374 -0
  63. package/scripts/lib/recommendation-engine.js +597 -0
  64. package/scripts/lib/session-memory.js +489 -0
  65. package/scripts/lib/skill-effectiveness.js +486 -0
  66. package/scripts/lib/skill-matcher.js +595 -0
  67. package/scripts/lib/tutorial-metrics.js +242 -0
  68. package/scripts/lib/tutorial-progress.js +209 -0
  69. package/scripts/lib/tutorial-renderer.js +431 -0
  70. package/scripts/lib/utils.js +380 -0
  71. package/scripts/lib/verify-formatter.js +143 -0
  72. package/scripts/lib/workflow-state.js +249 -0
  73. package/scripts/onboard.js +363 -0
  74. package/scripts/quarterly-report.js +692 -0
  75. package/scripts/setup-package-manager.js +204 -0
  76. package/scripts/sync-upstream.js +391 -0
  77. package/scripts/test.js +108 -0
  78. package/scripts/tutorial-runner.js +351 -0
  79. package/scripts/validate-all.js +201 -0
  80. package/scripts/verifiers/agents.js +245 -0
  81. package/scripts/verifiers/config.js +186 -0
  82. package/scripts/verifiers/environment.js +123 -0
  83. package/scripts/verifiers/hooks.js +188 -0
  84. package/scripts/verifiers/index.js +38 -0
  85. package/scripts/verifiers/persistence.js +140 -0
  86. package/scripts/verifiers/plugin.js +215 -0
  87. package/scripts/verifiers/skills.js +209 -0
  88. package/scripts/verify-setup.js +164 -0
  89. package/skills/INDEX.md +157 -0
  90. package/skills/backend-patterns/SKILL.md +586 -0
  91. package/skills/backend-patterns/catalyst-patterns.md +128 -0
  92. package/skills/bigquery-patterns/SKILL.md +27 -0
  93. package/skills/bigquery-patterns/performance-optimization.md +518 -0
  94. package/skills/bigquery-patterns/query-patterns.md +372 -0
  95. package/skills/bigquery-patterns/schema-design.md +78 -0
  96. package/skills/cloudstream-project-template/SKILL.md +20 -0
  97. package/skills/cloudstream-project-template/structure.md +65 -0
  98. package/skills/coding-standards/SKILL.md +524 -0
  99. package/skills/coding-standards/deluge-standards.md +83 -0
  100. package/skills/compliance-patterns/SKILL.md +28 -0
  101. package/skills/compliance-patterns/hipaa/audit-requirements.md +251 -0
  102. package/skills/compliance-patterns/hipaa/baa-process.md +298 -0
  103. package/skills/compliance-patterns/hipaa/data-archival-strategy.md +387 -0
  104. package/skills/compliance-patterns/hipaa/phi-handling.md +52 -0
  105. package/skills/compliance-patterns/pci-dss/saq-a-requirements.md +307 -0
  106. package/skills/compliance-patterns/pci-dss/tokenization-patterns.md +382 -0
  107. package/skills/compliance-patterns/pci-dss/zoho-checkout-patterns.md +56 -0
  108. package/skills/compliance-patterns/soc2/access-controls.md +344 -0
  109. package/skills/compliance-patterns/soc2/audit-logging.md +458 -0
  110. package/skills/compliance-patterns/soc2/change-management.md +403 -0
  111. package/skills/compliance-patterns/soc2/deluge-execution-logging.md +407 -0
  112. package/skills/consultancy-workflows/SKILL.md +19 -0
  113. package/skills/consultancy-workflows/client-isolation.md +21 -0
  114. package/skills/consultancy-workflows/documentation-automation.md +454 -0
  115. package/skills/consultancy-workflows/handoff-procedures.md +257 -0
  116. package/skills/consultancy-workflows/knowledge-capture.md +513 -0
  117. package/skills/consultancy-workflows/time-tracking.md +26 -0
  118. package/skills/continuous-learning/SKILL.md +84 -0
  119. package/skills/continuous-learning/config.json +18 -0
  120. package/skills/continuous-learning/evaluate-session.sh +60 -0
  121. package/skills/continuous-learning-v2/SKILL.md +126 -0
  122. package/skills/continuous-learning-v2/config.json +61 -0
  123. package/skills/frontend-patterns/SKILL.md +635 -0
  124. package/skills/frontend-patterns/zoho-widget-patterns.md +103 -0
  125. package/skills/gcp-data-engineering/SKILL.md +36 -0
  126. package/skills/gcp-data-engineering/bigquery/performance-optimization.md +337 -0
  127. package/skills/gcp-data-engineering/dataflow/error-handling.md +496 -0
  128. package/skills/gcp-data-engineering/dataflow/pipeline-patterns.md +444 -0
  129. package/skills/gcp-data-engineering/dbt/model-organization.md +63 -0
  130. package/skills/gcp-data-engineering/dbt/testing-patterns.md +503 -0
  131. package/skills/gcp-data-engineering/medallion-architecture/bronze-layer.md +60 -0
  132. package/skills/gcp-data-engineering/medallion-architecture/gold-layer.md +311 -0
  133. package/skills/gcp-data-engineering/medallion-architecture/layer-transitions.md +517 -0
  134. package/skills/gcp-data-engineering/medallion-architecture/silver-layer.md +305 -0
  135. package/skills/gcp-data-engineering/zoho-to-gcp/data-extraction.md +543 -0
  136. package/skills/gcp-data-engineering/zoho-to-gcp/real-time-vs-batch.md +337 -0
  137. package/skills/security-review/SKILL.md +498 -0
  138. package/skills/security-review/compliance-checklist.md +53 -0
  139. package/skills/strategic-compact/SKILL.md +67 -0
  140. package/skills/tdd-workflow/SKILL.md +413 -0
  141. package/skills/tdd-workflow/zoho-testing.md +124 -0
  142. package/skills/tutorial/SKILL.md +249 -0
  143. package/skills/tutorial/docs/ACCESSIBILITY.md +169 -0
  144. package/skills/tutorial/lessons/00-philosophy-and-workflow.md +198 -0
  145. package/skills/tutorial/lessons/01-basics.md +81 -0
  146. package/skills/tutorial/lessons/02-training.md +86 -0
  147. package/skills/tutorial/lessons/03-commands.md +109 -0
  148. package/skills/tutorial/lessons/04-workflows.md +115 -0
  149. package/skills/tutorial/lessons/05-compliance.md +116 -0
  150. package/skills/tutorial/lessons/06-zoho.md +121 -0
  151. package/skills/tutorial/lessons/07-hooks-system.md +277 -0
  152. package/skills/tutorial/lessons/08-mcp-servers.md +316 -0
  153. package/skills/tutorial/lessons/09-client-management.md +215 -0
  154. package/skills/tutorial/lessons/10-testing-e2e.md +260 -0
  155. package/skills/tutorial/lessons/11-skills-deep-dive.md +272 -0
  156. package/skills/tutorial/lessons/12-rules-system.md +326 -0
  157. package/skills/tutorial/lessons/13-golden-standard-graduation.md +213 -0
  158. package/skills/tutorial/lessons/14-fork-setup-and-sync.md +312 -0
  159. package/skills/tutorial/lessons/15-living-examples-system.md +221 -0
  160. package/skills/tutorial/tracks/accelerated/README.md +134 -0
  161. package/skills/tutorial/tracks/accelerated/assessment/checkpoint-1.md +161 -0
  162. package/skills/tutorial/tracks/accelerated/assessment/checkpoint-2.md +175 -0
  163. package/skills/tutorial/tracks/accelerated/day-1-core-concepts.md +234 -0
  164. package/skills/tutorial/tracks/accelerated/day-2-essential-commands.md +270 -0
  165. package/skills/tutorial/tracks/accelerated/day-3-workflow-mastery.md +305 -0
  166. package/skills/tutorial/tracks/accelerated/day-4-compliance-zoho.md +304 -0
  167. package/skills/tutorial/tracks/accelerated/day-5-hooks-skills.md +344 -0
  168. package/skills/tutorial/tracks/accelerated/day-6-client-testing.md +386 -0
  169. package/skills/tutorial/tracks/accelerated/day-7-graduation.md +369 -0
  170. package/skills/zoho-patterns/CHANGELOG.md +108 -0
  171. package/skills/zoho-patterns/SKILL.md +446 -0
  172. package/skills/zoho-patterns/analytics/dashboard-patterns.md +352 -0
  173. package/skills/zoho-patterns/analytics/zoho-to-bigquery-pipeline.md +427 -0
  174. package/skills/zoho-patterns/catalyst/appsail-deployment.md +349 -0
  175. package/skills/zoho-patterns/catalyst/context-close-patterns.md +354 -0
  176. package/skills/zoho-patterns/catalyst/cron-batch-processing.md +374 -0
  177. package/skills/zoho-patterns/catalyst/function-patterns.md +439 -0
  178. package/skills/zoho-patterns/creator/form-design.md +304 -0
  179. package/skills/zoho-patterns/creator/publish-api-patterns.md +313 -0
  180. package/skills/zoho-patterns/creator/widget-integration.md +306 -0
  181. package/skills/zoho-patterns/creator/workflow-automation.md +253 -0
  182. package/skills/zoho-patterns/deluge/api-patterns.md +468 -0
  183. package/skills/zoho-patterns/deluge/batch-processing.md +403 -0
  184. package/skills/zoho-patterns/deluge/cross-app-integration.md +356 -0
  185. package/skills/zoho-patterns/deluge/error-handling.md +423 -0
  186. package/skills/zoho-patterns/deluge/syntax-reference.md +65 -0
  187. package/skills/zoho-patterns/integration/cors-proxy-architecture.md +426 -0
  188. package/skills/zoho-patterns/integration/crm-books-native-sync.md +277 -0
  189. package/skills/zoho-patterns/integration/oauth-token-management.md +461 -0
  190. package/skills/zoho-patterns/integration/zoho-flow-patterns.md +334 -0
@@ -0,0 +1,344 @@
1
+ # Day 5: Hooks System & Skills Deep Dive
2
+
3
+ **Duration**: 3-4 hours
4
+ **Covers**: Standard Lessons 7-8, 11-12 (Hooks, MCP, Skills, Rules)
5
+
6
+ ---
7
+
8
+ ## Part 1: The Hooks System
9
+
10
+ Hooks are scripts that run automatically at specific lifecycle events, enforcing quality without manual intervention.
11
+
12
+ ### Hook Lifecycle Events
13
+
14
+ | Hook Type | When It Runs | Use Cases |
15
+ |-----------|--------------|-----------|
16
+ | **PreToolUse** | Before a tool executes | Block dangerous ops, validate inputs |
17
+ | **PostToolUse** | After a tool completes | Auto-format, type check, warn |
18
+ | **Stop** | When Claude response ends | Final validation |
19
+ | **SessionStart** | When session begins | Load context, detect environment |
20
+ | **SessionEnd** | When session closes | Persist state, capture patterns |
21
+ | **PreCompact** | Before context compaction | Save important state |
22
+
23
+ ### Current Production Hooks
24
+
25
+ #### Blocking Hooks (exit 1 = operation stopped)
26
+
27
+ | Hook | What It Does | Trigger |
28
+ |------|--------------|---------|
29
+ | Credential Check | Scans for hardcoded secrets | Edit/Write operations |
30
+ | Dev Server Block | BLOCKS dev servers outside tmux | `npm run dev` |
31
+ | Doc Blocker | BLOCKS random .md file creation | Write to non-README .md |
32
+ | Quality Gates | BLOCKS code violating critical rules | Edit/Write operations |
33
+
34
+ #### Warning Hooks (stderr only, operation continues)
35
+
36
+ | Hook | What It Does | Trigger |
37
+ |------|--------------|---------|
38
+ | Tmux Reminder | Suggests tmux for long commands | npm install, docker, pytest |
39
+ | Git Push Review | Reminds to review before push | `git push` commands |
40
+ | Console.log Warning | Warns about console.log | After editing JS/TS |
41
+
42
+ #### Auto-Enhancement Hooks
43
+
44
+ | Hook | What It Does | Trigger |
45
+ |------|--------------|---------|
46
+ | Prettier Format | Auto-formats JS/TS files | After editing .js/.ts |
47
+ | TypeScript Check | Runs `tsc --noEmit` | After editing .ts/.tsx |
48
+ | Skill Injector | Injects relevant skill guidance | PreToolUse on code files |
49
+
50
+ #### Session Hooks
51
+
52
+ | Hook | What It Does |
53
+ |------|--------------|
54
+ | SessionStart | Loads previous context, detects package manager |
55
+ | SessionEnd | Persists session state, extracts patterns |
56
+ | PreCompact | Saves state before memory trim |
57
+
58
+ ### Hook Configuration
59
+
60
+ Hooks are defined in `hooks/hooks.json`:
61
+
62
+ ```json
63
+ {
64
+ "hooks": {
65
+ "PreToolUse": [
66
+ {
67
+ "matcher": "tool == \"Edit\" || tool == \"Write\"",
68
+ "hooks": [
69
+ {
70
+ "type": "command",
71
+ "command": "node scripts/hooks/credential-check.js"
72
+ }
73
+ ],
74
+ "description": "Scan for hardcoded credentials"
75
+ }
76
+ ]
77
+ }
78
+ }
79
+ ```
80
+
81
+ ### Matcher Syntax
82
+
83
+ | Matcher | Meaning |
84
+ |---------|---------|
85
+ | `*` | Always run |
86
+ | `tool == "Edit"` | Only on Edit tool |
87
+ | `tool == "Bash" && tool_input.command matches "git push"` | Specific bash command |
88
+ | `tool_input.file_path matches "\\.ts$"` | TypeScript files |
89
+
90
+ ---
91
+
92
+ ## Part 2: MCP Servers
93
+
94
+ MCP (Model Context Protocol) provides external capabilities to Claude Code.
95
+
96
+ ### MCP Servers in This System
97
+
98
+ | Server | Purpose | Key Functions |
99
+ |--------|---------|---------------|
100
+ | **Memory** | Persistent knowledge graph | Stores entities, relations across sessions |
101
+ | **Context7** | Library documentation lookup | Real-time docs for npm packages |
102
+ | **Sequential Thinking** | Structured reasoning | Chain-of-thought for complex problems |
103
+
104
+ ### Memory MCP
105
+
106
+ Enables cross-session memory:
107
+
108
+ ```javascript
109
+ // Store knowledge
110
+ mcp__plugin_memory__create_entities({
111
+ entities: [{ name: "UserPreferences", entityType: "config", observations: ["dark mode", "vim bindings"] }]
112
+ })
113
+
114
+ // Query knowledge
115
+ mcp__plugin_memory__search_nodes({ query: "user preferences" })
116
+ ```
117
+
118
+ ### Using MCP in Practice
119
+
120
+ Run `/health-check` to verify MCP servers are connected:
121
+
122
+ ```
123
+ /health-check
124
+ ```
125
+
126
+ Output shows:
127
+ - Memory MCP: Connected/Disconnected
128
+ - Context7: Available/Unavailable
129
+ - Sequential Thinking: Ready/Not configured
130
+
131
+ ---
132
+
133
+ ## Part 3: Skills System
134
+
135
+ Skills are reusable knowledge packages that inform how Claude approaches domains.
136
+
137
+ ### The 15 Skills by Category
138
+
139
+ | Category | Skills | Purpose |
140
+ |----------|--------|---------|
141
+ | **Development** | coding-standards, tdd-workflow, backend-patterns, frontend-patterns | Coding patterns |
142
+ | **Quality** | security-review | Security and vulnerability detection |
143
+ | **Platform** | zoho-patterns, bigquery-patterns, gcp-data-engineering | Platform-specific |
144
+ | **Compliance** | compliance-patterns | Regulatory requirements |
145
+ | **Process** | consultancy-workflows, cloudstream-project-template, tutorial, strategic-compact, continuous-learning, continuous-learning-v2 | Workflow patterns |
146
+
147
+ ### Skill Anatomy
148
+
149
+ Every skill has a `SKILL.md`:
150
+
151
+ ```markdown
152
+ ---
153
+ name: skill-name
154
+ description: One-line description
155
+ version: 1.0.0
156
+ status: active
157
+ ---
158
+
159
+ # Skill Title
160
+
161
+ ## When to Activate
162
+ - Trigger conditions
163
+
164
+ ## Core Patterns
165
+ - Key approaches
166
+
167
+ ## Anti-Patterns
168
+ - What NOT to do
169
+
170
+ ## Examples
171
+ - Demonstrations
172
+ ```
173
+
174
+ ### Skill-Agent Relationships
175
+
176
+ Skills inform agents:
177
+
178
+ | Agent | Primary Skills |
179
+ |-------|---------------|
180
+ | planner | All skills (comprehensive planning) |
181
+ | tdd-guide | tdd-workflow, coding-standards |
182
+ | code-reviewer | coding-standards, security-review |
183
+ | deluge-reviewer | zoho-patterns/deluge |
184
+ | creator-architect | zoho-patterns/creator |
185
+ | security-reviewer | security-review, compliance-patterns |
186
+
187
+ ---
188
+
189
+ ## Part 4: Rules System
190
+
191
+ Rules define behavioral constraints. They load in priority order.
192
+
193
+ ### Rule Loading Order
194
+
195
+ 1. **Global CLAUDE.md** - System-wide defaults
196
+ 2. **Project .claude/CLAUDE.md** - Project-specific rules
197
+ 3. **Directory CLAUDE.md files** - Local overrides
198
+
199
+ ### Rule Frontmatter
200
+
201
+ ```markdown
202
+ ---
203
+ description: What this ruleset does
204
+ globs: src/**/*.ts
205
+ alwaysApply: true
206
+ ---
207
+
208
+ # Rules Content
209
+
210
+ ## Standards
211
+ - Rule 1
212
+ - Rule 2
213
+ ```
214
+
215
+ ### Key Fields
216
+
217
+ | Field | Purpose |
218
+ |-------|---------|
219
+ | `description` | Human-readable summary |
220
+ | `globs` | File patterns to apply rules to |
221
+ | `alwaysApply` | Whether rules are always active |
222
+
223
+ ---
224
+
225
+ ## Exercises
226
+
227
+ ### Exercise 5.1: Examine Hooks Configuration
228
+
229
+ ```bash
230
+ # View hooks configuration
231
+ cat hooks/hooks.json
232
+
233
+ # Count hooks by type
234
+ grep -c "PreToolUse\|PostToolUse\|SessionStart" hooks/hooks.json
235
+ ```
236
+
237
+ Questions:
238
+ - How many PreToolUse hooks exist?
239
+ - Which hooks are blocking vs. warning?
240
+
241
+ ### Exercise 5.2: Trigger a Hook
242
+
243
+ 1. Create a TypeScript file with an issue:
244
+ ```typescript
245
+ const x = 1;
246
+ console.log(x); // Will trigger warning hook
247
+ ```
248
+
249
+ 2. Observe:
250
+ - Prettier formats the file
251
+ - TypeScript check runs
252
+ - Console.log warning appears
253
+
254
+ ### Exercise 5.3: Verify MCP Status
255
+
256
+ ```
257
+ /health-check
258
+ ```
259
+
260
+ Check:
261
+ - Memory MCP connection status
262
+ - Other MCP servers available
263
+
264
+ ### Exercise 5.4: Explore Skills
265
+
266
+ ```bash
267
+ # List all skills
268
+ ls skills/
269
+
270
+ # Read a skill definition
271
+ cat skills/zoho-patterns/SKILL.md
272
+
273
+ # Explore skill subdirectories
274
+ ls skills/zoho-patterns/
275
+ ```
276
+
277
+ ### Exercise 5.5: Examine Rules Loading
278
+
279
+ ```bash
280
+ # View global rules
281
+ cat CLAUDE.md
282
+
283
+ # Check for project rules
284
+ ls -la .claude/
285
+
286
+ # View frontmatter patterns
287
+ grep -A 5 "^---" CLAUDE.md
288
+ ```
289
+
290
+ ---
291
+
292
+ ## Verification Checklist
293
+
294
+ Before proceeding to Day 6, confirm:
295
+
296
+ - [ ] Understand the 6 hook lifecycle events
297
+ - [ ] Know which hooks block vs. warn
298
+ - [ ] Saw hooks fire when editing a file
299
+ - [ ] Verified MCP status with `/health-check`
300
+ - [ ] Can list and navigate the 15 active skills
301
+ - [ ] Understand skill-agent relationships
302
+ - [ ] Know the rules loading priority order
303
+
304
+ ---
305
+
306
+ ## Key Takeaways
307
+
308
+ 1. **Hooks are invisible guardrails** - quality enforcement without manual steps
309
+ 2. **Blocking hooks prevent bad operations** - credentials, outside-tmux servers
310
+ 3. **Skills inform agents** - domain knowledge embedded in the system
311
+ 4. **Rules cascade** - global → project → directory
312
+ 5. **MCP enables persistence** - memory across sessions
313
+
314
+ ---
315
+
316
+ ## Quick Reference
317
+
318
+ ### Hook Types
319
+ ```
320
+ BLOCKING: credential-check, dev-server-block, doc-blocker, quality-gates
321
+ WARNING: console-log, tmux-reminder, git-push-review
322
+ AUTO: prettier-format, typescript-check, skill-injector
323
+ SESSION: session-start, session-end, pre-compact
324
+ ```
325
+
326
+ ### Skill Categories
327
+ ```
328
+ DEVELOPMENT: coding-standards, tdd-workflow, backend-patterns, frontend-patterns
329
+ QUALITY: security-review
330
+ PLATFORM: zoho-patterns, bigquery-patterns, gcp-data-engineering
331
+ COMPLIANCE: compliance-patterns
332
+ PROCESS: consultancy-workflows, project-template, tutorial, strategic-compact, continuous-learning
333
+ ```
334
+
335
+ ### Rules Loading
336
+ ```
337
+ 1. Global CLAUDE.md (system defaults)
338
+ 2. .claude/CLAUDE.md (project rules)
339
+ 3. Directory CLAUDE.md (local overrides)
340
+ ```
341
+
342
+ ---
343
+
344
+ **Day 5 Complete** | Next: [Day 6 - Client Management & Testing](day-6-client-testing.md)
@@ -0,0 +1,386 @@
1
+ # Day 6: Client Management & Testing
2
+
3
+ **Duration**: 3-4 hours
4
+ **Covers**: Standard Lessons 9-10 (Client Management, E2E Testing)
5
+ **Assessment**: Checkpoint 2 after this day
6
+
7
+ ---
8
+
9
+ ## Part 1: Client Management
10
+
11
+ CloudStream is a consultancy serving multiple clients. Proper isolation is critical.
12
+
13
+ ### Why Client Isolation Matters
14
+
15
+ | Risk | Consequence |
16
+ |------|-------------|
17
+ | Data leak | Client A's data visible to Client B |
18
+ | Config leak | Wrong API keys used |
19
+ | Compliance breach | HIPAA data in non-HIPAA project |
20
+ | Billing confusion | Time tracked to wrong client |
21
+
22
+ ### Client Context System
23
+
24
+ Each client has isolated:
25
+ - Environment variables (API keys, credentials)
26
+ - Compliance mode (HIPAA, SOC2, PCI-DSS)
27
+ - Project-specific CLAUDE.md rules
28
+ - Session memory and learned patterns
29
+
30
+ ### Key Commands
31
+
32
+ ```
33
+ /client-switch CLIENT-ID - Switch to client context
34
+ /handoff - Generate handoff documentation
35
+ ```
36
+
37
+ ### /client-switch
38
+
39
+ Switches to a client context:
40
+
41
+ ```
42
+ /client-switch CLT-042
43
+ ```
44
+
45
+ This:
46
+ 1. Loads client's environment variables
47
+ 2. Sets appropriate compliance mode
48
+ 3. Loads client-specific rules
49
+ 4. Displays recent activity summary
50
+
51
+ ### /handoff
52
+
53
+ Generates comprehensive handoff documentation:
54
+
55
+ ```
56
+ /handoff
57
+ ```
58
+
59
+ Produces:
60
+ - Project status summary
61
+ - Outstanding tasks
62
+ - Known issues and workarounds
63
+ - Configuration details
64
+ - Team contact information
65
+
66
+ Use when:
67
+ - Transitioning client to another developer
68
+ - Client completing engagement
69
+ - Quarterly documentation refresh
70
+
71
+ ### Client Configuration
72
+
73
+ Client settings in `.claude/clients/CLIENT-ID/`:
74
+
75
+ ```
76
+ .claude/clients/CLT-042/
77
+ ├── config.json # Client settings
78
+ ├── .env # Client environment variables
79
+ ├── CLAUDE.md # Client-specific rules
80
+ └── recent-activity/ # Session logs
81
+ ```
82
+
83
+ ---
84
+
85
+ ## Part 2: Testing & E2E
86
+
87
+ Comprehensive testing ensures quality and catches regressions.
88
+
89
+ ### The Testing Pyramid
90
+
91
+ ```
92
+ /\
93
+ / \
94
+ / E2E \ ← Fewer, slower, critical paths
95
+ /--------\
96
+ /Integration\ ← Medium, API boundaries
97
+ /--------------\
98
+ / Unit Tests \ ← Many, fast, isolated
99
+ /------------------\
100
+ ```
101
+
102
+ ### Key Testing Commands
103
+
104
+ | Command | Purpose | When to Use |
105
+ |---------|---------|-------------|
106
+ | `/tdd` | Test-driven development | All new code |
107
+ | `/e2e` | End-to-end Playwright tests | Critical user journeys |
108
+ | `/build-fix` | Fix build/type errors | When builds fail |
109
+ | `/test-coverage` | Analyze and increase coverage | Before PR, after features |
110
+ | `/eval` | Run quality evaluations | Quality gates, benchmarks |
111
+
112
+ ### /e2e Command
113
+
114
+ Generates and runs end-to-end tests:
115
+
116
+ ```
117
+ /e2e "user login flow"
118
+ ```
119
+
120
+ This:
121
+ 1. Creates Playwright test file
122
+ 2. Defines user journey steps
123
+ 3. Runs the test
124
+ 4. Captures screenshots/videos
125
+ 5. Reports results
126
+
127
+ ### /build-fix Command
128
+
129
+ Iteratively fixes build errors:
130
+
131
+ ```
132
+ /build-fix
133
+ ```
134
+
135
+ This:
136
+ 1. Parses current build errors
137
+ 2. Fixes one error at a time
138
+ 3. Re-runs build
139
+ 4. Repeats until green
140
+
141
+ ### /test-coverage Command
142
+
143
+ Analyzes and improves coverage:
144
+
145
+ ```
146
+ /test-coverage
147
+ ```
148
+
149
+ This:
150
+ 1. Runs coverage analysis
151
+ 2. Identifies uncovered lines
152
+ 3. Generates missing tests
153
+ 4. Reports coverage percentage
154
+
155
+ Target: 80%+ coverage
156
+
157
+ ### /eval Command
158
+
159
+ Runs quality evaluations:
160
+
161
+ ```
162
+ /eval check auth-login
163
+ ```
164
+
165
+ Evals are defined tests for specific functionality. They ensure:
166
+ - Regressions are caught
167
+ - Quality remains high
168
+ - Critical paths work
169
+
170
+ ---
171
+
172
+ ## Part 3: Testing Patterns
173
+
174
+ ### TDD Workflow (Review)
175
+
176
+ ```
177
+ /tdd "feature name"
178
+ ```
179
+
180
+ 1. **RED**: Write failing test
181
+ 2. **GREEN**: Minimal code to pass
182
+ 3. **REFACTOR**: Clean up while green
183
+
184
+ ### E2E Test Structure
185
+
186
+ ```javascript
187
+ // tests/e2e/login.spec.ts
188
+ import { test, expect } from '@playwright/test';
189
+
190
+ test('user can log in', async ({ page }) => {
191
+ // Arrange
192
+ await page.goto('/login');
193
+
194
+ // Act
195
+ await page.fill('[name="email"]', 'user@example.com');
196
+ await page.fill('[name="password"]', 'password123');
197
+ await page.click('button[type="submit"]');
198
+
199
+ // Assert
200
+ await expect(page).toHaveURL('/dashboard');
201
+ await expect(page.locator('h1')).toHaveText('Welcome');
202
+ });
203
+ ```
204
+
205
+ ### Coverage Strategy
206
+
207
+ | Coverage Level | Target | For |
208
+ |----------------|--------|-----|
209
+ | Unit | 80%+ | Business logic |
210
+ | Integration | 70%+ | API endpoints |
211
+ | E2E | Critical paths | User journeys |
212
+
213
+ ### Handling Flaky Tests
214
+
215
+ E2E tests can be flaky. The system:
216
+ 1. Retries failed tests (2x)
217
+ 2. Captures screenshots on failure
218
+ 3. Records video for debugging
219
+ 4. Quarantines persistently flaky tests
220
+
221
+ ---
222
+
223
+ ## Exercises
224
+
225
+ ### Exercise 6.1: Client Switch Simulation
226
+
227
+ If you have client configurations:
228
+
229
+ ```
230
+ /client-switch CLT-001
231
+ ```
232
+
233
+ Observe:
234
+ - Environment loaded message
235
+ - Compliance mode indication
236
+ - Recent activity display
237
+
238
+ If no clients configured:
239
+ ```
240
+ # Create mock client config
241
+ mkdir -p .claude/clients/TEST-001
242
+ echo '{"name": "Test Client", "compliance": "standard"}' > .claude/clients/TEST-001/config.json
243
+ ```
244
+
245
+ ### Exercise 6.2: Generate Handoff Documentation
246
+
247
+ ```
248
+ /handoff
249
+ ```
250
+
251
+ Review the generated documentation:
252
+ - Is project status accurate?
253
+ - Are known issues documented?
254
+ - Is configuration captured?
255
+
256
+ ### Exercise 6.3: Write E2E Test
257
+
258
+ ```
259
+ /e2e "user signup flow"
260
+ ```
261
+
262
+ Observe:
263
+ - Test file generation
264
+ - Step definitions
265
+ - Assertion patterns
266
+
267
+ ### Exercise 6.4: Fix Build Errors
268
+
269
+ Create a file with type errors:
270
+
271
+ ```typescript
272
+ // broken.ts
273
+ const x: number = "not a number"; // Type error
274
+ ```
275
+
276
+ Run:
277
+ ```
278
+ /build-fix
279
+ ```
280
+
281
+ Observe:
282
+ - Error parsing
283
+ - Suggested fix
284
+ - Verification
285
+
286
+ ### Exercise 6.5: Coverage Analysis
287
+
288
+ ```
289
+ /test-coverage
290
+ ```
291
+
292
+ Review:
293
+ - Current coverage percentage
294
+ - Uncovered lines identified
295
+ - Suggested tests
296
+
297
+ ### Exercise 6.6: Run Eval
298
+
299
+ ```
300
+ /eval list
301
+ ```
302
+
303
+ See available evals, then run one:
304
+
305
+ ```
306
+ /eval check [eval-name]
307
+ ```
308
+
309
+ ---
310
+
311
+ ## Verification Checklist
312
+
313
+ Before taking Checkpoint 2, confirm:
314
+
315
+ - [ ] Understand client isolation importance
316
+ - [ ] Can use `/client-switch` command
317
+ - [ ] Can generate handoff documentation
318
+ - [ ] Know the testing pyramid
319
+ - [ ] Practiced `/e2e` test generation
320
+ - [ ] Used `/build-fix` for error resolution
321
+ - [ ] Ran `/test-coverage` analysis
322
+ - [ ] Understand eval system basics
323
+
324
+ ---
325
+
326
+ ## Checkpoint 2 Assessment
327
+
328
+ After completing Day 6, you must pass Checkpoint 2 before proceeding.
329
+
330
+ Run:
331
+ ```
332
+ /tutorial checkpoint-2
333
+ ```
334
+
335
+ Topics covered:
336
+ - Compliance modes (HIPAA/SOC2/PCI-DSS)
337
+ - Zoho platform development
338
+ - Hooks system
339
+ - Skills and rules
340
+ - Client management
341
+ - Testing (E2E, coverage, evals)
342
+
343
+ Passing score: 80%
344
+ Max retakes: 2
345
+
346
+ See: [Checkpoint 2 Assessment](assessment/checkpoint-2.md)
347
+
348
+ ---
349
+
350
+ ## Key Takeaways
351
+
352
+ 1. **Client isolation is non-negotiable** - data leaks have legal consequences
353
+ 2. **Always handoff properly** - documentation prevents knowledge loss
354
+ 3. **Testing pyramid matters** - many unit tests, fewer E2E
355
+ 4. **80% coverage target** - quality gate for production
356
+ 5. **E2E tests critical paths** - user journeys that can't fail
357
+
358
+ ---
359
+
360
+ ## Quick Reference
361
+
362
+ ### Client Commands
363
+ ```
364
+ /client-switch CLIENT-ID - Switch context
365
+ /handoff - Generate handoff docs
366
+ ```
367
+
368
+ ### Testing Commands
369
+ ```
370
+ /tdd "name" - Test-driven development
371
+ /e2e "journey" - End-to-end tests
372
+ /build-fix - Fix build errors
373
+ /test-coverage - Coverage analysis
374
+ /eval check [name] - Run evaluation
375
+ ```
376
+
377
+ ### Testing Targets
378
+ ```
379
+ Unit: 80%+ coverage
380
+ Integration: 70%+ coverage
381
+ E2E: All critical paths
382
+ ```
383
+
384
+ ---
385
+
386
+ **Day 6 Complete** | **CHECKPOINT 2 REQUIRED** | Next: [Day 7 - Graduation](day-7-graduation.md)