Skip to content

Harmix/open-stanley / open-stanley/skills/stanley

stanley

Verified

Your head of content. Use this whenever the user wants help with LinkedIn or X (Twitter) — writing or scheduling a post, finding things to comment on, turning a meeting, voice note, or Slack thread into a post, reviewing why a post did or didn't work, planning the week's content, or asking "what should I post". Also use it for anything that mentions Stanley, ghostwriting, personal brand, founder-led content, building in public, or growing followers, even if the user doesn't say "post". Start here; it routes to the other open-stanley skills and holds the operating rules they all share.

FileKindSize
SKILL.mdskill md14.2 KB
references/capabilities.mdmarkdown3.3 KB
references/platform-access.mdmarkdown4.0 KB
references/recommended-mcps.mdmarkdown5.5 KB
references/recommended.mcp.jsonconfig2.0 KB
references/research-linkedin-2026.mdmarkdown6.7 KB
references/scheduling.mdmarkdown8.6 KB
references/vault-backends.mdmarkdown6.8 KB
references/verify-live.mdmarkdown2.2 KB
references/why-these-rules.mdmarkdown2.1 KB
scripts/stanley-auditexecutablescript24.6 KB
scripts/stanley-briefexecutablescript6.4 KB
scripts/stanley-chartexecutablescript14.5 KB
scripts/stanley-previewexecutablescript5.8 KB
scripts/stanley-statsexecutablescript14.9 KB
scripts/stanley-traceother6.3 KB
scripts/stanley-vaultexecutablescript35.1 KB

scripts/stanley-chart

View on GitHub
#!/usr/bin/env python3
"""stanley-chart: a feed-ready data graphic from a small CSV, no image model involved.

  stanley-chart data.csv --kind treemap|bars --title "Top 30 copper miners by market cap" --unit "US$ bn" (or a pattern: --unit "${}M" prints $750M) --source "Company filings" --asof "Data as of Nov 4, 2026" [--note "..."] [--size portrait|landscape] --out chart.png

CSV columns: name,value[,group][,domain|logo][,status]. `group` colours the tiles and fills the legend; `status=target` draws a dashed outline (money announced as a target, not closed). Treemap tiles are sized by value (squarified), bars are ranked. `domain` (e.g. bhp.com)
puts the company favicon on the tile (fetched from the public icon service at render time); `logo` is a local image path. Output: an HTML file always (1200x675,
inline SVG, no external assets) and a PNG when Playwright has a Chromium on this machine; the PNG is stripped of metadata.
Used by the atlas skill for "map your vertical" posts, and by visuals for a ranked chart from the user's own numbers.
"""
import argparse, csv, sys
from pathlib import Path

PALETTE = ["#1f4e79", "#c55a11", "#548235", "#7030a0", "#2e75b6", "#ed7d31", "#70ad47", "#9966cc", "#5b9bd5", "#f4b183", "#a9d18e", "#9dc3e6"]

def esc(s): return str(s).replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;")

def fmt(v, unit):
    """`unit` is a suffix ("US$ bn") or a pattern with {} ("${}M" -> "$750M"). Trailing zeros dropped: 90, 8.7, 4.1."""
    s = f"{v:,.0f}" if v >= 100 else (f"{v:,.1f}" if v >= 10 else f"{v:,.2f}")
    if "." in s: s = s.rstrip("0").rstrip(".")
    if "{}" in (unit or ""): return unit.replace("{}", s)
    return f"{s} {unit}".strip() if unit else s

def squarify(items, x, y, w, h):
    """items: list of (label, value, ...) sorted desc. Returns rects [(x,y,w,h,item)]. Bruls et al. squarified treemap."""
    out = []; items = [i for i in items if i[1] > 0]
    total = sum(i[1] for i in items)
    if not items or total <= 0 or w <= 0 or h <= 0: return out
    scale = w * h / total
    areas = [(i, i[1] * scale) for i in items]
    def worst(row, length):
        s = sum(a for _, a in row); mx = max(a for _, a in row); mn = min(a for _, a in row)
        return max(length * length * mx / (s * s), s * s / (length * length * mn))
    row = []; rest = areas[:]
    while rest:
        length = min(w, h)
        nxt = rest[0]
        if not row or worst(row + [nxt], length) <= worst(row, length):
            row.append(nxt); rest.pop(0); continue
        # lay out row
        s = sum(a for _, a in row)
        if w >= h:   # vertical strip on the left
            cw = s / h; cy = y
            for it, a in row: ch = a / cw; out.append((x, cy, cw, ch, it)); cy += ch
            x += cw; w -= cw
        else:
            ch = s / w; cx = x
            for it, a in row: cw = a / ch; out.append((cx, y, cw, ch, it)); cx += cw
            y += ch; h -= ch
        row = []
    if row:
        s = sum(a for _, a in row)
        if w >= h:
            cw = s / h; cy = y
            for it, a in row: ch = a / cw; out.append((x, cy, cw, ch, it)); cy += ch
        else:
            ch = s / w; cx = x
            for it, a in row: cw = a / ch; out.append((cx, y, cw, ch, it)); cx += cw
    return out

