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

tests/test_persist_skill.py

View on GitHub
"""Offline regression tests for persist-skill.sh (no Cloudflare credentials)."""

import json
import os
from pathlib import Path
import subprocess
import tempfile
import unittest


SCRIPT = Path(__file__).resolve().parents[1] / "scripts" / "persist-skill.sh"


class PersistSkillTests(unittest.TestCase):
    def setUp(self):
        self.temp = tempfile.TemporaryDirectory()
        self.addCleanup(self.temp.cleanup)
        self.root = Path(self.temp.name)
        self.project = self.root / "project"
        self.project.mkdir()
        self.bin = self.root / "bin"
        self.bin.mkdir()
        # Supply a minimal cloned bundle without contacting GitHub.
        git = self.bin / "git"
        git.write_text('''#!/usr/bin/env bash
set -eu
if [[ "$*" == *sparse-checkout* ]]; then
  exit 0
fi
for destination; do :; done
mkdir -p "$destination/skills/turnstile-spin/scripts"
printf 'fixture skill\\n' > "$destination/skills/turnstile-spin/SKILL.md"
printf '#!/usr/bin/env bash\\n' > "$destination/skills/turnstile-spin/scripts/helper.sh"
''')
        git.chmod(0o755)
        self.env = {**os.environ, "PATH": str(self.bin) + os.pathsep + os.environ["PATH"]}

    def run_script(self, target):
        result = subprocess.run(
            ["bash", str(SCRIPT), "--path", str(target / "SKILL.md")],
            cwd=self.project,
            env=self.env,
            capture_output=True,
            text=True,
        )
        return result, json.loads(result.stdout)

    def test_copy_failure_is_reported(self):
        # A file where the parent directory should be prevents installation.
        parent = self.project / ".claude"
        parent.write_text("keep this file\n")
        result, output = self.run_script(parent / "skills" / "turnstile-spin")
        self.assertNotEqual(result.returncode, 0, result.stdout + result.stderr)
        self.assertEqual(output, {"status": "error", "reason": "copy_failed"})
        self.assertEqual(parent.read_text(), "keep this file\n")

    def test_copy_to_new_or_empty_directory(self):
        for existing in (False, True):
            with self.subTest(existing=existing):
                target = self.project / str(existing) / "turnstile-spin"
                if existing:
                    target.mkdir(parents=True)
                result, output = self.run_script(target)
                self.assertEqual(result.returncode, 0, result.stderr)
                self.assertEqual(output["status"], "ok")
                self.assertEqual((target / "SKILL.md").read_text(), "fixture skill\n")
                self.assertTrue(os.access(target / "scripts" / "helper.sh", os.X_OK))

    def test_nonempty_destination_is_preserved(self):
        target = self.project / "turnstile-spin"
        target.mkdir()
        existing = target / "SKILL.md"
        existing.write_text("existing skill\n")
        result, output = self.run_script(target)
        self.assertNotEqual(result.returncode, 0)
        self.assertEqual(output["reason"], "target_not_empty")
        self.assertEqual(existing.read_text(), "existing skill\n")


if __name__ == "__main__":
    unittest.main()
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