Create a new skill from template
(name: str, description: str = "", author: str = "")
| 163 | |
| 164 | |
| 165 | def 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'''--- |
| 182 | name: "{name}" |
| 183 | description: "{description or 'Description of what this skill does and when to use it'}" |
| 184 | version: "1.0.0" |
| 185 | author: "{author or 'Your Name'}" |
| 186 | tags: ["custom"] |
| 187 | trigger_patterns: |
| 188 | - "{name}" |
| 189 | --- |
| 190 | |
| 191 | # {name.replace("-", " ").replace("_", " ").title()} |
| 192 | |
| 193 | ## When to Use |
| 194 | |
| 195 | Describe when this skill should be activated. |
| 196 | |
| 197 | ## Instructions |
| 198 | |
| 199 | Provide detailed instructions for the agent to follow. |
| 200 | |
| 201 | ### Step 1: First Step |
| 202 | |
| 203 | Description of what to do first. |
| 204 | |
| 205 | ### Step 2: Second Step |
| 206 | |
| 207 | Description 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 |