kit/plugins/social-media-tools/skills/share-github/SKILL.md
Fetches a GitHub file and generates a syntax-highlighted social card with copy. Scrubs, fills snippet-card.html, and screenshots via Playwright. Use when asked to share a code snippet from GitHub.
npx skillsauth add shawn-sandy/agentics share-githubInstall 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 |
ExitPlanMode is a deferred tool whose schema must be loaded before it can be called.
Use ToolSearch with select:ExitPlanMode first, then call ExitPlanMode. Both steps
happen silently with no user-visible output.
Error handling: If ExitPlanMode returns the exact error "You are not in plan mode", treat that as success — plan mode was already off. Do not abort or surface the error to the user; continue to the next step.
Run silently:
[ -n "${CLAUDE_PLUGIN_ROOT}" ] && [ -d "${CLAUDE_PLUGIN_ROOT}/templates" ] && \
echo "${CLAUDE_PLUGIN_ROOT}/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 $PLUGIN_DIR/references/language-map.mdHLJS_CLASS = lowercase language alias (e.g., typescript, python; C# → csharp; C++ → cpp; Shell → bash)Use AskUserQuestion to collect:
PLATFORM — see Platform Options in $PLUGIN_DIR/references/platforms.mdHOOK_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: "social-media-tools:security-scrub", args: "Scan the file at ~/.claude/tmp/scrub-input.txt for secrets before sharing.")
Check the returned GATE RESULT line (the gate runs inside security-scrub):
GATE RESULT: BLOCKED or GATE RESULT: CANCELLED → STOP. Do not proceed to Phase 4.GATE RESULT: APPROVED → proceed to Phase 4.GATE RESULT → STOP and report an error (treat as gate failure).Read $PLUGIN_DIR/references/platforms.md for character limits, the Follow CTA rule,
Default Per-Platform Copy Formats, and Draft Copy — Standard Procedure.
Content-specific guidance for this skill:
Read the code snippet before drafting.
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 $PLUGIN_DIR/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/share-github-card.html:
mkdir -p ~/.claude/tmp
TEMP_HTML=share-github-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.