@cloudstreamsoftware/claude-tools 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +152 -37
- package/agents/INDEX.md +183 -0
- package/agents/architect.md +247 -0
- package/agents/build-error-resolver.md +555 -0
- package/agents/catalyst-deployer.md +132 -0
- package/agents/code-reviewer.md +121 -0
- package/agents/compliance-auditor.md +148 -0
- package/agents/creator-architect.md +395 -0
- package/agents/deluge-reviewer.md +98 -0
- package/agents/doc-updater.md +471 -0
- package/agents/e2e-runner.md +711 -0
- package/agents/planner.md +122 -0
- package/agents/refactor-cleaner.md +309 -0
- package/agents/security-reviewer.md +582 -0
- package/agents/tdd-guide.md +302 -0
- package/config/versions.json +63 -0
- package/dist/hooks/hooks.json +209 -0
- package/dist/index.js +47 -0
- package/dist/lib/asset-value.js +609 -0
- package/dist/lib/client-manager.js +300 -0
- package/dist/lib/command-matcher.js +242 -0
- package/dist/lib/cross-session-patterns.js +754 -0
- package/dist/lib/intent-classifier.js +1075 -0
- package/dist/lib/package-manager.js +374 -0
- package/dist/lib/recommendation-engine.js +597 -0
- package/dist/lib/session-memory.js +489 -0
- package/dist/lib/skill-effectiveness.js +486 -0
- package/dist/lib/skill-matcher.js +595 -0
- package/dist/lib/tutorial-metrics.js +242 -0
- package/dist/lib/tutorial-progress.js +209 -0
- package/dist/lib/tutorial-renderer.js +431 -0
- package/dist/lib/utils.js +380 -0
- package/dist/lib/verify-formatter.js +143 -0
- package/dist/lib/workflow-state.js +249 -0
- package/hooks/hooks.json +209 -0
- package/package.json +5 -1
- package/scripts/aggregate-sessions.js +290 -0
- package/scripts/branch-name-validator.js +291 -0
- package/scripts/build.js +101 -0
- package/scripts/commands/client-switch.js +231 -0
- package/scripts/deprecate-skill.js +610 -0
- package/scripts/diagnose.js +324 -0
- package/scripts/doc-freshness.js +168 -0
- package/scripts/generate-weekly-digest.js +393 -0
- package/scripts/health-check.js +270 -0
- package/scripts/hooks/credential-check.js +101 -0
- package/scripts/hooks/evaluate-session.js +81 -0
- package/scripts/hooks/pre-compact.js +66 -0
- package/scripts/hooks/prompt-analyzer.js +276 -0
- package/scripts/hooks/prompt-router.js +422 -0
- package/scripts/hooks/quality-gate-enforcer.js +371 -0
- package/scripts/hooks/session-end.js +156 -0
- package/scripts/hooks/session-start.js +195 -0
- package/scripts/hooks/skill-injector.js +333 -0
- package/scripts/hooks/suggest-compact.js +58 -0
- package/scripts/lib/asset-value.js +609 -0
- package/scripts/lib/client-manager.js +300 -0
- package/scripts/lib/command-matcher.js +242 -0
- package/scripts/lib/cross-session-patterns.js +754 -0
- package/scripts/lib/intent-classifier.js +1075 -0
- package/scripts/lib/package-manager.js +374 -0
- package/scripts/lib/recommendation-engine.js +597 -0
- package/scripts/lib/session-memory.js +489 -0
- package/scripts/lib/skill-effectiveness.js +486 -0
- package/scripts/lib/skill-matcher.js +595 -0
- package/scripts/lib/tutorial-metrics.js +242 -0
- package/scripts/lib/tutorial-progress.js +209 -0
- package/scripts/lib/tutorial-renderer.js +431 -0
- package/scripts/lib/utils.js +380 -0
- package/scripts/lib/verify-formatter.js +143 -0
- package/scripts/lib/workflow-state.js +249 -0
- package/scripts/onboard.js +363 -0
- package/scripts/quarterly-report.js +692 -0
- package/scripts/setup-package-manager.js +204 -0
- package/scripts/sync-upstream.js +391 -0
- package/scripts/test.js +108 -0
- package/scripts/tutorial-runner.js +351 -0
- package/scripts/validate-all.js +201 -0
- package/scripts/verifiers/agents.js +245 -0
- package/scripts/verifiers/config.js +186 -0
- package/scripts/verifiers/environment.js +123 -0
- package/scripts/verifiers/hooks.js +188 -0
- package/scripts/verifiers/index.js +38 -0
- package/scripts/verifiers/persistence.js +140 -0
- package/scripts/verifiers/plugin.js +215 -0
- package/scripts/verifiers/skills.js +209 -0
- package/scripts/verify-setup.js +164 -0
- package/skills/INDEX.md +157 -0
- package/skills/backend-patterns/SKILL.md +586 -0
- package/skills/backend-patterns/catalyst-patterns.md +128 -0
- package/skills/bigquery-patterns/SKILL.md +27 -0
- package/skills/bigquery-patterns/performance-optimization.md +518 -0
- package/skills/bigquery-patterns/query-patterns.md +372 -0
- package/skills/bigquery-patterns/schema-design.md +78 -0
- package/skills/cloudstream-project-template/SKILL.md +20 -0
- package/skills/cloudstream-project-template/structure.md +65 -0
- package/skills/coding-standards/SKILL.md +524 -0
- package/skills/coding-standards/deluge-standards.md +83 -0
- package/skills/compliance-patterns/SKILL.md +28 -0
- package/skills/compliance-patterns/hipaa/audit-requirements.md +251 -0
- package/skills/compliance-patterns/hipaa/baa-process.md +298 -0
- package/skills/compliance-patterns/hipaa/data-archival-strategy.md +387 -0
- package/skills/compliance-patterns/hipaa/phi-handling.md +52 -0
- package/skills/compliance-patterns/pci-dss/saq-a-requirements.md +307 -0
- package/skills/compliance-patterns/pci-dss/tokenization-patterns.md +382 -0
- package/skills/compliance-patterns/pci-dss/zoho-checkout-patterns.md +56 -0
- package/skills/compliance-patterns/soc2/access-controls.md +344 -0
- package/skills/compliance-patterns/soc2/audit-logging.md +458 -0
- package/skills/compliance-patterns/soc2/change-management.md +403 -0
- package/skills/compliance-patterns/soc2/deluge-execution-logging.md +407 -0
- package/skills/consultancy-workflows/SKILL.md +19 -0
- package/skills/consultancy-workflows/client-isolation.md +21 -0
- package/skills/consultancy-workflows/documentation-automation.md +454 -0
- package/skills/consultancy-workflows/handoff-procedures.md +257 -0
- package/skills/consultancy-workflows/knowledge-capture.md +513 -0
- package/skills/consultancy-workflows/time-tracking.md +26 -0
- package/skills/continuous-learning/SKILL.md +84 -0
- package/skills/continuous-learning/config.json +18 -0
- package/skills/continuous-learning/evaluate-session.sh +60 -0
- package/skills/continuous-learning-v2/SKILL.md +126 -0
- package/skills/continuous-learning-v2/config.json +61 -0
- package/skills/frontend-patterns/SKILL.md +635 -0
- package/skills/frontend-patterns/zoho-widget-patterns.md +103 -0
- package/skills/gcp-data-engineering/SKILL.md +36 -0
- package/skills/gcp-data-engineering/bigquery/performance-optimization.md +337 -0
- package/skills/gcp-data-engineering/dataflow/error-handling.md +496 -0
- package/skills/gcp-data-engineering/dataflow/pipeline-patterns.md +444 -0
- package/skills/gcp-data-engineering/dbt/model-organization.md +63 -0
- package/skills/gcp-data-engineering/dbt/testing-patterns.md +503 -0
- package/skills/gcp-data-engineering/medallion-architecture/bronze-layer.md +60 -0
- package/skills/gcp-data-engineering/medallion-architecture/gold-layer.md +311 -0
- package/skills/gcp-data-engineering/medallion-architecture/layer-transitions.md +517 -0
- package/skills/gcp-data-engineering/medallion-architecture/silver-layer.md +305 -0
- package/skills/gcp-data-engineering/zoho-to-gcp/data-extraction.md +543 -0
- package/skills/gcp-data-engineering/zoho-to-gcp/real-time-vs-batch.md +337 -0
- package/skills/security-review/SKILL.md +498 -0
- package/skills/security-review/compliance-checklist.md +53 -0
- package/skills/strategic-compact/SKILL.md +67 -0
- package/skills/tdd-workflow/SKILL.md +413 -0
- package/skills/tdd-workflow/zoho-testing.md +124 -0
- package/skills/tutorial/SKILL.md +249 -0
- package/skills/tutorial/docs/ACCESSIBILITY.md +169 -0
- package/skills/tutorial/lessons/00-philosophy-and-workflow.md +198 -0
- package/skills/tutorial/lessons/01-basics.md +81 -0
- package/skills/tutorial/lessons/02-training.md +86 -0
- package/skills/tutorial/lessons/03-commands.md +109 -0
- package/skills/tutorial/lessons/04-workflows.md +115 -0
- package/skills/tutorial/lessons/05-compliance.md +116 -0
- package/skills/tutorial/lessons/06-zoho.md +121 -0
- package/skills/tutorial/lessons/07-hooks-system.md +277 -0
- package/skills/tutorial/lessons/08-mcp-servers.md +316 -0
- package/skills/tutorial/lessons/09-client-management.md +215 -0
- package/skills/tutorial/lessons/10-testing-e2e.md +260 -0
- package/skills/tutorial/lessons/11-skills-deep-dive.md +272 -0
- package/skills/tutorial/lessons/12-rules-system.md +326 -0
- package/skills/tutorial/lessons/13-golden-standard-graduation.md +213 -0
- package/skills/tutorial/lessons/14-fork-setup-and-sync.md +312 -0
- package/skills/tutorial/lessons/15-living-examples-system.md +221 -0
- package/skills/tutorial/tracks/accelerated/README.md +134 -0
- package/skills/tutorial/tracks/accelerated/assessment/checkpoint-1.md +161 -0
- package/skills/tutorial/tracks/accelerated/assessment/checkpoint-2.md +175 -0
- package/skills/tutorial/tracks/accelerated/day-1-core-concepts.md +234 -0
- package/skills/tutorial/tracks/accelerated/day-2-essential-commands.md +270 -0
- package/skills/tutorial/tracks/accelerated/day-3-workflow-mastery.md +305 -0
- package/skills/tutorial/tracks/accelerated/day-4-compliance-zoho.md +304 -0
- package/skills/tutorial/tracks/accelerated/day-5-hooks-skills.md +344 -0
- package/skills/tutorial/tracks/accelerated/day-6-client-testing.md +386 -0
- package/skills/tutorial/tracks/accelerated/day-7-graduation.md +369 -0
- package/skills/zoho-patterns/CHANGELOG.md +108 -0
- package/skills/zoho-patterns/SKILL.md +446 -0
- package/skills/zoho-patterns/analytics/dashboard-patterns.md +352 -0
- package/skills/zoho-patterns/analytics/zoho-to-bigquery-pipeline.md +427 -0
- package/skills/zoho-patterns/catalyst/appsail-deployment.md +349 -0
- package/skills/zoho-patterns/catalyst/context-close-patterns.md +354 -0
- package/skills/zoho-patterns/catalyst/cron-batch-processing.md +374 -0
- package/skills/zoho-patterns/catalyst/function-patterns.md +439 -0
- package/skills/zoho-patterns/creator/form-design.md +304 -0
- package/skills/zoho-patterns/creator/publish-api-patterns.md +313 -0
- package/skills/zoho-patterns/creator/widget-integration.md +306 -0
- package/skills/zoho-patterns/creator/workflow-automation.md +253 -0
- package/skills/zoho-patterns/deluge/api-patterns.md +468 -0
- package/skills/zoho-patterns/deluge/batch-processing.md +403 -0
- package/skills/zoho-patterns/deluge/cross-app-integration.md +356 -0
- package/skills/zoho-patterns/deluge/error-handling.md +423 -0
- package/skills/zoho-patterns/deluge/syntax-reference.md +65 -0
- package/skills/zoho-patterns/integration/cors-proxy-architecture.md +426 -0
- package/skills/zoho-patterns/integration/crm-books-native-sync.md +277 -0
- package/skills/zoho-patterns/integration/oauth-token-management.md +461 -0
- package/skills/zoho-patterns/integration/zoho-flow-patterns.md +334 -0
|
@@ -0,0 +1,486 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skill Effectiveness Tracker
|
|
3
|
+
*
|
|
4
|
+
* Tracks which skills lead to success vs. corrections/failures.
|
|
5
|
+
* Used to:
|
|
6
|
+
* 1. Prioritize skill suggestions (show most effective first)
|
|
7
|
+
* 2. Identify skills that need improvement
|
|
8
|
+
* 3. Deprecate skills with low success rates
|
|
9
|
+
* 4. Calculate ROI of skill library
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
const fs = require('fs');
|
|
13
|
+
const path = require('path');
|
|
14
|
+
const { ensureDir, getDateTimeString, getClaudeDir } = require('./utils');
|
|
15
|
+
|
|
16
|
+
// Storage paths
|
|
17
|
+
const KNOWLEDGE_DIR = path.join(getClaudeDir(), 'knowledge');
|
|
18
|
+
const EFFECTIVENESS_FILE = path.join(KNOWLEDGE_DIR, 'skill-effectiveness.json');
|
|
19
|
+
|
|
20
|
+
// Thresholds
|
|
21
|
+
const THRESHOLDS = {
|
|
22
|
+
MIN_USES_FOR_CONFIDENCE: 5, // Minimum uses before trusting effectiveness
|
|
23
|
+
LOW_EFFECTIVENESS: 0.6, // Below this is concerning
|
|
24
|
+
HIGH_EFFECTIVENESS: 0.85, // Above this is excellent
|
|
25
|
+
DEPRECATION_THRESHOLD: 0.4, // Below this after 10+ uses = deprecate candidate
|
|
26
|
+
PROMOTION_THRESHOLD: 0.9, // Above this = promote to shared skills
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Default effectiveness data structure
|
|
31
|
+
*/
|
|
32
|
+
function createDefaultData() {
|
|
33
|
+
return {
|
|
34
|
+
version: '1.0.0',
|
|
35
|
+
lastUpdated: getDateTimeString(),
|
|
36
|
+
skills: {},
|
|
37
|
+
summary: {
|
|
38
|
+
totalApplications: 0,
|
|
39
|
+
totalSuccesses: 0,
|
|
40
|
+
totalCorrections: 0,
|
|
41
|
+
averageEffectiveness: 0,
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Load effectiveness data
|
|
48
|
+
*/
|
|
49
|
+
function loadEffectivenessData() {
|
|
50
|
+
ensureDir(KNOWLEDGE_DIR);
|
|
51
|
+
|
|
52
|
+
try {
|
|
53
|
+
if (fs.existsSync(EFFECTIVENESS_FILE)) {
|
|
54
|
+
const content = fs.readFileSync(EFFECTIVENESS_FILE, 'utf8');
|
|
55
|
+
return JSON.parse(content);
|
|
56
|
+
}
|
|
57
|
+
} catch (err) {
|
|
58
|
+
console.error(`[SkillEffectiveness] Error loading data: ${err.message}`);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
return createDefaultData();
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Save effectiveness data
|
|
66
|
+
*/
|
|
67
|
+
function saveEffectivenessData(data) {
|
|
68
|
+
ensureDir(KNOWLEDGE_DIR);
|
|
69
|
+
data.lastUpdated = getDateTimeString();
|
|
70
|
+
|
|
71
|
+
try {
|
|
72
|
+
fs.writeFileSync(EFFECTIVENESS_FILE, JSON.stringify(data, null, 2), 'utf8');
|
|
73
|
+
return true;
|
|
74
|
+
} catch (err) {
|
|
75
|
+
console.error(`[SkillEffectiveness] Error saving data: ${err.message}`);
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Record a skill application
|
|
82
|
+
* @param {string} skillName - Name of the skill applied
|
|
83
|
+
* @param {string} skillType - 'builtin' or 'learned'
|
|
84
|
+
* @param {object} context - { filePath, technologies, complianceMode }
|
|
85
|
+
*/
|
|
86
|
+
function recordApplication(skillName, skillType = 'builtin', context = {}) {
|
|
87
|
+
const data = loadEffectivenessData();
|
|
88
|
+
|
|
89
|
+
if (!data.skills[skillName]) {
|
|
90
|
+
data.skills[skillName] = {
|
|
91
|
+
type: skillType,
|
|
92
|
+
applications: 0,
|
|
93
|
+
successes: 0,
|
|
94
|
+
corrections: 0,
|
|
95
|
+
errors: 0,
|
|
96
|
+
firstUsed: getDateTimeString(),
|
|
97
|
+
lastUsed: null,
|
|
98
|
+
contexts: [],
|
|
99
|
+
effectiveness: 0,
|
|
100
|
+
trend: 'new',
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
const skill = data.skills[skillName];
|
|
105
|
+
skill.applications++;
|
|
106
|
+
skill.lastUsed = getDateTimeString();
|
|
107
|
+
|
|
108
|
+
// Track context (keep last 10)
|
|
109
|
+
skill.contexts.push({
|
|
110
|
+
timestamp: getDateTimeString(),
|
|
111
|
+
filePath: context.filePath || null,
|
|
112
|
+
technologies: context.technologies || [],
|
|
113
|
+
complianceMode: context.complianceMode || null,
|
|
114
|
+
});
|
|
115
|
+
if (skill.contexts.length > 10) {
|
|
116
|
+
skill.contexts.shift();
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
// Update summary
|
|
120
|
+
data.summary.totalApplications++;
|
|
121
|
+
|
|
122
|
+
saveEffectivenessData(data);
|
|
123
|
+
|
|
124
|
+
return {
|
|
125
|
+
skillName,
|
|
126
|
+
applicationNumber: skill.applications,
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Record a success after skill application
|
|
132
|
+
* @param {string} skillName - Name of the skill
|
|
133
|
+
* @param {object} details - Optional details about the success
|
|
134
|
+
*/
|
|
135
|
+
function recordSuccess(skillName, details = {}) {
|
|
136
|
+
const data = loadEffectivenessData();
|
|
137
|
+
|
|
138
|
+
if (!data.skills[skillName]) {
|
|
139
|
+
// Skill not tracked, ignore
|
|
140
|
+
return null;
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const skill = data.skills[skillName];
|
|
144
|
+
skill.successes++;
|
|
145
|
+
|
|
146
|
+
// Recalculate effectiveness
|
|
147
|
+
skill.effectiveness = calculateEffectiveness(skill);
|
|
148
|
+
|
|
149
|
+
// Update trend
|
|
150
|
+
skill.trend = determineTrend(skill);
|
|
151
|
+
|
|
152
|
+
// Update summary
|
|
153
|
+
data.summary.totalSuccesses++;
|
|
154
|
+
data.summary.averageEffectiveness = calculateAverageEffectiveness(data.skills);
|
|
155
|
+
|
|
156
|
+
saveEffectivenessData(data);
|
|
157
|
+
|
|
158
|
+
return {
|
|
159
|
+
skillName,
|
|
160
|
+
newEffectiveness: skill.effectiveness,
|
|
161
|
+
trend: skill.trend,
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/**
|
|
166
|
+
* Record a correction after skill application
|
|
167
|
+
* @param {string} skillName - Name of the skill
|
|
168
|
+
* @param {object} correction - { type, description }
|
|
169
|
+
*/
|
|
170
|
+
function recordCorrection(skillName, correction = {}) {
|
|
171
|
+
const data = loadEffectivenessData();
|
|
172
|
+
|
|
173
|
+
if (!data.skills[skillName]) {
|
|
174
|
+
return null;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
const skill = data.skills[skillName];
|
|
178
|
+
skill.corrections++;
|
|
179
|
+
|
|
180
|
+
// Recalculate effectiveness
|
|
181
|
+
skill.effectiveness = calculateEffectiveness(skill);
|
|
182
|
+
|
|
183
|
+
// Update trend
|
|
184
|
+
skill.trend = determineTrend(skill);
|
|
185
|
+
|
|
186
|
+
// Update summary
|
|
187
|
+
data.summary.totalCorrections++;
|
|
188
|
+
data.summary.averageEffectiveness = calculateAverageEffectiveness(data.skills);
|
|
189
|
+
|
|
190
|
+
saveEffectivenessData(data);
|
|
191
|
+
|
|
192
|
+
// Check if skill should be flagged
|
|
193
|
+
const analysis = analyzeSkill(skill, skillName);
|
|
194
|
+
|
|
195
|
+
return {
|
|
196
|
+
skillName,
|
|
197
|
+
newEffectiveness: skill.effectiveness,
|
|
198
|
+
trend: skill.trend,
|
|
199
|
+
analysis,
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* Record an error after skill application
|
|
205
|
+
* @param {string} skillName - Name of the skill
|
|
206
|
+
* @param {string} errorMessage - Error description
|
|
207
|
+
*/
|
|
208
|
+
function recordError(skillName, errorMessage = '') {
|
|
209
|
+
const data = loadEffectivenessData();
|
|
210
|
+
|
|
211
|
+
if (!data.skills[skillName]) {
|
|
212
|
+
return null;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
const skill = data.skills[skillName];
|
|
216
|
+
skill.errors++;
|
|
217
|
+
|
|
218
|
+
// Errors count against effectiveness
|
|
219
|
+
skill.effectiveness = calculateEffectiveness(skill);
|
|
220
|
+
skill.trend = determineTrend(skill);
|
|
221
|
+
|
|
222
|
+
saveEffectivenessData(data);
|
|
223
|
+
|
|
224
|
+
return {
|
|
225
|
+
skillName,
|
|
226
|
+
newEffectiveness: skill.effectiveness,
|
|
227
|
+
errorCount: skill.errors,
|
|
228
|
+
};
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Calculate effectiveness score for a skill
|
|
233
|
+
*/
|
|
234
|
+
function calculateEffectiveness(skill) {
|
|
235
|
+
const total = skill.applications;
|
|
236
|
+
if (total === 0) return 0;
|
|
237
|
+
|
|
238
|
+
// Successes are positive, corrections and errors are negative
|
|
239
|
+
const positive = skill.successes;
|
|
240
|
+
const negative = skill.corrections + skill.errors;
|
|
241
|
+
|
|
242
|
+
// Effectiveness = successes / (successes + negatives)
|
|
243
|
+
// If no outcomes recorded yet, use applications as denominator
|
|
244
|
+
const outcomes = positive + negative;
|
|
245
|
+
if (outcomes === 0) return 0.5; // Neutral if no outcomes
|
|
246
|
+
|
|
247
|
+
return positive / outcomes;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* Determine trend based on recent performance
|
|
252
|
+
*/
|
|
253
|
+
function determineTrend(skill) {
|
|
254
|
+
if (skill.applications < THRESHOLDS.MIN_USES_FOR_CONFIDENCE) {
|
|
255
|
+
return 'new';
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
if (skill.effectiveness >= THRESHOLDS.HIGH_EFFECTIVENESS) {
|
|
259
|
+
return 'excellent';
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
if (skill.effectiveness >= 0.7) {
|
|
263
|
+
return 'good';
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
if (skill.effectiveness >= THRESHOLDS.LOW_EFFECTIVENESS) {
|
|
267
|
+
return 'moderate';
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
if (skill.effectiveness >= THRESHOLDS.DEPRECATION_THRESHOLD) {
|
|
271
|
+
return 'concerning';
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
return 'poor';
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Calculate average effectiveness across all skills
|
|
279
|
+
*/
|
|
280
|
+
function calculateAverageEffectiveness(skills) {
|
|
281
|
+
const skillsWithData = Object.values(skills).filter(
|
|
282
|
+
(s) => s.applications >= THRESHOLDS.MIN_USES_FOR_CONFIDENCE
|
|
283
|
+
);
|
|
284
|
+
|
|
285
|
+
if (skillsWithData.length === 0) return 0;
|
|
286
|
+
|
|
287
|
+
const sum = skillsWithData.reduce((acc, s) => acc + s.effectiveness, 0);
|
|
288
|
+
return sum / skillsWithData.length;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
/**
|
|
292
|
+
* Analyze a skill and return recommendations
|
|
293
|
+
*/
|
|
294
|
+
function analyzeSkill(skill, skillName) {
|
|
295
|
+
const analysis = {
|
|
296
|
+
status: 'ok',
|
|
297
|
+
recommendations: [],
|
|
298
|
+
};
|
|
299
|
+
|
|
300
|
+
// Not enough data
|
|
301
|
+
if (skill.applications < THRESHOLDS.MIN_USES_FOR_CONFIDENCE) {
|
|
302
|
+
analysis.status = 'insufficient_data';
|
|
303
|
+
analysis.recommendations.push('Need more usage data for reliable analysis');
|
|
304
|
+
return analysis;
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
// Deprecation candidate
|
|
308
|
+
if (skill.effectiveness < THRESHOLDS.DEPRECATION_THRESHOLD) {
|
|
309
|
+
analysis.status = 'deprecation_candidate';
|
|
310
|
+
analysis.recommendations.push(`Low effectiveness (${Math.round(skill.effectiveness * 100)}%)`);
|
|
311
|
+
analysis.recommendations.push('Consider reviewing and updating this skill');
|
|
312
|
+
analysis.recommendations.push('May need deprecation if not improved');
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
// Low effectiveness
|
|
316
|
+
else if (skill.effectiveness < THRESHOLDS.LOW_EFFECTIVENESS) {
|
|
317
|
+
analysis.status = 'needs_improvement';
|
|
318
|
+
analysis.recommendations.push(
|
|
319
|
+
`Below target effectiveness (${Math.round(skill.effectiveness * 100)}%)`
|
|
320
|
+
);
|
|
321
|
+
analysis.recommendations.push('Review recent corrections for patterns');
|
|
322
|
+
}
|
|
323
|
+
|
|
324
|
+
// Promotion candidate
|
|
325
|
+
else if (skill.effectiveness >= THRESHOLDS.PROMOTION_THRESHOLD && skill.type === 'learned') {
|
|
326
|
+
analysis.status = 'promotion_candidate';
|
|
327
|
+
analysis.recommendations.push(`High effectiveness (${Math.round(skill.effectiveness * 100)}%)`);
|
|
328
|
+
analysis.recommendations.push('Consider sharing with team via /skill-submit');
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
// Excellent performance
|
|
332
|
+
else if (skill.effectiveness >= THRESHOLDS.HIGH_EFFECTIVENESS) {
|
|
333
|
+
analysis.status = 'excellent';
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
return analysis;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
/**
|
|
340
|
+
* Get effectiveness report for all skills
|
|
341
|
+
*/
|
|
342
|
+
function getEffectivenessReport() {
|
|
343
|
+
const data = loadEffectivenessData();
|
|
344
|
+
|
|
345
|
+
const skills = Object.entries(data.skills).map(([name, skill]) => ({
|
|
346
|
+
name,
|
|
347
|
+
...skill,
|
|
348
|
+
analysis: analyzeSkill(skill, name),
|
|
349
|
+
}));
|
|
350
|
+
|
|
351
|
+
// Sort by effectiveness (highest first)
|
|
352
|
+
skills.sort((a, b) => b.effectiveness - a.effectiveness);
|
|
353
|
+
|
|
354
|
+
// Categorize
|
|
355
|
+
const excellent = skills.filter((s) => s.trend === 'excellent');
|
|
356
|
+
const good = skills.filter((s) => s.trend === 'good');
|
|
357
|
+
const moderate = skills.filter((s) => s.trend === 'moderate');
|
|
358
|
+
const concerning = skills.filter((s) => s.trend === 'concerning' || s.trend === 'poor');
|
|
359
|
+
const newSkills = skills.filter((s) => s.trend === 'new');
|
|
360
|
+
|
|
361
|
+
return {
|
|
362
|
+
summary: data.summary,
|
|
363
|
+
categories: {
|
|
364
|
+
excellent,
|
|
365
|
+
good,
|
|
366
|
+
moderate,
|
|
367
|
+
concerning,
|
|
368
|
+
new: newSkills,
|
|
369
|
+
},
|
|
370
|
+
promotionCandidates: skills.filter((s) => s.analysis.status === 'promotion_candidate'),
|
|
371
|
+
deprecationCandidates: skills.filter((s) => s.analysis.status === 'deprecation_candidate'),
|
|
372
|
+
needsImprovement: skills.filter((s) => s.analysis.status === 'needs_improvement'),
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* Get top effective skills for a given context
|
|
378
|
+
* Used by skill-injector to prioritize suggestions
|
|
379
|
+
*/
|
|
380
|
+
function getTopEffectiveSkills(matchedSkills, limit = 3) {
|
|
381
|
+
const data = loadEffectivenessData();
|
|
382
|
+
|
|
383
|
+
// Score matched skills by effectiveness
|
|
384
|
+
const scored = matchedSkills.map((skill) => {
|
|
385
|
+
const effectivenessData = data.skills[skill.skill] || null;
|
|
386
|
+
|
|
387
|
+
let effectivenessScore = 0.5; // Default neutral
|
|
388
|
+
if (effectivenessData && effectivenessData.applications >= THRESHOLDS.MIN_USES_FOR_CONFIDENCE) {
|
|
389
|
+
effectivenessScore = effectivenessData.effectiveness;
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
return {
|
|
393
|
+
...skill,
|
|
394
|
+
effectivenessScore,
|
|
395
|
+
effectivenessData,
|
|
396
|
+
combinedScore: skill.score * 0.6 + effectivenessScore * 0.4, // 60% match, 40% effectiveness
|
|
397
|
+
};
|
|
398
|
+
});
|
|
399
|
+
|
|
400
|
+
// Sort by combined score
|
|
401
|
+
scored.sort((a, b) => b.combinedScore - a.combinedScore);
|
|
402
|
+
|
|
403
|
+
return scored.slice(0, limit);
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
/**
|
|
407
|
+
* Generate markdown report
|
|
408
|
+
*/
|
|
409
|
+
function generateMarkdownReport() {
|
|
410
|
+
const report = getEffectivenessReport();
|
|
411
|
+
|
|
412
|
+
let md = `# Skill Effectiveness Report\n\n`;
|
|
413
|
+
md += `Generated: ${getDateTimeString()}\n\n`;
|
|
414
|
+
|
|
415
|
+
// Summary
|
|
416
|
+
md += `## Summary\n\n`;
|
|
417
|
+
md += `- Total Applications: ${report.summary.totalApplications}\n`;
|
|
418
|
+
md += `- Total Successes: ${report.summary.totalSuccesses}\n`;
|
|
419
|
+
md += `- Total Corrections: ${report.summary.totalCorrections}\n`;
|
|
420
|
+
md += `- Average Effectiveness: ${Math.round(report.summary.averageEffectiveness * 100)}%\n\n`;
|
|
421
|
+
|
|
422
|
+
// Excellent skills
|
|
423
|
+
if (report.categories.excellent.length > 0) {
|
|
424
|
+
md += `## Excellent Skills (85%+)\n\n`;
|
|
425
|
+
for (const skill of report.categories.excellent) {
|
|
426
|
+
md += `- **${skill.name}**: ${Math.round(skill.effectiveness * 100)}% (${skill.applications} uses)\n`;
|
|
427
|
+
}
|
|
428
|
+
md += `\n`;
|
|
429
|
+
}
|
|
430
|
+
|
|
431
|
+
// Promotion candidates
|
|
432
|
+
if (report.promotionCandidates.length > 0) {
|
|
433
|
+
md += `## Promotion Candidates (Share with Team)\n\n`;
|
|
434
|
+
for (const skill of report.promotionCandidates) {
|
|
435
|
+
md += `- **${skill.name}**: ${Math.round(skill.effectiveness * 100)}% effectiveness\n`;
|
|
436
|
+
md += ` - Run: \`/skill-submit ${skill.name}\`\n`;
|
|
437
|
+
}
|
|
438
|
+
md += `\n`;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
// Needs improvement
|
|
442
|
+
if (report.needsImprovement.length > 0) {
|
|
443
|
+
md += `## Skills Needing Improvement\n\n`;
|
|
444
|
+
for (const skill of report.needsImprovement) {
|
|
445
|
+
md += `- **${skill.name}**: ${Math.round(skill.effectiveness * 100)}%\n`;
|
|
446
|
+
for (const rec of skill.analysis.recommendations) {
|
|
447
|
+
md += ` - ${rec}\n`;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
md += `\n`;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
// Deprecation candidates
|
|
454
|
+
if (report.deprecationCandidates.length > 0) {
|
|
455
|
+
md += `## Deprecation Candidates\n\n`;
|
|
456
|
+
for (const skill of report.deprecationCandidates) {
|
|
457
|
+
md += `- **${skill.name}**: ${Math.round(skill.effectiveness * 100)}% (${skill.applications} uses)\n`;
|
|
458
|
+
md += ` - Consider deprecating or major revision\n`;
|
|
459
|
+
}
|
|
460
|
+
md += `\n`;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
return md;
|
|
464
|
+
}
|
|
465
|
+
|
|
466
|
+
module.exports = {
|
|
467
|
+
// Recording functions
|
|
468
|
+
recordApplication,
|
|
469
|
+
recordSuccess,
|
|
470
|
+
recordCorrection,
|
|
471
|
+
recordError,
|
|
472
|
+
|
|
473
|
+
// Query functions
|
|
474
|
+
getEffectivenessReport,
|
|
475
|
+
getTopEffectiveSkills,
|
|
476
|
+
analyzeSkill,
|
|
477
|
+
|
|
478
|
+
// Report generation
|
|
479
|
+
generateMarkdownReport,
|
|
480
|
+
|
|
481
|
+
// Data access
|
|
482
|
+
loadEffectivenessData,
|
|
483
|
+
|
|
484
|
+
// Thresholds (for external access)
|
|
485
|
+
THRESHOLDS,
|
|
486
|
+
};
|