Imported from clssck/agent-plugins (
plugins/coco-bundled-skills/skills/share-skill-and-plugin/SKILL.md). Install upstream withnpx skills add clssck/agent-plugins --skill share-skill-and-plugin. Copyright stays with the author.
When to Use
User wants to share, re-share, or stop sharing a local skill or plugin
(see trigger phrases in description:). Same-account sharing only.
The skill publishes to the Snowflake skill catalog. Prefer the Snowflake publish command when available; fall back to raw SQL when the CLI is missing or cannot express the requested options.
Artifact type (<artifact_type>)
Before Step 2, set <artifact_type> ∈ {skill, plugin}. This selects
manifest parsing, CREATE TYPE, upload layout, CLI command, and type guards.
Detection order (Step 1):
- User says "skill" or "plugin" explicitly.
- Directory contains
SKILL.mdat root →skill. - Dot-prefixed subdirectory contains
plugin.json→plugin. - Re-share / unshare via FQN or
snow://skill_catalog/...→DESCRIBEtypecolumn is authoritative (skillorplugin). - Both markers present, or neither → ⚠️ one disambiguation picker (share_interactive_prompts.md § Artifact type).
Carry <artifact_noun> = "skill" or "plugin" for user-facing copy.
Cortex Extension — user-facing one-liner
A Cortex Extension is the Snowflake schema-level object that backs every shared skill or plugin (one extension per shared artifact). It stores the files as a live version and holds the
READgrants that control who can use it.
Surface once per run before the first publish/unshare SQL the user will see.
Plugin structure (when <artifact_type> = plugin)
A plugin directory contains a hidden manifest directory (name starts with
.) with plugin.json. Common names: .cortex-plugin/, .claude-plugin/.
Discover at runtime; do not assume a fixed name.
| Field | Purpose |
|---|---|
name |
Extension object name (uppercase transform in Step 2) |
description |
Cortex Extension COMMENT on first share |
version |
Informational only |
Files upload flat under versions/live/, preserving local structure
(including the manifest directory). No skills/<basename>/ wrapper.
Skill structure (when <artifact_type> = skill)
Root SKILL.md with YAML frontmatter (name, description, summary,
info, version). Files upload under
versions/live/skills/<skill_basename>/ where <skill_basename> is
kebab-case from name.
Runtime modes
Packaging files differs by runtime. Schema ladder, extension DDL, grants, and unshare are SQL-only in both modes.
| Mode | When | Source | Upload |
|---|---|---|---|
| Sandbox or CLI | Bash + readable disk paths | Local path | PUT file://… |
| Non-sandbox (SQL-only) | Only SQL execute | Workspace snow://workspace/…/versions/live/… |
COPY FILES |
Non-sandbox: resolve default workspace once:
DESCRIBE WORKSPACE USER$<CURRENT_USER()>.PUBLIC."DEFAULT$";
Skill workspace hints: …/versions/live/.snowflake/cortex/skills/<folder>/ or
…/.snowflake/si/skills/<folder>/. See
workspaces/personal-skills-sync/SKILL.md.
Upload fallback: step_2_fallback_stage_copy.md.
Unshare (1→4→5) uses SQL only — no upload.
Interactive prompts
Every fixed-choice stop uses ask_user_question with locked labels in
share_interactive_prompts.md.
Audience state (both artifact types): <share_choice> (1/2/3),
<share_roles>, <discoverable_value>.
Do Not Do
- Do not route to generic catalog browse when intent is share / unshare.
- Do not present stopping-point choices as markdown lists when
ask_user_questionis available. - Do not handle install / consume flows.
- Do not bounce the user to Skill Manager UI for unshare.
- Do not silently change DISCOVERABLE or audience on content-only re-share.
- Do not ALTER / upload / COMMIT when manifest
name≠ catalog FQN — pivot to first-time share on the new name. - Do not share a skill into a non-skill extension or a plugin into a non-plugin extension.
- Do not use
TYPE = 'SKILL'on plugin extensions or omitTYPE = 'PLUGIN'on plugin CREATE.
Workflow
Load each step file before executing.
- step_1_collect_inputs.md
- Share: step_2_publish.md — CLI first, SQL fallback
- Share: step_3_apply_share_options.md
- Unshare: step_4_unshare.md
- Both: step_5_report_result.md
Routing
| Intent | CLI / path | Flow |
|---|---|---|
share-first-time / …-update-share-options |
Skill CLI success | 1→2→5 |
| same | Plugin CLI success, single/PUBLIC role | 1→2→5 |
| same | Plugin CLI success, multi-role | 1→2→3→5 |
| same | SQL Option B | 1→2→3→5 |
share-resync |
any | 1→2→5 |
unshare |
n/a | 1→4→5 |
| Renamed artifact | n/a | pivot share-first-time on new name |
Shared identifiers
- Extension name: manifest
name→ uppercase,-/whitespace →_. - Skill stage folder: kebab-case from
name→skills/<skill_basename>/. - Personal DB:
USER$<CURRENT_USER()>. - Schema ladder:
SKILL_SHARING,SKILL_SHARING_<8HEX>,SKILL_SHARING_<8HEX>_<XXXX>. - Share URI:
snow://skill_catalog/<DB>.<SCHEMA>.<EXTENSION>/… - COMMENT cap: 1024 chars.
SQL quoting
Double-quote identifiers; dollar-quote string literals ($$…$$).
Failure contract
Surface Snowflake error + failing statement. No silent retries.
Stage file size and count limits
When syncing files to the Cortex Extension stage (versions/live/…), the
server enforces account limits (defaults: 50 files, 2 MB per file,
10 MB total). Limits may differ per account.
Example error (wording varies by which limit was hit):
Error: Failed to sync skill files for <DB>.<SCHEMA>.<EXTENSION> Cortex Extension
'<EXTENSION>' version exceeds the configured size or file-count limits:
file count 51 exceeds the maximum of 50
Detect a stage-limit error when the message (case-insensitive) contains
exceeds the configured size or file-count limits, or any fragment below:
| Limit violated | Message fragment |
|---|---|
| File count > max | file count {count} exceeds the maximum of {maxCount} |
| Total size > max | total size {bytes} bytes exceeds the maximum of {maxBytes} |
| Any file > max | per-file size limit of {maxBytesPerFile} bytes exceeded by: {filePaths}… |
On stage-limit error — all publish modes (CLI cortex … publish, SQL
PUT / COPY FILES, snow stage copy, or COMMIT after upload):
- Stop immediately. Do not fall back to another upload path (CLI → SQL,
PUT/COPY FILES→snow stage copy, or retry the same upload in a loop). - Surface the verbatim server or CLI error.
- Tell the user which limit was violated when the fragment makes it clear (file count, total size, or per-file size).
- Advise them to adjust the local skill or plugin (fewer/smaller files) and share again, or contact Snowflake support to raise the account limit.
- If a live version was opened (
ADD LIVE VERSIONsucceeded — i.e. the SQL path, not the CLI), you must still runALTER CORTEX EXTENSION <id> ABORT;(ignore ABORT failure). Stopping does not mean skipping ABORT — without it, theSYNC_<ts>open version leaks.
Cortex Extensions feature not enabled
On first CORTEX EXTENSION statement failure (parse / unsupported feature),
stop and tell the user sharing via Cortex Extensions is not enabled; contact
support. Do not retry or upload.