Skip to content

OffchainLabs/arbitrum-docs / .agents/skills/arbitrum-brand-svg-diagrams

arbitrum-brand-svg-diagrams

Verified

Create or improve lightweight, brand-consistent SVG concept diagrams for the Arbitrum docs, using the official Google Drive infographic asset kit as the palette/style source. Use when asked to "make a diagram more efficient", replace a bloated haw-*.svg (draw.io PNG-in-SVG exports), replace an ASCII / box-drawing diagram in an MDX page with a real image, author a new concept diagram for content/docs/how-arbitrum-works or similar, or build a diagram from the Arbitrum brand assets. Hand-authored lean vector SVG — not Mermaid, not a full Excalidraw/draw.io pipeline.

FileKindSize
SKILL.mdskill md43.3 KB
assets/background.min.svgother44.1 KB
assets/background.svgother78.8 KB
assets/bg-frag.svgother44.0 KB
tools/check_contrast.pyscript4.5 KB
tools/excalidraw_bridge.pyscript8.9 KB
tools/round_arrows.pyscript1.4 KB
tools/test_security.pyscript5.8 KB

tools/check_contrast.py

View on GitHub
#!/usr/bin/env python3
"""Check every <text> in a brand SVG against WCAG AA contrast.

Renders the diagram twice - once as authored, once with all <text> stripped -
then samples the text-free render underneath each label to learn that label's
true background. This works uniformly for text on an opaque box and for text
sitting straight on the brand gradient, where the backdrop varies by position.

Usage:
    python3 check_contrast.py static/img/NAME.svg

Exits 1 if any label fails, so it can gate a build step.
"""

import re
import subprocess
import sys
import tempfile
from pathlib import Path
import xml.dom.minidom

# WCAG AA: 4.5:1 normal text, 3:1 "large" text (>=24px, or >=18.66px bold).
AA_NORMAL, AA_LARGE = 4.5, 3.0


def luminance(hex_color):
    h = hex_color.lstrip("#")
    if len(h) == 3:
        h = "".join(c * 2 for c in h)
    srgb = [int(h[i:i + 2], 16) / 255 for i in (0, 2, 4)]
    lin = [c / 12.92 if c <= 0.03928 else ((c + 0.055) / 1.055) ** 2.4 for c in srgb]
    return 0.2126 * lin[0] + 0.7152 * lin[1] + 0.0722 * lin[2]


def contrast(fg, bg):
    a, b = luminance(fg), luminance(bg)
    hi, lo = max(a, b), min(a, b)
    return (hi + 0.05) / (lo + 0.05)


def render(svg_path, png_path):
    subprocess.run(["rsvg-convert", "-b", "#ffffff", "-z", "1", svg_path,
                    "-o", png_path], check=True)


def read_ppm(png_path):
    """Return (width, height, bytes) of RGB8 pixel data."""
    ppm = png_path.rsplit(".", 1)[0] + ".ppm"
    subprocess.run(["magick", png_path, "-depth", "8", ppm], check=True)
    data = open(ppm, "rb").read()
    fields, pos = [], 0
    while len(fields) < 4:                      # magic, width, height, maxval
        while data[pos:pos + 1].isspace():
            pos += 1
        if data[pos:pos + 1] == b"#":           # skip comment line
            pos = data.index(b"\n", pos) + 1
            continue
        start = pos
        while not data[pos:pos + 1].isspace():
            pos += 1
        fields.append(data[start:pos])
    return int(fields[1]), int(fields[2]), data[pos + 1:]


def collect_text(svg_path):
    """Yield (label, fill, font_size, weight, x, y) for each <text>."""
    doc = xml.dom.minidom.parse(svg_path)
    for node in doc.getElementsByTagName("text"):
        fill = node.getAttribute("fill") or "#000000"
        if not fill.startswith("#"):
            continue                            # url()/currentColor: skip
        try:
            size = float(node.getAttribute("font-size") or 16)
            x, y = float(node.getAttribute("x")), float(node.getAttribute("y"))
        except ValueError:
            continue
        weight = node.getAttribute("font-weight") or "400"
        label = "".join(n.data for n in node.childNodes
                        if n.nodeType == n.TEXT_NODE).strip()
        yield label, fill.lower(), size, weight, x, y


