design-rules 1.4 KB

12345678910111213141516171819202122232425
  1. #!/bin/sh
  2. # SessionStart: adds a short pointer to the design skill, so design requests load the skill instead of
  3. # being answered from scratch when the skill description alone does not trigger it. The workflow itself
  4. # stays in skills/design/SKILL.md and is read only when the skill loads, not in every session.
  5. # The base directory is stated because the skill links its files relative to it.
  6. # POSIX sh only, so it also runs where Node is not installed (single-file CLI, desktop).
  7. # Every failure path exits 0 without output, so a missing file never blocks a session.
  8. root=${CLAUDE_PLUGIN_ROOT:-${ZCODE_PLUGIN_ROOT:-$(CDPATH= cd -- "$(dirname -- "$0")/.." 2>/dev/null && pwd)}}
  9. case "$root" in
  10. *\\*) command -v cygpath >/dev/null 2>&1 && root=$(cygpath -u "$root") ;;
  11. esac
  12. skill_dir="$root/skills/design"
  13. [ -r "$skill_dir/SKILL.md" ] || exit 0
  14. # Git Bash on Windows yields /c/Users/...; the agent's file tools run in Node and need C:/Users/....
  15. command -v cygpath >/dev/null 2>&1 && skill_dir=$(cygpath -m "$skill_dir")
  16. # JSON-escape backslashes and quotes in the path.
  17. base=$(printf '%s' "$skill_dir" | sed 's/\\/\\\\/g; s/"/\\"/g')
  18. printf '%s' '{"hookSpecificOutput":{"hookEventName":"SessionStart","additionalContext":"'
  19. printf '%s' 'For an HTML design, prototype, HTML deck or redesign, load the `design` skill first. '
  20. printf '%s' "Its paths are relative to: $base"
  21. printf '%s\n' '"}}'
  22. exit 0