mirror of
https://github.com/mukul975/Anthropic-Cybersecurity-Skills.git
synced 2026-06-10 05:04:56 +03:00
fix(validator): address all remaining review feedback from @mukul975
Three issues fixed: 1. Description list check — added elif isinstance(desc, list) branch that emits 'Description must be a string value, not a list'. Previously the block was silently skipped when YAML returned a list, causing the skill to pass without validating the description field. 2. tools/README.md synced — updated description constraint from '20-500 characters' to 'at least 50 characters (no upper limit)' to match the current code (DESCRIPTION_MIN_CHARS=50, no max enforced). 3. --all with wrong CWD now exits 1 — if glob returns no skill dirs, the script prints an error and exits with code 1 instead of reporting 'Total: 0 Passed: 0 Failed: 0' and exiting 0, which would cause CI to silently pass while validating nothing. All 754 skills continue to pass (0 regressions).
This commit is contained in:
+1
-1
@@ -20,7 +20,7 @@ python tools/validate-skill.py --all
|
||||
- Valid YAML frontmatter (between `---` markers)
|
||||
- Required fields present: `name`, `description`, `domain`, `subdomain`, `tags`
|
||||
- Name is kebab-case, 1–64 characters
|
||||
- Description is 20–500 characters
|
||||
- Description is at least 50 characters (no upper limit; multi-line folded scalars are valid)
|
||||
- Domain is `cybersecurity`
|
||||
- Subdomain is from the allowed list
|
||||
- Tags is a list with at least 2 items
|
||||
|
||||
@@ -205,7 +205,9 @@ def validate_skill(skill_dir):
|
||||
|
||||
# Validate description.
|
||||
desc = fm.get("description", "")
|
||||
if isinstance(desc, str):
|
||||
if isinstance(desc, list):
|
||||
errors.append("Description must be a string value, not a list")
|
||||
elif isinstance(desc, str):
|
||||
if len(desc) < DESCRIPTION_MIN_CHARS:
|
||||
errors.append(
|
||||
f"Description too short ({len(desc)} chars, min {DESCRIPTION_MIN_CHARS})"
|
||||
@@ -251,6 +253,9 @@ def main():
|
||||
|
||||
if sys.argv[1] == "--all":
|
||||
skill_dirs = sorted(glob.glob("skills/*/"))
|
||||
if not skill_dirs:
|
||||
print("ERROR: No skill directories found. Run from the repository root.")
|
||||
sys.exit(1)
|
||||
else:
|
||||
skill_dirs = [sys.argv[1].rstrip("/") + "/"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user