kit/plugins/social-media-tools/skills/github-code-share/SKILL.md
Fetches a GitHub file and generates social media copy. Creates a syntax-highlighted card image for LinkedIn, Twitter/X, or Bluesky. Use when asked to share a code snippet or file from a GitHub repository.
npx skillsauth add shawn-sandy/agentics github-code-shareInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Fetch a specific file or snippet from a public GitHub repository, security-scrub it, draft platform-aware copy, and generate a syntax-highlighted dark-mode card image.
Public repositories only. A 4xx from the raw URL means the repo is private or the path is wrong — stop with a clear error.
| Phase | Action |
|-------|--------|
| 0 — Locate | Locate templates/ and derive PLUGIN_DIR |
| 1 — Parse URL | Extract owner/repo/branch/path + parse #L fragment before any WebFetch |
| 1c — Reuse check | Scan docs/media/social/ for existing snippet posts; offer reuse |
| 2 — Fetch Raw Code | WebFetch raw URL; extract line range; cap at 80 lines |
| 3 — Security Scrub | Write to temp file; call security-scrub skill with explicit args |
| 4 — Draft Copy | Write platform-aware copy |
| 5 — Populate Template | HTML-escape code; fill snippet-card.html; save to docs/media/social/ |
| 6 — Deliver | Copy in fenced block + PNG card + saved path |
Run silently:
ls ~/devbox/agentics/kit/plugins/social-media-tools/templates 2>/dev/null && \
echo "$HOME/devbox/agentics/kit/plugins/social-media-tools/templates"
find ~/.claude/plugins -path "*/social-media-tools/templates" -type d 2>/dev/null | head -1
find ~/.claude -path "*/social-media-tools/templates" -type d 2>/dev/null | head -1
Use the first non-empty result as TEMPLATES_DIR. Derive:
PLUGIN_DIR=$(dirname "$TEMPLATES_DIR")
If not found: output "Templates not found. Install the plugin or load it with --plugin-dir." and STOP.
https://github.com/{owner}/{repo}/blob/{branch}/{path} — standard file viewhttps://raw.githubusercontent.com/{owner}/{repo}/{branch}/{path} — raw URL#L: split on #, parse the right side:
L10 → LINE_START=10, LINE_END=10L10-L25 → LINE_START=10, LINE_END=25#... fragment from the URL — do not include it in any subsequent step.OWNER, REPO, BRANCH, FILE_PATHFILENAME = basename of FILE_PATHREPO_SLUG = OWNER/REPOLANGUAGE and LANGUAGE_COLOR from file extension — look up in references/language-map.mdHLJS_CLASS = lowercase language alias (e.g., typescript, python; C# → csharp; C++ → cpp; Shell → bash)Use AskUserQuestion to collect:
PLATFORM — LinkedIn, Twitter/X, Bluesky, or All sitesHOOK_ANGLE (optional)FILE_PREFIX=snippet
Read $PLUGIN_DIR/references/reuse-check.md and follow its procedure.
Use ToolSearch with select:WebFetch first (silent, no user output), then call WebFetch.
github.com/.../blob/...: convert to raw URL:
https://raw.githubusercontent.com/{OWNER}/{REPO}/{BRANCH}/{FILE_PATH}raw.githubusercontent.com/...: use as-is.Call WebFetch on the raw URL. Store the response body as RAW_CONTENT.
4xx response:
"This repository may be private or the file path is incorrect. This skill only supports public repositories." Then STOP.
Extract lines from RAW_CONTENT: if LINE_START/LINE_END set, use those (1-indexed); otherwise use lines 1–80.
Write the extracted snippet to a temp file:
Write to: ~/.claude/tmp/scrub-input.txt
Content: the extracted code snippet (plain text, no HTML escaping yet)
Then invoke:
Skill(skill: "code-share:security-scrub", args: "Scan the file at ~/.claude/tmp/scrub-input.txt for secrets before sharing.")
Parse the returned SCRUB RESULT block:
BLOCKED → report masked findings, STOP.WARN → surface the warning, ask user to confirm before continuing.PASS → continue silently.For character limits, read $PLUGIN_DIR/references/platforms.md.
Read the code snippet before drafting. Present in a fenced code block labelled with the platform. Wait for approval.
POST_COPY_TEXT_RAWLINKEDIN_COPY, TWITTER_COPY, BLUESKY_COPY)Apply in this exact order:
& → & ← must be first (prevents double-escaping)< → <> → >" → "Store the result as CODE_LINES_ESCAPED.
For variable reference, read $PLUGIN_DIR/references/variables.md.
| Template variable | Value |
|-------------------|-------|
| {{FILENAME}} | FILENAME (HTML-escaped) |
| {{LANGUAGE}} | HLJS_CLASS (lowercase alias, e.g. typescript) |
| {{LANGUAGE_COLOR}} | LANGUAGE_COLOR hex (from references/language-map.md only) |
| {{CODE_LINES}} | CODE_LINES_ESCAPED |
| {{LINE_RANGE}} | e.g., "L10–L25" or "lines 1–80" |
| {{REPO_SLUG}} | "OWNER/REPO" (HTML-escaped) |
| {{GITHUB_URL}} | Fragment-stripped original URL |
Read $PLUGIN_DIR/references/copy-panels.md for markup and escaping rules.
Write the populated HTML to ~/.claude/tmp/github-code-share-card.html:
mkdir -p ~/.claude/tmp
TEMP_HTML=github-code-share-card.html
FILE_PREFIX=snippet
SLUG_INPUT=$FILENAME
Read $PLUGIN_DIR/references/saving-and-delivery.md — Persistent Save section.
Read $PLUGIN_DIR/references/rendering-pipeline.md and follow the full pipeline.
Read $PLUGIN_DIR/references/saving-and-delivery.md — Deliver section.
data-ai
Craft-prompt: interviews users and assembles a structured AI prompt using Anthropic best-practice techniques. Use when the user runs /plan-agent:craft-prompt or asks to craft a prompt.
development
Generates a SOCIAL.md project sharing config by analyzing the codebase. Use when asked to set up social sharing preferences or create a SOCIAL.md file.
development
Explains how any project file, component, or concept works. Reads source files and synthesizes developer-friendly principles, social copy, and a dark-mode card. Use when asked 'how does X work' or 'explain X'.
development
Generate an HTML implementation-plan document. Produces a self-contained .html plan file with steps, acceptance criteria, and metadata. Use when the user asks to create a plan document, generate an HTML plan, or write a plan file — not for general planning questions.