@phuc1403/musketeer 0.7.0 → 0.9.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 (84) hide show
  1. package/README.md +49 -49
  2. package/manifest.json +333 -301
  3. package/package.json +1 -1
  4. package/template/.claude/agents/code-reviewer.md +182 -166
  5. package/template/.claude/hooks/git-skill-reminder.cjs +53 -0
  6. package/template/.claude/hooks/inject-design-docs.cjs +13 -13
  7. package/template/.claude/hooks/inject-ubiquitous-language.cjs +52 -0
  8. package/template/.claude/hooks/lib/colors.cjs +180 -122
  9. package/template/.claude/hooks/lib/transcript-parser.cjs +300 -277
  10. package/template/.claude/skills/code-review/SKILL.md +201 -54
  11. package/template/.claude/skills/code-review/references/checklist-workflow.md +96 -0
  12. package/template/.claude/skills/code-review/references/checklists/api.md +52 -52
  13. package/template/.claude/skills/code-review/references/checklists/base.md +100 -100
  14. package/template/.claude/skills/code-review/references/checklists/web-app.md +54 -54
  15. package/template/.claude/skills/code-review/references/code-review-reception.md +113 -0
  16. package/template/.claude/skills/code-review/references/codebase-scan-workflow.md +30 -0
  17. package/template/.claude/skills/code-review/references/edge-case-scouting.md +119 -0
  18. package/template/.claude/skills/code-review/references/input-mode-resolution.md +135 -0
  19. package/template/.claude/skills/code-review/references/parallel-review-workflow.md +76 -0
  20. package/template/.claude/skills/code-review/references/requesting-code-review.md +116 -0
  21. package/template/.claude/skills/code-review/references/spec-compliance-review.md +43 -0
  22. package/template/.claude/skills/code-review/references/task-management-reviews.md +140 -0
  23. package/template/.claude/skills/code-review/references/verification-before-completion.md +139 -0
  24. package/template/.claude/skills/context-map/SKILL.md +1 -1
  25. package/template/.claude/skills/git/SKILL.md +131 -115
  26. package/template/.claude/skills/git/references/branch-management.md +88 -88
  27. package/template/.claude/skills/git/references/commit-standards.md +46 -46
  28. package/template/.claude/skills/git/references/context-efficiency.md +54 -0
  29. package/template/.claude/skills/git/references/gh-cli-guide.md +109 -109
  30. package/template/.claude/skills/git/references/safety-protocols.md +69 -69
  31. package/template/.claude/skills/git/references/workflow-commit.md +58 -58
  32. package/template/.claude/skills/git/references/workflow-merge-pr.md +136 -0
  33. package/template/.claude/skills/git/references/workflow-merge.md +48 -48
  34. package/template/.claude/skills/git/references/workflow-pr.md +58 -58
  35. package/template/.claude/skills/git/references/workflow-push.md +52 -52
  36. package/template/.claude/skills/knowledge-crunching/SKILL.md +56 -92
  37. package/template/.claude/skills/knowledge-crunching/assets/ubiquitous-language.template.md +3 -0
  38. package/template/.claude/skills/skill-creator/LICENSE.txt +201 -201
  39. package/template/.claude/skills/skill-creator/SKILL.md +154 -149
  40. package/template/.claude/skills/skill-creator/agents/analyzer.md +274 -274
  41. package/template/.claude/skills/skill-creator/agents/comparator.md +202 -202
  42. package/template/.claude/skills/skill-creator/agents/grader.md +223 -223
  43. package/template/.claude/skills/skill-creator/assets/eval_review.html +146 -146
  44. package/template/.claude/skills/skill-creator/eval-viewer/generate_review.py +471 -471
  45. package/template/.claude/skills/skill-creator/eval-viewer/viewer.html +1325 -1325
  46. package/template/.claude/skills/skill-creator/references/benchmark-optimization-guide.md +86 -86
  47. package/template/.claude/skills/skill-creator/references/distribution-guide.md +79 -79
  48. package/template/.claude/skills/skill-creator/references/eval-infrastructure-guide.md +129 -129
  49. package/template/.claude/skills/skill-creator/references/eval-schemas.md +121 -121
  50. package/template/.claude/skills/skill-creator/references/mcp-skills-integration.md +71 -71
  51. package/template/.claude/skills/skill-creator/references/metadata-quality-criteria.md +94 -94
  52. package/template/.claude/skills/skill-creator/references/plugin-marketplace-hosting.md +104 -104
  53. package/template/.claude/skills/skill-creator/references/plugin-marketplace-overview.md +89 -89
  54. package/template/.claude/skills/skill-creator/references/plugin-marketplace-schema.md +93 -93
  55. package/template/.claude/skills/skill-creator/references/plugin-marketplace-sources.md +103 -103
  56. package/template/.claude/skills/skill-creator/references/plugin-marketplace-troubleshooting.md +76 -76
  57. package/template/.claude/skills/skill-creator/references/script-quality-criteria.md +106 -106
  58. package/template/.claude/skills/skill-creator/references/skill-anatomy-and-requirements.md +77 -77
  59. package/template/.claude/skills/skill-creator/references/skill-creation-workflow.md +152 -151
  60. package/template/.claude/skills/skill-creator/references/skill-design-patterns.md +75 -75
  61. package/template/.claude/skills/skill-creator/references/skillmark-benchmark-criteria.md +102 -102
  62. package/template/.claude/skills/skill-creator/references/structure-organization-criteria.md +114 -114
  63. package/template/.claude/skills/skill-creator/references/testing-and-iteration.md +78 -78
  64. package/template/.claude/skills/skill-creator/references/token-efficiency-criteria.md +74 -74
  65. package/template/.claude/skills/skill-creator/references/troubleshooting-guide.md +81 -81
  66. package/template/.claude/skills/skill-creator/references/validation-checklist.md +83 -83
  67. package/template/.claude/skills/skill-creator/references/writing-effective-instructions.md +88 -88
  68. package/template/.claude/skills/skill-creator/references/yaml-frontmatter-reference.md +92 -92
  69. package/template/.claude/skills/skill-creator/scripts/aggregate_benchmark.py +401 -401
  70. package/template/.claude/skills/skill-creator/scripts/encoding_utils.py +36 -36
  71. package/template/.claude/skills/skill-creator/scripts/generate_report.py +326 -326
  72. package/template/.claude/skills/skill-creator/scripts/improve_description.py +248 -248
  73. package/template/.claude/skills/skill-creator/scripts/init_skill.py +360 -360
  74. package/template/.claude/skills/skill-creator/scripts/package_skill.py +143 -143
  75. package/template/.claude/skills/skill-creator/scripts/quick_validate.py +110 -110
  76. package/template/.claude/skills/skill-creator/scripts/run_eval.py +310 -310
  77. package/template/.claude/skills/skill-creator/scripts/run_loop.py +332 -332
  78. package/template/.claude/skills/skill-creator/scripts/utils.py +47 -47
  79. package/template/.claude/statusline.cjs +0 -0
  80. package/template/.claude/hooks/inject-context.cjs +0 -52
  81. package/template/.claude/skills/code-review/references/adversarial-review.md +0 -223
  82. package/template/.claude/skills/knowledge-crunching/assets/context.template.md +0 -59
  83. package/template/.claude/skills/knowledge-crunching/references/crunching-dialogue.md +0 -113
  84. /package/template/.claude/hooks/{usage-context-awareness.cjs → usage-quota-cache-refresh.cjs} +0 -0
