


















@@ -123,36 +123,38 @@ def validate_skill(skill_path):
123123if not isinstance(name, str):
124124return False, f"Name must be a string, got {type(name).__name__}"
125125name = name.strip()
126-if name:
127-if not re.match(r"^[a-z0-9-]+$", name):
128-return (
129-False,
130-f"Name '{name}' should be hyphen-case (lowercase letters, digits, and hyphens only)",
131- )
132-if name.startswith("-") or name.endswith("-") or "--" in name:
133-return (
134-False,
135-f"Name '{name}' cannot start/end with hyphen or contain consecutive hyphens",
136- )
137-if len(name) > MAX_SKILL_NAME_LENGTH:
138-return (
139-False,
140-f"Name is too long ({len(name)} characters). "
141-f"Maximum is {MAX_SKILL_NAME_LENGTH} characters.",
142- )
126+if not name:
127+return False, "Name must not be empty"
128+if not re.match(r"^[a-z0-9-]+$", name):
129+return (
130+False,
131+f"Name '{name}' should be hyphen-case (lowercase letters, digits, and hyphens only)",
132+ )
133+if name.startswith("-") or name.endswith("-") or "--" in name:
134+return (
135+False,
136+f"Name '{name}' cannot start/end with hyphen or contain consecutive hyphens",
137+ )
138+if len(name) > MAX_SKILL_NAME_LENGTH:
139+return (
140+False,
141+f"Name is too long ({len(name)} characters). "
142+f"Maximum is {MAX_SKILL_NAME_LENGTH} characters.",
143+ )
143144144145description = frontmatter.get("description", "")
145146if not isinstance(description, str):
146147return False, f"Description must be a string, got {type(description).__name__}"
147148description = description.strip()
148-if description:
149-if "<" in description or ">" in description:
150-return False, "Description cannot contain angle brackets (< or >)"
151-if len(description) > 1024:
152-return (
153-False,
154-f"Description is too long ({len(description)} characters). Maximum is 1024 characters.",
155- )
149+if not description:
150+return False, "Description must not be empty"
151+if "<" in description or ">" in description:
152+return False, "Description cannot contain angle brackets (< or >)"
153+if len(description) > 1024:
154+return (
155+False,
156+f"Description is too long ({len(description)} characters). Maximum is 1024 characters.",
157+ )
156158157159return True, "Skill is valid!"
158160此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。