# The style a real user approved after rejecting three others (2026-11-09): paper background, a newspaper grotesk,
# one muted colour per group with a legend (one colour for everything wastes a channel), white logos, the name and
# value top-left, a key for tiles too small to label, a dashed outline for money that is not closed. No mono font,
# no dark dashboard, no rainbow, no dot separators. Portrait 1080x1350 is the largest a LinkedIn feed image shows.
PAPER, INK, MUTE = "#F3F0E8", "#16181D", "#6B6F76"
GROUP_COLORS = ["#1E3A5C", "#2F6B4F", "#B4543A", "#5B4B8A", "#A07A2A", "#2C6E73", "#7A3F5E", "#4A5A6A"]
FONT = "'Schibsted Grotesk','Helvetica Neue',Helvetica,Arial,sans-serif"
FONT_LINK = '<link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Schibsted+Grotesk:wght@400;600;700&display=swap">'
WHITE = '<filter id="white"><feColorMatrix type="matrix" values="0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 1 0"/></filter>'

def group_colors(rows):
    groups = []
    for r in rows:
        if r[2] not in groups: groups.append(r[2])
    return groups, {g: GROUP_COLORS[i % len(GROUP_COLORS)] for i, g in enumerate(groups)}

def svg_treemap(rows, unit, W, H, logos="white"):
    groups, color = group_colors(rows)
    parts, small = [], []
    for (x, y, w, h, it) in squarify(rows, 0, 0, W, H):
        name, val, grp, icon, status = it
        g = 1.5; tw, th = max(0, w - 2 * g), max(0, h - 2 * g)
        target = status == "target"
        fill = PAPER if target else color[grp]
        stroke = f' stroke="{color[grp]}" stroke-width="3" stroke-dasharray="10 7"' if target else ""
        parts.append(f'<rect x="{x+g:.1f}" y="{y+g:.1f}" width="{tw:.1f}" height="{th:.1f}" fill="{fill}"{stroke}/>')
        txt = color[grp] if target else "#fff"
        big, mid = tw >= 170 and th >= 150, tw >= 96 and th >= 70
        inner = ""
        if big or mid:
            fs = min(40, max(22, int(tw * 0.085))) if big else 17
            fs = min(fs, int((tw - 24) / max(4, len(name)) * 1.75))
            inner += f'<text x="{20 if big else 10}" y="{18+fs if big else 8+fs}" font-size="{fs}" font-weight="700" fill="{txt}" letter-spacing="-0.5">{esc(name)}</text>'
            inner += f'<text x="{20 if big else 10}" y="{26+fs*1.8:.0f}" font-size="{int(fs*0.72)}" fill="{txt}" opacity="0.88">{esc(fmt(val, unit))}{" target" if target else ""}</text>' if big else \
                     f'<text x="{10}" y="{12+fs*1.8:.0f}" font-size="{int(fs*0.78)}" fill="{txt}" opacity="0.88">{esc(fmt(val, unit))}</text>'
            if icon and th > fs * 2.2 + 40:
                ls = int(min(120, min(tw, th) * 0.32)) if big else 30
                flt = ' filter="url(#white)"' if logos == "white" and not target else ""
                inner += f'<image href="{esc(icon)}" x="{tw-ls-(18 if big else 8):.0f}" y="{th-ls-(18 if big else 8):.0f}" width="{ls}" height="{ls}" preserveAspectRatio="xMidYMid meet"{flt}/>'
        else:
            small.append(f"{name} {fmt(val, unit)}")
            if icon and min(tw, th) >= 22:
                ls = int(min(tw, th) * 0.55); flt = ' filter="url(#white)"' if logos == "white" and not target else ""
                inner += f'<image href="{esc(icon)}" x="{(tw-ls)/2:.0f}" y="{(th-ls)/2:.0f}" width="{ls}" height="{ls}"{flt}/>'
        if inner: parts.append(f'<svg x="{x+g:.1f}" y="{y+g:.1f}" width="{tw:.1f}" height="{th:.1f}">{inner}</svg>')
    body = f'<defs>{WHITE}<clipPath id="frame"><rect width="{W}" height="{H}" rx="18"/></clipPath></defs><g clip-path="url(#frame)">' + "\n".join(parts) + "</g>"
    legend = [(g, color[g]) for g in groups] if len(groups) > 1 or (groups and groups[0]) else []
    return body, legend, small

