mgiovani/ai-arsenal / skills/anything-to-skill
anything-to-skill
VerifiedTurns 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).
scripts/anything_to_skill/compact/gate.py
View on GitHub"""The compaction eval gate: the one place the accept rule lives."""
import argparse
import json
import sys
from typing import Any
from anything_to_skill.core.workspace import Workspace
MAX_NONE = 0.8
MAX_LOSS = 0.05
MIN_GAIN = 0.1
_EPS = 1e-9
def add_args(parser: argparse.ArgumentParser) -> None:
for name in ('none', 'full', 'compact'):
parser.add_argument(
f'--{name}',
type=float,
required=True,
metavar='RATE',
help=f'pass rate (0-1) of the {name} run on the frozen evals',
)
parser.add_argument(
'--lost',
action='append',
default=[],
metavar='TEXT',
help='an assertion the full skill passed and compact failed (repeatable)',
)
def decide(none: float, full: float, compact: float) -> dict[str, Any]:
"""Accept iff compact is within 0.05 of full and at least 0.1 above no skill."""
if none > MAX_NONE + _EPS:
decision = 'strengthen-evals'
elif compact < full - MAX_LOSS - _EPS:
decision = 'reject-lost-too-much'
elif compact - none < MIN_GAIN - _EPS:
decision = 'reject-no-gain-over-none'
else:
decision = 'accept'
return {
'decision': decision,
'accepted': decision == 'accept',
'pass_rates': {'none': none, 'full': full, 'compact': compact},
}
def run(ws: Workspace, args: argparse.Namespace) -> int:
"""`a2s.py compact-gate`: print and record the accept decision; non-zero unless accepted."""
rates = (args.none, args.full, args.compact)
if not all(0 <= r <= 1 for r in rates):
print('compact-gate: pass rates are fractions between 0 and 1', file=sys.stderr)
return 2
report = decide(*rates)
report['lost_assertions'] = args.lost
try:
report['tokens'] = json.loads(ws.compact_verify_path.read_text('utf-8'))['tokens']
except (OSError, ValueError, KeyError):
report['tokens'] = None
ws.compact_gate_path.write_text(json.dumps(report, indent=2), encoding='utf-8')
tokens = report['tokens']
saved = (
f'tokens {tokens["before"]} -> {tokens["after"]} ({tokens["saved_pct"]}% saved)'
if tokens
else 'tokens: run compact-verify for the savings'
)
print(
f'compact-gate: {report["decision"]} '
f'(none {args.none}, full {args.full}, compact {args.compact}); '
f'{len(args.lost)} lost assertion(s); {saved} -> {ws.compact_gate_path}'
)
for text in args.lost:
print(f' lost: {text}')
if report['decision'] == 'strengthen-evals':
print(
f'compact-gate: no-skill pass rate above {MAX_NONE}: the evals do not measure '
'the skill; strengthen them, evals-freeze --force, re-run all three',
file=sys.stderr,
)
return 0 if report['accepted'] else 1
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| 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: 198k | Updated | Claude CodeCodex | Verified | Install |
| 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: 198k | Updated | Claude CodeCodex | Verified | Install |
| 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: 198k | Updated | Claude CodeCodex | Verified | Install |
| 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: 198k | Updated | Claude CodeCodex | Verified | Install |