MCPcopy
hub / github.com/agent0ai/agent-zero / create_skill

Function create_skill

helpers/skills_cli.py:165–234  ·  view source on GitHub ↗

Create a new skill from template

(name: str, description: str = "", author: str = "")

Source from the content-addressed store, hash-verified

163
164
165def create_skill(name: str, description: str = "", author: str = "") -> Path:
166 """Create a new skill from template"""
167 # Use custom directory for user-created skills
168 custom_dir = Path(files.get_abs_path("usr", "skills", "custom"))
169 custom_dir.mkdir(parents=True, exist_ok=True)
170
171 skill_dir = custom_dir / name
172 if skill_dir.exists():
173 raise ValueError(f"Skill '{name}' already exists at {skill_dir}")
174
175 # Create directory structure
176 skill_dir.mkdir(parents=True)
177 (skill_dir / "scripts").mkdir()
178 (skill_dir / "docs").mkdir()
179
180 # Create SKILL.md from template
181 skill_content = f'''---
182name: "{name}"
183description: "{description or 'Description of what this skill does and when to use it'}"
184version: "1.0.0"
185author: "{author or 'Your Name'}"
186tags: ["custom"]
187trigger_patterns:
188 - "{name}"
189---
190
191# {name.replace("-", " ").replace("_", " ").title()}
192
193## When to Use
194
195Describe when this skill should be activated.
196
197## Instructions
198
199Provide detailed instructions for the agent to follow.
200
201### Step 1: First Step
202
203Description of what to do first.
204
205### Step 2: Second Step
206
207Description of what to do next.
208
209## Examples
210
211**User**: "Example prompt that triggers this skill"
212
213**Agent Response**:
214> Example of how the agent should respond
215
216## Tips
217
218- Tip 1: Helpful guidance
219- Tip 2: More helpful guidance
220
221## Anti-Patterns
222

Callers 1

mainFunction · 0.85

Calls 2

titleMethod · 0.80
replaceMethod · 0.80

Tested by

no test coverage detected