if":"notin stripped: returnNone
key, value = stripped.split(":", 1)
key = key.strip()
value = value.strip() ifnot key: returnNone if (value.startswith('"') and value.endswith('"')) or (
value.startswith("'") and value.endswith("'")
):
value = value[1:-1]
parsed[key] = value
current_key = key return parsed
def validate_skill(skill_path): """Basic validation of a skill"""
skill_path = Path(skill_path)
if"name"notin frontmatter: returnFalse, "Missing 'name' in frontmatter" if"description"notin frontmatter: returnFalse, "Missing 'description' in frontmatter"
name = frontmatter.get("name", "") ifnot isinstance(name, str): returnFalse, f"Name must be a string, got {type(name).__name__}"
name = name.strip() if name: ifnot re.match(r"^[a-z0-9-]+$", name): return ( False,
f"Name '{name}' should be hyphen-case (lowercase letters, digits, and hyphens only)",
) if name.startswith("-") or name.endswith("-") or"--"in name: return ( False,
f"Name '{name}' cannot start/end with hyphen or contain consecutive hyphens",
) if len(name) > MAX_SKILL_NAME_LENGTH: return ( False,
f"Name is too long ({len(name)} characters). "
f"Maximum is {MAX_SKILL_NAME_LENGTH} characters.",
)
description = frontmatter.get("description", "") ifnot isinstance(description, str): returnFalse, f"Description must be a string, got {type(description).__name__}"
description = description.strip() if description: if"<"in description or">"in description: returnFalse, "Description cannot contain angle brackets (< or >)" if len(description) > 1024: return ( False,
f"Description is too long ({len(description)} characters). Maximum is 1024 characters.",
)
returnTrue, "Skill is valid!"
if __name__ == "__main__": if len(sys.argv) != 2:
print("Usage: python quick_validate.py <skill_directory>")
sys.exit(1)
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.