Skip to content

jianshuo/claude-skills / wjs-x-improving-content

wjs-x-improving-content

Verified

Use when 王建硕 wants to systematically improve his X (Twitter) content by iterating on the content-generation prompt (prompts/x/prompt.md, used by the every-6h tweet Action) and finding which prompt version produces the highest-reach tweets. Each prompt edit is a git-SHA-versioned, numbered experiment with a hypothesis; tweets are attributed to the version live at post time and judged on median impressions per tweet. Also mines per-tweet impression data for content-feature signals (angle / length / topic) that feed the next prompt edit. North-star = impressions per tweet. Triggers — "改 X 的 prompt", "X 内容改进", "哪版 prompt 最好", "什么内容 impression 高", "improve my tweets", "A/B test the X prompt", "/wjs-x-improving-content".

FileKindSize
SKILL.mdskill md6.2 KB
inbox/.gitignoreother12 B
scripts/_common.pyexecutablescript1.5 KB
scripts/analyze-content.pyexecutablescript4.1 KB
scripts/evaluate.pyexecutablescript3.1 KB
scripts/ingest-tweets.pyexecutablescript4.3 KB
scripts/ledger.pyexecutablescript2.9 KB
scripts/scoreboard.pyexecutablescript3.7 KB
state/.gitignoreother6 B
state/SCOREBOARD.mdmarkdown1.1 KB
state/tweets.jsonlother42.1 KB
state/versions.jsonlother523 B

scripts/_common.py

View on GitHub
"""Shared helpers for wjs-x-improving-content. stdlib only."""
import json
from datetime import date, datetime
from pathlib import Path
from statistics import median

SKILL_DIR = Path(__file__).resolve().parent.parent
STATE = SKILL_DIR / "state"
TWEETS = STATE / "tweets.jsonl"
VERSIONS = STATE / "versions.jsonl"
SCOREBOARD = STATE / "SCOREBOARD.md"

# Where the prompt-generated tweets are logged, and where the X prompt lives.
HISTORY = Path.home() / ".claude/skills/wjs-tweeting-from-articles/state/history.jsonl"
REPO = Path.home() / "code/wechat-publish"
PROMPT_FILE = "prompts/x/prompt.md"  # relative to REPO

MATURITY_DAYS = 3   # impressions keep climbing; tweets younger than this don't count in verdicts
MIN_TWEETS_PER_VERSION = 5  # need at least this many mature tweets before a version verdict


def read_jsonl(path: Path):
    if not path.exists():
        return []
    return [json.loads(l) for l in path.read_text().splitlines() if l.strip()]


def write_jsonl(path: Path, rows):
    path.parent.mkdir(parents=True, exist_ok=True)
    path.write_text("".join(json.dumps(r, ensure_ascii=False) + "\n" for r in rows))


def parse_date(s):
    return datetime.strptime(s, "%Y-%m-%d").date()


def med(vals):
    vals = [v for v in vals if v is not None]
    return round(median(vals), 1) if vals else None


def cjk_len(text):
    """王建硕 tweets are CJK; count chars excluding whitespace as the length proxy."""
    return len("".join(text.split()))


def mature_tweets():
    return [t for t in read_jsonl(TWEETS) if t.get("mature")]
finishing-a-development-branchobra/superpowersUse when implementation is complete, all tests pass, and you need to decide how to integrate the workStars: 322kUpdated Claude CodeCodexVerifiedInstall
systematic-debuggingobra/superpowersUse when encountering any bug, test failure, or unexpected behavior, before proposing fixesStars: 322kUpdated Claude CodeCodexVerifiedInstall
test-driven-developmentobra/superpowersUse when implementing any feature or bugfix, before writing implementation codeStars: 322kUpdated Claude CodeCodexVerifiedInstall
skill-creatoranthropics/skillsCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.Stars: 198kUpdated Claude CodeCodexVerifiedInstall