def main(svg_path):
    # A private directory prevents symlink attacks and concurrent-run collisions.
    with tempfile.TemporaryDirectory(prefix="brand-contrast-") as work:
        stripped = str(Path(work) / "notext.svg")
        png = str(Path(work) / "notext.png")
        src = Path(svg_path).read_text()
        Path(stripped).write_text(re.sub(r"<text\b.*?</text>", "", src, flags=re.S))
        render(stripped, png)
        w, h, px = read_ppm(png)

    failures = []
    print(f"{'ratio':>7}  {'need':>5}  {'size':>5}  text")
    print("-" * 72)
    for label, fill, size, weight, x, y in collect_text(svg_path):
        # Sample the visual middle of the glyphs, not the baseline.
        sx, sy = int(x), int(y - size * 0.35)
        if not (0 <= sx < w and 0 <= sy < h):
            continue
        i = (sy * w + sx) * 3
        bg = "#%02x%02x%02x" % (px[i], px[i + 1], px[i + 2])
        bold = weight in ("600", "700", "800", "900", "bold", "bolder")
        need = AA_LARGE if (size >= 24 or (size >= 18.66 and bold)) else AA_NORMAL
        ratio = contrast(fill, bg)
        ok = ratio >= need
        if not ok:
            failures.append((label, fill, bg, ratio, need))
        print(f"{ratio:7.2f}  {need:5.1f}  {size:5.0f}  "
              f"{'' if ok else 'FAIL '}{label[:46]}")

    print()
    if failures:
        print(f"{len(failures)} label(s) below WCAG AA:")
        for label, fill, bg, ratio, need in failures:
            print(f"  {ratio:.2f}:1 (need {need})  {fill} on {bg}  — {label[:50]}")
        return 1
    print("All text passes WCAG AA.")
    return 0


if __name__ == "__main__":
    if len(sys.argv) != 2:
        sys.exit(__doc__)
    sys.exit(main(sys.argv[1]))
writing-skillsobra/superpowersUse when creating new skills, editing existing skills, or verifying skills work before deploymentStars: 322kUpdated Claude CodeCodexVerifiedInstall
xlsxanthropics/skillsUse this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing .xlsx, .xlsm, .xltx, .csv, or .tsv file (e.g., adding columns, computing formulas, formatting, charting, cleaning messy data); create a new spreadsheet from scratch or from other data sources; or convert between tabular file formats. Trigger especially when the user references a spreadsheet file by name or path — even casually (like "the xlsx in my downloads") — and wants something done to it or produced from it. Also trigger for cleaning or restructuring messy tabular data files (malformed rows, misplaced headers, junk data) into proper spreadsheets. The deliverable must be a spreadsheet file. Do NOT trigger when the primary deliverable is a Word document, HTML report, standalone Python script, database pipeline, or Google Sheets API integration, even if tabular data is involved.Stars: 198kUpdated Claude CodeCodexVerifiedInstall
shipping-and-launchaddyosmani/agent-skillsPrepares production launches. Use when preparing to deploy to production, or when asking what needs to be in place before shipping. Use when you need a pre-launch checklist, when setting up monitoring, when planning a staged rollout, or when you need a rollback strategy.Stars: 119kUpdated Claude CodeCodexVerifiedInstall
childhoodthedotmack/claude-memBabysit a shipped release after merge, publication, or deployment. Verify published packages, production behavior, installed plugins, and late CI or user reports until the observation window is clean; use babysit for PR readiness before release.Stars: 118kUpdated Claude CodeCodexVerifiedInstall