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

Function validate_skill

helpers/skills_cli.py:128–162  ·  view source on GitHub ↗

Validate a skill and return list of issues

(skill: Skill)

Source from the content-addressed store, hash-verified

126
127
128def validate_skill(skill: Skill) -> List[str]:
129 """Validate a skill and return list of issues"""
130 issues = []
131
132 # Required fields
133 if not skill.name:
134 issues.append("Missing required field: name")
135 if not skill.description:
136 issues.append("Missing required field: description")
137
138 # Name format
139 if skill.name:
140 if not (1 <= len(skill.name) <= 64):
141 issues.append("Name must be 1-64 characters")
142 if not re.match(r"^[a-z0-9-]+$", skill.name):
143 issues.append(f"Invalid name format: '{skill.name}' (use lowercase letters, numbers, and hyphens)")
144 if skill.name.startswith("-") or skill.name.endswith("-"):
145 issues.append("Name must not start or end with a hyphen")
146 if "--" in skill.name:
147 issues.append("Name must not contain consecutive hyphens")
148
149 # Description length
150 if skill.description and len(skill.description) < 20:
151 issues.append("Description is too short (minimum 20 characters)")
152
153 # Content
154 if len(skill.content) < 100:
155 issues.append("Skill content is too short (minimum 100 characters)")
156
157 # Check for associated files
158 skill_dir = skill.path
159 has_scripts = (skill_dir / "scripts").exists()
160 has_docs = (skill_dir / "docs").exists()
161
162 return issues
163
164
165def create_skill(name: str, description: str = "", author: str = "") -> Path:

Callers 1

mainFunction · 0.70

Calls 1

matchMethod · 0.80

Tested by

no test coverage detected