Skip to content

Agent skills that give coding agents taste: art direction, reference images and a browser check instead of generic AI pages

fix: improve skill.sh help and errors

Andrew Barnes4a323b899c77
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..dfdb8b7
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1 @@
+*.sh text eol=lf
diff --git a/skill.sh b/skill.sh
index 7f19ae7..0817b90 100644
--- a/skill.sh
+++ b/skill.sh
@@ -17,9 +17,32 @@ declare -A SKILLS=(
[stitch-skill]="skills/stitch-skill/SKILL.md"
)
-if [[ $# -eq 0 ]]; then
- echo "Usage: source ./skill.sh <skill-name>"
- echo "Available skills: ${!SKILLS[@]}"
-else
- echo "${SKILLS[$1]}"
+print_help() {
+ echo "Usage: ./skill.sh <skill-name>"
+ echo " ./skill.sh --list"
+ echo
+ echo "Available skills:"
+ printf '%s\n' "${!SKILLS[@]}" | sort
+}
+
+if [[ $# -eq 0 || "$1" == "-h" || "$1" == "--help" ]]; then
+ print_help
+ exit 0
+fi
+
+if [[ "$1" == "--list" ]]; then
+ printf '%s\n' "${!SKILLS[@]}" | sort
+ exit 0
fi
+
+skill_name="$1"
+skill_path="${SKILLS[$skill_name]}"
+
+if [[ -z "$skill_path" ]]; then
+ echo "Unknown skill: $skill_name" >&2
+ echo >&2
+ print_help >&2
+ exit 2
+fi
+
+echo "$skill_path"