Skip to content

mgiovani/ai-arsenal / skills/anything-to-skill

anything-to-skill

Verified

Turns a docs site, local folder, PDF or book, YouTube video, playlist or channel, or a topic into a source-grounded, token-efficient agent skill (hub SKILL.md, sectioned references, INDEX, evals), and can compact it into a lean expert skill. Use for "make a skill from these docs", "turn this channel into a skill". Not for a skill from your own description (use create-skill), improving one (use improve-skill) or finding third-party skills (use find-skills).

FileKindSize
SKILL.mdskill md29.0 KB
assets/templates/SKILL.md.tmplother53 B
assets/templates/evals.json.tmplother41 B
assets/templates/trigger-eval.json.tmplother9 B
evals/evals.jsonconfig6.2 KB
evals/trigger-eval.jsonconfig1.9 KB
references/compaction.mdmarkdown5.8 KB
references/evals.mdmarkdown2.9 KB
references/extending.mdmarkdown2.6 KB
references/generated-skill-layout.mdmarkdown7.1 KB
references/interview.mdmarkdown2.7 KB
references/judge.mdmarkdown3.5 KB
references/sources.mdmarkdown11.1 KB
scripts/a2s.pyexecutablescript520 B
scripts/anything_to_skill/__init__.pyscript0 B
scripts/anything_to_skill/cli.pyscript17.5 KB
scripts/anything_to_skill/compact/__init__.pyscript0 B
scripts/anything_to_skill/compact/brief.pyscript8.2 KB
scripts/anything_to_skill/compact/freeze.pyscript3.5 KB
scripts/anything_to_skill/compact/gate.pyscript2.8 KB
scripts/anything_to_skill/compact/layout.pyscript1.6 KB
scripts/anything_to_skill/compact/swap.pyscript3.8 KB
scripts/anything_to_skill/compact/verify.pyscript15.4 KB
scripts/anything_to_skill/core/__init__.pyscript0 B
scripts/anything_to_skill/core/models.pyscript3.1 KB
scripts/anything_to_skill/core/sanitize.pyscript2.1 KB
scripts/anything_to_skill/core/ssrf.pyscript1.8 KB
scripts/anything_to_skill/core/store.pyscript13.8 KB
scripts/anything_to_skill/core/tokens.pyscript147 B
scripts/anything_to_skill/core/workspace.pyscript4.7 KB
scripts/anything_to_skill/emit/__init__.pyscript0 B
scripts/anything_to_skill/emit/link.pyscript612 B
scripts/anything_to_skill/emit/templates.pyscript398 B
scripts/anything_to_skill/emit/verify.pyscript9.7 KB
scripts/anything_to_skill/emit/write.pyscript21.0 KB
scripts/anything_to_skill/laya/__init__.pyscript0 B
scripts/anything_to_skill/laya/apply.pyscript3.1 KB
scripts/anything_to_skill/laya/brain.pyscript6.9 KB
scripts/anything_to_skill/laya/client.pyscript2.2 KB
scripts/anything_to_skill/laya/factcheck.pyscript10.5 KB
scripts/anything_to_skill/laya/judge.pyscript6.8 KB
scripts/anything_to_skill/laya/questions.pyscript2.1 KB
scripts/anything_to_skill/plan/__init__.pyscript0 B
scripts/anything_to_skill/plan/brief.pyscript8.1 KB
scripts/anything_to_skill/plan/index.pyscript912 B
scripts/anything_to_skill/plan/pack.pyscript16.6 KB
scripts/anything_to_skill/plan/priority.pyscript5.0 KB
scripts/anything_to_skill/plan/tree.pyscript19.1 KB
scripts/anything_to_skill/scan/__init__.pyscript0 B
scripts/anything_to_skill/scan/credentials.pyscript1.1 KB
scripts/anything_to_skill/scan/injection.pyscript1.9 KB
scripts/anything_to_skill/scan/quotes.pyscript8.4 KB
scripts/anything_to_skill/scan/unicode.pyscript691 B
scripts/anything_to_skill/sources/__init__.pyscript1.2 KB
scripts/anything_to_skill/sources/local/__init__.pyscript0 B
scripts/anything_to_skill/sources/local/convert.pyscript4.6 KB
scripts/anything_to_skill/sources/local/detect.pyscript178 B
scripts/anything_to_skill/sources/local/run.pyscript4.5 KB
scripts/anything_to_skill/sources/local/walk.pyscript1.1 KB
scripts/anything_to_skill/sources/web/__init__.pyscript0 B
scripts/anything_to_skill/sources/web/browser.pyscript4.2 KB
scripts/anything_to_skill/sources/web/detect.pyscript144 B
scripts/anything_to_skill/sources/web/discover.pyscript21.4 KB
scripts/anything_to_skill/sources/web/extract.pyscript13.0 KB
scripts/anything_to_skill/sources/web/fetch.pyscript8.7 KB
scripts/anything_to_skill/sources/web/frontier.pyscript9.5 KB
scripts/anything_to_skill/sources/web/run.pyscript12.6 KB
scripts/anything_to_skill/sources/web/throttle.pyscript7.3 KB
scripts/anything_to_skill/sources/youtube/__init__.pyscript0 B
scripts/anything_to_skill/sources/youtube/asr.pyscript1.5 KB
scripts/anything_to_skill/sources/youtube/captions.pyscript2.4 KB
scripts/anything_to_skill/sources/youtube/detect.pyscript313 B
scripts/anything_to_skill/sources/youtube/frames.pyscript3.8 KB
scripts/anything_to_skill/sources/youtube/funnel.pyscript7.4 KB
scripts/anything_to_skill/sources/youtube/listing.pyscript5.8 KB
scripts/anything_to_skill/sources/youtube/run.pyscript21.5 KB
scripts/anything_to_skill/sources/youtube/vtt.pyscript3.3 KB
scripts/convert_docling.pyexecutablescript513 B
scripts/crawl_brain.pyexecutablescript637 B
scripts/ingest_local.pyexecutablescript463 B
scripts/ingest_web.pyexecutablescript593 B
scripts/ingest_youtube.pyexecutablescript533 B
scripts/judge.pyexecutablescript481 B
scripts/transcribe.pyexecutablescript689 B
scripts/verify_laya.pyexecutablescript925 B
scripts/youtube_brain.pyexecutablescript598 B

