skill-analyzer 0.1.0 → 0.1.2

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/dist/budget.d.ts CHANGED
@@ -1 +1,3 @@
1
+ export declare const OVERHEAD_PER_SKILL = 109;
2
+ export declare const FALLBACK_BUDGET = 16000;
1
3
  export declare function budgetCommand(args: string[]): void;
package/dist/budget.js CHANGED
@@ -1,45 +1,52 @@
1
1
  import chalk from "chalk";
2
2
  import { getSkillsDir, loadSkillRegistry } from "./registry.js";
3
3
  import { sectionHeader, keyValue, budgetBar, makeTable } from "./formatter.js";
4
- const OVERHEAD_PER_SKILL = 109;
5
- const DEFAULT_BUDGET = 16_000;
4
+ export const OVERHEAD_PER_SKILL = 109;
5
+ export const FALLBACK_BUDGET = 16_000;
6
6
  export function budgetCommand(args) {
7
7
  const skillsDir = getSkillsDir(args);
8
8
  const skills = loadSkillRegistry(skillsDir);
9
- const budget = parseInt(process.env["SLASH_COMMAND_TOOL_CHAR_BUDGET"] ?? String(DEFAULT_BUDGET), 10);
9
+ const envBudget = process.env["SLASH_COMMAND_TOOL_CHAR_BUDGET"];
10
+ const budget = parseInt(envBudget ?? String(FALLBACK_BUDGET), 10);
11
+ const isFallback = !envBudget;
10
12
  const isJson = args.includes("--json");
11
13
  const entries = skills
12
14
  .map((s) => ({
13
15
  name: s.name,
14
16
  descriptionLength: s.descriptionLength,
15
- cost: s.descriptionLength + OVERHEAD_PER_SKILL,
17
+ totalChars: s.descriptionLength + OVERHEAD_PER_SKILL,
16
18
  }))
17
- .sort((a, b) => b.cost - a.cost);
18
- const totalCost = entries.reduce((sum, e) => sum + e.cost, 0);
19
+ .sort((a, b) => b.totalChars - a.totalChars);
20
+ const totalUsed = entries.reduce((sum, e) => sum + e.totalChars, 0);
19
21
  if (isJson) {
20
- console.log(JSON.stringify({ budget, totalCost, entries }, null, 2));
22
+ console.log(JSON.stringify({ budget, isFallback, totalUsed, entries }, null, 2));
21
23
  return;
22
24
  }
23
- const overBudget = totalCost > budget;
25
+ const overBudget = totalUsed > budget;
24
26
  sectionHeader("Description Budget", overBudget ? "OVER BUDGET" : undefined);
25
27
  keyValue([
26
- ["Budget:", budgetBar(totalCost, budget)],
28
+ ["Budget:", budgetBar(totalUsed, budget)],
27
29
  [
28
30
  "Used:",
29
- `${totalCost.toLocaleString()} / ${budget.toLocaleString()} chars`,
31
+ `${totalUsed.toLocaleString()} / ${budget.toLocaleString()} chars`,
30
32
  ],
31
33
  [
32
34
  "Remaining:",
33
35
  overBudget
34
- ? chalk.red(`-${(totalCost - budget).toLocaleString()} chars`)
35
- : chalk.green(`${(budget - totalCost).toLocaleString()} chars`),
36
+ ? chalk.red(`-${(totalUsed - budget).toLocaleString()} chars`)
37
+ : chalk.green(`${(budget - totalUsed).toLocaleString()} chars`),
36
38
  ],
37
39
  ["Skills:", `${entries.length} (${OVERHEAD_PER_SKILL} chars overhead each)`],
38
40
  ]);
39
41
  makeTable({
40
42
  head: ["#", "Skill", "Description Chars", "Total Chars"],
41
43
  colAligns: ["right", "left", "right", "right"],
42
- rows: entries.map((e, i) => [i + 1, e.name, e.descriptionLength, e.cost]),
44
+ rows: entries.map((e, i) => [i + 1, e.name, e.descriptionLength, e.totalChars]),
43
45
  });
46
+ if (isFallback) {
47
+ console.log();
48
+ console.log(chalk.dim(` ${budget.toLocaleString()} is a static fallback. The actual budget is determined dynamically by Claude Code.`));
49
+ console.log(chalk.dim(" See: https://code.claude.com/docs/en/skills#claude-doesnt-see-all-my-skills"));
50
+ }
44
51
  console.log();
45
52
  }
