claude-skills-cli 0.0.21 → 0.0.22
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/{add-hook.cmd-B6iZtoPi.js → add-hook.cmd-JWw5UqA3.js} +3 -3
- package/dist/{add-hook.cmd-B6iZtoPi.js.map → add-hook.cmd-JWw5UqA3.js.map} +1 -1
- package/dist/{frontmatter-validator-DO686mla.js → dependency-validator-CQJ1hCoU.js} +159 -3
- package/dist/dependency-validator-CQJ1hCoU.js.map +1 -0
- package/dist/{doctor.cmd-CkNw6ine.js → doctor.cmd-DJpHLDCV.js} +42 -19
- package/dist/doctor.cmd-DJpHLDCV.js.map +1 -0
- package/dist/index.js +7 -7
- package/dist/{init.cmd-BoeuCgQP.js → init.cmd-BdqImX8b.js} +3 -3
- package/dist/{init.cmd-BoeuCgQP.js.map → init.cmd-BdqImX8b.js.map} +1 -1
- package/dist/{install.cmd-CH7yZ92g.js → install.cmd-BaP8k9d2.js} +2 -2
- package/dist/{install.cmd-CH7yZ92g.js.map → install.cmd-BaP8k9d2.js.map} +1 -1
- package/dist/{output-Dz8fk6Gu.js → output-DiffPD2u.js} +4 -2
- package/dist/output-DiffPD2u.js.map +1 -0
- package/dist/{package.cmd-CwGRHdEq.js → package.cmd-BYhkheya.js} +3 -3
- package/dist/{package.cmd-CwGRHdEq.js.map → package.cmd-BYhkheya.js.map} +1 -1
- package/dist/{stats.cmd-D1ujNiDO.js → stats.cmd-Dd46qjoV.js} +37 -4
- package/dist/stats.cmd-Dd46qjoV.js.map +1 -0
- package/dist/{templates-BQTgkXfH.js → templates-fyteNbD0.js} +5 -1
- package/dist/templates-fyteNbD0.js.map +1 -0
- package/dist/{validate.cmd-CDUJDKGs.js → validate.cmd-BxF4HNsu.js} +3 -3
- package/dist/{validate.cmd-CDUJDKGs.js.map → validate.cmd-BxF4HNsu.js.map} +1 -1
- package/dist/{validator-DV5zeeel.js → validator-Dp5x-OjP.js} +11 -3
- package/dist/{validator-DV5zeeel.js.map → validator-Dp5x-OjP.js.map} +1 -1
- package/package.json +1 -1
- package/dist/doctor.cmd-CkNw6ine.js.map +0 -1
- package/dist/frontmatter-validator-DO686mla.js.map +0 -1
- package/dist/output-Dz8fk6Gu.js.map +0 -1
- package/dist/stats.cmd-D1ujNiDO.js.map +0 -1
- package/dist/templates-BQTgkXfH.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"output-Dz8fk6Gu.js","names":[],"sources":["../src/constants.ts","../src/utils/output.ts"],"sourcesContent":["/**\n * Anthropic skill spec limits\n * https://code.claude.com/docs/en/skills#frontmatter-reference\n */\n\n/** Max chars for skill name field */\nexport const NAME_MAX_LENGTH = 64;\n\n/** Max chars for description — Claude truncates at this limit in skill listing */\nexport const DESCRIPTION_MAX_LENGTH = 250;\n\n/** Min recommended chars for description to be useful */\nexport const DESCRIPTION_MIN_LENGTH = 50;\n\n/** Token budget for Level 2 content (~5000 words * 1.3) */\nexport const TOKEN_BUDGET = 6500;\n\n/** Words per paragraph before it's considered \"long\" */\nexport const LONG_PARAGRAPH_WORDS = 100;\n\n/** Min body length (chars) before warning about short content */\nexport const MIN_BODY_LENGTH = 100;\n\n/**\n * Progressive disclosure limits — three tiers for SKILL.md body\n *\n * strict: opinionated defaults for minimal context usage\n * lenient: relaxed for larger skills\n * loose: matches Anthropic official limits (500 lines)\n */\nexport const LIMITS = {\n\tstrict: {\n\t\tlines: { excellent: 30, good: 40, max: 50 },\n\t\twords: { excellent: 300, good: 500, max: 1000 },\n\t},\n\tlenient: {\n\t\tlines: { excellent: 50, good: 100, max: 150 },\n\t\twords: { excellent: 500, good: 1000, max: 2000 },\n\t},\n\tloose: {\n\t\tlines: { excellent: 100, good: 200, max: 500 },\n\t\twords: { excellent: 1000, good: 2000, max: 5000 },\n\t},\n} as const;\n","import {\n\tDESCRIPTION_MAX_LENGTH,\n\tLIMITS,\n\tTOKEN_BUDGET,\n} from '../constants.js';\nimport type { ValidationStats } from '../types.js';\n\nexport const success = (msg: string) => console.log(`✅ ${msg}`);\nexport const error = (msg: string) => console.log(`❌ ${msg}`);\nexport const warning = (msg: string) => console.log(`⚠️ ${msg}`);\nexport const info = (msg: string) => console.log(`📋 ${msg}`);\nexport const step = (msg: string) => console.log(` ${msg}`);\nexport const package_ = (msg: string) => console.log(`📦 ${msg}`);\nexport const upload = (msg: string) => console.log(`📤 ${msg}`);\nexport const search = (msg: string) => console.log(`🔍 ${msg}`);\n\nconst S = LIMITS.strict;\n\n/**\n * Display progressive disclosure statistics\n */\nexport function display_validation_stats(\n\tstats: ValidationStats,\n): void {\n\tconsole.log('\\n📊 Progressive Disclosure Stats:');\n\n\t// Level 1: Description\n\tconsole.log('\\n Level 1 (Metadata - Always Loaded):');\n\tconst desc_status =\n\t\tstats.description_length <= DESCRIPTION_MAX_LENGTH\n\t\t\t? '✅ Optimal'\n\t\t\t: '❌ Too long';\n\n\tconsole.log(\n\t\t` Description: ${stats.description_length} chars, ~${stats.description_tokens} tokens ${desc_status}`,\n\t);\n\tconsole.log(\n\t\t` (Target: <${DESCRIPTION_MAX_LENGTH} chars for Level 1 efficiency)`,\n\t);\n\n\t// Level 2: SKILL.md Body\n\tconsole.log('\\n Level 2 (SKILL.md Body - Loaded when triggered):');\n\n\t// Line count\n\tlet line_status: string;\n\tif (stats.line_count <= S.lines.excellent) {\n\t\tline_status = '✅ Excellent';\n\t} else if (stats.line_count <= S.lines.good) {\n\t\tline_status = '✅ Good';\n\t} else if (stats.line_count <= S.lines.max) {\n\t\tline_status = '⚠️ Consider splitting';\n\t} else {\n\t\tline_status = '❌ Too large';\n\t}\n\n\tconsole.log(\n\t\t` Lines: ${stats.line_count} (max: ${S.lines.max}) ${line_status}`,\n\t);\n\n\t// Word count\n\tlet word_status: string;\n\tif (stats.word_count < S.words.excellent) {\n\t\tword_status = '✅ Excellent';\n\t} else if (stats.word_count < S.words.good) {\n\t\tword_status = '✅ Good';\n\t} else if (stats.word_count < S.words.max) {\n\t\tword_status = '⚠️ Consider splitting';\n\t} else {\n\t\tword_status = '❌ Too large';\n\t}\n\n\tconsole.log(\n\t\t` Words: ${stats.word_count} (max: ${S.words.max}) ${word_status}`,\n\t);\n\n\t// Token estimation\n\tconst token_status =\n\t\tstats.estimated_tokens < TOKEN_BUDGET\n\t\t\t? 'within budget'\n\t\t\t: 'exceeds budget';\n\n\tconsole.log(\n\t\t` Est. tokens: ~${stats.estimated_tokens} (budget: <${TOKEN_BUDGET}) ${token_status}`,\n\t);\n\n\t// Code blocks\n\tconst code_status =\n\t\tstats.code_blocks > 3\n\t\t\t? ' (recommended: 1-2)'\n\t\t\t: stats.code_blocks <= 2\n\t\t\t\t? ' ✅'\n\t\t\t\t: '';\n\tconsole.log(` Code blocks: ${stats.code_blocks}${code_status}`);\n\n\t// Sections\n\tconst section_status =\n\t\tstats.sections > 8\n\t\t\t? ' (recommended: 3-5)'\n\t\t\t: stats.sections >= 3 && stats.sections <= 5\n\t\t\t\t? ' ✅'\n\t\t\t\t: '';\n\tconsole.log(` Sections: ${stats.sections}${section_status}`);\n\n\t// Long paragraphs\n\tif (stats.long_paragraphs > 0) {\n\t\tconst para_status =\n\t\t\tstats.long_paragraphs > 3\n\t\t\t\t? ' (consider moving to references/)'\n\t\t\t\t: '';\n\t\tconsole.log(\n\t\t\t` Long paragraphs: ${stats.long_paragraphs}${para_status}`,\n\t\t);\n\t}\n\n\t// Level 3 info\n\tconsole.log('\\n Level 3+ (References - Loaded as needed):');\n\tconsole.log(\n\t\t' Use references/ directory for detailed docs (unlimited size)',\n\t);\n\n\t// Overall assessment (based on strict defaults)\n\tconsole.log('\\n Overall Assessment:');\n\tif (\n\t\tstats.line_count <= S.lines.excellent &&\n\t\tstats.description_length <= DESCRIPTION_MAX_LENGTH\n\t) {\n\t\tconsole.log(' ✅ Excellent progressive disclosure!');\n\t} else if (\n\t\tstats.line_count <= S.lines.max &&\n\t\tstats.description_length <= DESCRIPTION_MAX_LENGTH\n\t) {\n\t\tconsole.log(' ✅ Good progressive disclosure');\n\t} else if (\n\t\tstats.line_count <= LIMITS.lenient.lines.max &&\n\t\tstats.word_count < LIMITS.lenient.words.max\n\t) {\n\t\tconsole.log(\n\t\t\t' ⚠️ Consider splitting content into references/',\n\t\t);\n\t} else {\n\t\tconsole.log(\n\t\t\t' ❌ Violates progressive disclosure (move content to references/)',\n\t\t);\n\t}\n}\n"],"mappings":";;AAeA,MAAa,eAAe;;;;;;;;AAe5B,MAAa,SAAS;CACrB,QAAQ;EACP,OAAO;GAAE,WAAW;GAAI,MAAM;GAAI,KAAK;GAAI;EAC3C,OAAO;GAAE,WAAW;GAAK,MAAM;GAAK,KAAK;GAAM;EAC/C;CACD,SAAS;EACR,OAAO;GAAE,WAAW;GAAI,MAAM;GAAK,KAAK;GAAK;EAC7C,OAAO;GAAE,WAAW;GAAK,MAAM;GAAM,KAAK;GAAM;EAChD;CACD,OAAO;EACN,OAAO;GAAE,WAAW;GAAK,MAAM;GAAK,KAAK;GAAK;EAC9C,OAAO;GAAE,WAAW;GAAM,MAAM;GAAM,KAAK;GAAM;EACjD;CACD;;;ACpCD,MAAa,WAAW,QAAgB,QAAQ,IAAI,KAAK,MAAM;AAC/D,MAAa,SAAS,QAAgB,QAAQ,IAAI,KAAK,MAAM;AAC7D,MAAa,WAAW,QAAgB,QAAQ,IAAI,OAAO,MAAM;AACjE,MAAa,QAAQ,QAAgB,QAAQ,IAAI,MAAM,MAAM;AAE7D,MAAa,YAAY,QAAgB,QAAQ,IAAI,MAAM,MAAM;AACjE,MAAa,UAAU,QAAgB,QAAQ,IAAI,MAAM,MAAM;AAC/D,MAAa,UAAU,QAAgB,QAAQ,IAAI,MAAM,MAAM;AAE/D,MAAM,IAAI,OAAO;;;;AAKjB,SAAgB,yBACf,OACO;AACP,SAAQ,IAAI,qCAAqC;AAGjD,SAAQ,IAAI,0CAA0C;CACtD,MAAM,cACL,MAAM,sBAAA,MACH,cACA;AAEJ,SAAQ,IACP,oBAAoB,MAAM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AM,sBAAA,IAEN,SAAQ,IAAI,oCAAoC;UAEhD,MAAM,cAAc,OAAO,QAAQ,MAAM,OACzC,MAAM,aAAa,OAAO,QAAQ,MAAM,IAExC,SAAQ,IACP,sDACA;KAED,SAAQ,IACP,sEACA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stats.cmd-D1ujNiDO.js","names":[],"sources":["../src/commands/stats.ts","../src/commands/stats.cmd.ts"],"sourcesContent":["import { existsSync, readdirSync, statSync } from 'node:fs';\nimport { join } from 'node:path';\nimport { DESCRIPTION_MAX_LENGTH, LIMITS } from '../constants.js';\nimport { SkillValidator } from '../core/validator.js';\nimport type { StatsOptions } from '../types.js';\nimport { error } from '../utils/output.js';\n\nexport function stats_command(options: StatsOptions): void {\n\tconst directory = options.directory || '.claude/skills';\n\n\t// Verify directory exists\n\tif (!existsSync(directory)) {\n\t\terror(`Directory not found: ${directory}`);\n\t\tprocess.exit(1);\n\t}\n\n\tconst dir_stats = statSync(directory);\n\tif (!dir_stats.isDirectory()) {\n\t\terror(`Path is not a directory: ${directory}`);\n\t\tprocess.exit(1);\n\t}\n\n\t// Find all skill directories (containing SKILL.md)\n\tconst entries = readdirSync(directory);\n\tconst skills: string[] = [];\n\n\tfor (const entry of entries) {\n\t\tconst skill_path = join(directory, entry);\n\t\tconst stat = statSync(skill_path);\n\n\t\tif (stat.isDirectory()) {\n\t\t\tconst skill_md_path = join(skill_path, 'SKILL.md');\n\t\t\tif (existsSync(skill_md_path)) {\n\t\t\t\tskills.push(skill_path);\n\t\t\t}\n\t\t}\n\t}\n\n\tif (skills.length === 0) {\n\t\tconsole.log(`No skills found in ${directory}`);\n\t\tconsole.log(\n\t\t\t'\\nCreate a skill with: claude-skills-cli init --name my-skill --description \"...\"\\n',\n\t\t);\n\t\treturn;\n\t}\n\n\t// Display overview header\n\tconsole.log('📊 Skills Overview');\n\tconsole.log(\n\t\t'============================================================',\n\t);\n\tconsole.log(\n\t\t`${skills.length} skill${skills.length === 1 ? '' : 's'} found:\\n`,\n\t);\n\n\t// Validate and display each skill\n\tfor (const skill_path of skills) {\n\t\tconst skill_name = skill_path.split('/').pop() || '';\n\t\tconst validator = new SkillValidator(skill_path);\n\t\tconst result = validator.validate_all();\n\n\t\t// Determine status icon\n\t\tlet status_icon = '✅';\n\t\tlet status_text = 'valid';\n\t\tif (!result.is_valid) {\n\t\t\tstatus_icon = '❌';\n\t\t\tstatus_text = 'errors';\n\t\t} else if (result.warnings.length > 0) {\n\t\t\tstatus_icon = '⚠️ ';\n\t\t\tstatus_text = 'warnings';\n\t\t}\n\n\t\tconsole.log(`${skill_name} (${status_icon} ${status_text})`);\n\n\t\tif (result.stats) {\n\t\t\t// Description length\n\t\t\tconst desc_length = result.stats.description_length;\n\t\t\tlet desc_status = '';\n\t\t\tif (desc_length > 0) {\n\t\t\t\tif (desc_length <= DESCRIPTION_MAX_LENGTH) {\n\t\t\t\t\tdesc_status = 'optimal';\n\t\t\t\t} else {\n\t\t\t\t\tdesc_status = 'too long';\n\t\t\t\t}\n\t\t\t\tconsole.log(\n\t\t\t\t\t` Description: ${desc_length} chars (${desc_status})`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// Body stats\n\t\t\tconst lines = result.stats.line_count;\n\t\t\tconst words = result.stats.word_count;\n\n\t\t\tconst S = LIMITS.strict;\n\t\t\tlet line_status = '';\n\t\t\tif (lines <= S.lines.excellent) {\n\t\t\t\tline_status = 'excellent';\n\t\t\t} else if (lines <= S.lines.good) {\n\t\t\t\tline_status = 'good';\n\t\t\t} else if (lines <= S.lines.max) {\n\t\t\t\tline_status = 'consider splitting';\n\t\t\t} else {\n\t\t\t\tline_status = 'too long';\n\t\t\t}\n\n\t\t\tlet word_status = '';\n\t\t\tif (words < S.words.excellent) {\n\t\t\t\tword_status = 'excellent';\n\t\t\t} else if (words < S.words.good) {\n\t\t\t\tword_status = 'good';\n\t\t\t} else if (words < S.words.max) {\n\t\t\t\tword_status = 'acceptable';\n\t\t\t} else {\n\t\t\t\tword_status = 'too long';\n\t\t\t}\n\n\t\t\tconsole.log(\n\t\t\t\t` Body: ${lines} lines (${line_status}), ${words} words (${word_status})`,\n\t\t\t);\n\n\t\t\t// Count reference files\n\t\t\tconst references_dir = join(skill_path, 'references');\n\t\t\tif (existsSync(references_dir)) {\n\t\t\t\tconst ref_files = readdirSync(references_dir).filter((f) =>\n\t\t\t\t\tf.endsWith('.md'),\n\t\t\t\t);\n\t\t\t\tif (ref_files.length > 0) {\n\t\t\t\t\t// Calculate total size\n\t\t\t\t\tlet total_size = 0;\n\t\t\t\t\tfor (const ref_file of ref_files) {\n\t\t\t\t\t\tconst ref_path = join(references_dir, ref_file);\n\t\t\t\t\t\tconst ref_stat = statSync(ref_path);\n\t\t\t\t\t\ttotal_size += ref_stat.size;\n\t\t\t\t\t}\n\t\t\t\t\tconst size_kb = (total_size / 1024).toFixed(1);\n\t\t\t\t\tconsole.log(\n\t\t\t\t\t\t` References: ${ref_files.length} file${ref_files.length === 1 ? '' : 's'} (${size_kb} KB)`,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t// Show error/warning count\n\t\tif (!result.is_valid) {\n\t\t\tconsole.log(\n\t\t\t\t` ${result.errors.length} error${result.errors.length === 1 ? '' : 's'}`,\n\t\t\t);\n\t\t}\n\t\tif (result.warnings.length > 0) {\n\t\t\tconsole.log(\n\t\t\t\t` ${result.warnings.length} warning${result.warnings.length === 1 ? '' : 's'}`,\n\t\t\t);\n\t\t}\n\n\t\tconsole.log(''); // Blank line between skills\n\t}\n\n\t// Summary\n\tconst valid_skills = skills.filter((path) => {\n\t\tconst validator = new SkillValidator(path);\n\t\tconst result = validator.validate_all();\n\t\treturn result.is_valid;\n\t}).length;\n\n\tconst skills_with_warnings = skills.filter((path) => {\n\t\tconst validator = new SkillValidator(path);\n\t\tconst result = validator.validate_all();\n\t\treturn result.is_valid && result.warnings.length > 0;\n\t}).length;\n\n\tconst invalid_skills = skills.length - valid_skills;\n\n\tconsole.log('Summary:');\n\tif (invalid_skills === 0 && skills_with_warnings === 0) {\n\t\tconsole.log(\n\t\t\t`✅ All ${skills.length} skills are valid with no warnings`,\n\t\t);\n\t} else {\n\t\tconsole.log(` Valid: ${valid_skills}`);\n\t\tif (skills_with_warnings > 0) {\n\t\t\tconsole.log(` With warnings: ${skills_with_warnings}`);\n\t\t}\n\t\tif (invalid_skills > 0) {\n\t\t\tconsole.log(` Invalid: ${invalid_skills}`);\n\t\t}\n\t}\n}\n","import { defineCommand } from 'citty';\nimport { stats_command } from './stats.js';\n\nexport default defineCommand({\n\tmeta: {\n\t\tname: 'stats',\n\t\tdescription: 'Show overview of all skills in a directory',\n\t},\n\targs: {\n\t\tdirectory: {\n\t\t\ttype: 'positional',\n\t\t\tdescription:\n\t\t\t\t'Directory containing skills (default: .claude/skills)',\n\t\t\trequired: false,\n\t\t},\n\t},\n\trun({ args }) {\n\t\tstats_command({ directory: args.directory });\n\t},\n});\n"],"mappings":";;;;;;AAOA,SAAgB,cAAc,SAA6B;CAC1D,MAAM,YAAY,QAAQ,aAAa;AAGvC,KAAI,CAAC,WAAW,UAAU,EAAE;AAC3B,QAAM,wBAAwB,YAAY;AAC1C,UAAQ,KAAK,EAAE;;AAIhB,KAAI,CADc,SAAS,UAAU,CACtB,aAAa,EAAE;AAC7B,QAAM,4BAA4B,YAAY;AAC9C,UAAQ,KAAK,EAAE;;CAIhB,MAAM,UAAU,YAAY,UAAU;CACtC,MAAM,SAAmB,EAAE;AAE3B,MAAK,MAAM,SAAS,SAAS;EAC5B,MAAM,aAAa,KAAK,WAAW,MAAM;AAGzC,MAFa,SAAS,WAAW,CAExB,aAAa;OAEjB,WADkB,KAAK,YAAY,WAAW,CACrB,CAC5B,QAAO,KAAK,WAAW;;;AAK1B,KAAI,OAAO,WAAW,GAAG;AACxB,UAAQ,IAAI,sBAAsB,YAAY;AAC9C,UAAQ,IACP,wFACA;AACD;;AAID,SAAQ,IAAI,qBAAqB;AACjC,S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gBAAc,EAAE,WAAW,KAAK,WAAW,CAAC;;CAE7C,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"templates-BQTgkXfH.js","names":[],"sources":["../src/core/templates.ts"],"sourcesContent":["export const SKILL_MD_TEMPLATE = (\n\tname: string,\n\tdescription: string,\n\ttitle: string,\n\tinclude_examples: boolean = false,\n) => {\n\tconst minimal_template = `---\nname: ${name}\n# Keep on ONE line, third-person voice, include \"Use when/for/to...\" trigger\n# prettier-ignore\ndescription: ${description}\n---\n\n# ${title}\n\n## Quick Start\n\n[Provide ONE minimal working example - the most common use case]\n\n\\`\\`\\`typescript\n// Keep this concise - show essential code only\n// Move detailed examples to references/ for Level 3 loading\n\\`\\`\\`\n\n## Core Principles\n\n- Principle 1: [Key concept]\n- Principle 2: [Key concept]\n- Principle 3: [Key concept]\n\n## Common Patterns\n\n### [Most Frequent Pattern]\n\n[Brief description - keep under 100 words]\n\n## Reference Files\n\nFor detailed documentation, see:\n- [references/](references/) - Add detailed guides here\n\n## Notes\n\n- Important note 1\n- Important note 2\n\n<!--\nPROGRESSIVE DISCLOSURE GUIDELINES:\n- Keep this file ~50 lines total (max ~150 lines)\n- Use 1-2 code blocks only (recommend 1)\n- Keep description <250 chars (Claude truncates at this limit)\n- Move detailed docs to references/ for Level 3 loading\n- This is Level 2 - quick reference ONLY, not a manual\n\nLLM WORKFLOW (when editing this file):\n1. Write/edit SKILL.md\n2. Format (if formatter available)\n3. Run: claude-skills-cli validate <path>\n4. If multi-line description warning: run claude-skills-cli doctor <path>\n5. Validate again to confirm\n-->\n`;\n\n\tconst full_template = `---\nname: ${name}\n# Keep on ONE line, third-person voice, include \"Use when/for/to...\" trigger\n# prettier-ignore\ndescription: ${description}\n---\n\n# ${title}\n\n## Quick Start\n\n[Provide ONE minimal working example - the most common use case]\n\n\\`\\`\\`typescript\n// Keep this concise - show essential code only\n// Detailed examples go in references/examples.md\n\\`\\`\\`\n\n## Core Principles\n\n- Principle 1: [Key concept]\n- Principle 2: [Key concept]\n- Principle 3: [Key concept]\n\n## Common Patterns\n\n### [Most Frequent Pattern]\n\n[Brief description - keep under 100 words]\n\n## Reference Files\n\nFor detailed documentation, see:\n- [references/detailed-guide.md](references/detailed-guide.md) - Complete guide\n- [references/examples.md](references/examples.md) - Additional examples\n\n## Scripts\n\n- \\`scripts/example.js\\` - [What this script does]\n\n## Notes\n\n- Important note 1\n- Important note 2\n\n<!--\nPROGRESSIVE DISCLOSURE GUIDELINES:\n- Keep this file ~50 lines total (max ~150 lines)\n- Use 1-2 code blocks only (recommend 1)\n- Keep description <250 chars (Claude truncates at this limit)\n- Move detailed docs to references/ for Level 3 loading\n- This is Level 2 - quick reference ONLY, not a manual\n\nLLM WORKFLOW (when editing this file):\n1. Write/edit SKILL.md\n2. Format (if formatter available)\n3. Run: claude-skills-cli validate <path>\n4. If multi-line description warning: run claude-skills-cli doctor <path>\n5. Validate again to confirm\n-->\n`;\n\n\treturn include_examples ? full_template : minimal_template;\n};\n\nexport const REFERENCE_TEMPLATE = (\n\ttitle: string,\n) => `# ${title} Reference\n\n<!-- This is a Level 3 resource file -->\n<!-- It's loaded on-demand when Claude needs detailed information -->\n<!-- No size limits - include comprehensive documentation here -->\n\n## Overview\n\n[Detailed explanation of this topic]\n\n## Complete Examples\n\n### Example 1: [Scenario]\n\n[Comprehensive example with full context]\n\n\\`\\`\\`typescript\n// Detailed code with comments\n// Include edge cases and variations\n\\`\\`\\`\n\n### Example 2: [Scenario]\n\n[Another detailed example]\n\n\\`\\`\\`typescript\n// More extensive code\n\\`\\`\\`\n\n## Advanced Topics\n\n[Deep dive into complex aspects]\n\n## API Reference\n\n[Complete API documentation if applicable]\n\n## Best Practices\n\n- [Detailed best practice 1]\n- [Detailed best practice 2]\n- [Detailed best practice 3]\n\n## Troubleshooting\n\n### Issue 1\n\n**Problem:** [Description]\n**Solution:** [Detailed solution]\n\n### Issue 2\n\n**Problem:** [Description]\n**Solution:** [Detailed solution]\n`;\n\nexport const SCRIPT_TEMPLATE = (\n\tfilename: string,\n) => `#!/usr/bin/env node\n\n/**\n * Description of what this script does.\n *\n * Usage:\n * node ${filename}\n */\n\nfunction main() {\n console.log('Script executed successfully');\n}\n\nmain();\n`;\n\n// Hook templates for skill activation\nexport const SIMPLE_HOOK_TEMPLATE = () => `#!/bin/bash\necho 'INSTRUCTION: If the prompt matches any available skill keywords, use Skill(skill-name) to activate it.'\n`;\n\nexport const FORCED_EVAL_HOOK_TEMPLATE = () => `#!/bin/bash\n# UserPromptSubmit hook that forces explicit skill evaluation\n#\n# This hook requires Claude to explicitly evaluate each available skill\n# before proceeding with implementation.\n#\n# Installation: Copy to .claude/hooks/UserPromptSubmit\n\ncat <<'EOF'\nINSTRUCTION: MANDATORY SKILL ACTIVATION SEQUENCE\n\nStep 1 - EVALUATE (do this in your response):\nFor each skill in <available_skills>, state: [skill-name] - YES/NO - [reason]\n\nStep 2 - ACTIVATE (do this immediately after Step 1):\nIF any skills are YES → Use Skill(skill-name) tool for EACH relevant skill NOW\nIF no skills are YES → State \"No skills needed\" and proceed\n\nStep 3 - IMPLEMENT:\nOnly after Step 2 is complete, proceed with implementation.\n\nCRITICAL: You MUST call Skill() tool in Step 2. Do NOT skip to implementation.\nThe evaluation (Step 1) is WORTHLESS unless you ACTIVATE (Step 2) the skills.\n\nExample of correct sequence:\n- research: NO - not a research task\n- svelte5-runes: YES - need reactive state\n- sveltekit-structure: YES - creating routes\n\n[Then IMMEDIATELY use Skill() tool:]\n> Skill(svelte5-runes)\n> Skill(sveltekit-structure)\n\n[THEN and ONLY THEN start implementation]\nEOF\n`;\n\nexport const LLM_EVAL_HOOK_TEMPLATE = () => `#!/bin/bash\n# UserPromptSubmit hook that uses Claude API for intelligent skill evaluation\n#\n# This hook analyses each user prompt and uses the Claude API to determine which\n# skills (if any) are relevant. It then instructs Claude to activate those skills\n# before proceeding with implementation.\n#\n# COST ANALYSIS (per prompt):\n# Current model: Claude Haiku 3.5 ($0.80/$4 per MTok input/output)\n# - Estimated: ~400 input tokens + ~20 output tokens\n# - Cost: ~$0.0004 per evaluation (0.04 cents)\n# - Volume: $0.40 per 1,000 prompts\n#\n# MODEL CONFIGURATION:\n# Uncomment the model you want to use below\n#\n# Alternative: Claude Haiku 4.5 ($1/$5 per MTok) - 25% more expensive\n# - Better accuracy and alignment\n# - Cost: ~$0.0005 per evaluation (0.05 cents)\n# - Trade-off: Extra 0.01¢ per call for improved skill matching\n#\n# REQUIREMENTS:\n# 1. Set ANTHROPIC_API_KEY environment variable\n# export ANTHROPIC_API_KEY=your-key-here\n# 2. Ensure jq is installed for JSON parsing\n\n# ============================================================================\n# MODEL CONFIGURATION - Uncomment the model you want to use\n# ============================================================================\n\n# Haiku 3.5 - Faster, cheaper, good for simple classification\nMODEL=\"claude-3-5-haiku-20241022\"\n\n# Haiku 4.5 - Better accuracy, 25% more expensive (verify model ID from Anthropic docs)\n# MODEL=\"claude-haiku-4-5-20251015\"\n\n# ============================================================================\n\n# Read JSON input from stdin with timeout\nINPUT_JSON=$(timeout 2 cat || echo '{}')\n\n# Extract user prompt and cwd from JSON\nUSER_PROMPT=$(echo \"$INPUT_JSON\" | jq -r '.prompt // \"\"' 2>/dev/null)\nCWD=$(echo \"$INPUT_JSON\" | jq -r '.cwd // \"\"' 2>/dev/null)\n\n# Use CLAUDE_PROJECT_DIR if CWD is empty\nif [ -z \"$CWD\" ] || [ \"$CWD\" = \"null\" ]; then\n\tCWD=\"\\${CLAUDE_PROJECT_DIR:-.}\"\nfi\n\n# Get available skills with descriptions from both global and project skills\nAVAILABLE_SKILLS=\"\"\n\n# Function to scan a skills directory\nscan_skills_dir() {\n\tlocal dir=\"$1\"\n\n\tif [ -d \"$dir\" ]; then\n\t\tfor skill_dir in \"$dir\"/*/; do\n\t\t\tif [ -d \"$skill_dir\" ]; then\n\t\t\t\tskill_file=\"$skill_dir/SKILL.md\"\n\t\t\t\tif [ -f \"$skill_file\" ]; then\n\t\t\t\t\tskill_name=$(basename \"$skill_dir\")\n\t\t\t\t\t# Extract description from YAML frontmatter (between --- markers)\n\t\t\t\t\tskill_desc=$(sed -n '/^---$/,/^---$/p' \"$skill_file\" | grep '^description:' | sed 's/^description: *//' | head -n 1)\n\n\t\t\t\t\tif [ -n \"$skill_desc\" ]; then\n\t\t\t\t\t\tAVAILABLE_SKILLS=\"\\${AVAILABLE_SKILLS}- \\${skill_name}: \\${skill_desc}\\\\n\"\n\t\t\t\t\telse\n\t\t\t\t\t\tAVAILABLE_SKILLS=\"\\${AVAILABLE_SKILLS}- \\${skill_name}\\\\n\"\n\t\t\t\t\tfi\n\t\t\t\tfi\n\t\t\tfi\n\t\tdone\n\tfi\n}\n\n# Scan global skills\nscan_skills_dir \"$HOME/.claude/skills\"\n\n# Scan project skills\nscan_skills_dir \"$CWD/.claude/skills\"\n\nif [ -z \"$AVAILABLE_SKILLS\" ]; then\n\tAVAILABLE_SKILLS=\"No skills found\"\nfi\n\n\n# Fallback instruction message\nFALLBACK_INSTRUCTION=\"INSTRUCTION: If the prompt matches any available skill keywords, use Skill(skill-name) to activate it.\"\n\n# If no API key in environment, fall back\nif [ -z \"$ANTHROPIC_API_KEY\" ]; then\n\techo \"$FALLBACK_INSTRUCTION\"\n\texit 0\nfi\n\n# Prepare the optimized evaluation prompt\nEVAL_PROMPT=$(cat <<EOF\nReturn ONLY a JSON array of skill names that match this request.\n\nRequest: \\${USER_PROMPT}\n\nSkills:\n\\${AVAILABLE_SKILLS}\nFormat: [\"skill-name\"] or []\nEOF\n)\n\n# Call Claude API with optimized parameters\nRESPONSE=$(curl -s https://api.anthropic.com/v1/messages \\\\\n\t-H \"content-type: application/json\" \\\\\n\t-H \"x-api-key: $ANTHROPIC_API_KEY\" \\\\\n\t-H \"anthropic-version: 2023-06-01\" \\\\\n\t-d \"{\n\t\t\\\\\"model\\\\\": \\\\\"$MODEL\\\\\",\n\t\t\\\\\"max_tokens\\\\\": 200,\n\t\t\\\\\"temperature\\\\\": 0,\n\t\t\\\\\"system\\\\\": \\\\\"You are a skill matcher. Return only valid JSON arrays.\\\\\",\n\t\t\\\\\"messages\\\\\": [{\n\t\t\t\\\\\"role\\\\\": \\\\\"user\\\\\",\n\t\t\t\\\\\"content\\\\\": $(echo \"$EVAL_PROMPT\" | jq -Rs .)\n\t\t}]\n\t}\")\n\n# Extract the skill list from response\nRAW_TEXT=$(echo \"$RESPONSE\" | jq -r '.content[0].text' 2>/dev/null)\n\n# Check if we got a valid response\nif [ $? -ne 0 ] || [ -z \"$RAW_TEXT\" ]; then\n\techo \"$FALLBACK_INSTRUCTION\"\n\texit 0\nfi\n\n# Strip markdown code fences if present and extract JSON\nSKILLS=$(echo \"$RAW_TEXT\" | sed -n '/^\\\\[/,/^\\\\]/p' | head -n 1)\n\n# If that didn't work, try the whole text\nif [ -z \"$SKILLS\" ]; then\n\tSKILLS=\"$RAW_TEXT\"\nfi\n\n# Parse the skills array\nSKILL_COUNT=$(echo \"$SKILLS\" | jq 'length' 2>/dev/null)\n\nif [ \"$SKILL_COUNT\" = \"0\" ]; then\n\techo \"INSTRUCTION: LLM evaluation determined no skills are needed for this task.\"\nelif [ -n \"$SKILL_COUNT\" ] && [ \"$SKILL_COUNT\" != \"null\" ]; then\n\tSKILL_NAMES=$(echo \"$SKILLS\" | jq -r '.[]' | paste -sd ',' -)\n\techo \"INSTRUCTION: LLM evaluation determined these skills are relevant: $SKILL_NAMES\"\n\techo \"\"\n\techo \"You MUST activate these skills using the Skill() tool BEFORE implementation:\"\n\techo \"$SKILLS\" | jq -r '.[] | \"- Skill(\\\\(.))\"'\nelse\n\t# Fallback if parsing failed\n\techo \"$FALLBACK_INSTRUCTION\"\nfi\n`;\n"],"mappings":";AAAA,MAAa,qBACZ,MACA,aACA,OACA,mBAA4B,UACxB;CACJ,MAAM,mBAAmB;QAClB,KAAK;;;eAGE,YAAY;;;IAGvB,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkDT,MAAM,gBAAgB;QACf,KAAK;;;eAGE,YAAY;;;IAGvB,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuDT,QAAO,mBAAmB,gBAAgB;;AAG3C,MAAa,sBACZ,UACI,KAAK,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwDhB,MAAa,mBACZ,aACI;;;;;;YAMO,SAAS;;;;;;;;;AAWrB,MAAa,6BAA6B;;;AAI1C,MAAa,kCAAkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqC/C,MAAa,+BAA+B"}
|