claude-code-orchestrator-kit 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 (130) hide show
  1. package/.claude/agents/database/workers/api-builder.md +155 -0
  2. package/.claude/agents/database/workers/database-architect.md +193 -0
  3. package/.claude/agents/database/workers/supabase-auditor.md +1070 -0
  4. package/.claude/agents/development/workers/code-reviewer.md +968 -0
  5. package/.claude/agents/development/workers/cost-calculator-specialist.md +683 -0
  6. package/.claude/agents/development/workers/llm-service-specialist.md +999 -0
  7. package/.claude/agents/development/workers/skill-builder-v2.md +480 -0
  8. package/.claude/agents/development/workers/typescript-types-specialist.md +649 -0
  9. package/.claude/agents/development/workers/utility-builder.md +582 -0
  10. package/.claude/agents/documentation/workers/technical-writer.md +152 -0
  11. package/.claude/agents/frontend/workers/fullstack-nextjs-specialist.md +206 -0
  12. package/.claude/agents/frontend/workers/visual-effects-creator.md +159 -0
  13. package/.claude/agents/health/orchestrators/bug-orchestrator.md +1045 -0
  14. package/.claude/agents/health/orchestrators/dead-code-orchestrator.md +1045 -0
  15. package/.claude/agents/health/orchestrators/dependency-orchestrator.md +1045 -0
  16. package/.claude/agents/health/orchestrators/security-orchestrator.md +1045 -0
  17. package/.claude/agents/health/workers/bug-fixer.md +525 -0
  18. package/.claude/agents/health/workers/bug-hunter.md +649 -0
  19. package/.claude/agents/health/workers/dead-code-hunter.md +446 -0
  20. package/.claude/agents/health/workers/dead-code-remover.md +437 -0
  21. package/.claude/agents/health/workers/dependency-auditor.md +379 -0
  22. package/.claude/agents/health/workers/dependency-updater.md +436 -0
  23. package/.claude/agents/health/workers/security-scanner.md +700 -0
  24. package/.claude/agents/health/workers/vulnerability-fixer.md +524 -0
  25. package/.claude/agents/infrastructure/workers/infrastructure-specialist.md +156 -0
  26. package/.claude/agents/infrastructure/workers/orchestration-logic-specialist.md +1260 -0
  27. package/.claude/agents/infrastructure/workers/qdrant-specialist.md +503 -0
  28. package/.claude/agents/infrastructure/workers/quality-validator-specialist.md +984 -0
  29. package/.claude/agents/meta/workers/meta-agent-v3.md +503 -0
  30. package/.claude/agents/research/workers/problem-investigator.md +507 -0
  31. package/.claude/agents/research/workers/research-specialist.md +423 -0
  32. package/.claude/agents/testing/workers/accessibility-tester.md +813 -0
  33. package/.claude/agents/testing/workers/integration-tester.md +188 -0
  34. package/.claude/agents/testing/workers/mobile-fixes-implementer.md +252 -0
  35. package/.claude/agents/testing/workers/mobile-responsiveness-tester.md +180 -0
  36. package/.claude/agents/testing/workers/performance-optimizer.md +262 -0
  37. package/.claude/agents/testing/workers/test-writer.md +800 -0
  38. package/.claude/commands/health-bugs.md +297 -0
  39. package/.claude/commands/health-cleanup.md +297 -0
  40. package/.claude/commands/health-deps.md +297 -0
  41. package/.claude/commands/health-metrics.md +747 -0
  42. package/.claude/commands/health-security.md +297 -0
  43. package/.claude/commands/push.md +21 -0
  44. package/.claude/commands/speckit.analyze.md +184 -0
  45. package/.claude/commands/speckit.checklist.md +294 -0
  46. package/.claude/commands/speckit.clarify.md +178 -0
  47. package/.claude/commands/speckit.constitution.md +78 -0
  48. package/.claude/commands/speckit.implement.md +182 -0
  49. package/.claude/commands/speckit.plan.md +87 -0
  50. package/.claude/commands/speckit.specify.md +250 -0
  51. package/.claude/commands/speckit.tasks.md +137 -0
  52. package/.claude/commands/translate-doc.md +95 -0
  53. package/.claude/commands/worktree-cleanup.md +382 -0
  54. package/.claude/commands/worktree-create.md +287 -0
  55. package/.claude/commands/worktree-list.md +239 -0
  56. package/.claude/commands/worktree-remove.md +339 -0
  57. package/.claude/schemas/base-plan.schema.json +82 -0
  58. package/.claude/schemas/bug-plan.schema.json +71 -0
  59. package/.claude/schemas/dead-code-plan.schema.json +71 -0
  60. package/.claude/schemas/dependency-plan.schema.json +74 -0
  61. package/.claude/schemas/security-plan.schema.json +71 -0
  62. package/.claude/scripts/gates/check-bundle-size.sh +47 -0
  63. package/.claude/scripts/gates/check-coverage.sh +67 -0
  64. package/.claude/scripts/gates/check-security.sh +46 -0
  65. package/.claude/scripts/release.sh +740 -0
  66. package/.claude/settings.local.json +21 -0
  67. package/.claude/settings.local.json.example +20 -0
  68. package/.claude/skills/calculate-priority-score/SKILL.md +229 -0
  69. package/.claude/skills/calculate-priority-score/scoring-matrix.json +83 -0
  70. package/.claude/skills/extract-version/SKILL.md +228 -0
  71. package/.claude/skills/format-commit-message/SKILL.md +189 -0
  72. package/.claude/skills/format-commit-message/template.md +64 -0
  73. package/.claude/skills/format-markdown-table/SKILL.md +202 -0
  74. package/.claude/skills/format-markdown-table/examples.md +84 -0
  75. package/.claude/skills/format-todo-list/SKILL.md +222 -0
  76. package/.claude/skills/format-todo-list/template.json +30 -0
  77. package/.claude/skills/generate-changelog/SKILL.md +258 -0
  78. package/.claude/skills/generate-changelog/commit-mapping.json +47 -0
  79. package/.claude/skills/generate-report-header/SKILL.md +228 -0
  80. package/.claude/skills/generate-report-header/template.md +66 -0
  81. package/.claude/skills/parse-error-logs/SKILL.md +286 -0
  82. package/.claude/skills/parse-error-logs/patterns.json +26 -0
  83. package/.claude/skills/parse-git-status/SKILL.md +164 -0
  84. package/.claude/skills/parse-package-json/SKILL.md +151 -0
  85. package/.claude/skills/parse-package-json/schema.json +43 -0
  86. package/.claude/skills/render-template/SKILL.md +245 -0
  87. package/.claude/skills/rollback-changes/SKILL.md +582 -0
  88. package/.claude/skills/rollback-changes/changes-log-schema.json +101 -0
  89. package/.claude/skills/run-quality-gate/SKILL.md +404 -0
  90. package/.claude/skills/run-quality-gate/gate-mappings.json +97 -0
  91. package/.claude/skills/validate-plan-file/SKILL.md +327 -0
  92. package/.claude/skills/validate-plan-file/schema.json +35 -0
  93. package/.claude/skills/validate-report-file/SKILL.md +256 -0
  94. package/.claude/skills/validate-report-file/schema.json +67 -0
  95. package/.env.example +49 -0
  96. package/.github/BRANCH_PROTECTION.md +137 -0
  97. package/.github/workflows/build.yml +70 -0
  98. package/.github/workflows/claude-code-review.yml +255 -0
  99. package/.github/workflows/claude.yml +79 -0
  100. package/.github/workflows/deploy-staging.yml +90 -0
  101. package/.github/workflows/test.yml +104 -0
  102. package/.gitignore +116 -0
  103. package/CLAUDE.md +137 -0
  104. package/LICENSE +72 -0
  105. package/README.md +1098 -0
  106. package/docs/ARCHITECTURE.md +746 -0
  107. package/docs/Agents Ecosystem/AGENT-ORCHESTRATION.md +568 -0
  108. package/docs/Agents Ecosystem/AI-AGENT-ECOSYSTEM-README.md +658 -0
  109. package/docs/Agents Ecosystem/ARCHITECTURE.md +606 -0
  110. package/docs/Agents Ecosystem/QUALITY-GATES-SPECIFICATION.md +1315 -0
  111. package/docs/Agents Ecosystem/REPORT-TEMPLATE-STANDARD.md +1324 -0
  112. package/docs/Agents Ecosystem/spec-kit-comprehensive-updates.md +478 -0
  113. package/docs/FAQ.md +572 -0
  114. package/docs/MIGRATION-GUIDE.md +542 -0
  115. package/docs/PERFORMANCE-OPTIMIZATION.md +494 -0
  116. package/docs/ROADMAP.md +439 -0
  117. package/docs/TUTORIAL-CUSTOM-AGENTS.md +2041 -0
  118. package/docs/USE-CASES.md +706 -0
  119. package/index.js +96 -0
  120. package/mcp/.mcp.base.json +21 -0
  121. package/mcp/.mcp.frontend.json +29 -0
  122. package/mcp/.mcp.full.json +67 -0
  123. package/mcp/.mcp.local.example.json +7 -0
  124. package/mcp/.mcp.local.json +7 -0
  125. package/mcp/.mcp.n8n.json +45 -0
  126. package/mcp/.mcp.supabase-full.json +35 -0
  127. package/mcp/.mcp.supabase-only.json +28 -0
  128. package/package.json +78 -0
  129. package/postinstall.js +71 -0
  130. package/switch-mcp.sh +101 -0
