@trespies-source/dojo-genesis-plugin 1.0.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/CHANGELOG.md +30 -0
- package/LICENSE +21 -0
- package/README.md +204 -0
- package/dist/hooks/after-tool-call/handler.d.ts +4 -0
- package/dist/hooks/after-tool-call/handler.d.ts.map +1 -0
- package/dist/hooks/after-tool-call/handler.js +37 -0
- package/dist/hooks/after-tool-call/handler.js.map +1 -0
- package/dist/hooks/agent-end/handler.d.ts +4 -0
- package/dist/hooks/agent-end/handler.d.ts.map +1 -0
- package/dist/hooks/agent-end/handler.js +16 -0
- package/dist/hooks/agent-end/handler.js.map +1 -0
- package/dist/hooks/before-agent-start/handler.d.ts +4 -0
- package/dist/hooks/before-agent-start/handler.d.ts.map +1 -0
- package/dist/hooks/before-agent-start/handler.js +81 -0
- package/dist/hooks/before-agent-start/handler.js.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +35 -0
- package/dist/index.js.map +1 -0
- package/dist/src/commands/archive.d.ts +4 -0
- package/dist/src/commands/archive.d.ts.map +1 -0
- package/dist/src/commands/archive.js +20 -0
- package/dist/src/commands/archive.js.map +1 -0
- package/dist/src/commands/init.d.ts +4 -0
- package/dist/src/commands/init.d.ts.map +1 -0
- package/dist/src/commands/init.js +57 -0
- package/dist/src/commands/init.js.map +1 -0
- package/dist/src/commands/list.d.ts +4 -0
- package/dist/src/commands/list.d.ts.map +1 -0
- package/dist/src/commands/list.js +9 -0
- package/dist/src/commands/list.js.map +1 -0
- package/dist/src/commands/router.d.ts +3 -0
- package/dist/src/commands/router.d.ts.map +1 -0
- package/dist/src/commands/router.js +83 -0
- package/dist/src/commands/router.js.map +1 -0
- package/dist/src/commands/skill-invoke.d.ts +4 -0
- package/dist/src/commands/skill-invoke.d.ts.map +1 -0
- package/dist/src/commands/skill-invoke.js +26 -0
- package/dist/src/commands/skill-invoke.js.map +1 -0
- package/dist/src/commands/status.d.ts +4 -0
- package/dist/src/commands/status.d.ts.map +1 -0
- package/dist/src/commands/status.js +42 -0
- package/dist/src/commands/status.js.map +1 -0
- package/dist/src/commands/switch.d.ts +4 -0
- package/dist/src/commands/switch.d.ts.map +1 -0
- package/dist/src/commands/switch.js +20 -0
- package/dist/src/commands/switch.js.map +1 -0
- package/dist/src/orchestration/tool-registry.d.ts +18 -0
- package/dist/src/orchestration/tool-registry.d.ts.map +1 -0
- package/dist/src/orchestration/tool-registry.js +153 -0
- package/dist/src/orchestration/tool-registry.js.map +1 -0
- package/dist/src/skills/catalog.d.ts +9 -0
- package/dist/src/skills/catalog.d.ts.map +1 -0
- package/dist/src/skills/catalog.js +251 -0
- package/dist/src/skills/catalog.js.map +1 -0
- package/dist/src/state/manager.d.ts +19 -0
- package/dist/src/state/manager.d.ts.map +1 -0
- package/dist/src/state/manager.js +114 -0
- package/dist/src/state/manager.js.map +1 -0
- package/dist/src/state/migrations.d.ts +3 -0
- package/dist/src/state/migrations.d.ts.map +1 -0
- package/dist/src/state/migrations.js +8 -0
- package/dist/src/state/migrations.js.map +1 -0
- package/dist/src/state/types.d.ts +62 -0
- package/dist/src/state/types.d.ts.map +1 -0
- package/dist/src/state/types.js +2 -0
- package/dist/src/state/types.js.map +1 -0
- package/dist/src/ui/chat-formatter.d.ts +11 -0
- package/dist/src/ui/chat-formatter.d.ts.map +1 -0
- package/dist/src/ui/chat-formatter.js +39 -0
- package/dist/src/ui/chat-formatter.js.map +1 -0
- package/dist/src/utils/file-ops.d.ts +6 -0
- package/dist/src/utils/file-ops.d.ts.map +1 -0
- package/dist/src/utils/file-ops.js +38 -0
- package/dist/src/utils/file-ops.js.map +1 -0
- package/dist/src/utils/markdown.d.ts +2 -0
- package/dist/src/utils/markdown.d.ts.map +1 -0
- package/dist/src/utils/markdown.js +11 -0
- package/dist/src/utils/markdown.js.map +1 -0
- package/dist/src/utils/validation.d.ts +7 -0
- package/dist/src/utils/validation.d.ts.map +1 -0
- package/dist/src/utils/validation.js +29 -0
- package/dist/src/utils/validation.js.map +1 -0
- package/dist/tests/__mocks__/openclaw-types.d.ts +54 -0
- package/dist/tests/__mocks__/openclaw-types.d.ts.map +1 -0
- package/dist/tests/__mocks__/openclaw-types.js +29 -0
- package/dist/tests/__mocks__/openclaw-types.js.map +1 -0
- package/hooks/after-tool-call/HOOK.md +7 -0
- package/hooks/after-tool-call/handler.ts +41 -0
- package/hooks/agent-end/HOOK.md +7 -0
- package/hooks/agent-end/handler.ts +18 -0
- package/hooks/before-agent-start/HOOK.md +7 -0
- package/hooks/before-agent-start/handler.ts +133 -0
- package/openclaw.plugin.json +19 -0
- package/package.json +61 -0
- package/skills/agent-teaching/SKILL.md +583 -0
- package/skills/agent-teaching/claw.json +12 -0
- package/skills/compression-ritual/SKILL.md +136 -0
- package/skills/compression-ritual/claw.json +12 -0
- package/skills/context-ingestion/SKILL.md +109 -0
- package/skills/context-ingestion/claw.json +12 -0
- package/skills/decision-propagation/SKILL.md +130 -0
- package/skills/decision-propagation/claw.json +12 -0
- package/skills/documentation-audit/SKILL.md +146 -0
- package/skills/documentation-audit/claw.json +12 -0
- package/skills/era-architecture/SKILL.md +166 -0
- package/skills/era-architecture/claw.json +12 -0
- package/skills/file-management/SKILL.md +127 -0
- package/skills/file-management/claw.json +12 -0
- package/skills/frontend-from-backend/SKILL.md +127 -0
- package/skills/frontend-from-backend/claw.json +12 -0
- package/skills/handoff-protocol/SKILL.md +168 -0
- package/skills/handoff-protocol/claw.json +12 -0
- package/skills/health-audit/SKILL.md +123 -0
- package/skills/health-audit/claw.json +12 -0
- package/skills/implementation-prompt/SKILL.md +361 -0
- package/skills/implementation-prompt/claw.json +12 -0
- package/skills/iterative-scouting/SKILL.md +106 -0
- package/skills/iterative-scouting/claw.json +12 -0
- package/skills/memory-garden/SKILL.md +470 -0
- package/skills/memory-garden/claw.json +12 -0
- package/skills/multi-surface-strategy/SKILL.md +288 -0
- package/skills/multi-surface-strategy/claw.json +12 -0
- package/skills/parallel-tracks/SKILL.md +152 -0
- package/skills/parallel-tracks/claw.json +12 -0
- package/skills/patient-learning-protocol/SKILL.md +438 -0
- package/skills/patient-learning-protocol/claw.json +12 -0
- package/skills/planning-with-files/SKILL.md +139 -0
- package/skills/planning-with-files/claw.json +12 -0
- package/skills/pre-implementation-checklist/SKILL.md +156 -0
- package/skills/pre-implementation-checklist/claw.json +12 -0
- package/skills/process-extraction/SKILL.md +148 -0
- package/skills/process-extraction/claw.json +12 -0
- package/skills/process-extraction/references/process_example_template.md +40 -0
- package/skills/product-positioning/SKILL.md +293 -0
- package/skills/product-positioning/claw.json +12 -0
- package/skills/project-exploration/SKILL.md +168 -0
- package/skills/project-exploration/claw.json +12 -0
- package/skills/release-specification/SKILL.md +645 -0
- package/skills/release-specification/claw.json +12 -0
- package/skills/repo-context-sync/SKILL.md +362 -0
- package/skills/repo-context-sync/claw.json +12 -0
- package/skills/repo-context-sync/references/file_hierarchy_patterns.md +186 -0
- package/skills/repo-context-sync/references/zenflow_repo_patterns.md +328 -0
- package/skills/repo-context-sync/scripts/context_mapper.py +251 -0
- package/skills/repo-context-sync/scripts/diff_tracker.py +187 -0
- package/skills/repo-context-sync/scripts/smart_clone.sh +52 -0
- package/skills/repo-context-sync/templates/context_summary.md +58 -0
- package/skills/repo-status/SKILL.md +240 -0
- package/skills/repo-status/claw.json +12 -0
- package/skills/repo-status/references/semantic-clusters.md +159 -0
- package/skills/repo-status/references/status-template.md +214 -0
- package/skills/research-modes/SKILL.md +515 -0
- package/skills/research-modes/claw.json +12 -0
- package/skills/research-synthesis/SKILL.md +110 -0
- package/skills/research-synthesis/claw.json +12 -0
- package/skills/retrospective/SKILL.md +152 -0
- package/skills/retrospective/claw.json +12 -0
- package/skills/seed-extraction/SKILL.md +419 -0
- package/skills/seed-extraction/claw.json +12 -0
- package/skills/seed-library/SKILL.md +424 -0
- package/skills/seed-library/claw.json +12 -0
- package/skills/seed-library/references/seed_catalog.md +171 -0
- package/skills/seed-library/scripts/apply_seed.py +129 -0
- package/skills/seed-library/scripts/suggest_seeds.py +183 -0
- package/skills/seed-library/seeds/01_three_tiered_governance.md +90 -0
- package/skills/seed-library/seeds/02_harness_trace.md +135 -0
- package/skills/seed-library/seeds/03_context_iceberg.md +120 -0
- package/skills/seed-library/seeds/04_agent_connect.md +106 -0
- package/skills/seed-library/seeds/05_go_live_bundles.md +40 -0
- package/skills/seed-library/seeds/06_cost_guard.md +40 -0
- package/skills/seed-library/seeds/07_safety_switch.md +41 -0
- package/skills/seed-library/seeds/08_implicit_perspective_extraction.md +41 -0
- package/skills/seed-library/seeds/09_mode_based_complexity_gating.md +46 -0
- package/skills/seed-library/seeds/10_shared_infrastructure.md +75 -0
- package/skills/seed-library/seeds/11_voice_before_structure.md +74 -0
- package/skills/seed-library/seeds/12_pointer_directories.md +81 -0
- package/skills/seed-library/seeds/13_granular_visibility.md +82 -0
- package/skills/seed-library/seeds/meta_governance_multiplies_velocity.md +43 -0
- package/skills/seed-to-skill-converter/SKILL.md +113 -0
- package/skills/seed-to-skill-converter/claw.json +12 -0
- package/skills/semantic-clusters/SKILL.md +246 -0
- package/skills/semantic-clusters/claw.json +12 -0
- package/skills/semantic-clusters/references/verb-catalog.md +267 -0
- package/skills/skill-audit-upgrade/SKILL.md +427 -0
- package/skills/skill-audit-upgrade/claw.json +12 -0
- package/skills/skill-creation/LICENSE.txt +202 -0
- package/skills/skill-creation/SKILL.md +252 -0
- package/skills/skill-creation/claw.json +12 -0
- package/skills/skill-creation/references/output-patterns.md +82 -0
- package/skills/skill-creation/references/progressive-disclosure-patterns.md +79 -0
- package/skills/skill-creation/references/workflows.md +28 -0
- package/skills/skill-creation/scripts/init_skill.py +305 -0
- package/skills/skill-creation/scripts/quick_validate.py +134 -0
- package/skills/skill-maintenance/SKILL.md +413 -0
- package/skills/skill-maintenance/claw.json +12 -0
- package/skills/spec-constellation-to-prompt-suite/SKILL.md +174 -0
- package/skills/spec-constellation-to-prompt-suite/claw.json +12 -0
- package/skills/status-template/SKILL.md +211 -0
- package/skills/status-template/claw.json +12 -0
- package/skills/status-template/references/complete-template.md +191 -0
- package/skills/status-writing/SKILL.md +161 -0
- package/skills/status-writing/claw.json +12 -0
- package/skills/strategic-scout/SKILL.md +163 -0
- package/skills/strategic-scout/claw.json +12 -0
- package/skills/strategic-to-tactical-workflow/SKILL.md +391 -0
- package/skills/strategic-to-tactical-workflow/claw.json +12 -0
- package/skills/workspace-navigation/SKILL.md +622 -0
- package/skills/workspace-navigation/claw.json +12 -0
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Skill Initializer - Creates a new skill from template
|
|
4
|
+
|
|
5
|
+
Usage:
|
|
6
|
+
init_skill.py <skill-name>
|
|
7
|
+
|
|
8
|
+
Examples:
|
|
9
|
+
init_skill.py my-new-skill
|
|
10
|
+
init_skill.py my-api-helper
|
|
11
|
+
|
|
12
|
+
Skills are created at /home/ubuntu/skills/<skill-name>/
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
import sys
|
|
16
|
+
from pathlib import Path
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
SKILL_TEMPLATE = """---
|
|
20
|
+
name: {skill_name}
|
|
21
|
+
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.]
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
# {skill_title}
|
|
25
|
+
|
|
26
|
+
## Overview
|
|
27
|
+
|
|
28
|
+
[TODO: 1-2 sentences explaining what this skill enables]
|
|
29
|
+
|
|
30
|
+
## Structuring This Skill
|
|
31
|
+
|
|
32
|
+
[TODO: Choose the structure that best fits this skill's purpose. Common patterns:
|
|
33
|
+
|
|
34
|
+
**1. Workflow-Based** (best for sequential processes)
|
|
35
|
+
- Works well when there are clear step-by-step procedures
|
|
36
|
+
- Example: DOCX skill with "Workflow Decision Tree" → "Reading" → "Creating" → "Editing"
|
|
37
|
+
- Structure: ## Overview → ## Workflow Decision Tree → ## Step 1 → ## Step 2...
|
|
38
|
+
|
|
39
|
+
**2. Task-Based** (best for tool collections)
|
|
40
|
+
- Works well when the skill offers different operations/capabilities
|
|
41
|
+
- Example: PDF skill with "Quick Start" → "Merge PDFs" → "Split PDFs" → "Extract Text"
|
|
42
|
+
- Structure: ## Overview → ## Quick Start → ## Task Category 1 → ## Task Category 2...
|
|
43
|
+
|
|
44
|
+
**3. Reference/Guidelines** (best for standards or specifications)
|
|
45
|
+
- Works well for brand guidelines, coding standards, or requirements
|
|
46
|
+
- Example: Brand styling with "Brand Guidelines" → "Colors" → "Typography" → "Features"
|
|
47
|
+
- Structure: ## Overview → ## Guidelines → ## Specifications → ## Usage...
|
|
48
|
+
|
|
49
|
+
**4. Capabilities-Based** (best for integrated systems)
|
|
50
|
+
- Works well when the skill provides multiple interrelated features
|
|
51
|
+
- Example: Product Management with "Core Capabilities" → numbered capability list
|
|
52
|
+
- Structure: ## Overview → ## Core Capabilities → ### 1. Feature → ### 2. Feature...
|
|
53
|
+
|
|
54
|
+
Patterns can be mixed and matched as needed. Most skills combine patterns (e.g., start with task-based, add workflow for complex operations).
|
|
55
|
+
|
|
56
|
+
Delete this entire "Structuring This Skill" section when done - it's just guidance.]
|
|
57
|
+
|
|
58
|
+
## [TODO: Replace with the first main section based on chosen structure]
|
|
59
|
+
|
|
60
|
+
[TODO: Add content here. See examples in existing skills:
|
|
61
|
+
- Code samples for technical skills
|
|
62
|
+
- Decision trees for complex workflows
|
|
63
|
+
- Concrete examples with realistic user requests
|
|
64
|
+
- References to scripts/templates/references as needed]
|
|
65
|
+
|
|
66
|
+
## Resources
|
|
67
|
+
|
|
68
|
+
This skill includes example resource directories that demonstrate how to organize different types of bundled resources:
|
|
69
|
+
|
|
70
|
+
### scripts/
|
|
71
|
+
Executable code (Python/Bash/etc.) that can be run directly to perform specific operations.
|
|
72
|
+
|
|
73
|
+
**Examples from other skills:**
|
|
74
|
+
- PDF skill: `fill_fillable_fields.py`, `extract_form_field_info.py` - utilities for PDF manipulation
|
|
75
|
+
- DOCX skill: `document.py`, `utilities.py` - Python modules for document processing
|
|
76
|
+
|
|
77
|
+
**Appropriate for:** Python scripts, shell scripts, or any executable code that performs automation, data processing, or specific operations.
|
|
78
|
+
|
|
79
|
+
**Note:** Scripts may be executed without loading into context, but can still be read by Manus for patching or environment adjustments.
|
|
80
|
+
|
|
81
|
+
### references/
|
|
82
|
+
Documentation and reference material intended to be loaded into context to inform Manus's process and thinking.
|
|
83
|
+
|
|
84
|
+
**Examples from other skills:**
|
|
85
|
+
- Product management: `communication.md`, `context_building.md` - detailed workflow guides
|
|
86
|
+
- BigQuery: API reference documentation and query examples
|
|
87
|
+
- Finance: Schema documentation, company policies
|
|
88
|
+
|
|
89
|
+
**Appropriate for:** In-depth documentation, API references, database schemas, comprehensive guides, or any detailed information that Manus should reference while working.
|
|
90
|
+
|
|
91
|
+
### templates/
|
|
92
|
+
Files not intended to be loaded into context, but rather used within the output Manus produces.
|
|
93
|
+
|
|
94
|
+
**Examples from other skills:**
|
|
95
|
+
- Brand styling: PowerPoint template files (.pptx), logo files
|
|
96
|
+
- Frontend builder: HTML/React boilerplate project directories
|
|
97
|
+
- Typography: Font files (.ttf, .woff2)
|
|
98
|
+
|
|
99
|
+
**Appropriate for:** Templates, boilerplate code, document templates, images, icons, fonts, or any files meant to be copied or used in the final output.
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
**Any unneeded directories can be deleted.** Not every skill requires all three types of resources.
|
|
104
|
+
"""
|
|
105
|
+
|
|
106
|
+
EXAMPLE_SCRIPT = '''#!/usr/bin/env python3
|
|
107
|
+
"""
|
|
108
|
+
Example helper script for {skill_name}
|
|
109
|
+
|
|
110
|
+
This is a placeholder script that can be executed directly.
|
|
111
|
+
Replace with actual implementation or delete if not needed.
|
|
112
|
+
|
|
113
|
+
Example real scripts from other skills:
|
|
114
|
+
- pdf/scripts/fill_fillable_fields.py - Fills PDF form fields
|
|
115
|
+
- pdf/scripts/convert_pdf_to_images.py - Converts PDF pages to images
|
|
116
|
+
"""
|
|
117
|
+
|
|
118
|
+
def main():
|
|
119
|
+
print("This is an example script for {skill_name}")
|
|
120
|
+
# TODO: Add actual script logic here
|
|
121
|
+
# This could be data processing, file conversion, API calls, etc.
|
|
122
|
+
|
|
123
|
+
if __name__ == "__main__":
|
|
124
|
+
main()
|
|
125
|
+
'''
|
|
126
|
+
|
|
127
|
+
EXAMPLE_REFERENCE = """# Reference Documentation for {skill_title}
|
|
128
|
+
|
|
129
|
+
This is a placeholder for detailed reference documentation.
|
|
130
|
+
Replace with actual reference content or delete if not needed.
|
|
131
|
+
|
|
132
|
+
Example real reference docs from other skills:
|
|
133
|
+
- product-management/references/communication.md - Comprehensive guide for status updates
|
|
134
|
+
- product-management/references/context_building.md - Deep-dive on gathering context
|
|
135
|
+
- bigquery/references/ - API references and query examples
|
|
136
|
+
|
|
137
|
+
## When Reference Docs Are Useful
|
|
138
|
+
|
|
139
|
+
Reference docs are ideal for:
|
|
140
|
+
- Comprehensive API documentation
|
|
141
|
+
- Detailed workflow guides
|
|
142
|
+
- Complex multi-step processes
|
|
143
|
+
- Information too lengthy for main SKILL.md
|
|
144
|
+
- Content that's only needed for specific use cases
|
|
145
|
+
|
|
146
|
+
## Structure Suggestions
|
|
147
|
+
|
|
148
|
+
### API Reference Example
|
|
149
|
+
- Overview
|
|
150
|
+
- Authentication
|
|
151
|
+
- Endpoints with examples
|
|
152
|
+
- Error codes
|
|
153
|
+
- Rate limits
|
|
154
|
+
|
|
155
|
+
### Workflow Guide Example
|
|
156
|
+
- Prerequisites
|
|
157
|
+
- Step-by-step instructions
|
|
158
|
+
- Common patterns
|
|
159
|
+
- Troubleshooting
|
|
160
|
+
- Best practices
|
|
161
|
+
"""
|
|
162
|
+
|
|
163
|
+
EXAMPLE_TEMPLATE = """# Example Template File
|
|
164
|
+
|
|
165
|
+
This placeholder represents where template files would be stored.
|
|
166
|
+
Replace with actual template files (templates, images, fonts, etc.) or delete if not needed.
|
|
167
|
+
|
|
168
|
+
Template files are NOT intended to be loaded into context, but rather used within
|
|
169
|
+
the output Manus produces.
|
|
170
|
+
|
|
171
|
+
Example template files from other skills:
|
|
172
|
+
- Brand guidelines: logo.png, slides_template.pptx
|
|
173
|
+
- Frontend builder: hello-world/ directory with HTML/React boilerplate
|
|
174
|
+
- Typography: custom-font.ttf, font-family.woff2
|
|
175
|
+
- Data: sample_data.csv, test_dataset.json
|
|
176
|
+
|
|
177
|
+
## Common Template Types
|
|
178
|
+
|
|
179
|
+
- Templates: .pptx, .docx, boilerplate directories
|
|
180
|
+
- Images: .png, .jpg, .svg, .gif
|
|
181
|
+
- Fonts: .ttf, .otf, .woff, .woff2
|
|
182
|
+
- Boilerplate code: Project directories, starter files
|
|
183
|
+
- Icons: .ico, .svg
|
|
184
|
+
- Data files: .csv, .json, .xml, .yaml
|
|
185
|
+
|
|
186
|
+
Note: This is a text placeholder. Actual templates can be any file type.
|
|
187
|
+
"""
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
def title_case_skill_name(skill_name):
|
|
191
|
+
"""Convert hyphenated skill name to Title Case for display."""
|
|
192
|
+
return ' '.join(word.capitalize() for word in skill_name.split('-'))
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
SKILLS_BASE_PATH = "/home/ubuntu/skills"
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
def init_skill(skill_name):
|
|
199
|
+
"""
|
|
200
|
+
Initialize a new skill directory with template SKILL.md.
|
|
201
|
+
|
|
202
|
+
Args:
|
|
203
|
+
skill_name: Name of the skill
|
|
204
|
+
|
|
205
|
+
Returns:
|
|
206
|
+
Path to created skill directory, or None if error
|
|
207
|
+
"""
|
|
208
|
+
# Determine skill directory path
|
|
209
|
+
skill_dir = Path(SKILLS_BASE_PATH) / skill_name
|
|
210
|
+
|
|
211
|
+
# Check if directory already exists
|
|
212
|
+
if skill_dir.exists():
|
|
213
|
+
print(f"❌ Error: Skill directory already exists: {skill_dir}")
|
|
214
|
+
return None
|
|
215
|
+
|
|
216
|
+
# Create skill directory
|
|
217
|
+
try:
|
|
218
|
+
skill_dir.mkdir(parents=True, exist_ok=False)
|
|
219
|
+
print(f"✅ Created skill directory: {skill_dir}")
|
|
220
|
+
except Exception as e:
|
|
221
|
+
print(f"❌ Error creating directory: {e}")
|
|
222
|
+
return None
|
|
223
|
+
|
|
224
|
+
# Create SKILL.md from template
|
|
225
|
+
skill_title = title_case_skill_name(skill_name)
|
|
226
|
+
skill_content = SKILL_TEMPLATE.format(
|
|
227
|
+
skill_name=skill_name,
|
|
228
|
+
skill_title=skill_title
|
|
229
|
+
)
|
|
230
|
+
|
|
231
|
+
skill_md_path = skill_dir / 'SKILL.md'
|
|
232
|
+
try:
|
|
233
|
+
skill_md_path.write_text(skill_content)
|
|
234
|
+
print("✅ Created SKILL.md")
|
|
235
|
+
except Exception as e:
|
|
236
|
+
print(f"❌ Error creating SKILL.md: {e}")
|
|
237
|
+
return None
|
|
238
|
+
|
|
239
|
+
# Create resource directories with example files
|
|
240
|
+
try:
|
|
241
|
+
# Create scripts/ directory with example script
|
|
242
|
+
scripts_dir = skill_dir / 'scripts'
|
|
243
|
+
scripts_dir.mkdir(exist_ok=True)
|
|
244
|
+
example_script = scripts_dir / 'example.py'
|
|
245
|
+
example_script.write_text(EXAMPLE_SCRIPT.format(skill_name=skill_name))
|
|
246
|
+
example_script.chmod(0o755)
|
|
247
|
+
print("✅ Created scripts/example.py")
|
|
248
|
+
|
|
249
|
+
# Create references/ directory with example reference doc
|
|
250
|
+
references_dir = skill_dir / 'references'
|
|
251
|
+
references_dir.mkdir(exist_ok=True)
|
|
252
|
+
example_reference = references_dir / 'api_reference.md'
|
|
253
|
+
example_reference.write_text(EXAMPLE_REFERENCE.format(skill_title=skill_title))
|
|
254
|
+
print("✅ Created references/api_reference.md")
|
|
255
|
+
|
|
256
|
+
# Create templates/ directory with example template placeholder
|
|
257
|
+
templates_dir = skill_dir / 'templates'
|
|
258
|
+
templates_dir.mkdir(exist_ok=True)
|
|
259
|
+
example_template = templates_dir / 'example_template.txt'
|
|
260
|
+
example_template.write_text(EXAMPLE_TEMPLATE)
|
|
261
|
+
print("✅ Created templates/example_template.txt")
|
|
262
|
+
except Exception as e:
|
|
263
|
+
print(f"❌ Error creating resource directories: {e}")
|
|
264
|
+
return None
|
|
265
|
+
|
|
266
|
+
# Print next steps
|
|
267
|
+
print(f"\n✅ Skill '{skill_name}' initialized successfully at {skill_dir}")
|
|
268
|
+
print("\nNext steps:")
|
|
269
|
+
print("1. Edit SKILL.md to complete the TODO items and update the description")
|
|
270
|
+
print("2. Customize or delete the example files in scripts/, references/, and templates/")
|
|
271
|
+
print("3. Run the validator when ready to check the skill structure")
|
|
272
|
+
|
|
273
|
+
return skill_dir
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
def main():
|
|
277
|
+
if len(sys.argv) != 2:
|
|
278
|
+
print("Usage: init_skill.py <skill-name>")
|
|
279
|
+
print("\nSkill name requirements:")
|
|
280
|
+
print(" - Hyphen-case identifier (e.g., 'data-analyzer')")
|
|
281
|
+
print(" - Lowercase letters, digits, and hyphens only")
|
|
282
|
+
print(" - Max 64 characters")
|
|
283
|
+
print(" - Must match directory name exactly")
|
|
284
|
+
print("\nExamples:")
|
|
285
|
+
print(" init_skill.py my-new-skill")
|
|
286
|
+
print(" init_skill.py my-api-helper")
|
|
287
|
+
print(f"\nSkills are created at {SKILLS_BASE_PATH}/<skill-name>/")
|
|
288
|
+
sys.exit(1)
|
|
289
|
+
|
|
290
|
+
skill_name = sys.argv[1]
|
|
291
|
+
|
|
292
|
+
print(f"🚀 Initializing skill: {skill_name}")
|
|
293
|
+
print(f" Location: {SKILLS_BASE_PATH}/{skill_name}")
|
|
294
|
+
print()
|
|
295
|
+
|
|
296
|
+
result = init_skill(skill_name)
|
|
297
|
+
|
|
298
|
+
if result:
|
|
299
|
+
sys.exit(0)
|
|
300
|
+
else:
|
|
301
|
+
sys.exit(1)
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
if __name__ == "__main__":
|
|
305
|
+
main()
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""
|
|
3
|
+
Quick validation script for skills - minimal version
|
|
4
|
+
|
|
5
|
+
Usage:
|
|
6
|
+
quick_validate.py <skill-name>
|
|
7
|
+
quick_validate.py <absolute-path-to-skill>
|
|
8
|
+
|
|
9
|
+
Examples:
|
|
10
|
+
quick_validate.py my-skill
|
|
11
|
+
quick_validate.py /home/ubuntu/skills/my-skill
|
|
12
|
+
|
|
13
|
+
Skills are expected at /home/ubuntu/skills/<skill-name>/
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
import sys
|
|
17
|
+
import re
|
|
18
|
+
import yaml
|
|
19
|
+
from pathlib import Path
|
|
20
|
+
|
|
21
|
+
SKILLS_BASE_PATH = Path("/home/ubuntu/skills")
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
def resolve_skill_path(skill_path_or_name):
|
|
25
|
+
"""
|
|
26
|
+
Resolve skill path to absolute path.
|
|
27
|
+
|
|
28
|
+
If given an absolute path, use it directly.
|
|
29
|
+
If given a skill name or relative path, resolve it under SKILLS_BASE_PATH.
|
|
30
|
+
"""
|
|
31
|
+
path = Path(skill_path_or_name)
|
|
32
|
+
|
|
33
|
+
# If it's an absolute path, use it directly
|
|
34
|
+
if path.is_absolute():
|
|
35
|
+
return path
|
|
36
|
+
|
|
37
|
+
# Otherwise, treat it as a skill name and look in SKILLS_BASE_PATH
|
|
38
|
+
return SKILLS_BASE_PATH / skill_path_or_name
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def validate_skill(skill_path_or_name):
|
|
42
|
+
"""Basic validation of a skill"""
|
|
43
|
+
skill_path = resolve_skill_path(skill_path_or_name)
|
|
44
|
+
|
|
45
|
+
# Check SKILL.md exists
|
|
46
|
+
skill_md = skill_path / 'SKILL.md'
|
|
47
|
+
if not skill_md.exists():
|
|
48
|
+
return False, "SKILL.md not found"
|
|
49
|
+
|
|
50
|
+
# Read and validate frontmatter
|
|
51
|
+
content = skill_md.read_text()
|
|
52
|
+
if not content.startswith('---'):
|
|
53
|
+
return False, "No YAML frontmatter found"
|
|
54
|
+
|
|
55
|
+
# Extract frontmatter
|
|
56
|
+
match = re.match(r'^---\n(.*?)\n---', content, re.DOTALL)
|
|
57
|
+
if not match:
|
|
58
|
+
return False, "Invalid frontmatter format"
|
|
59
|
+
|
|
60
|
+
frontmatter_text = match.group(1)
|
|
61
|
+
|
|
62
|
+
# Parse YAML frontmatter
|
|
63
|
+
try:
|
|
64
|
+
frontmatter = yaml.safe_load(frontmatter_text)
|
|
65
|
+
if not isinstance(frontmatter, dict):
|
|
66
|
+
return False, "Frontmatter must be a YAML dictionary"
|
|
67
|
+
except yaml.YAMLError as e:
|
|
68
|
+
return False, f"Invalid YAML in frontmatter: {e}"
|
|
69
|
+
|
|
70
|
+
# Define allowed properties
|
|
71
|
+
ALLOWED_PROPERTIES = {'name', 'description', 'license', 'allowed-tools', 'metadata'}
|
|
72
|
+
|
|
73
|
+
# Check for unexpected properties (excluding nested keys under metadata)
|
|
74
|
+
unexpected_keys = set(frontmatter.keys()) - ALLOWED_PROPERTIES
|
|
75
|
+
if unexpected_keys:
|
|
76
|
+
return False, (
|
|
77
|
+
f"Unexpected key(s) in SKILL.md frontmatter: {', '.join(sorted(unexpected_keys))}. "
|
|
78
|
+
f"Allowed properties are: {', '.join(sorted(ALLOWED_PROPERTIES))}"
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
# Check required fields
|
|
82
|
+
if 'name' not in frontmatter:
|
|
83
|
+
return False, "Missing 'name' in frontmatter"
|
|
84
|
+
if 'description' not in frontmatter:
|
|
85
|
+
return False, "Missing 'description' in frontmatter"
|
|
86
|
+
|
|
87
|
+
# Extract name for validation
|
|
88
|
+
name = frontmatter.get('name', '')
|
|
89
|
+
if not isinstance(name, str):
|
|
90
|
+
return False, f"Name must be a string, got {type(name).__name__}"
|
|
91
|
+
name = name.strip()
|
|
92
|
+
if name:
|
|
93
|
+
# Check naming convention (hyphen-case: lowercase with hyphens)
|
|
94
|
+
if not re.match(r'^[a-z0-9-]+$', name):
|
|
95
|
+
return False, f"Name '{name}' should be hyphen-case (lowercase letters, digits, and hyphens only)"
|
|
96
|
+
if name.startswith('-') or name.endswith('-') or '--' in name:
|
|
97
|
+
return False, f"Name '{name}' cannot start/end with hyphen or contain consecutive hyphens"
|
|
98
|
+
# Check name length (max 64 characters per spec)
|
|
99
|
+
if len(name) > 64:
|
|
100
|
+
return False, f"Name is too long ({len(name)} characters). Maximum is 64 characters."
|
|
101
|
+
|
|
102
|
+
# Extract and validate description
|
|
103
|
+
description = frontmatter.get('description', '')
|
|
104
|
+
if not isinstance(description, str):
|
|
105
|
+
return False, f"Description must be a string, got {type(description).__name__}"
|
|
106
|
+
description = description.strip()
|
|
107
|
+
if description:
|
|
108
|
+
# Check for angle brackets
|
|
109
|
+
if '<' in description or '>' in description:
|
|
110
|
+
return False, "Description cannot contain angle brackets (< or >)"
|
|
111
|
+
# Check description length (max 1024 characters per spec)
|
|
112
|
+
if len(description) > 1024:
|
|
113
|
+
return False, f"Description is too long ({len(description)} characters). Maximum is 1024 characters."
|
|
114
|
+
|
|
115
|
+
return True, "Skill is valid!"
|
|
116
|
+
|
|
117
|
+
if __name__ == "__main__":
|
|
118
|
+
if len(sys.argv) != 2:
|
|
119
|
+
print("Usage: quick_validate.py <skill-name>")
|
|
120
|
+
print(" quick_validate.py <absolute-path-to-skill>")
|
|
121
|
+
print("\nExamples:")
|
|
122
|
+
print(" quick_validate.py my-skill")
|
|
123
|
+
print(" quick_validate.py /home/ubuntu/skills/my-skill")
|
|
124
|
+
print(f"\nSkills are expected at {SKILLS_BASE_PATH}/<skill-name>/")
|
|
125
|
+
sys.exit(1)
|
|
126
|
+
|
|
127
|
+
skill_input = sys.argv[1]
|
|
128
|
+
resolved_path = resolve_skill_path(skill_input)
|
|
129
|
+
|
|
130
|
+
print(f"🔍 Validating skill at: {resolved_path}")
|
|
131
|
+
|
|
132
|
+
valid, message = validate_skill(skill_input)
|
|
133
|
+
print(message)
|
|
134
|
+
sys.exit(0 if valid else 1)
|