Skip to content

fcakyon/claude-codex-settings / plugins/cloudflare-skills/skills/turnstile-spin

turnstile-spin

Verified

Set up, repair, or migrate to Cloudflare Turnstile bot verification in an existing frontend and backend, including server-side Siteverify.

FileKindSize
README.mdmarkdown3.8 KB
SKILL.mdskill md28.2 KB
references/astro.mdmarkdown5.8 KB
references/hugo.mdmarkdown3.8 KB
references/nextjs-app.mdmarkdown7.5 KB
references/nextjs-pages.mdmarkdown2.7 KB
references/skill-feedback.mdmarkdown2.7 KB
references/sveltekit.mdmarkdown5.4 KB
references/vanilla-html.mdmarkdown5.6 KB
scripts/auth-probe.shexecutablescript11.0 KB
scripts/persist-skill.shexecutablescript3.6 KB
scripts/validate.shexecutablescript4.3 KB
scripts/widget-create.shexecutablescript4.1 KB
tests/test_persist_skill.pyscript3.1 KB
tests/validation.mdmarkdown3.2 KB

scripts/persist-skill.sh

View on GitHub
#!/usr/bin/env bash
# Persists the canonical Spin skill bundle into the current project.

set +x
set -uo pipefail

unset CLOUDFLARE_API_TOKEN CF_API_TOKEN CLOUDFLARE_API_KEY CF_API_KEY
unset CLOUDFLARE_EMAIL CF_API_EMAIL WIDGET_SECRET TURNSTILE_SECRET
unset WRANGLER_BIN WRANGLER_VERSION
unset GITHUB_TOKEN GH_TOKEN GITLAB_TOKEN NPM_TOKEN

need_arg() {
  if [[ -z "${2-}" || "$2" == --* ]]; then
    echo "persist-skill: missing value for $1" >&2
    exit 2
  fi
}

PATH_ARG=""
while [[ $# -gt 0 ]]; do
  case "$1" in
    --path) need_arg "$1" "${2-}"; PATH_ARG="$2"; shift 2 ;;
    *) echo "persist-skill: unknown arg $1" >&2; exit 2 ;;
  esac
done

[[ -n "$PATH_ARG" ]] || { echo "persist-skill: --path required" >&2; exit 2; }
if [[ "$(basename "$PATH_ARG")" != "SKILL.md" ]]; then
  echo "persist-skill: --path must end in SKILL.md for a directory-based skill bundle" >&2
  echo '{"status":"error","reason":"file_target_not_supported"}'
  exit 2
fi

for command_name in git python3; do
  command -v "$command_name" >/dev/null 2>&1 || {
    echo "persist-skill: $command_name is required" >&2
    echo "{\"status\":\"error\",\"reason\":\"${command_name}_not_available\"}"
    exit 1
  }
done

PROJECT_ROOT="$(pwd -P)"
TARGET_DIR="$(python3 -I -c 'import os,sys; print(os.path.realpath(os.path.abspath(sys.argv[1])))' "$(dirname "$PATH_ARG")")"
if [[ "$TARGET_DIR" != "$PROJECT_ROOT" && "$TARGET_DIR" != "$PROJECT_ROOT/"* ]]; then
  echo "persist-skill: target must be inside the current project" >&2
  echo '{"status":"error","reason":"target_outside_project"}'
  exit 1
fi
if [[ -e "$TARGET_DIR" ]] && ! python3 -I -c 'import os,sys; raise SystemExit(0 if not os.listdir(sys.argv[1]) else 1)' "$TARGET_DIR"; then
  echo "persist-skill: target directory is not empty" >&2
  echo '{"status":"error","reason":"target_not_empty"}'
  exit 1
fi

if ! TEMP_DIR="$(mktemp -d "${TMPDIR:-/tmp}/turnstile-spin-persist.XXXXXX")"; then
  echo "persist-skill: could not create a temporary directory" >&2
  echo '{"status":"error","reason":"temporary_directory_failed"}'
  exit 1
fi
trap 'rm -rf "$TEMP_DIR"' EXIT

if ! git -c core.hooksPath=/dev/null clone \
  --quiet \
  --depth 1 \
  --filter=blob:none \
  --sparse \
  "https://github.com/cloudflare/skills.git" \
  "$TEMP_DIR/repo"; then
  echo "persist-skill: clone failed" >&2
  echo '{"status":"error","reason":"clone_failed"}'
  exit 1
fi
if ! git -C "$TEMP_DIR/repo" -c core.hooksPath=/dev/null sparse-checkout set skills/turnstile-spin; then
  echo "persist-skill: sparse checkout failed" >&2
  echo '{"status":"error","reason":"sparse_checkout_failed"}'
  exit 1
fi

SOURCE_DIR="$TEMP_DIR/repo/skills/turnstile-spin"
if [[ ! -f "$SOURCE_DIR/SKILL.md" ]]; then
  echo "persist-skill: canonical bundle is missing SKILL.md" >&2
  echo '{"status":"error","reason":"skill_missing"}'
  exit 1
fi

if ! python3 -I - "$SOURCE_DIR" "$TARGET_DIR" <<'PY'
import pathlib
import shutil
import sys

source = pathlib.Path(sys.argv[1])
target = pathlib.Path(sys.argv[2])
if target.exists():
    target.rmdir()
target.parent.mkdir(parents=True, exist_ok=True)
shutil.copytree(source, target, dirs_exist_ok=False)
for script in (target / "scripts").glob("*.sh"):
    script.chmod(0o755)
PY
then
  echo "persist-skill: bundle copy failed" >&2
  echo '{"status":"error","reason":"copy_failed"}'
  exit 1
fi

python3 -I - "$PATH_ARG" "$TARGET_DIR" <<'PY'
import json
import pathlib
import sys

path_arg, bundle_root = sys.argv[1], pathlib.Path(sys.argv[2])
scripts = sorted(path.name for path in (bundle_root / "scripts").glob("*.sh"))
print(json.dumps({
    "status": "ok",
    "path": path_arg,
    "bundle_root": str(bundle_root),
    "scripts": scripts,
}))
PY
brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation).Stars: 322kUpdated Claude CodeCodexVerifiedInstall
brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).Stars: 198kUpdated Claude CodeCodexVerifiedInstall