scripts/anything_to_skill/sources/web/throttle.py

View on GitHub
import asyncio
import random
import time
from collections.abc import Awaitable, Callable
from dataclasses import dataclass
from email.utils import parsedate_to_datetime
from http import HTTPStatus

from protego import Protego

ROBOTS_TTL_S = 86400
MAX_WAIT_S = 300.0
BLOCK_STATUSES = (429, 403)
THROTTLE_STATUSES = (429, 503)
# Statuses that say nothing about the host's mood (missing pages are normal in a crawl).
HEALTHY_ERRORS = (404, 410)

LogFn = Callable[..., None]


class HostBlockedError(Exception):
    """The circuit breaker gave up on this host: a probe after the cooldown was refused too."""


def parse_retry_after(value: str | None, now: float | None = None) -> float | None:
    """Retry-After as seconds, from either a delta-seconds or an HTTP-date value."""
    if not value:
        return None
    value = value.strip()
    if value.isdigit():
        return float(value)
    try:
        when = parsedate_to_datetime(value)
    except (TypeError, ValueError):
        return None
    return max(0.0, when.timestamp() - (time.time() if now is None else now))


@dataclass
class _Host:
    limit: int
    inflight: int = 0
    ok_streak: int = 0
    next_ok: float = 0.0
    backoff_n: int = 0
    crawl_delay: float = 0.0
    blocks: int = 0
    open_until: float = 0.0
    tripped: bool = False
    probing: bool = False
    dead: bool = False


