#!/usr/bin/env bash # STATUS: LIVE_VERIFIED 2026-09-18 — same sequence executed via scripts/live.py (list anthropic skills, create custom skill, # retrieve, versions list/create/retrieve, download, delete version, delete skill). Skills API is GA: no beta header needed. # Usage: source scripts/lib.sh && bash examples/anthropic/skills/skills_lifecycle.sh (requires jq) set -eo pipefail cd "$(dirname "$0")/../../.." # shellcheck disable=SC1091 source scripts/lib.sh OUTF=$(mktemp); trap 'rm -f "$OUTF"' EXIT call() { ant "$@" > "$OUTF"; OUT="$(cat "$OUTF")"; } # runs a request, keeps body in $OUT and status in $ANT_STATUS # 1. Anthropic-provided skills (observed ids: xlsx, pptx, pdf, docx) ant GET "/v1/skills?source=anthropic" | jq -c '.data[] | {id, display_name, latest_version_id}'; log_request anthropic GET /v1/skills "$ANT_STATUS" 0 "skills example list anthropic" # 2. create a tiny custom skill (multipart; files[] repeatable; SKILL.md needs YAML frontmatter name+description) tmp=$(mktemp -d); mkdir -p "$tmp/atlas-platform-agent-demo" cat > "$tmp/atlas-platform-agent-demo/SKILL.md" <<'MD' --- name: atlas-platform-agent-demo description: Tiny demo skill created by the API Atlas example; says OK when asked for a status check. --- # Atlas demo skill When the user asks for a status check, reply with exactly `OK`. MD created=$(ant POST /v1/skills -H 'Content-Type: multipart/form-data' -F "files[]=@$tmp/atlas-platform-agent-demo/SKILL.md;filename=atlas-platform-agent-demo/SKILL.md" -F 'display_name=atlas-platform-agent-demo') log_request anthropic POST /v1/skills "$ANT_STATUS" 0 "skills example create" sid=$(echo "$created" | jq -r .id); v1=$(echo "$created" | jq -r .latest_version_id); echo "created $sid latest_version_id=$v1" # 3. retrieve, versions, latest, download (zip) ant GET "/v1/skills/$sid" | jq -c '{id, display_name, source}'; log_request anthropic GET "/v1/skills/{id}" "$ANT_STATUS" 0 "skills example retrieve" ant GET "/v1/skills/$sid/versions" | jq -c '{n: (.data|length), next_page}'; log_request anthropic GET "/v1/skills/{id}/versions" "$ANT_STATUS" 0 "skills example versions" ant GET "/v1/skills/$sid/versions/latest" | jq -c '{id, name, description}'; log_request anthropic GET "/v1/skills/{id}/versions/latest" "$ANT_STATUS" 0 "skills example version latest" ant GET "/v1/skills/$sid/versions/$v1/content" > "$tmp/skill.zip"; log_request anthropic GET "/v1/skills/{id}/versions/{v}/content" "$ANT_STATUS" 0 "skills example download"; echo "downloaded $(wc -c < "$tmp/skill.zip") bytes (zip)" # 4. new version (2 files) → then delete it (only a non-last version can be deleted) v2=$(ant POST "/v1/skills/$sid/versions" -H 'Content-Type: multipart/form-data' -F "files[]=@$tmp/atlas-platform-agent-demo/SKILL.md;filename=atlas-platform-agent-demo/SKILL.md" -F "files[]=@$tmp/atlas-platform-agent-demo/SKILL.md;filename=atlas-platform-agent-demo/notes.md" | jq -r .id) log_request anthropic POST "/v1/skills/{id}/versions" "$ANT_STATUS" 0 "skills example version create"; echo "v2=$v2" ant DELETE "/v1/skills/$sid/versions/$v2" | jq -c .; log_request anthropic DELETE "/v1/skills/{id}/versions/{v}" "$ANT_STATUS" 0 "skills example version delete" # 5. delete skill (removes remaining versions) — cleanup ant DELETE "/v1/skills/$sid" | jq -c .; log_request anthropic DELETE "/v1/skills/{id}" "$ANT_STATUS" 0 "skills example delete" rm -rf "$tmp"