def svg_bars(rows, unit, W, H, logos="white"):
    groups, color = group_colors(rows)
    n = len(rows); mx = max(r[1] for r in rows) or 1
    bh = max(16, min(40, (H - 10) / n - 8)); gap = (H - n * bh) / max(1, n)
    label_w = 300; parts = [f"<defs>{WHITE}</defs>"]
    for i, (name, val, grp, icon, status) in enumerate(rows):
        y = i * (bh + gap); bw = max(2, (W - label_w - 150) * val / mx)
        parts.append(f'<text x="{label_w-14}" y="{y+bh*0.7:.1f}" font-size="{min(20,bh*0.6):.0f}" text-anchor="end" fill="{INK}">{esc(name)}</text>')
        dash = f' fill="{PAPER}" stroke="{color[grp]}" stroke-width="2.5" stroke-dasharray="8 6"' if status == "target" else f' fill="{color[grp]}"'
        parts.append(f'<rect x="{label_w}" y="{y:.1f}" width="{bw:.1f}" height="{bh:.1f}"{dash}/>')
        parts.append(f'<text x="{label_w+bw+10:.1f}" y="{y+bh*0.7:.1f}" font-size="{min(18,bh*0.55):.0f}" fill="{INK}">{esc(fmt(val, unit))}</text>')
    legend = [(g, color[g]) for g in groups] if len(groups) > 1 else []
    return "\n".join(parts), legend, []

def build(rows, kind, title, subtitle, unit, source, note="", asof="", size="portrait", logos="white"):
    W, H = (1080, 1350) if size == "portrait" else (1200, 675)
    M = 48
    tfs = 58 if size == "portrait" else 34
    lines = wrap(title, int((W - 2 * M) / (tfs * 0.52)))
    y = M + tfs
    head = []
    for ln in lines:
        head.append(f'<text x="{M}" y="{y}" font-size="{tfs}" font-weight="700" fill="{INK}" letter-spacing="-1.5">{esc(ln)}</text>'); y += int(tfs * 1.04)
    if subtitle:
        y += 6; head.append(f'<text x="{M}" y="{y}" font-size="21" fill="{MUTE}">{esc(subtitle)}</text>'); y += 30
    for ln in wrap(note, int((W - 2 * M) / 10.5)) if note else []:
        head.append(f'<text x="{M}" y="{y+4}" font-size="20" fill="{INK}">{esc(ln)}</text>'); y += 27
    top = y + 22
    bottom = 150 if size == "portrait" else 64
    body, legend, small = (svg_treemap if kind == "treemap" else svg_bars)(rows, unit, W - 2 * M, H - top - bottom, logos)
    foot, fy = [], H - bottom + 30
    if legend:
        x = M
        for g, c in legend:
            foot.append(f'<rect x="{x}" y="{fy-13}" width="14" height="14" fill="{c}"/><text x="{x+22}" y="{fy}" font-size="16" fill="{INK}">{esc(g)}</text>'); x += 40 + int(len(g) * 8.6)
        fy += 30
    if small:
        for ln in wrap("Small boxes: " + ", ".join(small) + ".", int((W - 2 * M) / 8.2))[:3]:
            foot.append(f'<text x="{M}" y="{fy}" font-size="15" fill="{MUTE}">{esc(ln)}</text>'); fy += 21
    foot.append(f'<text x="{M}" y="{H-24}" font-size="15" fill="{MUTE}">{esc(("Source: " + source) if source and not source.lower().startswith("source") else source)}</text>')
    if asof: foot.append(f'<text x="{W-M}" y="{H-24}" font-size="15" fill="{MUTE}" text-anchor="end">{esc(asof)}</text>')
    return f"""<!doctype html><meta charset="utf-8"><title>{esc(title)}</title>{FONT_LINK}
<style>body{{margin:0;background:{PAPER}}}.card{{width:{W}px;height:{H}px;position:relative;background:{PAPER};font-family:{FONT}}}svg text{{font-family:{FONT}}}</style>
<div class="card"><svg width="{W}" height="{H}" viewBox="0 0 {W} {H}" xmlns="http://www.w3.org/2000/svg">
{"".join(head)}
<g transform="translate({M},{top})">{body}</g>
{"".join(foot)}
</svg></div>"""

def wrap(text, width):
    out, line = [], ""
    for w in (text or "").split():
        if line and len(line) + 1 + len(w) > width: out.append(line); line = w
        else: line = (line + " " + w).strip()
    if line: out.append(line)
    return out

