No slash command · from snowflake-cortex-code
Routes Snowflake operations to either a local Cortex Code CLI or a remote MCP backend. Handles backend selection, CLI verification, and request routing for data quality, governance, and query analysis tasks.
Ships in snowflake-cortex-code. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Route Snowflake operations to the selected Cortex Code backend.
Before any CLI check or routing script, run:
bash "${CLAUDE_PLUGIN_ROOT}/scripts/run_python.sh" "${CLAUDE_PLUGIN_ROOT}/scripts/router/backend.py"
Codex may use ${PLUGIN_ROOT} instead of
${CLAUDE_PLUGIN_ROOT}. In Devin, use the absolute plugin root the prompt hook gives you. Stop on an error; do not guess a backend.
remote: read and follow Remote MCP delegation,
using only the exact tool returned by the helper. Do not run the local steps
below, install Cortex, or disable the managed MCP connection. The remote
workflow handles approval consent, schema checks, context and continuation.local: follow the existing CLI workflow below.The local CLI has specialized bundled skills (data-quality, semantic views, cost-intelligence, ML, governance, etc.).
CRITICAL: Follow steps 1 → 2 → 3 in order. Do NOT skip to Step 3.
In Devin CLI and Devin Desktop, ${CLAUDE_PLUGIN_ROOT} is not set in your shell. The prompt hook gives
the exact commands with absolute paths: run those instead of the ones below.
which cortex 2>/dev/null && cortex --version
If cortex is NOT found:
snowflake-cortex-code:cortex-setup skill using the Skill tool.Run the routing script to check if this prompt should go to Cortex or stay in Claude Code:
bash "${CLAUDE_PLUGIN_ROOT}/scripts/run_python.sh" "${CLAUDE_PLUGIN_ROOT}/scripts/router/route_request.py" --prompt "USER_PROMPT_HERE"
Replace USER_PROMPT_HERE with the actual user prompt (shell-escaped).
The shared launcher selects python3, or python only after verifying Python 3.
Use Bash (Git Bash on Windows). It never retries a failed script under another interpreter.
If routing fails, STOP and report the error; do not bypass a configuration/policy error.
Read the output carefully:
"route": "cortex" → proceed to Step 3"route": "claude" → STOP. Handle the request yourself with your own tools (sql_execute, Read, Write, etc.). Do NOT run execute_cortex.py.Only reach this step if Step 2 confirmed routing to Cortex.
Choose a security envelope based on the operation:
Default to RO. Use RW only when the user asked to create, alter, load or delete something.
bash "${CLAUDE_PLUGIN_ROOT}/scripts/run_python.sh" "${CLAUDE_PLUGIN_ROOT}/scripts/router/execute_cortex.py" \
--prompt "USER_PROMPT_HERE" \
--envelope "RO"
Add --connection CONNECTION_NAME if a specific Snowflake connection is needed.
--resume-last vs freshEvery cortex invocation returns a session_id that the router persists. Follow-up
turns can resume that session so Cortex sees the prior conversation -- real
multi-turn, not one-shot batches per prompt.
--resume-last when the current prompt is a continuation of the
previous Cortex turn: "keep going", "apply the top suggestion", "dig deeper",
"also show me ...", "and for last quarter", "fix that", or any clarification
of an answer Cortex just gave.--resume-last (start fresh) when the user switches topics, asks
about a different database/warehouse, or begins a clearly new task.--resume <session_id> is also accepted if you have an explicit id.# Follow-up on the previous Cortex turn
bash "${CLAUDE_PLUGIN_ROOT}/scripts/run_python.sh" "${CLAUDE_PLUGIN_ROOT}/scripts/router/execute_cortex.py" \
--prompt "drill into the top customer" --envelope "RO" \
--resume-last
Timeout: This command may take 30-90 seconds. If it takes longer than 2 minutes, it likely hung — kill the process and tell the user to try $cortex-run for direct invocation.
Format Cortex's output for the user:
--resume-last (see Step 3)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub snowflake-labs/snowflake-ai-kit --plugin snowflake-cortex-code3 skills in this plugin
/cortex-runONLY load this skill when the user explicitly types $cortex-run, /cortex-run, or /snowflake-cortex-code:cortex-run (Devin CLI and Desktop). NEVER load this skill from auto-routing hooks or keyword matching. For auto-routed prompts, use snowflake-cortex-code:cortex-router instead./cortex-setupSets up the selected Cortex Code backend: local CLI or host-authenticated remote MCP. Use when cortex is not installed, when the user asks to set up Cortex Code, when routing fails because the CLI is missing, or when the configured remote tool is missing or needs authentication. In Devin, also installs Snowflake AIM for database migrations (local mode). Triggers: setup cortex, install cortex, cortex not found, CLI not installed, set up snowflake, install AIM, set up migrations, configure remote MCP.Other plugins' skills for the same job