@nano-step/skill-manager 5.1.0 → 5.2.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/dist/utils.d.ts +1 -1
- package/dist/utils.js +1 -1
- package/package.json +1 -1
- package/skills/blog-workflow/SKILL.md +522 -0
- package/skills/blog-workflow/skill.json +16 -0
- package/skills/comprehensive-feature-builder/SKILL.md +558 -0
- package/skills/comprehensive-feature-builder/skill.json +9 -0
- package/skills/idea-workflow/SKILL.md +229 -0
- package/skills/idea-workflow/skill.json +14 -0
- package/skills/reddit-workflow/SKILL.md +187 -0
- package/skills/reddit-workflow/skill.json +14 -0
- package/skills/security-workflow/SKILL.md +258 -0
- package/skills/security-workflow/skill.json +15 -0
- package/skills/skill-creator/LICENSE.txt +202 -0
- package/skills/skill-creator/SKILL.md +309 -0
- package/skills/skill-creator/references/metadata-quality-criteria.md +76 -0
- package/skills/skill-creator/references/plugin-marketplace-hosting.md +101 -0
- package/skills/skill-creator/references/plugin-marketplace-overview.md +55 -0
- package/skills/skill-creator/references/plugin-marketplace-schema.md +88 -0
- package/skills/skill-creator/references/plugin-marketplace-sources.md +103 -0
- package/skills/skill-creator/references/plugin-marketplace-troubleshooting.md +80 -0
- package/skills/skill-creator/references/script-quality-criteria.md +106 -0
- package/skills/skill-creator/references/structure-organization-criteria.md +114 -0
- package/skills/skill-creator/references/token-efficiency-criteria.md +74 -0
- package/skills/skill-creator/references/validation-checklist.md +83 -0
- package/skills/skill-creator/scripts/encoding_utils.py +36 -0
- package/skills/skill-creator/scripts/init_skill.py +308 -0
- package/skills/skill-creator/scripts/package_skill.py +115 -0
- package/skills/skill-creator/scripts/quick_validate.py +69 -0
- package/skills/skill-creator/skill.json +14 -0
- package/skills/team-workflow/SKILL.md +227 -0
- package/skills/team-workflow/skill.json +15 -0
- package/skills/ui-ux-pro-max/SKILL.md +292 -0
- package/skills/ui-ux-pro-max/data/charts.csv +26 -0
- package/skills/ui-ux-pro-max/data/colors.csv +97 -0
- package/skills/ui-ux-pro-max/data/icons.csv +101 -0
- package/skills/ui-ux-pro-max/data/landing.csv +31 -0
- package/skills/ui-ux-pro-max/data/products.csv +97 -0
- package/skills/ui-ux-pro-max/data/react-performance.csv +45 -0
- package/skills/ui-ux-pro-max/data/stacks/astro.csv +54 -0
- package/skills/ui-ux-pro-max/data/stacks/flutter.csv +53 -0
- package/skills/ui-ux-pro-max/data/stacks/html-tailwind.csv +56 -0
- package/skills/ui-ux-pro-max/data/stacks/jetpack-compose.csv +53 -0
- package/skills/ui-ux-pro-max/data/stacks/nextjs.csv +53 -0
- package/skills/ui-ux-pro-max/data/stacks/nuxt-ui.csv +51 -0
- package/skills/ui-ux-pro-max/data/stacks/nuxtjs.csv +59 -0
- package/skills/ui-ux-pro-max/data/stacks/react-native.csv +52 -0
- package/skills/ui-ux-pro-max/data/stacks/react.csv +54 -0
- package/skills/ui-ux-pro-max/data/stacks/shadcn.csv +61 -0
- package/skills/ui-ux-pro-max/data/stacks/svelte.csv +54 -0
- package/skills/ui-ux-pro-max/data/stacks/swiftui.csv +51 -0
- package/skills/ui-ux-pro-max/data/stacks/vue.csv +50 -0
- package/skills/ui-ux-pro-max/data/styles.csv +68 -0
- package/skills/ui-ux-pro-max/data/typography.csv +58 -0
- package/skills/ui-ux-pro-max/data/ui-reasoning.csv +101 -0
- package/skills/ui-ux-pro-max/data/ux-guidelines.csv +100 -0
- package/skills/ui-ux-pro-max/data/web-interface.csv +31 -0
- package/skills/ui-ux-pro-max/scripts/core.py +253 -0
- package/skills/ui-ux-pro-max/scripts/design_system.py +1067 -0
- package/skills/ui-ux-pro-max/scripts/search.py +114 -0
- package/skills/ui-ux-pro-max/skill.json +16 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
# Token Efficiency Criteria
|
|
2
|
+
|
|
3
|
+
Skills use progressive disclosure to minimize context window usage.
|
|
4
|
+
|
|
5
|
+
## Three-Level Loading
|
|
6
|
+
|
|
7
|
+
1. **Metadata** - Always loaded (~200 chars)
|
|
8
|
+
2. **SKILL.md body** - Loaded when skill triggers (<150 lines)
|
|
9
|
+
3. **Bundled resources** - Loaded as needed (unlimited for scripts)
|
|
10
|
+
|
|
11
|
+
## Size Limits
|
|
12
|
+
|
|
13
|
+
| Resource | Limit | Notes |
|
|
14
|
+
|----------|-------|-------|
|
|
15
|
+
| Description | <200 chars | In YAML frontmatter |
|
|
16
|
+
| SKILL.md | <150 lines | Core instructions only |
|
|
17
|
+
| Each reference file | <150 lines | Split if larger |
|
|
18
|
+
| Scripts | No limit | Executed, not loaded into context |
|
|
19
|
+
|
|
20
|
+
## SKILL.md Content Strategy
|
|
21
|
+
|
|
22
|
+
**Include in SKILL.md:**
|
|
23
|
+
- Purpose (2-3 sentences)
|
|
24
|
+
- When to use (trigger conditions)
|
|
25
|
+
- Quick reference for common workflows
|
|
26
|
+
- Pointers to resources (scripts, references, assets)
|
|
27
|
+
|
|
28
|
+
**Move to references/:**
|
|
29
|
+
- Detailed documentation
|
|
30
|
+
- Database schemas
|
|
31
|
+
- API specs
|
|
32
|
+
- Step-by-step guides
|
|
33
|
+
- Examples and templates
|
|
34
|
+
- Best practices
|
|
35
|
+
|
|
36
|
+
## No Duplication Rule
|
|
37
|
+
|
|
38
|
+
Information lives in ONE place:
|
|
39
|
+
- Either in SKILL.md
|
|
40
|
+
- Or in references/
|
|
41
|
+
|
|
42
|
+
**Bad:** Schema overview in SKILL.md + detailed schema in references/schema.md
|
|
43
|
+
**Good:** Brief mention in SKILL.md + full schema only in references/schema.md
|
|
44
|
+
|
|
45
|
+
## Splitting Large Files
|
|
46
|
+
|
|
47
|
+
If reference exceeds 150 lines, split by logical boundaries:
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
references/
|
|
51
|
+
├── api-endpoints-auth.md # Auth endpoints
|
|
52
|
+
├── api-endpoints-users.md # User endpoints
|
|
53
|
+
├── api-endpoints-payments.md # Payment endpoints
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Include grep patterns in SKILL.md for discoverability:
|
|
57
|
+
|
|
58
|
+
```markdown
|
|
59
|
+
## API Documentation
|
|
60
|
+
- Auth: `references/api-endpoints-auth.md`
|
|
61
|
+
- Users: `references/api-endpoints-users.md`
|
|
62
|
+
- Payments: `references/api-endpoints-payments.md`
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Scripts: Best Token Efficiency
|
|
66
|
+
|
|
67
|
+
Scripts execute without loading into context.
|
|
68
|
+
|
|
69
|
+
**When to use scripts:**
|
|
70
|
+
- Repetitive code patterns
|
|
71
|
+
- Deterministic operations
|
|
72
|
+
- Complex transformations
|
|
73
|
+
|
|
74
|
+
**Example:** PDF rotation via `scripts/rotate_pdf.py` vs rewriting rotation code each time.
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# Skill Validation Checklist
|
|
2
|
+
|
|
3
|
+
Quick validation before packaging. Run `scripts/package_skill.py` for automated checks.
|
|
4
|
+
|
|
5
|
+
## Critical (Must Pass)
|
|
6
|
+
|
|
7
|
+
### Metadata
|
|
8
|
+
- [ ] `name`: kebab-case, descriptive
|
|
9
|
+
- [ ] `description`: under 200 characters, specific triggers, not generic
|
|
10
|
+
|
|
11
|
+
### Size Limits
|
|
12
|
+
- [ ] SKILL.md: under 150 lines
|
|
13
|
+
- [ ] Each reference file: under 150 lines
|
|
14
|
+
- [ ] No info duplication between SKILL.md and references
|
|
15
|
+
|
|
16
|
+
### Structure
|
|
17
|
+
- [ ] SKILL.md exists with valid YAML frontmatter
|
|
18
|
+
- [ ] Unused example files deleted
|
|
19
|
+
- [ ] File names: kebab-case, self-documenting
|
|
20
|
+
|
|
21
|
+
## Scripts (If Applicable)
|
|
22
|
+
|
|
23
|
+
- [ ] Tests exist and pass
|
|
24
|
+
- [ ] Cross-platform (Node.js/Python preferred)
|
|
25
|
+
- [ ] Env vars: respects hierarchy `process.env` > `$HOME/.claude/skills/${SKILL}/.env` (global) > `$HOME/.claude/skills/.env` (global) > `$HOME/.claude/.env` (global) > `./.claude/skills/${SKILL}/.env` (cwd) > `./.claude/skills/.env` (cwd) > `./.claude/.env` (cwd)
|
|
26
|
+
- [ ] Dependencies documented (requirements.txt, .env.example)
|
|
27
|
+
- [ ] Manually tested with real use cases
|
|
28
|
+
|
|
29
|
+
## Quality
|
|
30
|
+
|
|
31
|
+
### Writing Style
|
|
32
|
+
- [ ] Imperative form: "To accomplish X, do Y"
|
|
33
|
+
- [ ] Third-person metadata: "This skill should be used when..."
|
|
34
|
+
- [ ] Concise, no fluff
|
|
35
|
+
|
|
36
|
+
### Practical Utility
|
|
37
|
+
- [ ] Teaches *how* to do tasks, not *what* tools are
|
|
38
|
+
- [ ] Based on real workflows
|
|
39
|
+
- [ ] Includes concrete trigger phrases/examples
|
|
40
|
+
|
|
41
|
+
## Integration
|
|
42
|
+
|
|
43
|
+
- [ ] No duplication with existing skills
|
|
44
|
+
- [ ] Related topics consolidated (e.g., cloudflare + docker → devops)
|
|
45
|
+
- [ ] Composable with other skills
|
|
46
|
+
|
|
47
|
+
## Automated Validation
|
|
48
|
+
|
|
49
|
+
Run packaging script to validate:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
scripts/package_skill.py <path/to/skill-folder>
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Checks performed:
|
|
56
|
+
- YAML frontmatter format
|
|
57
|
+
- Required fields present
|
|
58
|
+
- Description length (<200 chars)
|
|
59
|
+
- Directory structure
|
|
60
|
+
- File organization
|
|
61
|
+
|
|
62
|
+
Fix all errors before distributing.
|
|
63
|
+
|
|
64
|
+
## Subagent Delegation Enforcement
|
|
65
|
+
|
|
66
|
+
When a skill requires subagent delegation (via Task tool):
|
|
67
|
+
|
|
68
|
+
1. **Use MUST language** - "Use subagent" is weak; "MUST spawn subagent" is enforceable
|
|
69
|
+
2. **Include Task pattern** - Show exact syntax: `Task(subagent_type="X", prompt="Y", description="Z")`
|
|
70
|
+
3. **Add validation rule** - "If Task tool calls = 0 at end, workflow is INCOMPLETE"
|
|
71
|
+
4. **Mark requirements clearly** - Use table with "MUST spawn" column
|
|
72
|
+
5. **Forbid direct implementation** - "DO NOT implement X yourself - DELEGATE to subagent"
|
|
73
|
+
|
|
74
|
+
**Anti-pattern (weak):**
|
|
75
|
+
```
|
|
76
|
+
- Use `tester` agent for testing
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
**Correct pattern (enforceable):**
|
|
80
|
+
```
|
|
81
|
+
- **MUST** spawn `tester` subagent: `Task(subagent_type="tester", prompt="Run tests", description="Test")`
|
|
82
|
+
- DO NOT run tests yourself - DELEGATE
|
|
83
|
+
```
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Cross-platform encoding utilities for Windows compatibility.
|
|
4
|
+
|
|
5
|
+
Fixes UnicodeEncodeError on Windows by reconfiguring stdout/stderr to UTF-8
|
|
6
|
+
and providing encoding-aware file I/O helpers.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
import sys
|
|
10
|
+
from pathlib import Path
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def configure_utf8_console():
|
|
14
|
+
"""
|
|
15
|
+
Reconfigure stdout/stderr for UTF-8 on Windows.
|
|
16
|
+
|
|
17
|
+
Windows uses cp1252 by default which cannot encode Unicode emojis.
|
|
18
|
+
This function switches to UTF-8 with 'replace' error handling to
|
|
19
|
+
prevent crashes on truly incompatible terminals.
|
|
20
|
+
"""
|
|
21
|
+
if sys.platform == 'win32':
|
|
22
|
+
try:
|
|
23
|
+
sys.stdout.reconfigure(encoding='utf-8', errors='replace')
|
|
24
|
+
sys.stderr.reconfigure(encoding='utf-8', errors='replace')
|
|
25
|
+
except AttributeError:
|
|
26
|
+
pass # Python < 3.7
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
def read_text_utf8(path: Path) -> str:
|
|
30
|
+
"""Read file with explicit UTF-8 encoding."""
|
|
31
|
+
return path.read_text(encoding='utf-8')
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def write_text_utf8(path: Path, content: str) -> None:
|
|
35
|
+
"""Write file with explicit UTF-8 encoding."""
|
|
36
|
+
path.write_text(content, encoding='utf-8')
|
|
@@ -0,0 +1,308 @@
|
|
|
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
|
+
from pathlib import Path
|
|
16
|
+
|
|
17
|
+
from encoding_utils import configure_utf8_console, write_text_utf8
|
|
18
|
+
|
|
19
|
+
# Fix Windows console encoding for Unicode output (emojis, arrows)
|
|
20
|
+
configure_utf8_console()
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
SKILL_TEMPLATE = """---
|
|
24
|
+
name: {skill_name}
|
|
25
|
+
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.]
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
# {skill_title}
|
|
29
|
+
|
|
30
|
+
## Overview
|
|
31
|
+
|
|
32
|
+
[TODO: 1-2 sentences explaining what this skill enables]
|
|
33
|
+
|
|
34
|
+
## Structuring This Skill
|
|
35
|
+
|
|
36
|
+
[TODO: Choose the structure that best fits this skill's purpose. Common patterns:
|
|
37
|
+
|
|
38
|
+
**1. Workflow-Based** (best for sequential processes)
|
|
39
|
+
- Works well when there are clear step-by-step procedures
|
|
40
|
+
- Example: DOCX skill with "Workflow Decision Tree" → "Reading" → "Creating" → "Editing"
|
|
41
|
+
- Structure: ## Overview → ## Workflow Decision Tree → ## Step 1 → ## Step 2...
|
|
42
|
+
|
|
43
|
+
**2. Task-Based** (best for tool collections)
|
|
44
|
+
- Works well when the skill offers different operations/capabilities
|
|
45
|
+
- Example: PDF skill with "Quick Start" → "Merge PDFs" → "Split PDFs" → "Extract Text"
|
|
46
|
+
- Structure: ## Overview → ## Quick Start → ## Task Category 1 → ## Task Category 2...
|
|
47
|
+
|
|
48
|
+
**3. Reference/Guidelines** (best for standards or specifications)
|
|
49
|
+
- Works well for brand guidelines, coding standards, or requirements
|
|
50
|
+
- Example: Brand styling with "Brand Guidelines" → "Colors" → "Typography" → "Features"
|
|
51
|
+
- Structure: ## Overview → ## Guidelines → ## Specifications → ## Usage...
|
|
52
|
+
|
|
53
|
+
**4. Capabilities-Based** (best for integrated systems)
|
|
54
|
+
- Works well when the skill provides multiple interrelated features
|
|
55
|
+
- Example: Product Management with "Core Capabilities" → numbered capability list
|
|
56
|
+
- Structure: ## Overview → ## Core Capabilities → ### 1. Feature → ### 2. Feature...
|
|
57
|
+
|
|
58
|
+
Patterns can be mixed and matched as needed. Most skills combine patterns (e.g., start with task-based, add workflow for complex operations).
|
|
59
|
+
|
|
60
|
+
Delete this entire "Structuring This Skill" section when done - it's just guidance.]
|
|
61
|
+
|
|
62
|
+
## [TODO: Replace with the first main section based on chosen structure]
|
|
63
|
+
|
|
64
|
+
[TODO: Add content here. See examples in existing skills:
|
|
65
|
+
- Code samples for technical skills
|
|
66
|
+
- Decision trees for complex workflows
|
|
67
|
+
- Concrete examples with realistic user requests
|
|
68
|
+
- References to scripts/templates/references as needed]
|
|
69
|
+
|
|
70
|
+
## Resources
|
|
71
|
+
|
|
72
|
+
This skill includes example resource directories that demonstrate how to organize different types of bundled resources:
|
|
73
|
+
|
|
74
|
+
### scripts/
|
|
75
|
+
Executable code (Python/Bash/etc.) that can be run directly to perform specific operations.
|
|
76
|
+
|
|
77
|
+
**Examples from other skills:**
|
|
78
|
+
- PDF skill: `fill_fillable_fields.py`, `extract_form_field_info.py` - utilities for PDF manipulation
|
|
79
|
+
- DOCX skill: `document.py`, `utilities.py` - Python modules for document processing
|
|
80
|
+
|
|
81
|
+
**Appropriate for:** Python scripts, shell scripts, or any executable code that performs automation, data processing, or specific operations.
|
|
82
|
+
|
|
83
|
+
**Note:** Scripts may be executed without loading into context, but can still be read by Claude for patching or environment adjustments.
|
|
84
|
+
|
|
85
|
+
### references/
|
|
86
|
+
Documentation and reference material intended to be loaded into context to inform Claude's process and thinking.
|
|
87
|
+
|
|
88
|
+
**Examples from other skills:**
|
|
89
|
+
- Product management: `communication.md`, `context_building.md` - detailed workflow guides
|
|
90
|
+
- BigQuery: API reference documentation and query examples
|
|
91
|
+
- Finance: Schema documentation, company policies
|
|
92
|
+
|
|
93
|
+
**Appropriate for:** In-depth documentation, API references, database schemas, comprehensive guides, or any detailed information that Claude should reference while working.
|
|
94
|
+
|
|
95
|
+
### assets/
|
|
96
|
+
Files not intended to be loaded into context, but rather used within the output Claude produces.
|
|
97
|
+
|
|
98
|
+
**Examples from other skills:**
|
|
99
|
+
- Brand styling: PowerPoint template files (.pptx), logo files
|
|
100
|
+
- Frontend builder: HTML/React boilerplate project directories
|
|
101
|
+
- Typography: Font files (.ttf, .woff2)
|
|
102
|
+
|
|
103
|
+
**Appropriate for:** Templates, boilerplate code, document templates, images, icons, fonts, or any files meant to be copied or used in the final output.
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
**Any unneeded directories can be deleted.** Not every skill requires all three types of resources.
|
|
108
|
+
"""
|
|
109
|
+
|
|
110
|
+
EXAMPLE_SCRIPT = '''#!/usr/bin/env python3
|
|
111
|
+
"""
|
|
112
|
+
Example helper script for {skill_name}
|
|
113
|
+
|
|
114
|
+
This is a placeholder script that can be executed directly.
|
|
115
|
+
Replace with actual implementation or delete if not needed.
|
|
116
|
+
|
|
117
|
+
Example real scripts from other skills:
|
|
118
|
+
- pdf/scripts/fill_fillable_fields.py - Fills PDF form fields
|
|
119
|
+
- pdf/scripts/convert_pdf_to_images.py - Converts PDF pages to images
|
|
120
|
+
"""
|
|
121
|
+
|
|
122
|
+
def main():
|
|
123
|
+
print("This is an example script for {skill_name}")
|
|
124
|
+
# TODO: Add actual script logic here
|
|
125
|
+
# This could be data processing, file conversion, API calls, etc.
|
|
126
|
+
|
|
127
|
+
if __name__ == "__main__":
|
|
128
|
+
main()
|
|
129
|
+
'''
|
|
130
|
+
|
|
131
|
+
EXAMPLE_REFERENCE = """# Reference Documentation for {skill_title}
|
|
132
|
+
|
|
133
|
+
This is a placeholder for detailed reference documentation.
|
|
134
|
+
Replace with actual reference content or delete if not needed.
|
|
135
|
+
|
|
136
|
+
Example real reference docs from other skills:
|
|
137
|
+
- product-management/references/communication.md - Comprehensive guide for status updates
|
|
138
|
+
- product-management/references/context_building.md - Deep-dive on gathering context
|
|
139
|
+
- bigquery/references/ - API references and query examples
|
|
140
|
+
|
|
141
|
+
## When Reference Docs Are Useful
|
|
142
|
+
|
|
143
|
+
Reference docs are ideal for:
|
|
144
|
+
- Comprehensive API documentation
|
|
145
|
+
- Detailed workflow guides
|
|
146
|
+
- Complex multi-step processes
|
|
147
|
+
- Information too lengthy for main SKILL.md
|
|
148
|
+
- Content that's only needed for specific use cases
|
|
149
|
+
|
|
150
|
+
## Structure Suggestions
|
|
151
|
+
|
|
152
|
+
### API Reference Example
|
|
153
|
+
- Overview
|
|
154
|
+
- Authentication
|
|
155
|
+
- Endpoints with examples
|
|
156
|
+
- Error codes
|
|
157
|
+
- Rate limits
|
|
158
|
+
|
|
159
|
+
### Workflow Guide Example
|
|
160
|
+
- Prerequisites
|
|
161
|
+
- Step-by-step instructions
|
|
162
|
+
- Common patterns
|
|
163
|
+
- Troubleshooting
|
|
164
|
+
- Best practices
|
|
165
|
+
"""
|
|
166
|
+
|
|
167
|
+
EXAMPLE_ASSET = """# Example Asset File
|
|
168
|
+
|
|
169
|
+
This placeholder represents where asset files would be stored.
|
|
170
|
+
Replace with actual asset files (templates, images, fonts, etc.) or delete if not needed.
|
|
171
|
+
|
|
172
|
+
Asset files are NOT intended to be loaded into context, but rather used within
|
|
173
|
+
the output Claude produces.
|
|
174
|
+
|
|
175
|
+
Example asset files from other skills:
|
|
176
|
+
- Brand guidelines: logo.png, slides_template.pptx
|
|
177
|
+
- Frontend builder: hello-world/ directory with HTML/React boilerplate
|
|
178
|
+
- Typography: custom-font.ttf, font-family.woff2
|
|
179
|
+
- Data: sample_data.csv, test_dataset.json
|
|
180
|
+
|
|
181
|
+
## Common Asset Types
|
|
182
|
+
|
|
183
|
+
- Templates: .pptx, .docx, boilerplate directories
|
|
184
|
+
- Images: .png, .jpg, .svg, .gif
|
|
185
|
+
- Fonts: .ttf, .otf, .woff, .woff2
|
|
186
|
+
- Boilerplate code: Project directories, starter files
|
|
187
|
+
- Icons: .ico, .svg
|
|
188
|
+
- Data files: .csv, .json, .xml, .yaml
|
|
189
|
+
|
|
190
|
+
Note: This is a text placeholder. Actual assets can be any file type.
|
|
191
|
+
"""
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
def title_case_skill_name(skill_name):
|
|
195
|
+
"""Convert hyphenated skill name to Title Case for display."""
|
|
196
|
+
return ' '.join(word.capitalize() for word in skill_name.split('-'))
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
def init_skill(skill_name, path):
|
|
200
|
+
"""
|
|
201
|
+
Initialize a new skill directory with template SKILL.md.
|
|
202
|
+
|
|
203
|
+
Args:
|
|
204
|
+
skill_name: Name of the skill
|
|
205
|
+
path: Path where the skill directory should be created
|
|
206
|
+
|
|
207
|
+
Returns:
|
|
208
|
+
Path to created skill directory, or None if error
|
|
209
|
+
"""
|
|
210
|
+
# Determine skill directory path
|
|
211
|
+
skill_dir = Path(path).resolve() / skill_name
|
|
212
|
+
|
|
213
|
+
# Check if directory already exists
|
|
214
|
+
if skill_dir.exists():
|
|
215
|
+
print(f"❌ Error: Skill directory already exists: {skill_dir}")
|
|
216
|
+
return None
|
|
217
|
+
|
|
218
|
+
# Create skill directory
|
|
219
|
+
try:
|
|
220
|
+
skill_dir.mkdir(parents=True, exist_ok=False)
|
|
221
|
+
print(f"✅ Created skill directory: {skill_dir}")
|
|
222
|
+
except Exception as e:
|
|
223
|
+
print(f"❌ Error creating directory: {e}")
|
|
224
|
+
return None
|
|
225
|
+
|
|
226
|
+
# Create SKILL.md from template
|
|
227
|
+
skill_title = title_case_skill_name(skill_name)
|
|
228
|
+
skill_content = SKILL_TEMPLATE.format(
|
|
229
|
+
skill_name=skill_name,
|
|
230
|
+
skill_title=skill_title
|
|
231
|
+
)
|
|
232
|
+
|
|
233
|
+
skill_md_path = skill_dir / 'SKILL.md'
|
|
234
|
+
try:
|
|
235
|
+
write_text_utf8(skill_md_path, skill_content)
|
|
236
|
+
print("✅ Created SKILL.md")
|
|
237
|
+
except Exception as e:
|
|
238
|
+
print(f"❌ Error creating SKILL.md: {e}")
|
|
239
|
+
return None
|
|
240
|
+
|
|
241
|
+
# Create resource directories with example files
|
|
242
|
+
try:
|
|
243
|
+
# Create scripts/ directory with example script
|
|
244
|
+
scripts_dir = skill_dir / 'scripts'
|
|
245
|
+
scripts_dir.mkdir(exist_ok=True)
|
|
246
|
+
example_script = scripts_dir / 'example.py'
|
|
247
|
+
write_text_utf8(example_script, EXAMPLE_SCRIPT.format(skill_name=skill_name))
|
|
248
|
+
example_script.chmod(0o755)
|
|
249
|
+
print("✅ Created scripts/example.py")
|
|
250
|
+
|
|
251
|
+
# Create references/ directory with example reference doc
|
|
252
|
+
references_dir = skill_dir / 'references'
|
|
253
|
+
references_dir.mkdir(exist_ok=True)
|
|
254
|
+
example_reference = references_dir / 'api_reference.md'
|
|
255
|
+
write_text_utf8(example_reference, EXAMPLE_REFERENCE.format(skill_title=skill_title))
|
|
256
|
+
print("✅ Created references/api_reference.md")
|
|
257
|
+
|
|
258
|
+
# Create assets/ directory with example asset placeholder
|
|
259
|
+
assets_dir = skill_dir / 'assets'
|
|
260
|
+
assets_dir.mkdir(exist_ok=True)
|
|
261
|
+
example_asset = assets_dir / 'example_asset.txt'
|
|
262
|
+
write_text_utf8(example_asset, EXAMPLE_ASSET)
|
|
263
|
+
print("✅ Created assets/example_asset.txt")
|
|
264
|
+
except Exception as e:
|
|
265
|
+
print(f"❌ Error creating resource directories: {e}")
|
|
266
|
+
return None
|
|
267
|
+
|
|
268
|
+
# Print next steps
|
|
269
|
+
print(f"\n✅ Skill '{skill_name}' initialized successfully at {skill_dir}")
|
|
270
|
+
print("\nNext steps:")
|
|
271
|
+
print("1. Edit SKILL.md to complete the TODO items and update the description")
|
|
272
|
+
print("2. Customize or delete the example files in scripts/, references/, and assets/")
|
|
273
|
+
print("3. Run the validator when ready to check the skill structure")
|
|
274
|
+
|
|
275
|
+
return skill_dir
|
|
276
|
+
|
|
277
|
+
|
|
278
|
+
def main():
|
|
279
|
+
if len(sys.argv) < 4 or sys.argv[2] != '--path':
|
|
280
|
+
print("Usage: init_skill.py <skill-name> --path <path>")
|
|
281
|
+
print("\nSkill name requirements:")
|
|
282
|
+
print(" - Hyphen-case identifier (e.g., 'data-analyzer')")
|
|
283
|
+
print(" - Lowercase letters, digits, and hyphens only")
|
|
284
|
+
print(" - Max 40 characters")
|
|
285
|
+
print(" - Must match directory name exactly")
|
|
286
|
+
print("\nExamples:")
|
|
287
|
+
print(" init_skill.py my-new-skill --path skills/public")
|
|
288
|
+
print(" init_skill.py my-api-helper --path skills/private")
|
|
289
|
+
print(" init_skill.py custom-skill --path /custom/location")
|
|
290
|
+
sys.exit(1)
|
|
291
|
+
|
|
292
|
+
skill_name = sys.argv[1]
|
|
293
|
+
path = sys.argv[3]
|
|
294
|
+
|
|
295
|
+
print(f"🚀 Initializing skill: {skill_name}")
|
|
296
|
+
print(f" Location: {path}")
|
|
297
|
+
print()
|
|
298
|
+
|
|
299
|
+
result = init_skill(skill_name, path)
|
|
300
|
+
|
|
301
|
+
if result:
|
|
302
|
+
sys.exit(0)
|
|
303
|
+
else:
|
|
304
|
+
sys.exit(1)
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
if __name__ == "__main__":
|
|
308
|
+
main()
|
|
@@ -0,0 +1,115 @@
|
|
|
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 sys
|
|
14
|
+
import zipfile
|
|
15
|
+
from pathlib import Path
|
|
16
|
+
|
|
17
|
+
from encoding_utils import configure_utf8_console
|
|
18
|
+
from quick_validate import validate_skill
|
|
19
|
+
|
|
20
|
+
# Fix Windows console encoding for Unicode output (emojis, arrows)
|
|
21
|
+
configure_utf8_console()
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def package_skill(skill_path, output_dir=None):
|
|
25
|
+
"""
|
|
26
|
+
Package a skill folder into a zip file.
|
|
27
|
+
|
|
28
|
+
Args:
|
|
29
|
+
skill_path: Path to the skill folder
|
|
30
|
+
output_dir: Optional output directory for the zip file (defaults to current directory)
|
|
31
|
+
|
|
32
|
+
Returns:
|
|
33
|
+
Path to the created zip file, or None if error
|
|
34
|
+
"""
|
|
35
|
+
skill_path = Path(skill_path).resolve()
|
|
36
|
+
|
|
37
|
+
# Validate skill folder exists
|
|
38
|
+
if not skill_path.exists():
|
|
39
|
+
print(f"❌ Error: Skill folder not found: {skill_path}")
|
|
40
|
+
return None
|
|
41
|
+
|
|
42
|
+
if not skill_path.is_dir():
|
|
43
|
+
print(f"❌ Error: Path is not a directory: {skill_path}")
|
|
44
|
+
return None
|
|
45
|
+
|
|
46
|
+
# Validate SKILL.md exists
|
|
47
|
+
skill_md = skill_path / "SKILL.md"
|
|
48
|
+
if not skill_md.exists():
|
|
49
|
+
print(f"❌ Error: SKILL.md not found in {skill_path}")
|
|
50
|
+
return None
|
|
51
|
+
|
|
52
|
+
# Run validation before packaging
|
|
53
|
+
print("🔍 Validating skill...")
|
|
54
|
+
valid, message = validate_skill(skill_path)
|
|
55
|
+
if not valid:
|
|
56
|
+
print(f"❌ Validation failed: {message}")
|
|
57
|
+
print(" Please fix the validation errors before packaging.")
|
|
58
|
+
return None
|
|
59
|
+
print(f"✅ {message}\n")
|
|
60
|
+
|
|
61
|
+
# Determine output location
|
|
62
|
+
skill_name = skill_path.name
|
|
63
|
+
if output_dir:
|
|
64
|
+
output_path = Path(output_dir).resolve()
|
|
65
|
+
output_path.mkdir(parents=True, exist_ok=True)
|
|
66
|
+
else:
|
|
67
|
+
output_path = Path.cwd()
|
|
68
|
+
|
|
69
|
+
zip_filename = output_path / f"{skill_name}.zip"
|
|
70
|
+
|
|
71
|
+
# Create the zip file
|
|
72
|
+
try:
|
|
73
|
+
with zipfile.ZipFile(zip_filename, 'w', zipfile.ZIP_DEFLATED) as zipf:
|
|
74
|
+
# Walk through the skill directory
|
|
75
|
+
for file_path in skill_path.rglob('*'):
|
|
76
|
+
if file_path.is_file():
|
|
77
|
+
# Calculate the relative path within the zip
|
|
78
|
+
arcname = file_path.relative_to(skill_path.parent)
|
|
79
|
+
zipf.write(file_path, arcname)
|
|
80
|
+
print(f" Added: {arcname}")
|
|
81
|
+
|
|
82
|
+
print(f"\n✅ Successfully packaged skill to: {zip_filename}")
|
|
83
|
+
return zip_filename
|
|
84
|
+
|
|
85
|
+
except Exception as e:
|
|
86
|
+
print(f"❌ Error creating zip file: {e}")
|
|
87
|
+
return None
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
def main():
|
|
91
|
+
if len(sys.argv) < 2:
|
|
92
|
+
print("Usage: python utils/package_skill.py <path/to/skill-folder> [output-directory]")
|
|
93
|
+
print("\nExample:")
|
|
94
|
+
print(" python utils/package_skill.py skills/public/my-skill")
|
|
95
|
+
print(" python utils/package_skill.py skills/public/my-skill ./dist")
|
|
96
|
+
sys.exit(1)
|
|
97
|
+
|
|
98
|
+
skill_path = sys.argv[1]
|
|
99
|
+
output_dir = sys.argv[2] if len(sys.argv) > 2 else None
|
|
100
|
+
|
|
101
|
+
print(f"📦 Packaging skill: {skill_path}")
|
|
102
|
+
if output_dir:
|
|
103
|
+
print(f" Output directory: {output_dir}")
|
|
104
|
+
print()
|
|
105
|
+
|
|
106
|
+
result = package_skill(skill_path, output_dir)
|
|
107
|
+
|
|
108
|
+
if result:
|
|
109
|
+
sys.exit(0)
|
|
110
|
+
else:
|
|
111
|
+
sys.exit(1)
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
if __name__ == "__main__":
|
|
115
|
+
main()
|
|
@@ -0,0 +1,69 @@
|
|
|
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()
|
|
46
|
+
# Check naming convention (hyphen-case: lowercase with hyphens)
|
|
47
|
+
if not re.match(r'^[a-z0-9-]+$', name):
|
|
48
|
+
return False, f"Name '{name}' should be hyphen-case (lowercase letters, digits, and hyphens only)"
|
|
49
|
+
if name.startswith('-') or name.endswith('-') or '--' in name:
|
|
50
|
+
return False, f"Name '{name}' cannot start/end with hyphen or contain consecutive hyphens"
|
|
51
|
+
|
|
52
|
+
# Extract and validate description
|
|
53
|
+
desc_match = re.search(r'description:\s*(.+)', frontmatter)
|
|
54
|
+
if desc_match:
|
|
55
|
+
description = desc_match.group(1).strip()
|
|
56
|
+
# Check for angle brackets
|
|
57
|
+
if '<' in description or '>' in description:
|
|
58
|
+
return False, "Description cannot contain angle brackets (< or >)"
|
|
59
|
+
|
|
60
|
+
return True, "Skill is valid!"
|
|
61
|
+
|
|
62
|
+
if __name__ == "__main__":
|
|
63
|
+
if len(sys.argv) != 2:
|
|
64
|
+
print("Usage: python quick_validate.py <skill_directory>")
|
|
65
|
+
sys.exit(1)
|
|
66
|
+
|
|
67
|
+
valid, message = validate_skill(sys.argv[1])
|
|
68
|
+
print(message)
|
|
69
|
+
sys.exit(0 if valid else 1)
|