@@ -0,0 +1,747 @@
1
+ # Command: /health-metrics
2
+
3
+ You are analyzing agent ecosystem health metrics to generate monthly performance reports.
4
+
5
+ ## Purpose
6
+
7
+ Generate comprehensive monthly metrics report showing agent performance, quality gates, complexity distribution, Context7 usage, and system health for data-driven optimization decisions.
8
+
9
+ ## Process
10
+
11
+ ### Step 1: Determine Reporting Period
12
+
13
+ **Default**: Current month (YYYY-MM format)
14
+
15
+ **User can specify**: Previous month or specific month
16
+
17
+ **Examples**:
18
+ - `/health-metrics` → Current month (2025-10)
19
+ - `/health-metrics 2025-09` → September 2025
20
+ - `/health-metrics last-month` → Previous month
21
+
22
+ ### Step 2: Read Metrics Files
23
+
24
+ **Current Month**:
25
+ ```
26
+ File: .tmp/metrics/YYYY-MM.json
27
+ ```
28
+
29
+ **Previous Month** (for comparison):
30
+ ```
31
+ File: .tmp/metrics/YYYY-(MM-1).json
32
+ ```
33
+
34
+ **If file doesn't exist**:
35
+ - Report: "No metrics data for {month}"
36
+ - Suggest: "Run agent workflows to generate metrics first"
37
+ - Exit gracefully
38
+
39
+ **If file corrupt**:
40
+ - Attempt to read backup: `.tmp/metrics/YYYY-MM.json.backup`
41
+ - If backup also corrupt: Report error and exit
42
+ - Log corruption incident
43
+
44
+ ### Step 3: Analyze Metrics
45
+
46
+ Calculate key insights from metrics data.
47
+
48
+ #### Agent Performance Analysis
49
+
50
+ **For each agent**:
51
+ - **Success Rate**: `(successes / invocations) * 100`
52
+ - **Performance Trend**: Compare avg_duration vs previous month
53
+ - **Value Delivered**: Count of bugs/vulnerabilities/issues found
54
+
55
+ **Categorize Agents**:
56
+ - **Top Performers**: Success rate >= 90%
57
+ - **Needs Improvement**: Success rate < 70%
58
+ - **Underutilized**: Invocations < 5 per month
59
+
60
+ #### Orchestrator Performance Analysis
61
+
62
+ **For each orchestrator**:
63
+ - **Success Rate**: `(completed / runs) * 100`
64
+ - **Abort Rate**: `(aborted / runs) * 100`
65
+ - **Iteration Efficiency**: avg_iterations (lower is better)
66
+ - **Max Iterations Hit**: Count (indicates complexity issues)
67
+
68
+ #### Quality Gates Analysis
69
+
70
+ **For each gate (type-check, build, tests)**:
71
+ - **Pass Rate**: Already calculated in metrics
72
+ - **Trend**: Compare pass rate vs previous month
73
+ - **Flag Concerns**: Pass rate < 85%
74
+
75
+ #### Complexity Distribution
76
+
77
+ **Analyze complexity levels**:
78
+ - **Percentage by level**: Calculate % for trivial/moderate/high/critical
79
+ - **Research Usage**: % of high/critical that triggered research
80
+ - **Average Score**: Indicates overall task difficulty
81
+
82
+ #### Context7 Integration Health
83
+
84
+ **Metrics**:
85
+ - **Success Rate**: `(successful_queries / total_queries) * 100`
86
+ - **Availability**: `100 - (unavailable_events / total_invocations * 100)`
87
+ - **Performance**: avg_response_time_ms
88
+ - **Top Libraries**: Sort by query count
89
+
90
+ #### Behavioral OS Health
91
+
92
+ **Fallback Frequency**:
93
+ - Count total fallbacks
94
+ - Calculate % of invocations that triggered fallbacks
95
+ - Flag if any fallback > 5% frequency
96
+
97
+ **Emergency Incidents**:
98
+ - Count each emergency type
99
+ - Flag if any emergency occurred (should be rare)
100
+
101
+ **Prime Directive Violations**:
102
+ - Should be 0 (self-diagnostics prevent violations)
103
+ - If > 0: Critical issue, needs investigation
104
+
105
+ ### Step 4: Generate Trend Analysis
106
+
107
+ Compare current month vs previous month (if available).
108
+
109
+ **Metrics to Compare**:
110
+ - Total invocations (growth indicator)
111
+ - Overall success rate (reliability trend)
112
+ - Quality gate pass rates (code health trend)
113
+ - Context7 usage (adoption trend)
114
+ - Research phases triggered (complexity trend)
115
+
116
+ **Change Indicators**:
117
+ - ⬆️ Increase
118
+ - ⬇️ Decrease
119
+ - ➡️ No change (within 2%)
120
+
121
+ ### Step 5: Generate Recommendations
122
+
123
+ Based on data analysis, provide actionable recommendations.
124
+
125
+ **High Priority** (Success rate < 70%, emergency incidents):
126
+ - Specific agent improvements needed
127
+ - Quality gate investigations required
128
+ - System reliability issues
129
+
130
+ **Medium Priority** (Pass rate < 85%, underutilization):
131
+ - Agent discoverability improvements
132
+ - Documentation updates
133
+ - Workflow optimizations
134
+
135
+ **Low Priority** (Nice-to-have optimizations):
136
+ - Token efficiency improvements
137
+ - Performance optimizations
138
+ - Feature requests
139
+
140
+ ### Step 6: Create Report
141
+
142
+ **Location**: `docs/reports/metrics/YYYY-MM-ecosystem-health.md`
143
+
144
+ **Directory Creation**:
145
+ - If `docs/reports/metrics/` doesn't exist: create it
146
+ - Ensure parent directories exist
147
+
148
+ **Report Format**:
149
+
150
+ ```markdown
151
+ # Agent Ecosystem Health Report — {Month} {Year}
152
+
153
+ **Generated**: {timestamp}
154
+ **Period**: {Month} 1-{last day}, {Year}
155
+ **Total Agent Invocations**: {count}
156
+
157
+ ---
158
+
159
+ ## Executive Summary
160
+
161
+ **Overall Health**: ✅ **GOOD** | ⚠️ **FAIR** | ❌ **POOR** ({success_rate}% success rate)
162
+
163
+ **Determination**:
164
+ - >= 90% success rate: GOOD ✅
165
+ - >= 75% success rate: FAIR ⚠️
166
+ - < 75% success rate: POOR ❌
167
+
168
+ **Highlights**:
169
+ - Most used agent: {agent_name} ({invocations} invocations)
170
+ - Best performer: {agent_name} ({success_rate}% success rate)
171
+ - Top concern: {agent_name} ({issue_description})
172
+
173
+ **Key Metrics**:
174
+ - Total bugs found: {count}
175
+ - Total vulnerabilities found: {count}
176
+ - Context7 queries: {count} ({success_rate}% success rate)
177
+ - Quality gates pass rate: {percent}%
178
+
179
+ ---
180
+
181
+ ## Agent Performance
182
+
183
+ ### Top Performers ✅
184
+
185
+ For each agent with >= 90% success rate:
186
+
187
+ #### {Agent Name}
188
+ - **Success Rate**: {percent}% ({successes}/{invocations})
189
+ - **Avg Duration**: {minutes} minutes
190
+ - **Value**: {metric description}
191
+ - **Context7 Usage**: {percent}% ({queries} queries)
192
+ - **Trend**: {comparison to previous month}
193
+
194
+ ### Needs Improvement ⚠️
195
+
196
+ For each agent with < 70% success rate:
197
+
198
+ #### {Agent Name}
199
+ - **Success Rate**: {percent}% ({successes}/{invocations})
200
+ - **Avg Duration**: {minutes} minutes
201
+ - **Failures**: {count} ({failure_rate}%)
202
+ - **Root Cause**: {analysis based on failure patterns}
203
+ - **Recommendation**: {specific actionable improvement}
204
+
205
+ ### Underutilized 📊
206
+
207
+ For each agent with < 5 invocations:
208
+
209
+ #### {Agent Name}
210
+ - **Invocations**: Only {count} (lowest usage)
211
+ - **Success Rate**: {percent}% ({successes}/{invocations})
212
+ - **Value**: {metric description}
213
+ - **Recommendation**: {discoverability/documentation improvements}
214
+
215
+ ---
216
+
217
+ ## Orchestrator Performance
218
+
219
+ | Orchestrator | Runs | Completed | Aborted | Success Rate | Avg Duration | Avg Iterations |
220
+ |--------------|------|-----------|---------|--------------|--------------|----------------|
221
+ | {name} | {runs} | {completed} | {aborted} | {percent}% | {minutes} min | {iterations} |
222
+
223
+ **Insights**:
224
+ - {Analysis of orchestrator patterns}
225
+ - {Concerns about abort rates or iterations}
226
+ - {Recommendations for improvements}
227
+
228
+ ---
229
+
230
+ ## Quality Gates
231
+
232
+ | Gate | Runs | Passes | Failures | Pass Rate | Avg Duration |
233
+ |------|------|--------|----------|-----------|--------------|
234
+ | type-check | {runs} | {passes} | {failures} | {percent}% {status} | {seconds}s |
235
+ | build | {runs} | {passes} | {failures} | {percent}% {status} | {seconds}s |
236
+ | tests | {runs} | {passes} | {failures} | {percent}% {status} | {seconds}s |
237
+
238
+ **Status Indicators**:
239
+ - ✅ Pass rate >= 90%
240
+ - ⚠️ Pass rate 75-89%
241
+ - ❌ Pass rate < 75%
242
+
243
+ **Concerns**:
244
+ For each gate with pass rate < 85%:
245
+ - **{Gate Name}**: {percent}% pass rate (below 90% target)
246
+ - Investigation needed: {reason for failures}
247
+ - Recommendation: {specific action}
248
+
249
+ ---
250
+
251
+ ## Complexity Distribution
252
+
253
+ **Tasks Analyzed**: {count}
254
+
255
+ | Level | Count | % | Research Triggered |
256
+ |-------|-------|---|--------------------|
257
+ | Trivial (0-3) | {count} | {percent}% | {count} |
258
+ | Moderate (4-6) | {count} | {percent}% | {count} |
259
+ | High (7-8) | {count} | {percent}% | {count} |
260
+ | Critical (9-10) | {count} | {percent}% | {count} |
261
+
262
+ **Insights**:
263
+ - Most tasks are {level} complexity ({percent}%)
264
+ - Research phase used {appropriately|too often|too rarely}
265
+ - Avg complexity score: {score} ({level})
266
+
267
+ **Analysis**:
268
+ - If avg score > 6: Codebase has many complex issues, consider dedicated research time
269
+ - If avg score < 4: Mostly simple fixes, direct workflow is efficient
270
+ - If research triggered for trivial/moderate: Scoring calibration needed
271
+
272
+ ---
273
+
274
+ ## Context7 Integration
275
+
276
+ **Total Queries**: {count}
277
+ **Success Rate**: {percent}% ({successes}/{total})
278
+ **Avg Response Time**: {seconds} seconds
279
+ **Unavailable Events**: {count} ({percent}% of time)
280
+
281
+ **Top Libraries Queried**:
282
+ 1. {Library}: {count} queries ({percent}%)
283
+ 2. {Library}: {count} queries ({percent}%)
284
+ 3. {Library}: {count} queries ({percent}%)
285
+ 4. {Library}: {count} queries ({percent}%)
286
+ 5. {Library}: {count} queries ({percent}%)
287
+
288
+ **Performance**: {EXCELLENT|GOOD|FAIR|POOR}
289
+
290
+ **Determination**:
291
+ - Success rate >= 95% AND response time < 2s: EXCELLENT ✅
292
+ - Success rate >= 90% AND response time < 3s: GOOD ✅
293
+ - Success rate >= 80% OR response time < 5s: FAIR ⚠️
294
+ - Otherwise: POOR ❌
295
+
296
+ **Concerns** (if any):
297
+ - If success rate < 95%: {analysis and recommendation}
298
+ - If response time > 2s: {analysis and recommendation}
299
+ - If unavailable > 1%: {analysis and recommendation}
300
+
301
+ ---
302
+
303
+ ## Token Efficiency
304
+
305
+ **Estimated Conversations**: {count}
306
+ **Minimal MCP Mode**: {count} ({percent}%)
307
+ **Full MCP Mode**: {count} ({percent}%)
308
+
309
+ **Token Savings**:
310
+ - Avg tokens saved per conversation: ~{count}
311
+ - Total tokens saved (estimated): ~{count}
312
+ - **ROI**: Minimal MCP mode reduces token usage by ~{percent}% per conversation
313
+
314
+ **Analysis**:
315
+ - {percent}% of conversations use minimal mode (target: >85%)
316
+ - Estimated savings: {count} tokens/month
317
+ - {Recommendations for optimizing MCP usage}
318
+
319
+ ---
320
+
321
+ ## Behavioral OS Health
322
+
323
+ ### Fallback Strategies Triggered
324
+
325
+ | Fallback | Count | % of Invocations |
326
+ |----------|-------|------------------|
327
+ | Context7 unavailable | {count} | {percent}% |
328
+ | Quality gate failure | {count} | {percent}% |
329
+ | Max iterations reached | {count} | {percent}% |
330
+ | Worker failure | {count} | {percent}% |
331
+ | Plan invalid | {count} | {percent}% |
332
+
333
+ **Analysis**: {HEALTHY|CONCERNING|CRITICAL}
334
+
335
+ **Determination**:
336
+ - All fallbacks < 5%: HEALTHY ✅
337
+ - Any fallback 5-10%: CONCERNING ⚠️
338
+ - Any fallback > 10%: CRITICAL ❌
339
+
340
+ **Concerns** (if any):
341
+ For each fallback > 5%:
342
+ - **{Fallback Type}**: {percent}% frequency
343
+ - Root cause: {analysis}
344
+ - Recommendation: {action to reduce frequency}
345
+
346
+ ### Emergency Protocols Triggered
347
+
348
+ | Emergency | Count |
349
+ |-----------|-------|
350
+ | Infinite loop | {count} |
351
+ | File corruption | {count} |
352
+ | Token exhaustion | {count} |
353
+ | Concurrent conflict | {count} |
354
+
355
+ **Analysis**: {EXCELLENT|CONCERNING|CRITICAL}
356
+
357
+ **Determination**:
358
+ - Zero emergencies: EXCELLENT ✅
359
+ - 1-2 emergencies: CONCERNING ⚠️
360
+ - > 2 emergencies: CRITICAL ❌
361
+
362
+ **Incidents** (if any):
363
+ For each emergency > 0:
364
+ - **{Emergency Type}**: {count} incident(s)
365
+ - Details: {from emergency metadata if available}
366
+ - Impact: {analysis}
367
+ - Prevention: {recommendation}
368
+
369
+ ### Prime Directive Violations
370
+
371
+ **Count**: {count} {flagged and prevented|CRITICAL - violations occurred}
372
+
373
+ **Status**:
374
+ - 0 violations: ✅ **EXCELLENT** (self-diagnostics working)
375
+ - > 0 violations: ❌ **CRITICAL** (system integrity compromised)
376
+
377
+ **Details** (if > 0):
378
+ For each violation:
379
+ 1. {PD-X violation description}
380
+ - Agent: {name}
381
+ - When: {timestamp}
382
+ - How caught: {self-diagnostics|manual detection}
383
+ - Impact: {user impact assessment}
384
+ - Fix: {what was done to prevent}
385
+
386
+ ---
387
+
388
+ ## Recommendations
389
+
390
+ ### High Priority
391
+
392
+ For critical issues (success rate < 70%, emergencies, violations):
393
+
394
+ 1. **{Recommendation Title}**
395
+ - Issue: {specific problem}
396
+ - Impact: {why it matters}
397
+ - Action: {what to do}
398
+ - Target: {measurable goal}
399
+
400
+ ### Medium Priority
401
+
402
+ For important improvements (pass rate < 85%, underutilization):
403
+
404
+ 2. **{Recommendation Title}**
405
+ - Issue: {specific problem}
406
+ - Impact: {why it matters}
407
+ - Action: {what to do}
408
+ - Target: {measurable goal}
409
+
410
+ ### Low Priority
411
+
412
+ For optimizations (nice-to-have improvements):
413
+
414
+ 3. **{Recommendation Title}**
415
+ - Opportunity: {what could be better}
416
+ - Benefit: {value of improvement}
417
+ - Action: {what to do}
418
+
419
+ ---
420
+
421
+ ## Trend Analysis (vs. {Previous Month})
422
+
423
+ | Metric | {Current Month} | {Previous Month} | Change |
424
+ |--------|-----------------|------------------|--------|
425
+ | Total invocations | {count} | {count} | {percent}% {indicator} |
426
+ | Success rate | {percent}% | {percent}% | {percent}% {indicator} |
427
+ | Context7 usage | {percent}% | {percent}% | {percent}% {indicator} |
428
+ | Quality gate pass rate | {percent}% | {percent}% | {percent}% {indicator} |
429
+ | Research phases | {count} | {count} | {percent}% {indicator} |
430
+
431
+ **Insights**:
432
+ - Ecosystem usage {growing|stable|declining} ({indicator} invocations)
433
+ - Reliability {improving|stable|declining} ({indicator} success rate)
434
+ - Complexity {increasing|stable|decreasing} ({indicator} research phases)
435
+
436
+ **Analysis**:
437
+ - {Interpretation of trends}
438
+ - {What's working well}
439
+ - {What needs attention}
440
+
441
+ ---
442
+
443
+ ## Conclusion
444
+
445
+ **Overall Status**: {HEALTHY AND IMPROVING|HEALTHY|NEEDS ATTENTION|CRITICAL}
446
+
447
+ **Determination**:
448
+ - Success rate >= 90% AND no emergencies AND positive trends: HEALTHY AND IMPROVING ✅
449
+ - Success rate >= 80% AND < 2 emergencies: HEALTHY ✅
450
+ - Success rate 70-79% OR 2-5 emergencies: NEEDS ATTENTION ⚠️
451
+ - Success rate < 70% OR > 5 emergencies: CRITICAL ❌
452
+
453
+ **Summary**:
454
+ {1-2 paragraph summary of ecosystem health, key achievements, main concerns, and overall trajectory}
455
+
456
+ **Next Steps**:
457
+ 1. {Most important action item with timeline}
458
+ 2. {Second most important action with timeline}
459
+ 3. {When to re-evaluate metrics}
460
+
461
+ ---
462
+
463
+ ## Appendix: Raw Data
464
+
465
+ **Metrics File**: `.tmp/metrics/{YYYY-MM}.json`
466
+
467
+ To view detailed raw metrics:
468
+ ```bash
469
+ cat .tmp/metrics/{YYYY-MM}.json | jq .
470
+ ```
471
+
472
+ To compare with previous month:
473
+ ```bash
474
+ diff <(cat .tmp/metrics/{YYYY-MM-1}.json | jq .) <(cat .tmp/metrics/{YYYY-MM}.json | jq .)
475
+ ```
476
+ ```
477
+
478
+ ### Step 7: Display Report Location
479
+
480
+ Report successful generation to user.
481
+
482
+ **Message**:
483
+ ```
484
+ ✅ Metrics report generated successfully
485
+
486
+ Report: docs/reports/metrics/{YYYY-MM}-ecosystem-health.md
487
+
488
+ Summary:
489
+ - Overall Health: {status}
490
+ - Total Invocations: {count}
491
+ - Success Rate: {percent}%
492
+ - Top Performer: {agent_name}
493
+ - Top Concern: {issue if any}
494
+
495
+ View full report:
496
+ cat docs/reports/metrics/{YYYY-MM}-ecosystem-health.md
497
+ ```
498
+
499
+ ---
500
+
501
+ ## Error Handling
502
+
503
+ ### No Metrics Data
504
+
505
+ **Issue**: Metrics file doesn't exist for requested month
506
+
507
+ **Action**:
508
+ ```
509
+ ❌ No metrics data for {month}
510
+
511
+ Metrics file not found: .tmp/metrics/{YYYY-MM}.json
512
+
513
+ This means no agent workflows were run during {month}.
514
+
515
+ To generate metrics:
516
+ 1. Run agent workflows: /health-bugs, /health-security, etc.
517
+ 2. Agents automatically record metrics via record-metrics Skill
518
+ 3. Re-run /health-metrics after workflows complete
519
+
520
+ Note: Metrics are stored monthly in .tmp/metrics/ directory.
521
+ ```
522
+
523
+ ### Corrupt Metrics File
524
+
525
+ **Issue**: Metrics file exists but has invalid JSON
526
+
527
+ **Action**:
528
+ ```
529
+ ⛔ Metrics file corrupt
530
+
531
+ File: .tmp/metrics/{YYYY-MM}.json
532
+ Error: Invalid JSON (SyntaxError: ...)
533
+
534
+ Attempting to read backup...
535
+ ```
536
+
537
+ If backup exists and valid:
538
+ ```
539
+ ✅ Restored from backup
540
+
541
+ Backup: .tmp/metrics/{YYYY-MM}.json.backup
542
+ Status: Valid
543
+
544
+ Generating report from backup data...
545
+ ```
546
+
547
+ If backup also corrupt:
548
+ ```
549
+ ❌ Backup also corrupt or not found
550
+
551
+ Cannot generate report from corrupted data.
552
+
553
+ Options:
554
+ 1. Review .tmp/metrics/{YYYY-MM}.json manually
555
+ 2. Delete corrupt file and start fresh next month
556
+ 3. Report this issue (file corruption shouldn't happen)
557
+
558
+ File corruption may indicate:
559
+ - Concurrent write conflict
560
+ - Disk I/O error
561
+ - System crash during metrics recording
562
+ ```
563
+
564
+ ### Report Generation Failed
565
+
566
+ **Issue**: Error creating report file
567
+
568
+ **Action**:
569
+ ```
570
+ ⛔ Report generation failed
571
+
572
+ Target: docs/reports/metrics/{YYYY-MM}-ecosystem-health.md
573
+ Error: {error message}
574
+
575
+ Possible causes:
576
+ - Insufficient disk space
577
+ - Permission denied (check docs/reports/metrics/ permissions)
578
+ - Disk I/O error
579
+
580
+ Recommendation:
581
+ 1. Check disk space: df -h
582
+ 2. Check permissions: ls -la docs/reports/
583
+ 3. Retry after resolving issue
584
+ ```
585
+
586
+ ---
587
+
588
+ ## Examples
589
+
590
+ ### Example 1: Current Month Report
591
+
592
+ **Command**: `/health-metrics`
593
+
594
+ **Actions**:
595
+ 1. Determine current month: 2025-10
596
+ 2. Read `.tmp/metrics/2025-10.json`
597
+ 3. Read `.tmp/metrics/2025-09.json` (previous month for comparison)
598
+ 4. Analyze all metrics sections
599
+ 5. Calculate trends (vs September)
600
+ 6. Generate recommendations
601
+ 7. Write report to `docs/reports/metrics/2025-10-ecosystem-health.md`
602
+
603
+ **Output**:
604
+ ```
605
+ ✅ Metrics report generated successfully
606
+
607
+ Report: docs/reports/metrics/2025-10-ecosystem-health.md
608
+
609
+ Summary:
610
+ - Overall Health: HEALTHY AND IMPROVING ✅
611
+ - Total Invocations: 150
612
+ - Success Rate: 91%
613
+ - Top Performer: security-scanner (100% success rate)
614
+ - Top Concern: dependency-updater (70% success rate)
615
+
616
+ View full report:
617
+ cat docs/reports/metrics/2025-10-ecosystem-health.md
618
+ ```
619
+
620
+ ### Example 2: Previous Month Report
621
+
622
+ **Command**: `/health-metrics last-month`
623
+
624
+ **Actions**:
625
+ 1. Determine previous month: 2025-09
626
+ 2. Read `.tmp/metrics/2025-09.json`
627
+ 3. Read `.tmp/metrics/2025-08.json` (for comparison)
628
+ 4. Generate report for September
629
+
630
+ **Output**:
631
+ ```
632
+ ✅ Metrics report generated successfully
633
+
634
+ Report: docs/reports/metrics/2025-09-ecosystem-health.md
635
+
636
+ Summary:
637
+ - Overall Health: HEALTHY ✅
638
+ - Total Invocations: 132
639
+ - Success Rate: 88%
640
+ - Top Performer: security-scanner (100% success rate)
641
+ - Top Concern: dependency-updater (65% success rate)
642
+ ```
643
+
644
+ ### Example 3: Specific Month
645
+
646
+ **Command**: `/health-metrics 2025-08`
647
+
648
+ **Actions**:
649
+ 1. Parse month: 2025-08
650
+ 2. Read `.tmp/metrics/2025-08.json`
651
+ 3. Read `.tmp/metrics/2025-07.json` (for comparison)
652
+ 4. Generate report for August
653
+
654
+ ### Example 4: No Data Available
655
+
656
+ **Command**: `/health-metrics 2025-07`
657
+
658
+ **Actions**:
659
+ 1. Attempt to read `.tmp/metrics/2025-07.json`
660
+ 2. File not found
661
+
662
+ **Output**:
663
+ ```
664
+ ❌ No metrics data for July 2025
665
+
666
+ Metrics file not found: .tmp/metrics/2025-07.json
667
+
668
+ This means no agent workflows were run during July 2025.
669
+
670
+ To generate metrics:
671
+ 1. Run agent workflows: /health-bugs, /health-security, etc.
672
+ 2. Agents automatically record metrics via record-metrics Skill
673
+ 3. Re-run /health-metrics after workflows complete
674
+ ```
675
+
676
+ ---
677
+
678
+ ## Implementation Notes
679
+
680
+ ### Month Calculation
681
+
682
+ **Current Month**:
683
+ ```
684
+ Today: 2025-10-21
685
+ Current month: 2025-10
686
+ ```
687
+
688
+ **Previous Month**:
689
+ ```
690
+ Current: 2025-10
691
+ Previous: 2025-09
692
+
693
+ Edge case (January):
694
+ Current: 2025-01
695
+ Previous: 2024-12
696
+ ```
697
+
698
+ ### Health Status Determination
699
+
700
+ **Agent Success Rate**:
701
+ - >= 90%: Top Performer ✅
702
+ - 70-89%: Acceptable
703
+ - < 70%: Needs Improvement ⚠️
704
+
705
+ **Overall System Health**:
706
+ - >= 90% success rate + no emergencies + positive trends: HEALTHY AND IMPROVING ✅
707
+ - >= 80% success rate + < 2 emergencies: HEALTHY ✅
708
+ - 70-79% success rate OR 2-5 emergencies: NEEDS ATTENTION ⚠️
709
+ - < 70% success rate OR > 5 emergencies: CRITICAL ❌
710
+
711
+ ### Report File Naming
712
+
713
+ **Format**: `{YYYY-MM}-ecosystem-health.md`
714
+
715
+ **Examples**:
716
+ - `2025-10-ecosystem-health.md`
717
+ - `2025-09-ecosystem-health.md`
718
+
719
+ ### Trend Indicators
720
+
721
+ **Calculation**:
722
+ ```
723
+ Change % = ((New - Old) / Old) * 100
724
+
725
+ If change > 2%: ⬆️ (increase)
726
+ If change < -2%: ⬇️ (decrease)
727
+ If change between -2% and 2%: ➡️ (stable)
728
+ ```
729
+
730
+ ---
731
+
732
+ ## Benefits
733
+
734
+ ✅ **Visibility**: Clear view of ecosystem health each month
735
+ ✅ **Trends**: Track improvements (or regressions) over time
736
+ ✅ **Data-Driven**: Make optimization decisions based on real metrics
737
+ ✅ **Accountability**: Demonstrate ROI with concrete numbers
738
+ ✅ **Early Detection**: Flag issues before they become critical
739
+ ✅ **Transparency**: Share ecosystem health with team/stakeholders
740
+
741
+ ---
742
+
743
+ ## Related
744
+
745
+ - `record-metrics` Skill: Records events that populate metrics files
746
+ - `.tmp/metrics/YYYY-MM.json`: Monthly metrics data files
747
+ - CLAUDE.md PART 5: Self-Diagnostics uses metrics for validation