def embed_icon(src):
    """Return a data: URI for a local file or a fetched favicon, or "" when it cannot be had (offline machine, blocked egress)."""
    if not src: return ""
    import base64, mimetypes, urllib.request
    try:
        if src.startswith("http"):
            if not src.startswith("https://"): return ""          # https only; no file:, no plain http
            with urllib.request.urlopen(src, timeout=6) as r:
                data = r.read(1_000_000 + 1); mime = r.headers.get("content-type", "image/png").split(";")[0]
                if len(data) > 1_000_000 or not mime.startswith("image/"): return ""
        else:
            data = Path(src).read_bytes(); mime = mimetypes.guess_type(src)[0] or "image/png"
        if not data or len(data) < 64: return ""
        return f"data:{mime};base64," + base64.b64encode(data).decode()
    except Exception:
        return ""

def strip_png_metadata(path):
    """Drop C2PA (caBX) and text chunks: cloud sandboxes stamp rendered PNGs and LinkedIn shows a 'Content credentials' label."""
    import struct
    d = Path(path).read_bytes()
    if d[:8] != b"\x89PNG\r\n\x1a\n": return
    out = bytearray(d[:8]); i = 8
    while i + 8 <= len(d):
        n = struct.unpack(">I", d[i:i+4])[0]; t = d[i+4:i+8]
        if t not in (b"caBX", b"tEXt", b"iTXt", b"zTXt", b"eXIf"): out += d[i:i+12+n]
        i += 12 + n
    Path(path).write_bytes(bytes(out))

def main():
    ap = argparse.ArgumentParser()
    ap.add_argument("csv"); ap.add_argument("--kind", default="treemap", choices=["treemap", "bars"])
    ap.add_argument("--title", required=True); ap.add_argument("--subtitle", default=""); ap.add_argument("--unit", default="")
    ap.add_argument("--source", default="", help="where the numbers come from, printed on the graphic"); ap.add_argument("--out", default="chart.png")
    ap.add_argument("--top", type=int, default=0, help="keep the N largest")
    ap.add_argument("--note", default="", help="one line under the title, e.g. the outlier left out of the map and why")
    ap.add_argument("--asof", default="", help="printed bottom right, e.g. 'Data as of Nov 8, 2026'")
    ap.add_argument("--size", default="portrait", choices=["portrait", "landscape"], help="portrait 1080x1350 (feed) or landscape 1200x675")
    ap.add_argument("--logos", default="white", choices=["white", "keep"], help="white: logos drawn in white on the tile; keep: original colours")
    a = ap.parse_args()
    rows = []
    with open(a.csv, newline="", encoding="utf-8") as f:
        for r in csv.DictReader(f):
            icon = ""
            if (r.get("logo") or "").strip(): icon = r["logo"].strip()
            elif (r.get("domain") or "").strip(): icon = "https://icons.duckduckgo.com/ip3/%s.ico" % r["domain"].strip().lower()
            try: rows.append((r["name"].strip(), float(str(r["value"]).replace(",", "")), (r.get("group") or "").strip(), icon, (r.get("status") or "").strip().lower()))
            except (KeyError, ValueError): sys.exit(f"bad row {r}: need name,value[,group]")
    rows.sort(key=lambda r: -r[1])
    if a.top: rows = rows[:a.top]
    rows = [(n, v, g, embed_icon(i), st) for n, v, g, i, st in rows]   # icons become data URIs or are dropped; never a broken image on the graphic
    if not rows: sys.exit("no rows")
    page = build(rows, a.kind, a.title, a.subtitle, a.unit, a.source, a.note, a.asof, a.size, a.logos)
    out = Path(a.out); html_path = out.with_suffix(".html"); html_path.write_text(page, encoding="utf-8")
    try:
        from playwright.sync_api import sync_playwright
        with sync_playwright() as p:
            b = p.chromium.launch(); W, H = (1080, 1350) if a.size == "portrait" else (1200, 675)
            pg = b.new_page(viewport={"width": W, "height": H}, device_scale_factor=2)
            pg.set_content(page)
            try: pg.wait_for_load_state("networkidle", timeout=5000)   # the web font, when the machine can fetch it
            except Exception: pass
            pg.locator(".card").screenshot(path=str(out)); b.close()
        strip_png_metadata(out)
        print(out)
    except Exception as e:
        print(f"{html_path} (no PNG: {type(e).__name__}; screenshot the HTML with a browser tool or render it where Chromium exists, then `stanley-vault image-clean`)")

if __name__ == "__main__":
    main()
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 470kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall