From cortex-code
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 cortex-code:cortex-router instead.
npx claudepluginhub snowflake-labs/snowflake-ai-kit --plugin snowflake-cortex-codeThis skill uses the workspace's default tool permissions.
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.
Conducts multi-round deep research on GitHub repos via API and web searches, generating markdown reports with executive summaries, timelines, metrics, and Mermaid diagrams.
Share bugs, ideas, or general feedback.
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 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:
cortex-code:cortex-setup skill using the Skill tool.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:
python "${CLAUDE_PLUGIN_ROOT}/scripts/router/execute_cortex.py" \
--prompt "USER_PROMPT_HERE" \
--envelope "RW"
For read-only queries:
python "${CLAUDE_PLUGIN_ROOT}/scripts/router/execute_cortex.py" \
--prompt "USER_PROMPT_HERE" \
--envelope "RO"
To specify a Snowflake connection:
python "${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).
--resume-last vs freshEvery 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.
--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
python "${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)
--resume-last for follow-up prompts so Cortex retains conversation context. For new topics, omit it and include relevant context in the prompt instead.--dangerously-allow-all-tool-calls flag (used by execute_cortex.py) auto-approves all tool calls; security envelope is enforced via prompt-level instructions.