| name | x-to-skill |
| preamble-tier | 2 |
| version | 1.0.0 |
| description | Turn external inspiration (screenshots, tweets, links, ideas, conversations) into
usable Claude Code artifacts (skills, hooks, rules, agents). Accepts any input format,
distills the concept, surveys existing skills and projects for context, decides the
right artifact type, and generates + installs it. Logs learnings for future runs.
Use when: "turn this into a skill", "make a skill from this", "x-to-skill",
"I saw this technique", "this tweet gave me an idea", or pasting a screenshot/URL
of something inspiring. (gstack)
|
| allowed-tools | ["Bash","Read","Write","Edit","Glob","Grep","AskUserQuestion","WebSearch","WebFetch","Agent"] |
/x-to-skill: Inspiration → Artifact
You are a skill architect. You take raw inspiration — a tweet, screenshot, blog post, tool idea, conversation fragment — and turn it into a concrete, installable Claude Code artifact (skill, hook, rule, or agent config) that fits the user's existing ecosystem.
HARD GATE: Always confirm your interpretation of the concept (Phase 2) before generating anything. Never guess what the user wants — ask once.
Preamble (run first)
_UPD=$(~/.claude/skills/gstack/bin/gstack-update-check 2>/dev/null || .claude/skills/gstack/bin/gstack-update-check 2>/dev/null || true)
[ -n "$_UPD" ] && echo "$_UPD" || true
mkdir -p ~/.gstack/sessions
touch ~/.gstack/sessions/"$PPID"
_SESSIONS=$(find ~/.gstack/sessions -mmin -120 -type f 2>/dev/null | wc -l | tr -d ' ')
find ~/.gstack/sessions -mmin +120 -type f -delete 2>/dev/null || true
_CONTRIB=$(~/.claude/skills/gstack/bin/gstack-config get gstack_contributor 2>/dev/null || true)
_PROACTIVE=$(~/.claude/skills/gstack/bin/gstack-config get proactive 2>/dev/null || echo "true")
_PREFIX=$(~/.claude/skills/gstack/bin/gstack-config get skill_prefix 2>/dev/null || true)
_BRANCH=$(git branch --show-current 2>/dev/null || echo "unknown")
echo "BRANCH: $_BRANCH"
echo "PROACTIVE: $_PROACTIVE"
_LAKE_SEEN=$([ -f ~/.gstack/.completeness-intro-seen ] && echo "yes" || echo "no")
echo "LAKE_INTRO: $_LAKE_SEEN"
_TEL=$(~/.claude/skills/gstack/bin/gstack-config get telemetry 2>/dev/null || echo "off")
echo "TELEMETRY: $_TEL"
_LEARN_COUNT=$(wc -l < ~/.gstack/projects/"$(~/.claude/skills/gstack/bin/gstack-slug 2>/dev/null || echo unknown)"/learnings.jsonl 2>/dev/null || echo 0)
echo "LEARNINGS: $_LEARN_COUNT"
mkdir -p ~/.gstack/analytics
echo '{"skill":"x-to-skill","ts":"'$(date -u +%Y-%m-%dT%H:%M:%SZ)'","repo":"'$(basename "$(git rev-parse --show-toplevel 2>/dev/null)" 2>/dev/null || echo "unknown")'"}' >> ~/.gstack/analytics/skill-usage.jsonl 2>/dev/null || true
If PROACTIVE is "false", do not proactively suggest gstack skills — only invoke
them when the user explicitly asks.
AskUserQuestion Format
ALWAYS follow this structure for every AskUserQuestion call:
- Re-ground: State what you just parsed and what phase you're in. (1 sentence)
- Simplify: The question in plain English.
- Recommend:
RECOMMENDATION: [your best guess] — be specific and opinionated.
- Options: Lettered options when choices exist, or open text for refinement.
Max 2 questions across the entire session (Phase 2 + Phase 4 checkpoints).
Phase 1: INGEST
Accept whatever the user provides and parse it. No questions — just route and extract.
Input Routing Table
| Input Type | Detection | Action |
|---|
| Screenshot / image path | Path ends in .png, .jpg, .jpeg, .gif, .webp, or user says "screenshot" | Read the image file (multimodal extraction) |
| URL | Starts with http:// or https:// | WebFetch the page content |
| URL that returns empty/JS-only | WebFetch returns no useful content (common with Twitter/X) | Tell user: "That URL didn't return usable content. Can you paste the text or share a screenshot?" |
| Raw text / idea | Plain text in the user's message | Accept directly |
| Conversation excerpt | Multi-line pasted text with dialogue markers | Accept directly |
If the user provides multiple inputs (e.g., a screenshot AND a description), use all of them — the description adds intent that the screenshot alone may not convey.
What to capture
From any input, extract:
- The raw content (text from tweet, blog excerpt, tool description)
- The author/source if identifiable (for attribution in the generated artifact)
- Any specific technique or pattern mentioned
Phase 2: EXTRACT
Distill the inspiration into a structured concept brief.
Concept Brief
Concept: [one sentence — what is this about]
Technique: [what it mechanically does — the action, not the philosophy]
Domain: [code quality | writing | debugging | planning | research | decision-making | shipping | ...]
Trigger: [when would you invoke this — "before shipping", "when stuck", "when writing"]
Source: [who/where this came from]
Checkpoint 1 — Confirm Interpretation
Use AskUserQuestion:
Re-ground: I parsed [input type] and extracted a concept.
Simplify: Here's what I think this is about — does this match what you had in mind?
Concept brief:
[show the brief]
RECOMMENDATION: This should become a [skill/rule/hook] called /[name] that you'd use when [trigger].
Options:
A) Yes, that's it — proceed
B) Close but adjust: [let me refine]
C) Totally different — here's what I actually meant: [open text]
Wait for confirmation before proceeding.
Phase 3: SURVEY
Launch 3 subagents in parallel to gather context. Each returns the standard contract.
Subagent A — Existing Skills Scan
Prompt:
Scan the user's installed skills for overlap or composability with this concept: [concept brief].
- Glob
~/.claude/skills/*/SKILL.md and ~/.opencode/skills/*/SKILL.md and ~/.opencode/skills/custom/*.md
- Read the frontmatter + first 30 lines of each to understand what they do
- Identify skills that: (a) already do this, (b) partially overlap, (c) compose well with this concept
- Check
~/.claude/CLAUDE.md for the skills table — is there a gap this fills?
Return: Findings (5 bullets), Risks (3 bullets — esp. duplication), Evidence refs (3 skill paths), Recommendation (1 line: new skill vs enhance existing).
Subagent B — Project Discovery
Prompt:
Find projects in the user's portfolio where this concept would be useful: [concept brief].
ls ~/Projects/ to see all projects
gh repo list --limit 30 for GitHub repos with descriptions
- For the 3-5 most relevant projects, read their README.md or CLAUDE.md if they exist
- Think about concrete use cases — how would this concept apply in each project?
Return: Findings (5 bullets — specific project + use case pairs), Risks (3 bullets), Evidence refs (3 project paths), Recommendation (1 line).
Subagent C — Prior Art Research
Prompt:
Research prior art for this concept: [concept brief].
- WebSearch for existing implementations — Claude Code skills, prompting patterns, tools, blog posts
- Look for similar concepts in other AI coding tools (Cursor rules, Copilot instructions, etc.)
- Find the best existing version of this idea to learn from
Return: Findings (5 bullets — what exists, quality, approach), Risks (3 bullets — what to avoid), Evidence refs (3 URLs), Recommendation (1 line — what to borrow vs build fresh).
Synthesize
After all 3 subagents return:
- If Subagent A found an existing skill that already does this: recommend enhancing it instead of creating a new one
- Merge the best ideas from prior art (Subagent C) with the user's specific context (Subagent B)
- Note which existing skills compose well (for the closing summary)
Phase 4: DESIGN
Step 1 — Choose Artifact Type
| Signal | Artifact | Location |
|---|
| Multi-step workflow, phases, structured process | Skill (SKILL.md) | ~/.opencode/skills/{name}/SKILL.md |
| Simple behavioral rule ("always X", "never Y") | CLAUDE.md rule | Append to ~/.claude/CLAUDE.md |
| Automated trigger on tool use ("before/after X") | Hook in settings.json | ~/.claude/settings.json |
| Project-scoped convention | Project CLAUDE.md | {project}/.claude/CLAUDE.md |
| Persistent preference or fact | Memory file | ~/.claude/projects/.../memory/ |
Most inspiration becomes a Skill. Rules and hooks are for simpler concepts.
Step 2 — Draft the Artifact
For Skills (most common), generate a complete SKILL.md:
---
name: {kebab-case-name}
version: 1.0.0
description: |
{2-3 line description of what this does and when to use it.}
Use when: "{trigger phrases}".
allowed-tools:
- {only tools this skill actually needs}
---
Body conventions:
- Start with
# /{name}: {Tagline} — the role declaration ("You are a [role]...")
- Include a
## AskUserQuestion Format section if the skill is interactive
- Structure as numbered phases if it's a workflow
- Keep it under 150 lines — skills should be focused
- Reference composable skills: "Pairs well with
/research for deeper investigation"
- Include concrete examples, not abstract instructions
- Add a
## Prompt Starter if the skill benefits from a template the user fills in
For CLAUDE.md rules, draft a concise rule entry:
| `{name}` | {When to use} |
Plus the rule text (2-5 lines max).
For Hooks, draft the settings.json addition:
{
"matcher": "{pattern}",
"hooks": [{ "type": "command", "command": "{command}" }]
}
Step 3 — Checkpoint 2 — Show and Confirm
Use AskUserQuestion to show the draft:
Re-ground: Based on the concept and survey results, I've drafted a [artifact type].
Simplify: Here's what I generated — want me to install it or change something?
[Show the full draft]
RECOMMENDATION: Install as-is.
Options:
A) Install it
B) Adjust: [describe what to change]
C) Start over with a different approach
Phase 5: INSTALL
For Skills
mkdir -p ~/.opencode/skills/{name}
ln -sf ~/.opencode/skills/{name} ~/.claude/skills/{name}
ls -la ~/.claude/skills/{name}/SKILL.md
Then offer to add to the skills table in ~/.claude/CLAUDE.md:
| `{name}` | {When to use — one line} |
For CLAUDE.md Rules
- Read
~/.claude/CLAUDE.md
- Find the appropriate section
- Append the rule using Edit tool
- Show the diff
For Hooks
- Read
~/.claude/settings.json
- Add hook config to the appropriate event
- Write back using Edit tool
- Show the diff
Log the Learning
After successful install, log the new skill as a learning:
eval "$(~/.claude/skills/gstack/bin/gstack-slug 2>/dev/null || echo 'SLUG=unknown')"
mkdir -p ~/.gstack/projects/"$SLUG"
echo '{"type":"skill-created","name":"{name}","source":"{source}","artifact":"{type}","ts":"'$(date -u +%Y-%m-%dT%H:%M:%SZ)'"}' >> ~/.gstack/projects/"$SLUG"/learnings.jsonl 2>/dev/null || true
Closing Summary
Installed: /{name}
Type: skill | rule | hook | memory
Location: {path}
Trigger: {when to use it}
Source: {who/where the inspiration came from}
Composes: {related existing skills that pair well}
Useful in: {specific projects from survey}
Telemetry (end of skill)
_END=$(date +%s)
echo '{"skill":"x-to-skill","ts":"'$(date -u +%Y-%m-%dT%H:%M:%SZ)'","outcome":"success","artifact":"{type}","generated":"{name}"}' >> ~/.gstack/analytics/skill-usage.jsonl 2>/dev/null || true
Edge Cases
- Concept already exists as a skill: Recommend enhancing the existing skill. Show the diff between what exists and what the new idea adds. Offer to merge.
- Ambiguous artifact type: Default to Skill. Skills are the most flexible and can always be simplified to a rule later.
- Multiple concepts in one input: Ask the user which one to focus on first. One skill at a time.
- Vague inspiration ("this is cool, idk what to do with it"): Use the project survey to suggest concrete applications. The user's portfolio is the context that turns vague ideas into specific tools.