package/dist/dead.js CHANGED
@@ -2,6 +2,7 @@ import chalk from "chalk";
2
2
  import { getSkillsDir, loadSkillRegistry } from "./registry.js";
3
3
  import { getLogsDir, scanSessions, aggregateUsage } from "./scanner.js";
4
4
  import { sectionHeader, keyValue, makeTable } from "./formatter.js";
5
+ import { OVERHEAD_PER_SKILL } from "./budget.js";
5
6
  export function deadCommand(args) {
6
7
  const skillsDir = getSkillsDir(args);
7
8
  const logsDir = getLogsDir(args);
@@ -19,7 +20,7 @@ export function deadCommand(args) {
19
20
  }
20
21
  const period = days ? `last ${days} days` : "all time";
21
22
  sectionHeader(`Dead Skills (${period})`);
22
- const totalWaste = deadSkills.reduce((sum, s) => sum + s.descriptionLength + 109, 0);
23
+ const totalWaste = deadSkills.reduce((sum, s) => sum + s.descriptionLength + OVERHEAD_PER_SKILL, 0);
23
24
  keyValue([
24
25
  ["Dead:", `${deadSkills.length} of ${registry.length} local skills`],
25
26
  [
@@ -40,7 +41,7 @@ export function deadCommand(args) {
40
41
  i + 1,
41
42
  chalk.red(s.name),
42
43
  s.descriptionLength,
43
- s.descriptionLength + 109,
44
+ s.descriptionLength + OVERHEAD_PER_SKILL,
44
45
  ]),
45
46
  });
46
47
  console.log();
package/dist/report.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { getSkillsDir, loadSkillRegistry } from "./registry.js";
2
2
  import { getLogsDir, scanSessions, aggregateUsage } from "./scanner.js";
3
- import { budgetCommand } from "./budget.js";
3
+ import { budgetCommand, OVERHEAD_PER_SKILL, FALLBACK_BUDGET } from "./budget.js";
4
4
  import { usageCommand } from "./usage.js";
5
5
  import { deadCommand } from "./dead.js";
6
6
  export function reportCommand(args) {
@@ -24,18 +24,20 @@ function reportJson(args) {
24
24
  const usage = aggregateUsage(invocations);
25
25
  const usedSkills = new Set(usage.map((u) => u.skill));
26
26
  const deadSkills = registry.filter((s) => !usedSkills.has(s.name)).map((s) => s.name);
27
- const budget = parseInt(process.env["SLASH_COMMAND_TOOL_CHAR_BUDGET"] ?? "16000", 10);
27
+ const envBudget = process.env["SLASH_COMMAND_TOOL_CHAR_BUDGET"];
28
+ const budget = parseInt(envBudget ?? String(FALLBACK_BUDGET), 10);
29
+ const isFallback = !envBudget;
28
30
  const budgetEntries = registry
29
31
  .map((s) => ({
30
32
  name: s.name,
31
33
  descriptionLength: s.descriptionLength,
32
- cost: s.descriptionLength + 109,
34
+ totalChars: s.descriptionLength + OVERHEAD_PER_SKILL,
33
35
  }))
34
- .sort((a, b) => b.cost - a.cost);
35
- const totalCost = budgetEntries.reduce((sum, e) => sum + e.cost, 0);
36
+ .sort((a, b) => b.totalChars - a.totalChars);
37
+ const totalUsed = budgetEntries.reduce((sum, e) => sum + e.totalChars, 0);
36
38
  console.log(JSON.stringify({
37
39
  usage: { totalInvocations: invocations.length, skills: usage },
38
40
  dead: { count: deadSkills.length, skills: deadSkills },
39
- budget: { limit: budget, totalCost, entries: budgetEntries },
41
+ budget: { limit: budget, isFallback, totalUsed, entries: budgetEntries },
40
42
  }, null, 2));
41
43
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skill-analyzer",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "description": "Analyze Claude Code skill library: usage frequency, dead skills, description budget consumption",
5
5
  "type": "module",
6
6
  "bin": {