kit/plugins/social-media-tools/skills/share-selection/SKILL.md
Turns selected or pasted code into a platform-aware social card. Scrubs, picks a template, and screenshots via Playwright. Use when asked to share, post, or tweet highlighted or pasted code.
npx skillsauth add shawn-sandy/agentics share-selectionInstall 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.
Turn code the user selected, highlighted, opened, or pasted into platform-aware social
media copy and a styled dark-mode card image for any supported platform (see
$PLUGIN_DIR/references/platforms.md) — with the copy shaped by the user's stated objective.
This skill is selection-driven: it shares a specific piece of code the user points at. It
does not scan git history — that is code-share's job.
| Phase | Action |
|-------|--------|
| 0 — Locate | Locate templates/ and derive PLUGIN_DIR |
| 1 — Capture | Detect selected/open/pasted code + the post objective |
| 1c — Reuse check | Scan docs/media/social/ for existing posts; offer reuse |
| 2 — Scrub | Run security-scrub on the code before sharing |
| 3 — Draft | Write platform-aware copy that serves the objective |
| 4 — Pick template | diff-like → diff-card, otherwise snippet-card |
| 5 — Populate | Read template, substitute {{VARIABLES}} including {{COPY_PANELS}} |
| 5b — Save | Persistent save to docs/media/social/ |
| 6 — Screenshot | Serve HTML locally, Playwright screenshot |
| 7 — Deliver | Present copy + attach PNG + show 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:
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 no directory is found: output "Templates not found. Install the plugin or load it with --plugin-dir." and STOP.
LINE_RANGE to the highlighted range (e.g. "L42–L58").FILENAME and the language from the real path/extension.```python) when present.Capture for later phases: the code text (CODE_RAW), a filename/path hint, a language hint,
and a line range when known.
package-lock.json/*.lock, minified
bundle, or anything that isn't human-readable source): do not render it. Tell the user
what was selected and ask them to pick a code file or paste a snippet instead. STOP.snippet-card caps at ~80 lines (Phase 5). (Interactive mode) If the
source exceeds 80 lines, use AskUserQuestion to ask which region to feature (a line range,
function, or section), then use only that range. Do not silently truncate or render the
whole file. (Background mode) use the first 80 lines without asking.If none of the three sources yields code, ask the user to paste or select the code to share. Do not fall back to git history.
Determine OBJECTIVE — what the user wants the post to accomplish or emphasize:
OBJECTIVE = "highlight the performance win").AskUserQuestion that collects PLATFORM
(see Platform Options in $PLUGIN_DIR/references/platforms.md) and TONE.FILE_PREFIX=<snippet or diff> # set after Phase 4's template decision; default snippet
Read $PLUGIN_DIR/references/reuse-check.md and follow its procedure.
Selected/pasted code is untrusted and about to be published. Write it to a temp file:
Write to: ~/.claude/tmp/scrub-input.txt
Content: CODE_RAW (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 3.GATE RESULT: APPROVED → proceed to Phase 3.GATE RESULT → STOP and report an error (treat as gate failure).Read $PLUGIN_DIR/references/platforms.md for character limits, tone defaults, the
Follow CTA rule, Default Per-Platform Copy Formats, and Draft Copy — Standard
Procedure.
Draft copy that serves OBJECTIVE within each platform's limit and the chosen tone:
Inspect CODE_RAW:
+ / -, it contains @@ … @@ hunk headers, or it
was pasted in a ```diff fence → use diff-card.html, FILE_PREFIX=diff.snippet-card.html, FILE_PREFIX=snippet.CARD_TYPE=<diff or snippet>
TEMPLATE_FILE=$TEMPLATES_DIR/${CARD_TYPE}-card.html
TEMP_HTML=share-selection-card.html
SLUG_INPUT=<FILENAME or a short title for the snippet>
Read TEMPLATE_FILE. For the variable reference, read $PLUGIN_DIR/references/variables.md.
For {{COPY_PANELS}} markup and escaping, read $PLUGIN_DIR/references/copy-panels.md.
Apply to the code content in this exact order, storing the result as CODE_LINES_ESCAPED:
& → & ← first, to prevent double-escaping< → <> → >" → "Derive LANGUAGE (lowercase hljs alias) and LANGUAGE_COLOR (hex) from the file
extension or fence tag via $PLUGIN_DIR/references/language-map.md.
| Template variable | Value |
|-------------------|-------|
| {{FILENAME}} | Basename of the selected file (HTML-escaped); else snippet.<ext> / snippet.txt |
| {{LANGUAGE}} | Lowercase hljs alias (e.g. typescript, python, csharp, cpp, bash) |
| {{LANGUAGE_COLOR}} | Hex from references/language-map.md only |
| {{CODE_LINES}} | CODE_LINES_ESCAPED |
| {{LINE_RANGE}} | Highlighted/selected range (e.g. "L42–L58"); else "selected lines" |
| {{REPO_SLUG}} | Local repo slug from git remote get-url origin parsed to owner/repo; fallback the repo directory name; else empty string |
| {{GITHUB_URL}} | Empty string for local selections (footer link renders blank) |
Convert CODE_RAW into hunk rows and fill the diff-card variables per the diff-card.html
section of $PLUGIN_DIR/references/variables.md (row format, {{STAT_ADD}}/{{STAT_DEL}},
{{COPY_PANELS}}). {{FILENAME}} is the selected file name or a short title.
Write the populated HTML to ~/.claude/tmp/share-selection-card.html:
mkdir -p ~/.claude/tmp
Variables already set: FILE_PREFIX, SLUG_INPUT, TEMP_HTML.
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.