MCPcopy Create free account
hub / github.com/codeaashu/claude-code / getSkillUsageScore

Function getSkillUsageScore

src/utils/suggestions/skillUsageTracking.ts:44–55  ·  view source on GitHub ↗
(skillName: string)

Source from the content-addressed store, hash-verified

42 * meaning usage from 7 days ago is worth half as much as usage today.
43 */
44export function getSkillUsageScore(skillName: string): number {
45 const config = getGlobalConfig()
46 const usage = config.skillUsage?.[skillName]
47 if (!usage) return 0
48
49 // Recency decay: halve score every 7 days
50 const daysSinceUse = (Date.now() - usage.lastUsedAt) / (1000 * 60 * 60 * 24)
51 const recencyFactor = Math.pow(0.5, daysSinceUse / 7)
52
53 // Minimum recency factor of 0.1 to avoid completely dropping old but heavily used skills
54 return usage.usageCount * Math.max(recencyFactor, 0.1)
55}
56

Callers 1

Calls 2

getGlobalConfigFunction · 0.85
maxMethod · 0.80

Tested by

no test coverage detected