pfp-scripts
The pfp.py script, copied out by the install command in icon-setup. Never read or retype it.
от brokep★ 48 звёзд на GitHub
Установить pfp-scripts в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
pfp-scripts
Part of the Pfp Bot agent preset.
pfp-scripts
The pfp.py script. The install command in icon-setup copies it out by its marker, so never read or retype it. Commands: warm, prep, preview, finish, love, tweak, state. Each prints one JSON line.
#!/usr/bin/env python3
# PFP_TOOLS_V1: file chores for Pfp Bot, using only Python and the box's own ffmpeg.
# Every command prints one JSON line.
import argparse
import glob
import json
import os
import re
import shutil
import subprocess
import time
import urllib.request
HOME = os.environ.get("PFP_HOME", "/workspace/pfp-bot")
AGENTS = os.environ.get("PFP_AGENTS", "/home/box/agent-data/agents")
FFMPEG = os.environ.get("PFP_FFMPEG", shutil.which("ffmpeg") or "")
STATE = os.path.join(HOME, "state.json")
OUT = os.path.join(HOME, "out")
DONE = os.path.join(HOME, "warm.done")
LOCK = os.path.join(HOME, "warm.lock")
SITE = "https://grokbot-icon-studio.serio-ai.chatgpt.site/images/"
SITE_REFS = [
("pink.png", "style-ref-site-1.png"),
("blonde.jpg", "style-ref-site-2.jpg"),
("teal.jpg", "style-ref-site-3.jpg"),
]
SQUARE = "crop='min(iw,ih)':'min(iw,ih)':0:'ih-min(iw,ih)'"
def load():
try:
with open(STATE) as f:
return json.load(f)
except (OSError, ValueError):
return {"next": 1, "tweaks": [], "loved": [], "candidates": {}}
def save(st):
os.makedirs(HOME, exist_ok=True)
with open(STATE, "w") as f:
json.dump(st, f, indent=1)
def fetch(url, dest):
req = urllib.request.Request(url, headers={"User-Agent": "Mozilla/5.0 pfp-bot"})
with urllib.request.urlopen(req, timeout=30) as resp:
data = resp.read()
with open(dest, "wb") as f:
f.write(data)
def kind(path):
with open(path, "rb") as f:
head = f.read(12)
if head.startswith(b"\xff\xd8\xff"):
return ".jpg"
if head.startswith(b"\x89PNG"):
return ".png"
if head.startswith(b"RIFF") and head[8:12] == b"WEBP":
return ".webp"
return None
def check(path):
ext = kind(path)
w = h = None
if FFMPEG:
info = subprocess.run([FFMPEG, "-hide_banner", "-i", path], capture_output=True, text=True).stderr
m = re.search(r"Video:.*?\b(\d{2,5})x(\d{2,5})\b", info)
if m:
w, h = int(m.group(1)), int(m.group(2))
if ext is None and w is None:
raise ValueError("not a readable image")
return {"path": path, "w": w, "h": h, "small": bool(w and min(w, h) < 200)}
def ffmpeg(src, dest, vf=None):
cmd = [FFMPEG, "-y", "-v", "error", "-i", src, "-frames:v", "1", "-update", "1"]
if vf:
cmd += ["-vf", vf]
if dest.endswith(".jpg"):
cmd += ["-q:v", "2"]
subprocess.run(cmd + [dest], check=True, capture_output=True)
return dest
def sized(src, dest, px):
if FFMPEG:
try:
return ffmpeg(src, dest, SQUARE + ",scale=%d:%d:flags=lanczos" % (px, px))
except (OSError, subprocess.CalledProcessError):
pass
return src
def stage(src, stem):
# GenerateImage reads the image type from the file extension, so copies get the real one.
ext = kind(src)
if FFMPEG and ext not in (".jpg", ".png"):
return check(ffmpeg(src, stem + ".jpg"))
if ext is None:
raise ValueError("not a JPEG, PNG, or WebP image")
shutil.copyfile(src, stem + ext)
return check(stem + ext)
def agent_of(path):
parts = os.path.normpath(path).split(os.sep)
for i in range(len(parts) - 3):
if parts[i] == "agents" and parts[i + 2] in ("attachments", "assets", "downloads"):
return os.sep.join(parts[: i + 2])
return None
def find_media(name):
hits = []
for p in glob.glob(os.path.join(AGENTS, "*", "profile.json")):
try:
with open(p) as f:
if json.load(f).get("name", "").strip().lower() == name.strip().lower():
hits.append((os.path.getmtime(p), os.path.dirname(p)))
except (OSError, ValueError):
pass
return [d for _, d in sorted(hits, reverse=True)]
def pick_refs(st):
loved = [p for p in st.get("loved", []) if os.path.exists(p)]
site = [p for p in st.get("site_refs", []) if os.path.exists(p)]
return (loved[::-1] + site)[:2]
def rehome(st, media):
os.makedirs(media, exist_ok=True)
def move(path):
dest = os.path.join(media, os.path.basename(path))
if os.path.exists(path) and not os.path.exists(dest):
shutil.copyfile(path, dest)
return dest if os.path.exists(dest) else None
st["media"] = media
st["site_refs"] = [p for p in map(move, st.get("site_refs", [])) if p]
st["loved"] = [p for p in map(move, st.get("loved", [])) if p]
st["sources"] = [check(p) for p in (move(s["path"]) for s in st.get("sources", [])) if p]
st["refs"] = pick_refs(st)
save(st)
def warm(args):
st = load()
media = args.media or st.get("media")
if not media:
hits = find_media(arg
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл pfp-scripts?
The pfp.py script, copied out by the install command in icon-setup. Never read or retype it.
Как установить скилл pfp-scripts?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл pfp-scripts запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
theme-factory
AnthropicToolkit for styling artifacts with a theme. These artifacts can be slides, docs, reportings, HTML landing pages, etc. There are 10 pre-set themes with…
access
AnthropicManage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…
configure
AnthropicSet up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how…
access
AnthropicManage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed…