#!/usr/bin/env bash
# Install the "lauta" Claude Code skill.
# Source:  https://www.lauta.blog/lauta-skill.md
# Usage:   curl -fsSL https://www.lauta.blog/install-skill.sh | bash
#
# Writes the skill to ~/.claude/skills/lauta/SKILL.md so any future
# Claude Code session in this user account can invoke it via /lauta
# or natural-language phrases like "as Lauta, draft a tweet about X".

set -euo pipefail

SKILL_NAME="lauta"
SKILL_URL="https://www.lauta.blog/lauta-skill.md"
DEST_DIR="${HOME}/.claude/skills/${SKILL_NAME}"
DEST_FILE="${DEST_DIR}/SKILL.md"

if ! command -v curl >/dev/null 2>&1; then
  echo "error: curl is required but not installed." >&2
  exit 1
fi

mkdir -p "${DEST_DIR}"

if [[ -f "${DEST_FILE}" ]]; then
  cp "${DEST_FILE}" "${DEST_FILE}.backup"
  echo "↻ existing skill backed up to ${DEST_FILE}.backup"
fi

curl -fsSL "${SKILL_URL}" -o "${DEST_FILE}"

cat <<EOF

  ✓ installed lauta skill
  ↳ ${DEST_FILE}

  invoke from any Claude Code session with:
    /lauta

  or just say things like:
    "as Lauta, draft a tweet about X"
    "rewrite this paragraph in my voice"
    "what would I say to this founder?"

EOF
