Files
dance-lessons-coach/.vibe/skills/skill_creator/scripts/validate_skill.sh
Gabriel Radureau 0215a8b7df
Some checks failed
Go CI/CD Pipeline / Lint and Format (push) Failing after 58s
Go CI/CD Pipeline / Arcodange Workflow Validation (push) Failing after 6m10s
Go CI/CD Pipeline / Build and Test (push) Failing after 6m34s
Go CI/CD Pipeline / Version Management (push) Has been skipped
📝 docs: update README with Gitea setup and fix skill validation
Update project README.md:

- Add Gitea Integration section

- Document Gitea client skill setup instructions

- Provide usage examples for monitoring CI/CD jobs

Fix skill creator validation script:

- Fix grep command for consecutive hyphens check

- Fix description extraction logic

- Improve error handling for skill validation

These changes support the new Gitea client skill and improve

the skill creation/validation workflow.
2026-04-06 12:34:57 +02:00

73 lines
2.1 KiB
Bash
Executable File

#!/bin/bash
# Validate a skill follows the Agent Skills specification
set -e
echo "Validating skill at: $1"
# Check if SKILL.md exists
if [ ! -f "$1/SKILL.md" ]; then
echo "ERROR: SKILL.md file is required"
exit 1
fi
# Check if name field exists and matches directory name (convert underscores to hyphens)
SKILL_NAME=$(grep -E "^name:" "$1/SKILL.md" | cut -d " " -f 2 | tr -d ' ')
DIRECTORY_NAME=$(basename "$1" | tr '_' '-')
if [ "$SKILL_NAME" != "$DIRECTORY_NAME" ]; then
echo "ERROR: Skill name '$SKILL_NAME' doesn't match directory name '$DIRECTORY_NAME' (underscores converted to hyphens)"
exit 1
fi
# Check if description field exists
if ! grep -q "^description:" "$1/SKILL.md"; then
echo "ERROR: description field is required"
exit 1
fi
# Check name format (lowercase alphanumeric and hyphens only)
if ! echo "$SKILL_NAME" | grep -q "^[a-z0-9-]*$"; then
echo "ERROR: Skill name can only contain lowercase alphanumeric characters and hyphens"
exit 1
fi
# Check name doesn't start or end with hyphen
if [[ "$SKILL_NAME" == -* ]] || [[ "$SKILL_NAME" == *- ]]; then
echo "ERROR: Skill name cannot start or end with hyphen"
exit 1
fi
# Check name doesn't contain consecutive hyphens
if echo "$SKILL_NAME" | grep -q -e "--"; then
echo "ERROR: Skill name cannot contain consecutive hyphens"
exit 1
fi
# Check description length (1-1024 characters)
DESCRIPTION=$(grep "^description:" "$1/SKILL.md" | cut -d " " -f 2-)
DESCRIPTION_LENGTH=${#DESCRIPTION}
if [ "$DESCRIPTION_LENGTH" -lt 1 ] || [ "$DESCRIPTION_LENGTH" -gt 1024 ]; then
echo "ERROR: Description must be 1-1024 characters"
exit 1
fi
echo "✓ Skill validation passed: $SKILL_NAME"
echo "✓ Name format: $SKILL_NAME"
echo "✓ Description length: $DESCRIPTION_LENGTH characters"
echo "✓ Directory structure: Valid"
# Check for optional directories
if [ -d "$1/scripts" ]; then
echo "✓ Optional scripts/ directory found"
fi
if [ -d "$1/references" ]; then
echo "✓ Optional references/ directory found"
fi
if [ -d "$1/assets" ]; then
echo "✓ Optional assets/ directory found"
fi