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/ledger.py

View on GitHub
#!/usr/bin/env python3
"""Annotate prompt versions with intent + verdict (state/versions.jsonl).

The version *identity* comes from git (prompts/x/prompt.md short-SHA). This ledger
adds the human layer the SHA can't carry: the hypothesis behind each edit and the
final verdict. One line per version.

Subcommands:
    register SHA --hypothesis "..."   # record a new prompt version + why you changed it
    keep     SHA [--note ...]         # this version won → leave it live
    rollback SHA [--note ...]         # this version lost → git checkout the prior SHA, mark it
    list

Typical flow:
    # 1. edit prompts/x/prompt.md, commit it → new SHA appears
    # 2. register that SHA with the hypothesis
    # 3. let tweets accrue, then evaluate.py → keep / rollback
"""
import argparse, sys
from datetime import date
from pathlib import Path

sys.path.insert(0, str(Path(__file__).resolve().parent))
from _common import VERSIONS, read_jsonl, write_jsonl  # noqa: E402


def save(rows): write_jsonl(VERSIONS, rows)


def get(rows, sha):
    for r in rows:
        if r["prompt_sha"] == sha:
            return r
    return None


def cmd_register(a):
    rows = read_jsonl(VERSIONS)
    if get(rows, a.sha):
        sys.exit(f"version {a.sha} already registered.")
    n = max((r.get("id", 0) for r in rows), default=0) + 1
    rows.append({"id": n, "prompt_sha": a.sha, "hypothesis": a.hypothesis,
                 "registered": date.today().isoformat(), "status": "active",
                 "verdict": None, "notes": ""})
    save(rows)
    print(f"Registered v{n} ({a.sha}): {a.hypothesis}")


def _close(a, status):
    rows = read_jsonl(VERSIONS)
    r = get(rows, a.sha) or sys.exit(f"version {a.sha} not registered.")
    r["status"] = status
    if a.note:
        r["notes"] = (r["notes"] + " " + a.note).strip()
    save(rows)
    print(f"{a.sha} -> {status}.")
    if status == "rolled_back":
        print(f"  还原命令: git -C ~/code/wechat-publish checkout <prior-sha> -- prompts/x/prompt.md")


def cmd_list(a):
    rows = read_jsonl(VERSIONS)
    for r in rows:
        print(f"  v{r['id']} {r['prompt_sha']} [{r['status']}] {r.get('verdict') or ''} — {r['hypothesis']}")
    if not rows:
        print("  (none) — 还没登记任何 prompt 版本")


def main():
    ap = argparse.ArgumentParser()
    sub = ap.add_subparsers(dest="cmd", required=True)
    p = sub.add_parser("register"); p.set_defaults(fn=cmd_register)
    p.add_argument("sha"); p.add_argument("--hypothesis", required=True)
    p = sub.add_parser("keep"); p.set_defaults(fn=lambda a: _close(a, "kept"))
    p.add_argument("sha"); p.add_argument("--note")
    p = sub.add_parser("rollback"); p.set_defaults(fn=lambda a: _close(a, "rolled_back"))
    p.add_argument("sha"); p.add_argument("--note")
    p = sub.add_parser("list"); p.set_defaults(fn=cmd_list)
    a = ap.parse_args(); a.fn(a)


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