@@ -1,360 +1,360 @@
1
- #!/usr/bin/env python3
2
- """
3
- Skill Initializer - Creates a new skill from template
4
-
5
- Usage:
6
- init_skill.py <skill-name> --path <path>
7
-
8
- Examples:
9
- init_skill.py my-new-skill --path skills/public
10
- init_skill.py my-api-helper --path skills/private
11
- init_skill.py custom-skill --path /custom/location
12
- """
13
-
14
- import sys
15
- import re
16
- from pathlib import Path
17
-
18
- from encoding_utils import configure_utf8_console, write_text_utf8
19
-
20
- # Fix Windows console encoding for Unicode output (emojis, arrows)
21
- configure_utf8_console()
22
-
23
-
24
- SKILL_TEMPLATE = """---
25
- name: {skill_name}
26
- description: [TODO: Complete and informative explanation of what the skill does and when to use it. Include WHEN to use this skill - specific scenarios, file types, or tasks that trigger it.]
27
- ---
28
-
29
- # {skill_title}
30
-
31
- ## Overview
32
-
33
- [TODO: 1-2 sentences explaining what this skill enables]
34
-
35
- ## Structuring This Skill
36
-
37
- [TODO: Choose the structure that best fits this skill's purpose. Common patterns:
38
-
39
- **1. Workflow-Based** (best for sequential processes)
40
- - Works well when there are clear step-by-step procedures
41
- - Example: DOCX skill with "Workflow Decision Tree" → "Reading" → "Creating" → "Editing"
42
- - Structure: ## Overview → ## Workflow Decision Tree → ## Step 1 → ## Step 2...
43
-
44
- **2. Task-Based** (best for tool collections)
45
- - Works well when the skill offers different operations/capabilities
46
- - Example: PDF skill with "Quick Start" → "Merge PDFs" → "Split PDFs" → "Extract Text"
47
- - Structure: ## Overview → ## Quick Start → ## Task Category 1 → ## Task Category 2...
48
-
49
- **3. Reference/Guidelines** (best for standards or specifications)
50
- - Works well for brand guidelines, coding standards, or requirements
51
- - Example: Brand styling with "Brand Guidelines" → "Colors" → "Typography" → "Features"
52
- - Structure: ## Overview → ## Guidelines → ## Specifications → ## Usage...
53
-
54
- **4. Capabilities-Based** (best for integrated systems)
55
- - Works well when the skill provides multiple interrelated features
56
- - Example: Product Management with "Core Capabilities" → numbered capability list
57
- - Structure: ## Overview → ## Core Capabilities → ### 1. Feature → ### 2. Feature...
58
-
59
- Patterns can be mixed and matched as needed. Most skills combine patterns (e.g., start with task-based, add workflow for complex operations).
60
-
61
- Delete this entire "Structuring This Skill" section when done - it's just guidance.]
62
-
63
- ## [TODO: Replace with the first main section based on chosen structure]
64
-
65
- [TODO: Add content here. See examples in existing skills:
66
- - Code samples for technical skills
67
- - Decision trees for complex workflows
68
- - Concrete examples with realistic user requests
69
- - References to scripts/templates/references as needed]
70
-
71
- ## Resources
72
-
73
- This skill includes example resource directories that demonstrate how to organize different types of bundled resources:
74
-
75
- ### scripts/
76
- Executable code (Python/Bash/etc.) that can be run directly to perform specific operations.
77
-
78
- **Examples from other skills:**
79
- - PDF skill: `fill_fillable_fields.py`, `extract_form_field_info.py` - utilities for PDF manipulation
80
- - DOCX skill: `document.py`, `utilities.py` - Python modules for document processing
81
-
82
- **Appropriate for:** Python scripts, shell scripts, or any executable code that performs automation, data processing, or specific operations.
83
-
84
- **Note:** Scripts may be executed without loading into context, but can still be read by Claude for patching or environment adjustments.
85
-
86
- ### references/
87
- Documentation and reference material intended to be loaded into context to inform Claude's process and thinking.
88
-
89
- **Examples from other skills:**
90
- - Product management: `communication.md`, `context_building.md` - detailed workflow guides
91
- - BigQuery: API reference documentation and query examples
92
- - Finance: Schema documentation, company policies
93
-
94
- **Appropriate for:** In-depth documentation, API references, database schemas, comprehensive guides, or any detailed information that Claude should reference while working.
95
-
96
- ### assets/
97
- Files not intended to be loaded into context, but rather used within the output Claude produces.
98
-
99
- **Examples from other skills:**
100
- - Brand styling: PowerPoint template files (.pptx), logo files
101
- - Frontend builder: HTML/React boilerplate project directories
102
- - Typography: Font files (.ttf, .woff2)
103
-
104
- **Appropriate for:** Templates, boilerplate code, document templates, images, icons, fonts, or any files meant to be copied or used in the final output.
105
-
106
- ---
107
-
108
- **Any unneeded directories can be deleted.** Not every skill requires all three types of resources.
109
- """
110
-
111
- EXAMPLE_SCRIPT = '''#!/usr/bin/env python3
112
- """
113
- Example helper script for {skill_name}
114
-
115
- This is a placeholder script that can be executed directly.
116
- Replace with actual implementation or delete if not needed.
117
-
118
- Example real scripts from other skills:
119
- - pdf/scripts/fill_fillable_fields.py - Fills PDF form fields
120
- - pdf/scripts/convert_pdf_to_images.py - Converts PDF pages to images
121
- """
122
-
123
- def main():
124
- print("This is an example script for {skill_name}")
125
- # TODO: Add actual script logic here
126
- # This could be data processing, file conversion, API calls, etc.
127
-
128
- if __name__ == "__main__":
129
- main()
130
- '''
131
-
132
- EXAMPLE_REFERENCE = """# Reference Documentation for {skill_title}
133
-
134
- This is a placeholder for detailed reference documentation.
135
- Replace with actual reference content or delete if not needed.
136
-
137
- Example real reference docs from other skills:
138
- - product-management/references/communication.md - Comprehensive guide for status updates
139
- - product-management/references/context_building.md - Deep-dive on gathering context
140
- - bigquery/references/ - API references and query examples
141
-
142
- ## When Reference Docs Are Useful
143
-
144
- Reference docs are ideal for:
145
- - Comprehensive API documentation
146
- - Detailed workflow guides
147
- - Complex multi-step processes
148
- - Information too lengthy for main SKILL.md
149
- - Content that's only needed for specific use cases
150
-
151
- ## Structure Suggestions
152
-
153
- ### API Reference Example
154
- - Overview
155
- - Authentication
156
- - Endpoints with examples
157
- - Error codes
158
- - Rate limits
159
-
160
- ### Workflow Guide Example
161
- - Prerequisites
162
- - Step-by-step instructions
163
- - Common patterns
164
- - Troubleshooting
165
- - Best practices
166
- """
167
-
168
- EXAMPLE_ASSET = """# Example Asset File
169
-
170
- This placeholder represents where asset files would be stored.
171
- Replace with actual asset files (templates, images, fonts, etc.) or delete if not needed.
172
-
173
- Asset files are NOT intended to be loaded into context, but rather used within
174
- the output Claude produces.
175
-
176
- Example asset files from other skills:
177
- - Brand guidelines: logo.png, slides_template.pptx
178
- - Frontend builder: hello-world/ directory with HTML/React boilerplate
179
- - Typography: custom-font.ttf, font-family.woff2
180
- - Data: sample_data.csv, test_dataset.json
181
-
182
- ## Common Asset Types
183
-
184
- - Templates: .pptx, .docx, boilerplate directories
185
- - Images: .png, .jpg, .svg, .gif
186
- - Fonts: .ttf, .otf, .woff, .woff2
187
- - Boilerplate code: Project directories, starter files
188
- - Icons: .ico, .svg
189
- - Data files: .csv, .json, .xml, .yaml
190
-
191
- Note: This is a text placeholder. Actual assets can be any file type.
192
- """
193
-
194
-
195
- def title_case_skill_name(skill_name):
196
- """Convert hyphenated skill name to Title Case for display."""
197
- return ' '.join(word.capitalize() for word in skill_name.split('-'))
198
-
199
-
200
- def parse_skill_identifier(skill_identifier):
201
- """
202
- Parse and validate skill identifier.
203
-
204
- Accepted formats:
205
- - skill-name
206
- - namespace:skill-name (single colon)
207
- """
208
- value = skill_identifier.strip().strip('"').strip("'")
209
-
210
- if value.count(':') > 1:
211
- raise ValueError(
212
- "Skill name must contain at most one colon: use 'skill-name' or "
213
- "'namespace:skill-name'"
214
- )
215
-
216
- namespace = None
217
- skill_slug = value
218
- if ':' in value:
219
- namespace, skill_slug = value.split(':', 1)
220
-
221
- pattern = r'^[a-z0-9-]+$'
222
- if namespace and not re.match(pattern, namespace):
223
- raise ValueError(
224
- f"Invalid namespace '{namespace}'. Use lowercase letters, digits, and hyphens only."
225
- )
226
- if not re.match(pattern, skill_slug):
227
- raise ValueError(
228
- f"Invalid skill id '{skill_slug}'. Use lowercase letters, digits, and hyphens only."
229
- )
230
-
231
- for label, segment in [("Namespace", namespace), ("Skill id", skill_slug)]:
232
- if segment and (segment.startswith('-') or segment.endswith('-') or '--' in segment):
233
- raise ValueError(
234
- f"{label} '{segment}' cannot start/end with hyphen or contain consecutive hyphens."
235
- )
236
-
237
- if len(skill_slug) > 40:
238
- raise ValueError("Skill id must be 40 characters or fewer.")
239
-
240
- full_name = f"{namespace}:{skill_slug}" if namespace else skill_slug
241
- return full_name, skill_slug
242
-
243
-
244
- def init_skill(skill_name, path):
245
- """
246
- Initialize a new skill directory with template SKILL.md.
247
-
248
- Args:
249
- skill_name: Name of the skill
250
- path: Path where the skill directory should be created
251
-
252
- Returns:
253
- Path to created skill directory, or None if error
254
- """
255
- try:
256
- full_name, skill_slug = parse_skill_identifier(skill_name)
257
- except ValueError as exc:
258
- print(f"❌ Error: {exc}")
259
- return None
260
-
261
- # Determine skill directory path (always use slug for folder name)
262
- skill_dir = Path(path).resolve() / skill_slug
263
-
264
- # Check if directory already exists
265
- if skill_dir.exists():
266
- print(f"❌ Error: Skill directory already exists: {skill_dir}")
267
- return None
268
-
269
- # Create skill directory
270
- try:
271
- skill_dir.mkdir(parents=True, exist_ok=False)
272
- print(f"✅ Created skill directory: {skill_dir}")
273
- except Exception as e:
274
- print(f"❌ Error creating directory: {e}")
275
- return None
276
-
277
- # Create SKILL.md from template
278
- skill_title = title_case_skill_name(skill_slug)
279
- skill_content = SKILL_TEMPLATE.format(
280
- skill_name=full_name,
281
- skill_title=skill_title
282
- )
283
-
284
- skill_md_path = skill_dir / 'SKILL.md'
285
- try:
286
- write_text_utf8(skill_md_path, skill_content)
287
- print("✅ Created SKILL.md")
288
- except Exception as e:
289
- print(f"❌ Error creating SKILL.md: {e}")
290
- return None
291
-
292
- # Create resource directories with example files
293
- try:
294
- # Create scripts/ directory with example script
295
- scripts_dir = skill_dir / 'scripts'
296
- scripts_dir.mkdir(exist_ok=True)
297
- example_script = scripts_dir / 'example.py'
298
- write_text_utf8(example_script, EXAMPLE_SCRIPT.format(skill_name=full_name))
299
- example_script.chmod(0o755)
300
- print("✅ Created scripts/example.py")
301
-
302
- # Create references/ directory with example reference doc
303
- references_dir = skill_dir / 'references'
304
- references_dir.mkdir(exist_ok=True)
305
- example_reference = references_dir / 'api_reference.md'
306
- write_text_utf8(example_reference, EXAMPLE_REFERENCE.format(skill_title=skill_title))
307
- print("✅ Created references/api_reference.md")
308
-
309
- # Create assets/ directory with example asset placeholder
310
- assets_dir = skill_dir / 'assets'
311
- assets_dir.mkdir(exist_ok=True)
312
- example_asset = assets_dir / 'example_asset.txt'
313
- write_text_utf8(example_asset, EXAMPLE_ASSET)
314
- print("✅ Created assets/example_asset.txt")
315
- except Exception as e:
316
- print(f"❌ Error creating resource directories: {e}")
317
- return None
318
-
319
- # Print next steps
320
- print(f"\n✅ Skill '{full_name}' initialized successfully at {skill_dir}")
321
- print("\nNext steps:")
322
- print("1. Edit SKILL.md to complete the TODO items and update the description")
323
- print("2. Customize or delete the example files in scripts/, references/, and assets/")
324
- print("3. Run the validator when ready to check the skill structure")
325
-
326
- return skill_dir
327
-
328
-
329
- def main():
330
- if len(sys.argv) < 4 or sys.argv[2] != '--path':
331
- print("Usage: init_skill.py <skill-name> --path <path>")
332
- print("\nSkill name requirements:")
333
- print(" - Use either 'skill-name' or 'namespace:skill-name' (e.g., 'ck:data-analyzer')")
334
- print(" - Namespace and skill id: lowercase letters, digits, and hyphens only")
335
- print(" - Skill id max 40 characters")
336
- print(" - Directory name is always the skill id segment")
337
- print("\nExamples:")
338
- print(" init_skill.py my-new-skill --path skills/public")
339
- print(" init_skill.py ck:my-new-skill --path skills/public")
340
- print(" init_skill.py my-api-helper --path skills/private")
341
- print(" init_skill.py custom-skill --path /custom/location")
342
- sys.exit(1)
343
-
344
- skill_name = sys.argv[1]
345
- path = sys.argv[3]
346
-
347
- print(f"🚀 Initializing skill: {skill_name}")
348
- print(f" Location: {path}")
349
- print()
350
-
351
- result = init_skill(skill_name, path)
352
-
353
- if result:
354
- sys.exit(0)
355
- else:
356
- sys.exit(1)
357
-
358
-
359
- if __name__ == "__main__":
360
- main()
1
+ #!/usr/bin/env python3
2
+ """
3
+ Skill Initializer - Creates a new skill from template
4
+
5
+ Usage:
6
+ init_skill.py <skill-name> --path <path>
7
+
8
+ Examples:
9
+ init_skill.py my-new-skill --path skills/public
10
+ init_skill.py my-api-helper --path skills/private
11
+ init_skill.py custom-skill --path /custom/location
12
+ """
13
+
14
+ import sys
15
+ import re
16
+ from pathlib import Path
17
+
18
+ from encoding_utils import configure_utf8_console, write_text_utf8
19
+
20
+ # Fix Windows console encoding for Unicode output (emojis, arrows)
21
+ configure_utf8_console()
22
+
23
+
24
+ SKILL_TEMPLATE = """---
25
+ name: {skill_name}
26
+ description: [TODO: Complete and informative explanation of what the skill does and when to use it. Include WHEN to use this skill - specific scenarios, file types, or tasks that trigger it.]
27
+ ---
28
+
29
+ # {skill_title}
30
+
31
+ ## Overview
32
+
33
+ [TODO: 1-2 sentences explaining what this skill enables]
34
+
35
+ ## Structuring This Skill
36
+
37
+ [TODO: Choose the structure that best fits this skill's purpose. Common patterns:
38
+
39
+ **1. Workflow-Based** (best for sequential processes)
40
+ - Works well when there are clear step-by-step procedures
41
+ - Example: DOCX skill with "Workflow Decision Tree" → "Reading" → "Creating" → "Editing"
42
+ - Structure: ## Overview → ## Workflow Decision Tree → ## Step 1 → ## Step 2...
43
+
44
+ **2. Task-Based** (best for tool collections)
45
+ - Works well when the skill offers different operations/capabilities
46
+ - Example: PDF skill with "Quick Start" → "Merge PDFs" → "Split PDFs" → "Extract Text"
47
+ - Structure: ## Overview → ## Quick Start → ## Task Category 1 → ## Task Category 2...
48
+
49
+ **3. Reference/Guidelines** (best for standards or specifications)
50
+ - Works well for brand guidelines, coding standards, or requirements
51
+ - Example: Brand styling with "Brand Guidelines" → "Colors" → "Typography" → "Features"
52
+ - Structure: ## Overview → ## Guidelines → ## Specifications → ## Usage...
53
+
54
+ **4. Capabilities-Based** (best for integrated systems)
55
+ - Works well when the skill provides multiple interrelated features
56
+ - Example: Product Management with "Core Capabilities" → numbered capability list
57
+ - Structure: ## Overview → ## Core Capabilities → ### 1. Feature → ### 2. Feature...
58
+
59
+ Patterns can be mixed and matched as needed. Most skills combine patterns (e.g., start with task-based, add workflow for complex operations).
60
+
61
+ Delete this entire "Structuring This Skill" section when done - it's just guidance.]
62
+
63
+ ## [TODO: Replace with the first main section based on chosen structure]
64
+
65
+ [TODO: Add content here. See examples in existing skills:
66
+ - Code samples for technical skills
67
+ - Decision trees for complex workflows
68
+ - Concrete examples with realistic user requests
69
+ - References to scripts/templates/references as needed]
70
+
71
+ ## Resources
72
+
73
+ This skill includes example resource directories that demonstrate how to organize different types of bundled resources:
74
+
75
+ ### scripts/
76
+ Executable code (Python/Bash/etc.) that can be run directly to perform specific operations.
77
+
78
+ **Examples from other skills:**
79
+ - PDF skill: `fill_fillable_fields.py`, `extract_form_field_info.py` - utilities for PDF manipulation
80
+ - DOCX skill: `document.py`, `utilities.py` - Python modules for document processing
81
+
82
+ **Appropriate for:** Python scripts, shell scripts, or any executable code that performs automation, data processing, or specific operations.
83
+
84
+ **Note:** Scripts may be executed without loading into context, but can still be read by Claude for patching or environment adjustments.
85
+
86
+ ### references/
87
+ Documentation and reference material intended to be loaded into context to inform Claude's process and thinking.
88
+
89
+ **Examples from other skills:**
90
+ - Product management: `communication.md`, `context_building.md` - detailed workflow guides
91
+ - BigQuery: API reference documentation and query examples
92
+ - Finance: Schema documentation, company policies
93
+
94
+ **Appropriate for:** In-depth documentation, API references, database schemas, comprehensive guides, or any detailed information that Claude should reference while working.
95
+
96
+ ### assets/
97
+ Files not intended to be loaded into context, but rather used within the output Claude produces.
98
+
99
+ **Examples from other skills:**
100
+ - Brand styling: PowerPoint template files (.pptx), logo files
101
+ - Frontend builder: HTML/React boilerplate project directories
102
+ - Typography: Font files (.ttf, .woff2)
103
+
104
+ **Appropriate for:** Templates, boilerplate code, document templates, images, icons, fonts, or any files meant to be copied or used in the final output.
105
+
106
+ ---
107
+
108
+ **Any unneeded directories can be deleted.** Not every skill requires all three types of resources.
109
+ """
110
+
111
+ EXAMPLE_SCRIPT = '''#!/usr/bin/env python3
112
+ """
113
+ Example helper script for {skill_name}
114
+
115
+ This is a placeholder script that can be executed directly.
116
+ Replace with actual implementation or delete if not needed.
117
+
118
+ Example real scripts from other skills:
119
+ - pdf/scripts/fill_fillable_fields.py - Fills PDF form fields
120
+ - pdf/scripts/convert_pdf_to_images.py - Converts PDF pages to images
121
+ """
122
+
123
+ def main():
124
+ print("This is an example script for {skill_name}")
125
+ # TODO: Add actual script logic here
126
+ # This could be data processing, file conversion, API calls, etc.
127
+
128
+ if __name__ == "__main__":
129
+ main()
130
+ '''
131
+
132
+ EXAMPLE_REFERENCE = """# Reference Documentation for {skill_title}
133
+
134
+ This is a placeholder for detailed reference documentation.
135
+ Replace with actual reference content or delete if not needed.
136
+
137
+ Example real reference docs from other skills:
138
+ - product-management/references/communication.md - Comprehensive guide for status updates
139
+ - product-management/references/context_building.md - Deep-dive on gathering context
140
+ - bigquery/references/ - API references and query examples
141
+
142
+ ## When Reference Docs Are Useful
143
+
144
+ Reference docs are ideal for:
145
+ - Comprehensive API documentation
146
+ - Detailed workflow guides
147
+ - Complex multi-step processes
148
+ - Information too lengthy for main SKILL.md
149
+ - Content that's only needed for specific use cases
150
+
151
+ ## Structure Suggestions
152
+
153
+ ### API Reference Example
154
+ - Overview
155
+ - Authentication
156
+ - Endpoints with examples
157
+ - Error codes
158
+ - Rate limits
159
+
160
+ ### Workflow Guide Example
161
+ - Prerequisites
162
+ - Step-by-step instructions
163
+ - Common patterns
164
+ - Troubleshooting
165
+ - Best practices
166
+ """
167
+
168
+ EXAMPLE_ASSET = """# Example Asset File
169
+
170
+ This placeholder represents where asset files would be stored.
171
+ Replace with actual asset files (templates, images, fonts, etc.) or delete if not needed.
172
+
173
+ Asset files are NOT intended to be loaded into context, but rather used within
174
+ the output Claude produces.
175
+
176
+ Example asset files from other skills:
177
+ - Brand guidelines: logo.png, slides_template.pptx
178
+ - Frontend builder: hello-world/ directory with HTML/React boilerplate
179
+ - Typography: custom-font.ttf, font-family.woff2
180
+ - Data: sample_data.csv, test_dataset.json
181
+
182
+ ## Common Asset Types
183
+
184
+ - Templates: .pptx, .docx, boilerplate directories
185
+ - Images: .png, .jpg, .svg, .gif
186
+ - Fonts: .ttf, .otf, .woff, .woff2
187
+ - Boilerplate code: Project directories, starter files
188
+ - Icons: .ico, .svg
189
+ - Data files: .csv, .json, .xml, .yaml
190
+
191
+ Note: This is a text placeholder. Actual assets can be any file type.
192
+ """
193
+
194
+
195
+ def title_case_skill_name(skill_name):
196
+ """Convert hyphenated skill name to Title Case for display."""
197
+ return ' '.join(word.capitalize() for word in skill_name.split('-'))
198
+
199
+
200
+ def parse_skill_identifier(skill_identifier):
201
+ """
202
+ Parse and validate skill identifier.
203
+
204
+ Accepted formats:
205
+ - skill-name
206
+ - namespace:skill-name (single colon)
207
+ """
208
+ value = skill_identifier.strip().strip('"').strip("'")
209
+
210
+ if value.count(':') > 1:
211
+ raise ValueError(
212
+ "Skill name must contain at most one colon: use 'skill-name' or "
213
+ "'namespace:skill-name'"
214
+ )
215
+
216
+ namespace = None
217
+ skill_slug = value
218
+ if ':' in value:
219
+ namespace, skill_slug = value.split(':', 1)
220
+
221
+ pattern = r'^[a-z0-9-]+$'
222
+ if namespace and not re.match(pattern, namespace):
223
+ raise ValueError(
224
+ f"Invalid namespace '{namespace}'. Use lowercase letters, digits, and hyphens only."
225
+ )
226
+ if not re.match(pattern, skill_slug):
227
+ raise ValueError(
228
+ f"Invalid skill id '{skill_slug}'. Use lowercase letters, digits, and hyphens only."
229
+ )
230
+
231
+ for label, segment in [("Namespace", namespace), ("Skill id", skill_slug)]:
232
+ if segment and (segment.startswith('-') or segment.endswith('-') or '--' in segment):
233
+ raise ValueError(
234
+ f"{label} '{segment}' cannot start/end with hyphen or contain consecutive hyphens."
235
+ )
236
+
237
+ if len(skill_slug) > 40:
238
+ raise ValueError("Skill id must be 40 characters or fewer.")
239
+
240
+ full_name = f"{namespace}:{skill_slug}" if namespace else skill_slug
241
+ return full_name, skill_slug
242
+
243
+
244
+ def init_skill(skill_name, path):
245
+ """
246
+ Initialize a new skill directory with template SKILL.md.
247
+
248
+ Args:
249
+ skill_name: Name of the skill
250
+ path: Path where the skill directory should be created
251
+
252
+ Returns:
253
+ Path to created skill directory, or None if error
254
+ """
255
+ try:
256
+ full_name, skill_slug = parse_skill_identifier(skill_name)
257
+ except ValueError as exc:
258
+ print(f"❌ Error: {exc}")
259
+ return None
260
+
261
+ # Determine skill directory path (always use slug for folder name)
262
+ skill_dir = Path(path).resolve() / skill_slug
263
+
264
+ # Check if directory already exists
265
+ if skill_dir.exists():
266
+ print(f"❌ Error: Skill directory already exists: {skill_dir}")
267
+ return None
268
+
269
+ # Create skill directory
270
+ try:
271
+ skill_dir.mkdir(parents=True, exist_ok=False)
272
+ print(f"✅ Created skill directory: {skill_dir}")
273
+ except Exception as e:
274
+ print(f"❌ Error creating directory: {e}")
275
+ return None
276
+
277
+ # Create SKILL.md from template
278
+ skill_title = title_case_skill_name(skill_slug)
279
+ skill_content = SKILL_TEMPLATE.format(
280
+ skill_name=full_name,
281
+ skill_title=skill_title
282
+ )
283
+
284
+ skill_md_path = skill_dir / 'SKILL.md'
285
+ try:
286
+ write_text_utf8(skill_md_path, skill_content)
287
+ print("✅ Created SKILL.md")
288
+ except Exception as e:
289
+ print(f"❌ Error creating SKILL.md: {e}")
290
+ return None
291
+
292
+ # Create resource directories with example files
293
+ try:
294
+ # Create scripts/ directory with example script
295
+ scripts_dir = skill_dir / 'scripts'
296
+ scripts_dir.mkdir(exist_ok=True)
297
+ example_script = scripts_dir / 'example.py'
298
+ write_text_utf8(example_script, EXAMPLE_SCRIPT.format(skill_name=full_name))
299
+ example_script.chmod(0o755)
300
+ print("✅ Created scripts/example.py")
301
+
302
+ # Create references/ directory with example reference doc
303
+ references_dir = skill_dir / 'references'
304
+ references_dir.mkdir(exist_ok=True)
305
+ example_reference = references_dir / 'api_reference.md'
306
+ write_text_utf8(example_reference, EXAMPLE_REFERENCE.format(skill_title=skill_title))
307
+ print("✅ Created references/api_reference.md")
308
+
309
+ # Create assets/ directory with example asset placeholder
310
+ assets_dir = skill_dir / 'assets'
311
+ assets_dir.mkdir(exist_ok=True)
312
+ example_asset = assets_dir / 'example_asset.txt'
313
+ write_text_utf8(example_asset, EXAMPLE_ASSET)
314
+ print("✅ Created assets/example_asset.txt")
315
+ except Exception as e:
316
+ print(f"❌ Error creating resource directories: {e}")
317
+ return None
318
+
319
+ # Print next steps
320
+ print(f"\n✅ Skill '{full_name}' initialized successfully at {skill_dir}")
321
+ print("\nNext steps:")
322
+ print("1. Edit SKILL.md to complete the TODO items and update the description")
323
+ print("2. Customize or delete the example files in scripts/, references/, and assets/")
324
+ print("3. Run the validator when ready to check the skill structure")
325
+
326
+ return skill_dir
327
+
328
+
329
+ def main():
330
+ if len(sys.argv) < 4 or sys.argv[2] != '--path':
331
+ print("Usage: init_skill.py <skill-name> --path <path>")
332
+ print("\nSkill name requirements:")
333
+ print(" - Use either 'skill-name' or 'namespace:skill-name' (e.g., 'ck:data-analyzer')")
334
+ print(" - Namespace and skill id: lowercase letters, digits, and hyphens only")
335
+ print(" - Skill id max 40 characters")
336
+ print(" - Directory name is always the skill id segment")
337
+ print("\nExamples:")
338
+ print(" init_skill.py my-new-skill --path skills/public")
339
+ print(" init_skill.py ck:my-new-skill --path skills/public")
340
+ print(" init_skill.py my-api-helper --path skills/private")
341
+ print(" init_skill.py custom-skill --path /custom/location")
342
+ sys.exit(1)
343
+
344
+ skill_name = sys.argv[1]
345
+ path = sys.argv[3]
346
+
347
+ print(f"🚀 Initializing skill: {skill_name}")
348
+ print(f" Location: {path}")
349
+ print()
350
+
351
+ result = init_skill(skill_name, path)
352
+
353
+ if result:
354
+ sys.exit(0)
355
+ else:
356
+ sys.exit(1)
357
+
358
+
359
+ if __name__ == "__main__":
360
+ main()