k-skill/scripts/validate-skills.sh
Jeffrey (Dongkyu) Kim dbc091d3d4 Frame k-skill as an installable Korean skills package
The repo starts as a markdown-first multi-skill package with one shared security policy, one validation script, and lightweight install docs. This keeps v1 easy to publish and easy to review before any skill-specific automation grows deeper.

Constraint: Skills must stay compatible with the skills CLI package layout
Rejected: Add a repo-level manifest or build system | the package spec only requires per-skill SKILL.md
Confidence: high
Scope-risk: narrow
Reversibility: clean
Directive: Keep credential-bearing skills on 1Password CLI runtime injection, not plaintext env files
Tested: bash scripts/validate-skills.sh
Not-tested: Fresh-machine install via npx skills add
2026-03-25 00:16:11 +09:00

51 lines
1.2 KiB
Bash
Executable file

#!/usr/bin/env bash
set -euo pipefail
root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
status=0
while IFS= read -r -d '' skill_dir; do
skill_name="$(basename "$skill_dir")"
skill_file="$skill_dir/SKILL.md"
if [[ ! -f "$skill_file" ]]; then
echo "missing SKILL.md: $skill_name"
status=1
continue
fi
if ! head -n 1 "$skill_file" | grep -qx -- "---"; then
echo "missing frontmatter start: $skill_file"
status=1
fi
if ! grep -q '^name: ' "$skill_file"; then
echo "missing name field: $skill_file"
status=1
fi
if ! grep -q '^description: ' "$skill_file"; then
echo "missing description field: $skill_file"
status=1
fi
declared_name="$(sed -n 's/^name: //p' "$skill_file" | head -n 1 | tr -d '"')"
if [[ "$declared_name" != "$skill_name" ]]; then
echo "name mismatch: $skill_file declares '$declared_name' but directory is '$skill_name'"
status=1
fi
done < <(
find "$root" -mindepth 1 -maxdepth 1 -type d \
! -name .git \
! -name .omx \
! -name docs \
! -name scripts \
! -name examples \
-print0
)
if [[ "$status" -ne 0 ]]; then
exit "$status"
fi
echo "skill layout looks valid"