class HostThrottle:
    """Per-host politeness: AIMD concurrency, jittered delay, Retry-After, circuit breaker.

    `floor` is the minimum inter-request delay in seconds and also scales the
    backoff base, so one knob (--min-delay) slows or speeds everything together.
    Only events worth showing (backoff, breaker) go to `log`, not every request.
    """

    def __init__(
        self,
        log: LogFn | None = None,
        *,
        floor: float = 1.0,
        start: int = 2,
        ceiling: int = 4,
        grow_after: int = 8,
        breaker_after: int = 5,
        cooldown: float = 60.0,
        backoff_base: float | None = None,
        backoff_cap: float = MAX_WAIT_S,
        clock: Callable[[], float] = time.monotonic,
        sleep: Callable[[float], Awaitable[None]] = asyncio.sleep,
        rng: random.Random | None = None,
    ) -> None:
        self._log = log or (lambda *_a, **_k: None)
        self.floor = floor
        self.start = start
        self.ceiling = ceiling
        self.grow_after = grow_after
        self.breaker_after = breaker_after
        self.cooldown = cooldown
        self.backoff_base = 5.0 * floor if backoff_base is None else backoff_base
        self.backoff_cap = backoff_cap
        self.clock = clock
        self.sleep = sleep
        self.rng = rng or random.Random()  # noqa: S311 - jitter, not security
        self._hosts: dict[str, _Host] = {}

    def host(self, name: str) -> _Host:
        return self._hosts.setdefault(name, _Host(limit=self.start))

    def set_crawl_delay(self, host: str, seconds: float) -> None:
        self.host(host).crawl_delay = seconds

    async def acquire(self, host: str) -> None:
        h = self.host(host)
        while True:
            if h.dead:
                raise HostBlockedError(host)
            now = self.clock()
            if h.inflight >= h.limit or (h.tripped and h.inflight):
                wait = 0.05
            else:
                wait = max(h.next_ok, h.open_until) - now
            if wait <= 0:
                break
            await self.sleep(wait)
        if h.tripped:
            h.probing = True
        h.inflight += 1
        gap = max(h.crawl_delay, self.floor) * self.rng.uniform(1, 2)
        h.next_ok = max(h.next_ok, now + gap)

    def release(self, host: str, status: int, retry_after: float | None = None) -> None:
        """Report a finished request; status 0 means a network error (neutral)."""
        h = self.host(host)
        h.inflight = max(0, h.inflight - 1)
        now = self.clock()
        if h.probing:
            self._probe_result(host, h, status)
        if status in THROTTLE_STATUSES:
            self._back_off(host, h, status, retry_after, now)
        elif 0 < status < HTTPStatus.BAD_REQUEST or status in HEALTHY_ERRORS:
            h.backoff_n = 0
            h.ok_streak += 1
            if h.ok_streak >= self.grow_after and h.limit < self.ceiling:
                h.limit += 1
                h.ok_streak = 0
        if status in BLOCK_STATUSES:
            h.blocks += 1
            if h.blocks >= self.breaker_after and not h.tripped:
                h.tripped = True
                h.open_until = now + self.cooldown
                self._log(
                    host, 'breaker_open', status, self.cooldown, f'{h.blocks} blocks'
                )
        elif status != 0 and not h.tripped:
            h.blocks = 0

    def _back_off(
        self, host: str, h: _Host, status: int, retry_after: float | None, now: float
    ) -> None:
        h.limit = max(1, h.limit // 2)
        h.ok_streak = 0
        h.backoff_n += 1
        jitter = self.rng.uniform(
            0, min(self.backoff_cap, self.backoff_base * 2**h.backoff_n)
        )
        wait = min(MAX_WAIT_S, max(retry_after or 0.0, jitter))
        h.next_ok = max(h.next_ok, now + wait)
        detail = f'retry-after={retry_after:g}s' if retry_after is not None else 'jitter'
        self._log(host, 'backoff', status, wait, f'{detail}; concurrency={h.limit}')

    def _probe_result(self, host: str, h: _Host, status: int) -> None:
        h.probing = False
        if status in BLOCK_STATUSES:
            h.dead = True
            self._log(host, 'host_skipped', status, 0.0, 'probe after cooldown refused')
        elif status != 0:
            h.tripped = False
            h.blocks = 0
            self._log(host, 'breaker_closed', status, 0.0, 'probe succeeded')


class RobotsCache:
    """robots.txt per origin, cached 24h.

    A 5xx or a network error means disallow all; any 4xx means no rules (RFC 9309).
    protego does the matching, so `*`/`$` wildcards and longest-match hold on every
    supported Python, unlike urllib's parser.
    """

    def __init__(self, clock: Callable[[], float] = time.time) -> None:
        self._clock = clock
        self._entries: dict[str, tuple[float, Protego]] = {}

    def fresh(self, origin: str) -> bool:
        entry = self._entries.get(origin)
        return entry is not None and self._clock() - entry[0] < ROBOTS_TTL_S

    def load(self, origin: str, status: int | None, body: str = '') -> Protego:
        """Record a robots.txt fetch result; status None means the request failed."""
        if status == HTTPStatus.OK:
            rules = Protego.parse(body)
        elif status is None or status >= HTTPStatus.INTERNAL_SERVER_ERROR:
            rules = Protego.parse('User-agent: *\nDisallow: /')
        else:
            rules = Protego.parse('')
        self._entries[origin] = (self._clock(), rules)
        return rules

    def allowed(self, origin: str, url: str) -> bool:
        entry = self._entries.get(origin)
        return entry is not None and entry[1].can_fetch(url, '*')

    def crawl_delay(self, origin: str) -> float | None:
        entry = self._entries.get(origin)
        delay = entry[1].crawl_delay('*') if entry else None
        return float(delay) if delay is not None else None

    def sitemaps(self, origin: str) -> list[str]:
        entry = self._entries.get(origin)
        return list(entry[1].sitemaps) if entry else []
canvas-designanthropics/skillsCreate beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
docxanthropics/skillsUse this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', '.dotx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx or .dotx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
pdfanthropics/skillsUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
pptxanthropics/skillsUse this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an email or summary); editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates (.potx), layouts, speaker notes, or comments. Trigger whenever the user mentions "deck," "slides," "presentation," or references a .pptx or .potx filename, regardless of what they plan to do with the content afterward. If a .pptx or .potx file needs to be opened, created, or touched, use this skill.Stars: 198kUpdated Claude CodeCodexVerifiedInstall