cortex-router
Auto-routing skill loaded by the prompt filter hook. Routes Snowflake-related operations to Cortex Code CLI. Not for direct…
ONLY load this skill when the user explicitly types $cortex-run or /cortex-run. NEVER load this skill from auto-routing hooks or keyword matching. For auto-routed prompts, use snowflake-cortex-code:cortex-router instead.
Claude Code
$ npx -y skills add Snowflake-Labs/snowflake-ai-kit --skill cortex-run --agent claude-code
Codex
$ npx skills add Snowflake-Labs/snowflake-ai-kit --skill cortex-run -a codex -y
Cursor
$ npx skills add Snowflake-Labs/snowflake-ai-kit --skill cortex-run -a cursor -y
Gemini CLI
$ npx skills add Snowflake-Labs/snowflake-ai-kit --skill cortex-run -a gemini-cli -y
GitHub Copilot
$ npx skills add Snowflake-Labs/snowflake-ai-kit --skill cortex-run -a github-copilot -y
OpenCode
$ npx skills add Snowflake-Labs/snowflake-ai-kit --skill cortex-run -a opencode -y
Windsurf
$ npx skills add Snowflake-Labs/snowflake-ai-kit --skill cortex-run -a windsurf -y
name: cortex-run description: "ONLY load this skill when the user explicitly types $cortex-run or /cortex-run. NEVER load this skill from auto-routing hooks or keyword matching. For auto-routed prompts, use snowflake-cortex-code:cortex-router instead." license: Proprietary. See LICENSE-SKILLS.md for complete terms user-invocable: true metadata: author: Snowflake version: 1.0.0
Send a prompt directly to Cortex Code CLI, bypassing the auto-routing keyword filter. Use this when the user explicitly wants Cortex Code to handle their request.
Cortex Code CLI must be installed and on PATH:
which cortex && cortex --version
If `cortex` is not found, load the `snowflake-cortex-code:cortex-setup` skill to install it. Do NOT proceed without it.
**This step is mandatory. Do it first, every time.**
which cortex 2>/dev/null && cortex --version
If `cortex` is NOT found or the command fails: 1. Tell the user: "Cortex Code CLI is not installed. Setting it up now." 2. Load the `snowflake-cortex-code:cortex-setup` skill using the Skill tool. 3. Follow its instructions to install the CLI. 4. **STOP here** — do NOT proceed to Step 2 until the CLI is installed and working.
The user's message after `$cortex-run` is the prompt to send. If the user typed only `$cortex-run` with no additional text, ask what they want to do in Snowflake.
Pick the envelope based on what the operation needs:
| Envelope | Use when | Blocks | |----------|----------|--------| | **RO** | Queries, reads, exploration | Edit, Write, destructive Bash | | **RW** | Data modifications, DDL | Destructive Bash (rm -rf, sudo) | | **RESEARCH** | Exploration + web access | Edit, Write, destructive Bash | | **DEPLOY** | Full access needed | Nothing |
Default to **RW** unless the request is clearly read-only.
Run the prompt through the execution script:
Use the shared launcher in Bash (Git Bash on Windows). It prefers `python3`, accepts `python` only if it is Python 3, and never retries a failed script. On a configuration/policy error, STOP and report it; do not switch interpreters or bypass the plugin.
bash "${CLAUDE_PLUGIN_ROOT}/scripts/run_python.sh" "${CLAUDE_PLUGIN_ROOT}/scripts/router/execute_cortex.py" \
--prompt "USER_PROMPT_HERE" \
--envelope "RW"For read-only queries:
bash "${CLAUDE_PLUGIN_ROOT}/scripts/run_python.sh" "${CLAUDE_PLUGIN_ROOT}/scripts/router/execute_cortex.py" \
--prompt "USER_PROMPT_HERE" \
--envelope "RO"To specify a Snowflake connection:
bash "${CLAUDE_PLUGIN_ROOT}/scripts/run_python.sh" "${CLAUDE_PLUGIN_ROOT}/scripts/router/execute_cortex.py" \
--prompt "USER_PROMPT_HERE" \
--envelope "RW" \
--connection "connection_name"Format Cortex's output for the user:
Before sending the prompt, prepend relevant context from the current Claude Code conversation:
# Context from Claude Code Session [Last 2-3 relevant exchanges — Snowflake-specific details only] # User Request [The original prompt]
Keep context minimal — Cortex only sees what you send in each prompt (unless resuming a session).
Every Cortex invocation returns a `session_id` that is persisted automatically. Follow-up turns can resume that session so Cortex sees the prior conversation — real multi-turn, not one-shot batches per prompt.
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.
about a different database/warehouse, or begins a clearly new task.
# Follow-up on the previous Cortex turn
bash "${CLAUDE_PLUGIN_ROOT}/scripts/run_python.sh" "${CLAUDE_PLUGIN_ROOT}/scripts/router/execute_cortex.py" \
--prompt "also show me the column types" --envelope "RO" \
--resume-last**User**: `$cortex-run show me tables in the RAW schema`
**User**: `$cortex-run create a dynamic table that aggregates daily sales`
**User**: `$cortex-run` (no prompt)
Connect your AI coding agent to Snowflake. Plugins for Claude Code and OpenAI Codex that automatically detect Snowflake prompts and route them to Cortex Code — where 55+ built-in skills handle SQL, data governance, dynamic tables, ML, and more.
Auto-routing skill loaded by the prompt filter hook. Routes Snowflake-related operations to Cortex Code CLI. Not for direct…
Install Snowflake CLI and Cortex Code CLI. Use when cortex is not installed, when the user asks to set up Cortex Code, or when…
Use Cortex AI services — Cortex Analyst for natural-language-to-SQL through semantic views, Cortex Search for semantic search,…
Manage Database Change Management (DCM) projects in Snowflake. DCM is infrastructure-as-code for Snowflake objects — databases,…
Discover databases, schemas, tables, views, and columns in Snowflake. Use when the user wants to understand what data is…
Audit data access, inspect masking and row access policies, review tags and classification, and analyze role hierarchies and…
You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…
Ask which skill or flow fits your situation. A router over the skills in this repo.