@phuc1403/musketeer 0.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/INSTALLATION.md +22 -0
- package/LICENSE +21 -0
- package/README.md +38 -0
- package/bin/musketeer.js +72 -0
- package/manifest.json +238 -0
- package/package.json +46 -0
- package/src/copier.js +119 -0
- package/src/lockfile.js +61 -0
- package/src/manifest-loader.js +46 -0
- package/src/muster.js +48 -0
- package/src/provisioner/detect.js +93 -0
- package/src/provisioner/guide.js +32 -0
- package/src/provisioner/index.js +113 -0
- package/src/provisioner/mcp.js +26 -0
- package/src/provisioner/os-package-manager.js +71 -0
- package/src/provisioner/venv.js +44 -0
- package/src/reconcile.js +94 -0
- package/src/resolver.js +130 -0
- package/src/schema.js +152 -0
- package/src/settings-merger.js +0 -0
- package/template/.claude/agents/code-reviewer.md +166 -0
- package/template/.claude/agents/hallmark-auditor.md +78 -0
- package/template/.claude/agents/hallmark-explorer.md +81 -0
- package/template/.claude/agents/researcher.md +33 -0
- package/template/.claude/hooks/block-migration-edits.cjs +31 -0
- package/template/.claude/hooks/format-json-hook.js +91 -0
- package/template/.claude/hooks/inject-design-docs.cjs +86 -0
- package/template/.claude/hooks/lib/colors.cjs +122 -0
- package/template/.claude/hooks/lib/git-info-cache.cjs +191 -0
- package/template/.claude/hooks/lib/transcript-parser.cjs +277 -0
- package/template/.claude/hooks/usage-context-awareness.cjs +166 -0
- package/template/.claude/hooks/validate-cml-hook.js +145 -0
- package/template/.claude/skills/adr-writer/SKILL.md +78 -0
- package/template/.claude/skills/adr-writer/references/adr-example.md +38 -0
- package/template/.claude/skills/adr-writer/references/adr-template.md +46 -0
- package/template/.claude/skills/architecture-characteristic-writer/SKILL.md +117 -0
- package/template/.claude/skills/architecture-characteristic-writer/assets/worksheet-template.md +40 -0
- package/template/.claude/skills/architecture-characteristic-writer/references/characteristics-catalog.md +106 -0
- package/template/.claude/skills/code-review/SKILL.md +54 -0
- package/template/.claude/skills/code-review/references/adversarial-review.md +223 -0
- package/template/.claude/skills/code-review/references/checklists/api.md +52 -0
- package/template/.claude/skills/code-review/references/checklists/base.md +100 -0
- package/template/.claude/skills/code-review/references/checklists/web-app.md +54 -0
- package/template/.claude/skills/context-map/SKILL.md +80 -0
- package/template/.claude/skills/context-map/example.cml +106 -0
- package/template/.claude/skills/context-map/reference/Aggregate/Aggregate.md +1 -0
- package/template/.claude/skills/context-map/reference/Bounded Context/Bounded Context.md +41 -0
- package/template/.claude/skills/context-map/reference/Bounded Context/businessModel.md +6 -0
- package/template/.claude/skills/context-map/reference/Bounded Context/domainVisionStatement.md +3 -0
- package/template/.claude/skills/context-map/reference/Bounded Context/evolution.md +6 -0
- package/template/.claude/skills/context-map/reference/Bounded Context/implementationTechnology.md +1 -0
- package/template/.claude/skills/context-map/reference/Bounded Context/implements.md +1 -0
- package/template/.claude/skills/context-map/reference/Bounded Context/knowledgeLevel.md +5 -0
- package/template/.claude/skills/context-map/reference/Bounded Context/realizes.md +9 -0
- package/template/.claude/skills/context-map/reference/Bounded Context/refines.md +10 -0
- package/template/.claude/skills/context-map/reference/Bounded Context/responsibilities.md +26 -0
- package/template/.claude/skills/context-map/reference/Bounded Context/type.md +23 -0
- package/template/.claude/skills/context-map/reference/Bounded Context Relationship/Anticorruption Layer.md +5 -0
- package/template/.claude/skills/context-map/reference/Bounded Context Relationship/Bounded Context Relationship.md +13 -0
- package/template/.claude/skills/context-map/reference/Bounded Context Relationship/Conformist.md +5 -0
- package/template/.claude/skills/context-map/reference/Bounded Context Relationship/Customer-Supplier (C-S).md +23 -0
- package/template/.claude/skills/context-map/reference/Bounded Context Relationship/Open Host Service.md +5 -0
- package/template/.claude/skills/context-map/reference/Bounded Context Relationship/Partnership (P).md +14 -0
- package/template/.claude/skills/context-map/reference/Bounded Context Relationship/Published Language.md +5 -0
- package/template/.claude/skills/context-map/reference/Bounded Context Relationship/Shared Kernel (SK).md +13 -0
- package/template/.claude/skills/context-map/reference/Context Map.md +63 -0
- package/template/.claude/skills/context-map/reference/Domain/Domain.md +30 -0
- package/template/.claude/skills/context-map/reference/Domain/supports.md +34 -0
- package/template/.claude/skills/context-map/reference/Domain/type.md +3 -0
- package/template/.claude/skills/context-map/reference/Semantic Rules.md +33 -0
- package/template/.claude/skills/hallmark/SKILL.md +552 -0
- package/template/.claude/skills/hallmark/references/anti-patterns.md +412 -0
- package/template/.claude/skills/hallmark/references/assets.md +406 -0
- package/template/.claude/skills/hallmark/references/color.md +95 -0
- package/template/.claude/skills/hallmark/references/component-cookbook.md +256 -0
- package/template/.claude/skills/hallmark/references/components/c1-outlined-chip.md +12 -0
- package/template/.claude/skills/hallmark/references/components/c2-inline-form-as-cta.md +16 -0
- package/template/.claude/skills/hallmark/references/components/c3-typographic-link.md +8 -0
- package/template/.claude/skills/hallmark/references/components/c4-sticky-bottom-bar.md +16 -0
- package/template/.claude/skills/hallmark/references/components/f1-bento-grid.md +20 -0
- package/template/.claude/skills/hallmark/references/components/f2-sticky-scroll-stack.md +20 -0
- package/template/.claude/skills/hallmark/references/components/f3-tabular-spec-sheet.md +11 -0
- package/template/.claude/skills/hallmark/references/components/f4-step-sequence.md +11 -0
- package/template/.claude/skills/hallmark/references/components/f5-annotated-screenshot.md +11 -0
- package/template/.claude/skills/hallmark/references/components/f6-product-card-grid.md +41 -0
- package/template/.claude/skills/hallmark/references/components/ft1-mast-headed.md +13 -0
- package/template/.claude/skills/hallmark/references/components/ft2-inline-rule-single-line.md +10 -0
- package/template/.claude/skills/hallmark/references/components/ft3-index-style-category-list.md +12 -0
- package/template/.claude/skills/hallmark/references/components/ft4-dense-typographic.md +10 -0
- package/template/.claude/skills/hallmark/references/components/ft5-statement.md +21 -0
- package/template/.claude/skills/hallmark/references/components/ft6-letter-close.md +19 -0
- package/template/.claude/skills/hallmark/references/components/ft7-newsletter-first.md +27 -0
- package/template/.claude/skills/hallmark/references/components/ft8-marquee-scroll.md +25 -0
- package/template/.claude/skills/hallmark/references/components/h1-marquee.md +15 -0
- package/template/.claude/skills/hallmark/references/components/h2-split-diptych.md +15 -0
- package/template/.claude/skills/hallmark/references/components/h3-quote-led.md +11 -0
- package/template/.claude/skills/hallmark/references/components/h4-stat-led.md +14 -0
- package/template/.claude/skills/hallmark/references/components/h5-letter-hero.md +11 -0
- package/template/.claude/skills/hallmark/references/components/h6-photographic-fold.md +16 -0
- package/template/.claude/skills/hallmark/references/components/h7-demo-video-clipped-by-viewport-edge.md +27 -0
- package/template/.claude/skills/hallmark/references/components/h8-mockup-split-browser-framed.md +23 -0
- package/template/.claude/skills/hallmark/references/components/h9-custom-illustration-centerpiece.md +27 -0
- package/template/.claude/skills/hallmark/references/components/n1-wordmark-2-links.md +12 -0
- package/template/.claude/skills/hallmark/references/components/n10-floating-on-scroll-morph.md +19 -0
- package/template/.claude/skills/hallmark/references/components/n2-floating-chip.md +14 -0
- package/template/.claude/skills/hallmark/references/components/n3-side-rail.md +14 -0
- package/template/.claude/skills/hallmark/references/components/n4-hidden-behind-k.md +9 -0
- package/template/.claude/skills/hallmark/references/components/n5-floating-pill.md +28 -0
- package/template/.claude/skills/hallmark/references/components/n6-newspaper-masthead.md +24 -0
- package/template/.claude/skills/hallmark/references/components/n7-brutal-slab.md +22 -0
- package/template/.claude/skills/hallmark/references/components/n8-terminal-command.md +21 -0
- package/template/.claude/skills/hallmark/references/components/n9-edge-aligned-minimal.md +17 -0
- package/template/.claude/skills/hallmark/references/components/s1-left-margin-numbered.md +15 -0
- package/template/.claude/skills/hallmark/references/components/s2-hanging.md +13 -0
- package/template/.claude/skills/hallmark/references/components/s3-sticky-pinned.md +19 -0
- package/template/.claude/skills/hallmark/references/components/s4-inline-no-break.md +11 -0
- package/template/.claude/skills/hallmark/references/components/s5-bottom-anchored.md +13 -0
- package/template/.claude/skills/hallmark/references/components/t1-pull-quote-with-marginalia.md +12 -0
- package/template/.claude/skills/hallmark/references/components/t2-logo-wall-hairline.md +19 -0
- package/template/.claude/skills/hallmark/references/components/t3-single-huge-quote.md +11 -0
- package/template/.claude/skills/hallmark/references/components/t4-numbered-stat-strip.md +14 -0
- package/template/.claude/skills/hallmark/references/contract.md +24 -0
- package/template/.claude/skills/hallmark/references/copy.md +182 -0
- package/template/.claude/skills/hallmark/references/custom-craft.md +626 -0
- package/template/.claude/skills/hallmark/references/custom-theme.md +329 -0
- package/template/.claude/skills/hallmark/references/design-md.md +116 -0
- package/template/.claude/skills/hallmark/references/export-formats.md +328 -0
- package/template/.claude/skills/hallmark/references/floating-nav.md +89 -0
- package/template/.claude/skills/hallmark/references/genres/atmospheric.md +65 -0
- package/template/.claude/skills/hallmark/references/genres/editorial.md +70 -0
- package/template/.claude/skills/hallmark/references/genres/modern-minimal.md +67 -0
- package/template/.claude/skills/hallmark/references/genres/playful.md +65 -0
- package/template/.claude/skills/hallmark/references/hero-enrichment.md +474 -0
- package/template/.claude/skills/hallmark/references/imagery-kit.md +170 -0
- package/template/.claude/skills/hallmark/references/interaction-and-states.md +207 -0
- package/template/.claude/skills/hallmark/references/layout-and-space.md +111 -0
- package/template/.claude/skills/hallmark/references/macrostructures/01-bento-grid.md +35 -0
- package/template/.claude/skills/hallmark/references/macrostructures/02-long-document.md +34 -0
- package/template/.claude/skills/hallmark/references/macrostructures/03-marquee-hero.md +31 -0
- package/template/.claude/skills/hallmark/references/macrostructures/04-stat-led.md +32 -0
- package/template/.claude/skills/hallmark/references/macrostructures/05-workbench.md +32 -0
- package/template/.claude/skills/hallmark/references/macrostructures/06-conversational-faq.md +33 -0
- package/template/.claude/skills/hallmark/references/macrostructures/07-manifesto.md +32 -0
- package/template/.claude/skills/hallmark/references/macrostructures/08-photographic.md +34 -0
- package/template/.claude/skills/hallmark/references/macrostructures/09-quote-led.md +32 -0
- package/template/.claude/skills/hallmark/references/macrostructures/10-specimen.md +32 -0
- package/template/.claude/skills/hallmark/references/macrostructures/11-catalogue.md +23 -0
- package/template/.claude/skills/hallmark/references/macrostructures/12-letter.md +23 -0
- package/template/.claude/skills/hallmark/references/macrostructures/13-index-first.md +23 -0
- package/template/.claude/skills/hallmark/references/macrostructures/14-narrative-workflow.md +23 -0
- package/template/.claude/skills/hallmark/references/macrostructures/15-split-studio.md +23 -0
- package/template/.claude/skills/hallmark/references/macrostructures/16-feature-stack.md +23 -0
- package/template/.claude/skills/hallmark/references/macrostructures/17-type-specimen.md +23 -0
- package/template/.claude/skills/hallmark/references/macrostructures/18-portfolio-grid.md +23 -0
- package/template/.claude/skills/hallmark/references/macrostructures/19-map-diagram.md +23 -0
- package/template/.claude/skills/hallmark/references/macrostructures/20-ecosystem-index.md +23 -0
- package/template/.claude/skills/hallmark/references/macrostructures/21-component-playground.md +23 -0
- package/template/.claude/skills/hallmark/references/macrostructures.md +89 -0
- package/template/.claude/skills/hallmark/references/microinteractions.md +260 -0
- package/template/.claude/skills/hallmark/references/motion.md +109 -0
- package/template/.claude/skills/hallmark/references/preview-examples.md +49 -0
- package/template/.claude/skills/hallmark/references/responsive.md +138 -0
- package/template/.claude/skills/hallmark/references/slop-test.md +205 -0
- package/template/.claude/skills/hallmark/references/structure.md +164 -0
- package/template/.claude/skills/hallmark/references/study.md +511 -0
- package/template/.claude/skills/hallmark/references/typography.md +243 -0
- package/template/.claude/skills/hallmark/references/verbs/audit.md +25 -0
- package/template/.claude/skills/hallmark/references/verbs/redesign.md +269 -0
- package/template/.claude/skills/hallmark-explore/SKILL.md +137 -0
- package/template/.claude/skills/hallmark-explore/references/direction-matrix.md +124 -0
- package/template/.claude/skills/hallmark-explore/references/explorer-call.md +68 -0
- package/template/.claude/skills/hallmark-explore/scripts/build_compare.py +174 -0
- package/template/.claude/skills/hallmark-explore/scripts/scaffold_exploration.py +122 -0
- package/template/.claude/skills/hallmark-loop/SKILL.md +105 -0
- package/template/.claude/skills/hallmark-loop/references/auditor-call.md +60 -0
- package/template/.claude/skills/hallmark-loop/references/capture.md +78 -0
- package/template/.claude/skills/hallmark-loop/references/loop-control.md +79 -0
- package/template/.claude/skills/handoff/SKILL.md +15 -0
- package/template/.claude/skills/install.ps1 +42 -0
- package/template/.claude/skills/install.sh +54 -0
- package/template/.claude/skills/knowledge-crunching/SKILL.md +130 -0
- package/template/.claude/skills/knowledge-crunching/assets/context.template.md +59 -0
- package/template/.claude/skills/knowledge-crunching/references/crunching-dialogue.md +113 -0
- package/template/.claude/skills/research/SKILL.md +69 -0
- package/template/.claude/skills/skill-creator/LICENSE.txt +202 -0
- package/template/.claude/skills/skill-creator/SKILL.md +149 -0
- package/template/.claude/skills/skill-creator/agents/analyzer.md +274 -0
- package/template/.claude/skills/skill-creator/agents/comparator.md +202 -0
- package/template/.claude/skills/skill-creator/agents/grader.md +223 -0
- package/template/.claude/skills/skill-creator/assets/eval_review.html +146 -0
- package/template/.claude/skills/skill-creator/eval-viewer/generate_review.py +471 -0
- package/template/.claude/skills/skill-creator/eval-viewer/viewer.html +1325 -0
- package/template/.claude/skills/skill-creator/references/benchmark-optimization-guide.md +86 -0
- package/template/.claude/skills/skill-creator/references/distribution-guide.md +79 -0
- package/template/.claude/skills/skill-creator/references/eval-infrastructure-guide.md +129 -0
- package/template/.claude/skills/skill-creator/references/eval-schemas.md +121 -0
- package/template/.claude/skills/skill-creator/references/mcp-skills-integration.md +71 -0
- package/template/.claude/skills/skill-creator/references/metadata-quality-criteria.md +94 -0
- package/template/.claude/skills/skill-creator/references/plugin-marketplace-hosting.md +104 -0
- package/template/.claude/skills/skill-creator/references/plugin-marketplace-overview.md +89 -0
- package/template/.claude/skills/skill-creator/references/plugin-marketplace-schema.md +93 -0
- package/template/.claude/skills/skill-creator/references/plugin-marketplace-sources.md +103 -0
- package/template/.claude/skills/skill-creator/references/plugin-marketplace-troubleshooting.md +76 -0
- package/template/.claude/skills/skill-creator/references/script-quality-criteria.md +106 -0
- package/template/.claude/skills/skill-creator/references/skill-anatomy-and-requirements.md +77 -0
- package/template/.claude/skills/skill-creator/references/skill-creation-workflow.md +151 -0
- package/template/.claude/skills/skill-creator/references/skill-design-patterns.md +75 -0
- package/template/.claude/skills/skill-creator/references/skillmark-benchmark-criteria.md +102 -0
- package/template/.claude/skills/skill-creator/references/structure-organization-criteria.md +114 -0
- package/template/.claude/skills/skill-creator/references/testing-and-iteration.md +78 -0
- package/template/.claude/skills/skill-creator/references/token-efficiency-criteria.md +74 -0
- package/template/.claude/skills/skill-creator/references/troubleshooting-guide.md +81 -0
- package/template/.claude/skills/skill-creator/references/validation-checklist.md +83 -0
- package/template/.claude/skills/skill-creator/references/writing-effective-instructions.md +88 -0
- package/template/.claude/skills/skill-creator/references/yaml-frontmatter-reference.md +92 -0
- package/template/.claude/skills/skill-creator/scripts/aggregate_benchmark.py +401 -0
- package/template/.claude/skills/skill-creator/scripts/encoding_utils.py +36 -0
- package/template/.claude/skills/skill-creator/scripts/generate_report.py +326 -0
- package/template/.claude/skills/skill-creator/scripts/improve_description.py +248 -0
- package/template/.claude/skills/skill-creator/scripts/init_skill.py +360 -0
- package/template/.claude/skills/skill-creator/scripts/package_skill.py +143 -0
- package/template/.claude/skills/skill-creator/scripts/quick_validate.py +110 -0
- package/template/.claude/skills/skill-creator/scripts/run_eval.py +310 -0
- package/template/.claude/skills/skill-creator/scripts/run_loop.py +332 -0
- package/template/.claude/skills/skill-creator/scripts/utils.py +47 -0
- package/template/.claude/skills/tdd/SKILL.md +142 -0
- package/template/.claude/skills/tdd/assets/Directory.Build.props +26 -0
- package/template/.claude/skills/tdd/deep-modules.md +15 -0
- package/template/.claude/skills/tdd/dotnet-build-config.md +21 -0
- package/template/.claude/skills/tdd/interface-design.md +31 -0
- package/template/.claude/skills/tdd/mocking.md +59 -0
- package/template/.claude/skills/tdd/refactoring.md +10 -0
- package/template/.claude/skills/tdd/test-per-layer.md +69 -0
- package/template/.claude/skills/tdd/tests.md +61 -0
- package/template/.claude/statusline.cjs +0 -0
|
@@ -0,0 +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()
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Skill Packager - Creates a distributable zip file of a skill folder
|
|
4
|
+
|
|
5
|
+
Usage:
|
|
6
|
+
python utils/package_skill.py <path/to/skill-folder> [output-directory]
|
|
7
|
+
|
|
8
|
+
Example:
|
|
9
|
+
python utils/package_skill.py skills/public/my-skill
|
|
10
|
+
python utils/package_skill.py skills/public/my-skill ./dist
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
import fnmatch
|
|
14
|
+
import sys
|
|
15
|
+
import zipfile
|
|
16
|
+
from pathlib import Path
|
|
17
|
+
|
|
18
|
+
from encoding_utils import configure_utf8_console
|
|
19
|
+
from quick_validate import validate_skill
|
|
20
|
+
|
|
21
|
+
# Fix Windows console encoding for Unicode output (emojis, arrows)
|
|
22
|
+
configure_utf8_console()
|
|
23
|
+
|
|
24
|
+
# Exclusion patterns (from official Anthropic skill-creator)
|
|
25
|
+
EXCLUDE_DIRS = {'__pycache__', 'node_modules', '.git', '.DS_Store'}
|
|
26
|
+
EXCLUDE_GLOBS = {'*.pyc', '*.pyo', '.DS_Store', '*.egg-info'}
|
|
27
|
+
ROOT_EXCLUDE_DIRS = {'evals'} # Only excluded at skill root level
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def package_skill(skill_path, output_dir=None):
|
|
31
|
+
"""
|
|
32
|
+
Package a skill folder into a zip file.
|
|
33
|
+
|
|
34
|
+
Args:
|
|
35
|
+
skill_path: Path to the skill folder
|
|
36
|
+
output_dir: Optional output directory for the zip file (defaults to current directory)
|
|
37
|
+
|
|
38
|
+
Returns:
|
|
39
|
+
Path to the created zip file, or None if error
|
|
40
|
+
"""
|
|
41
|
+
skill_path = Path(skill_path).resolve()
|
|
42
|
+
|
|
43
|
+
# Validate skill folder exists
|
|
44
|
+
if not skill_path.exists():
|
|
45
|
+
print(f"ā Error: Skill folder not found: {skill_path}")
|
|
46
|
+
return None
|
|
47
|
+
|
|
48
|
+
if not skill_path.is_dir():
|
|
49
|
+
print(f"ā Error: Path is not a directory: {skill_path}")
|
|
50
|
+
return None
|
|
51
|
+
|
|
52
|
+
# Validate SKILL.md exists
|
|
53
|
+
skill_md = skill_path / "SKILL.md"
|
|
54
|
+
if not skill_md.exists():
|
|
55
|
+
print(f"ā Error: SKILL.md not found in {skill_path}")
|
|
56
|
+
return None
|
|
57
|
+
|
|
58
|
+
# Run validation before packaging
|
|
59
|
+
print("š Validating skill...")
|
|
60
|
+
valid, message = validate_skill(skill_path)
|
|
61
|
+
if not valid:
|
|
62
|
+
print(f"ā Validation failed: {message}")
|
|
63
|
+
print(" Please fix the validation errors before packaging.")
|
|
64
|
+
return None
|
|
65
|
+
print(f"ā
{message}\n")
|
|
66
|
+
|
|
67
|
+
# Determine output location
|
|
68
|
+
skill_name = skill_path.name
|
|
69
|
+
if output_dir:
|
|
70
|
+
output_path = Path(output_dir).resolve()
|
|
71
|
+
output_path.mkdir(parents=True, exist_ok=True)
|
|
72
|
+
else:
|
|
73
|
+
output_path = Path.cwd()
|
|
74
|
+
|
|
75
|
+
zip_filename = output_path / f"{skill_name}.zip"
|
|
76
|
+
|
|
77
|
+
# Create the zip file
|
|
78
|
+
try:
|
|
79
|
+
with zipfile.ZipFile(zip_filename, 'w', zipfile.ZIP_DEFLATED) as zipf:
|
|
80
|
+
# Walk through the skill directory, excluding unwanted files
|
|
81
|
+
skipped = []
|
|
82
|
+
for file_path in skill_path.rglob('*'):
|
|
83
|
+
if file_path.is_file():
|
|
84
|
+
rel = file_path.relative_to(skill_path)
|
|
85
|
+
parts = rel.parts
|
|
86
|
+
|
|
87
|
+
# Skip excluded directories
|
|
88
|
+
if any(p in EXCLUDE_DIRS for p in parts):
|
|
89
|
+
skipped.append(str(rel))
|
|
90
|
+
continue
|
|
91
|
+
|
|
92
|
+
# Skip root-only excluded dirs (e.g., evals/)
|
|
93
|
+
if parts[0] in ROOT_EXCLUDE_DIRS:
|
|
94
|
+
skipped.append(str(rel))
|
|
95
|
+
continue
|
|
96
|
+
|
|
97
|
+
# Skip excluded file patterns
|
|
98
|
+
if any(fnmatch.fnmatch(file_path.name, g) for g in EXCLUDE_GLOBS):
|
|
99
|
+
skipped.append(str(rel))
|
|
100
|
+
continue
|
|
101
|
+
|
|
102
|
+
arcname = file_path.relative_to(skill_path.parent)
|
|
103
|
+
zipf.write(file_path, arcname)
|
|
104
|
+
print(f" Added: {arcname}")
|
|
105
|
+
|
|
106
|
+
if skipped:
|
|
107
|
+
print(f"\n Skipped {len(skipped)} file(s): {', '.join(skipped[:5])}"
|
|
108
|
+
+ ("..." if len(skipped) > 5 else ""))
|
|
109
|
+
|
|
110
|
+
print(f"\nā
Successfully packaged skill to: {zip_filename}")
|
|
111
|
+
return zip_filename
|
|
112
|
+
|
|
113
|
+
except Exception as e:
|
|
114
|
+
print(f"ā Error creating zip file: {e}")
|
|
115
|
+
return None
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
def main():
|
|
119
|
+
if len(sys.argv) < 2:
|
|
120
|
+
print("Usage: python utils/package_skill.py <path/to/skill-folder> [output-directory]")
|
|
121
|
+
print("\nExample:")
|
|
122
|
+
print(" python utils/package_skill.py skills/public/my-skill")
|
|
123
|
+
print(" python utils/package_skill.py skills/public/my-skill ./dist")
|
|
124
|
+
sys.exit(1)
|
|
125
|
+
|
|
126
|
+
skill_path = sys.argv[1]
|
|
127
|
+
output_dir = sys.argv[2] if len(sys.argv) > 2 else None
|
|
128
|
+
|
|
129
|
+
print(f"š¦ Packaging skill: {skill_path}")
|
|
130
|
+
if output_dir:
|
|
131
|
+
print(f" Output directory: {output_dir}")
|
|
132
|
+
print()
|
|
133
|
+
|
|
134
|
+
result = package_skill(skill_path, output_dir)
|
|
135
|
+
|
|
136
|
+
if result:
|
|
137
|
+
sys.exit(0)
|
|
138
|
+
else:
|
|
139
|
+
sys.exit(1)
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
if __name__ == "__main__":
|
|
143
|
+
main()
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Quick validation script for skills - minimal version
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
import sys
|
|
7
|
+
import re
|
|
8
|
+
from pathlib import Path
|
|
9
|
+
|
|
10
|
+
from encoding_utils import configure_utf8_console, read_text_utf8
|
|
11
|
+
|
|
12
|
+
# Fix Windows console encoding for Unicode output
|
|
13
|
+
configure_utf8_console()
|
|
14
|
+
|
|
15
|
+
def validate_skill(skill_path):
|
|
16
|
+
"""Basic validation of a skill"""
|
|
17
|
+
skill_path = Path(skill_path)
|
|
18
|
+
|
|
19
|
+
# Check SKILL.md exists
|
|
20
|
+
skill_md = skill_path / 'SKILL.md'
|
|
21
|
+
if not skill_md.exists():
|
|
22
|
+
return False, "SKILL.md not found"
|
|
23
|
+
|
|
24
|
+
# Read and validate frontmatter
|
|
25
|
+
content = read_text_utf8(skill_md)
|
|
26
|
+
if not content.startswith('---'):
|
|
27
|
+
return False, "No YAML frontmatter found"
|
|
28
|
+
|
|
29
|
+
# Extract frontmatter
|
|
30
|
+
match = re.match(r'^---\n(.*?)\n---', content, re.DOTALL)
|
|
31
|
+
if not match:
|
|
32
|
+
return False, "Invalid frontmatter format"
|
|
33
|
+
|
|
34
|
+
frontmatter = match.group(1)
|
|
35
|
+
|
|
36
|
+
# Check required fields
|
|
37
|
+
if 'name:' not in frontmatter:
|
|
38
|
+
return False, "Missing 'name' in frontmatter"
|
|
39
|
+
if 'description:' not in frontmatter:
|
|
40
|
+
return False, "Missing 'description' in frontmatter"
|
|
41
|
+
|
|
42
|
+
# Extract name for validation
|
|
43
|
+
name_match = re.search(r'name:\s*(.+)', frontmatter)
|
|
44
|
+
if name_match:
|
|
45
|
+
name = name_match.group(1).strip().strip('"').strip("'")
|
|
46
|
+
|
|
47
|
+
# Support namespaced identifiers: ck:skill-name (single namespace segment)
|
|
48
|
+
if name.count(':') > 1:
|
|
49
|
+
return False, (
|
|
50
|
+
f"Name '{name}' is invalid. Use either 'skill-name' or "
|
|
51
|
+
"'namespace:skill-name' with a single colon."
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
namespace = None
|
|
55
|
+
skill_id = name
|
|
56
|
+
if ':' in name:
|
|
57
|
+
namespace, skill_id = name.split(':', 1)
|
|
58
|
+
|
|
59
|
+
id_pattern = r'^[a-z0-9-]+$'
|
|
60
|
+
if namespace and not re.match(id_pattern, namespace):
|
|
61
|
+
return False, (
|
|
62
|
+
f"Namespace '{namespace}' must be lowercase letters, digits, and hyphens only"
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
if not re.match(id_pattern, skill_id):
|
|
66
|
+
return False, (
|
|
67
|
+
f"Skill id '{skill_id}' must be lowercase letters, digits, and hyphens only"
|
|
68
|
+
)
|
|
69
|
+
|
|
70
|
+
for segment_name, segment in [("namespace", namespace), ("skill id", skill_id)]:
|
|
71
|
+
if segment and (segment.startswith('-') or segment.endswith('-') or '--' in segment):
|
|
72
|
+
return False, (
|
|
73
|
+
f"{segment_name.capitalize()} '{segment}' cannot start/end with hyphen "
|
|
74
|
+
"or contain consecutive hyphens"
|
|
75
|
+
)
|
|
76
|
+
|
|
77
|
+
# Validate name length (official max: 64 chars)
|
|
78
|
+
if name_match:
|
|
79
|
+
if len(skill_id) > 64:
|
|
80
|
+
return False, f"Skill id '{skill_id}' exceeds 64 characters ({len(skill_id)})"
|
|
81
|
+
if namespace and len(namespace) > 64:
|
|
82
|
+
return False, f"Namespace '{namespace}' exceeds 64 characters ({len(namespace)})"
|
|
83
|
+
|
|
84
|
+
# Extract and validate description
|
|
85
|
+
desc_match = re.search(r'description:\s*(.+)', frontmatter)
|
|
86
|
+
if desc_match:
|
|
87
|
+
description = desc_match.group(1).strip().strip('"').strip("'")
|
|
88
|
+
|
|
89
|
+
# YAML block scalar indicators are valid (e.g. description: >-)
|
|
90
|
+
if description in {'>', '>-', '|', '|-'}:
|
|
91
|
+
description = ''
|
|
92
|
+
|
|
93
|
+
# Check for angle brackets
|
|
94
|
+
if '<' in description or '>' in description:
|
|
95
|
+
return False, "Description cannot contain angle brackets (< or >)"
|
|
96
|
+
|
|
97
|
+
# Check description length (official max: 1024 chars)
|
|
98
|
+
if len(description) > 1024:
|
|
99
|
+
return False, f"Description exceeds 1024 characters ({len(description)})"
|
|
100
|
+
|
|
101
|
+
return True, "Skill is valid!"
|
|
102
|
+
|
|
103
|
+
if __name__ == "__main__":
|
|
104
|
+
if len(sys.argv) != 2:
|
|
105
|
+
print("Usage: python quick_validate.py <skill_directory>")
|
|
106
|
+
sys.exit(1)
|
|
107
|
+
|
|
108
|
+
valid, message = validate_skill(sys.argv[1])
|
|
109
|
+
print(message)
|
|
110
|
+
sys.exit(0 if valid else 1)
|