| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
This skill routes Snowflake-related operations to Cortex Code CLI, enabling coding agents to leverage specialized Snowflake expertise in headless mode.
Choose your coding agent:
| Agent | Install method | Details |
|---|---|---|
| Claude Code | npx skills add snowflake-labs/subagent-cortex-code --copy --global | → Claude Code |
| Cursor | npx skills add snowflake-labs/subagent-cortex-code --copy --global + copy routing rule | → Cursor |
| Windsurf | npx skills add snowflake-labs/subagent-cortex-code --copy --global | → Windsurf |
| Codex | bash integrations/codex/install.sh (not npx — uses cortexcode-tool) | → Codex |
| GitHub Copilot | npx skills add snowflake-labs/subagent-cortex-code --copy --global | → GitHub Copilot |
| VSCode / terminal | bash integrations/cli-tool/setup.sh | → CLI tool |
Prerequisite for all: Cortex Code CLI installed and configured.
which cortex # must return a path
cortex connections list # must show an active connectionWhen you run npx skills add snowflake-labs/subagent-cortex-code --copy --global, the skill is automatically installed for every "universal" agent the skills CLI knows about. No extra steps required — just restart the agent.
Universal agents (installed to ~/.agents/skills/cortex-code/, always included):
For the full list of 40+ supported agents (including optional opt-in ones like Continue, Goose, OpenHands, Roo Code, etc.) see the skills CLI agents catalog. The interactive npx prompt lets you select additional targets per install.
Install the skill via npx:
npx skills add snowflake-labs/subagent-cortex-code --copy --globalnpx skills add installs to ~/.agents/skills/cortex-code/. Move it into Claude Code's skills directory:
mv ~/.agents/skills/cortex-code ~/.claude/skills/cortex-codeVerify:
ls ~/.claude/skills/cortex-code/SKILL.mdStart Claude Code and mention anything Snowflake-related — the skill activates automatically.
Optional: configure security mode
cp ~/.claude/skills/cortex-code/config.yaml.example \
~/.claude/skills/cortex-code/config.yaml
# edit as needed — default is "prompt" (asks before executing)See integrations/claude-code/README.md for full details.
Step 1 — Install the skill:
npx skills add snowflake-labs/subagent-cortex-code --copy --globalThis installs skills/cortex-code/ to ~/.cursor/skills/cortex-code/.
Step 2 — Activate the auto-routing rule:
mkdir -p ~/.cursor/rules
cp ~/.cursor/skills/cortex-code/cortex-snowflake-routing.mdc ~/.cursor/rules/Step 3 — Restart Cursor.
Without the routing rule you type /cortex-code your question. With it, Cursor detects Snowflake queries automatically and invokes the skill.
Verify:
ls ~/.cursor/skills/cortex-code/SKILL.md
ls ~/.cursor/rules/cortex-snowflake-routing.mdcSee integrations/cursor/README.md for full details.
Install the skill via npx:
npx skills add snowflake-labs/subagent-cortex-code --copy --globalThis installs skills/cortex-code/ to ~/.codeium/windsurf/skills/cortex-code/.
Verify:
ls ~/.codeium/windsurf/skills/cortex-code/SKILL.mdRestart Windsurf — Cascade auto-discovers the skill by name and description. Mention anything Snowflake-related and it activates automatically. No routing rule needed.
Optional: configure security mode
cp ~/.codeium/windsurf/skills/cortex-code/config.yaml.example \
~/.codeium/windsurf/skills/cortex-code/config.yaml
# edit as needed — default is "prompt" (asks before executing)Codex uses the cortexcode-tool CLI directly — no skill directory needed.
Important: Do NOT run npx skills add for Codex. Codex uses the cortexcode-tool CLI so the agent can request sandbox/network approval in chat, then run the approved command with --yes. Use the CLI install below instead.
git clone https://github.com/Snowflake-Labs/subagent-cortex-code.git
cd subagent-cortex-code
bash integrations/codex/install.shThe script:
Verify:
cortexcode-tool --version
cortexcode-tool "How many databases do I have in Snowflake?" --envelope ROThe second command is a direct terminal smoke test and may ask for approval in the terminal. Inside a Codex chat, Codex should first ask you to approve the planned Cortex Code execution, then retry the approved foreground command with --yes.
Usage from Codex sessions:
First time — paste into a Codex session to confirm the tool is discoverable:
which cortexcode-tool cortexcode-tool --help
Once discovered, Codex invokes cortexcode-tool for Snowflake questions automatically. For read-only Snowflake questions, the approved command should look like this:
cortexcode-tool --yes "How many databases do I have in Snowflake?" --envelope RO
Implicit prompts also work — Codex detects Snowflake intent, asks for approval, and calls cortexcode-tool on your behalf:
How many databases do I have in Snowflake?
See integrations/codex/README.md for full details.
Install the skill via npx:
npx skills add snowflake-labs/subagent-cortex-code --copy --globalThis installs skills/cortex-code/ to ~/.agents/skills/cortex-code/ — the universal skills directory that GitHub Copilot CLI reads from automatically.
Verify:
ls ~/.agents/skills/cortex-code/SKILL.mdStart a GitHub Copilot CLI session — it auto-discovers the skill by name and description. Mention anything Snowflake-related and it activates automatically. No routing rule needed.
Optional: configure security mode
cp ~/.agents/skills/cortex-code/config.yaml.example \
~/.agents/skills/cortex-code/config.yaml
# edit as needed — default is "prompt" (asks before executing)For VSCode task runners, Windsurf, or any terminal environment:
git clone https://github.com/Snowflake-Labs/subagent-cortex-code.git
cd subagent-cortex-code/integrations/cli-tool
bash setup.shVerify:
cortexcode-tool --version
cortexcode-tool "your question"See integrations/cli-tool/README.md for full details.
The Cortex Code Integration Skill bridges coding agents and Cortex Code CLI, allowing seamless delegation of Snowflake-specific tasks while the agent handles everything else.
Key Features:
User Request
↓
[Your Coding Agent — Routing Layer]
↓
Is Snowflake-related?
↓ YES ↓ NO
[Cortex Code CLI] [Your Coding Agent]
↓ ↓
Snowflake Execution General Tasks
Routing Principle: ONLY Snowflake operations → Cortex Code. Everything else → your coding agent.
✅ Routes to Cortex:
❌ Stays with your agent:
| Mode | Security | Use Case |
|---|---|---|
| prompt (default) | High | Interactive sessions, production |
| auto | Medium | Automated workflows, CI/CD |
| envelope_only | Medium | Trusted environments, faster |
Configure in config.yaml in the skill's install directory (for skill-based agents) or ~/.local/lib/cortexcode-tool/config.yaml (for CLI-based agents):
security:
approval_mode: "prompt" # or "auto" or "envelope_only"| Envelope | Use Case | Blocked Tools |
|---|---|---|
| RO (Read-Only) | Queries and reads | Edit, Write, Bash |
| RW (Read-Write) | Data modifications | Bash and destructive shell patterns |
| RESEARCH | Exploratory work | Edit, Write, Bash |
| DEPLOY | Deployment operations | Requires explicit confirmation; blocks Bash/destructive shell |
| NONE | No managed execution | Rejected before Cortex execution |
See SECURITY.md and SECURITY_GUIDE.md for full details.
The integration automatically discovers Cortex Code's native capabilities at session start:
This is future-proof: new Cortex releases with additional skills work automatically.
Cortex is invoked with stream JSON output for non-TTY execution:
cortex -p "ENRICHED_PROMPT" --output-format stream-jsonSecurity is enforced via --disallowed-tools blocklists controlled by the chosen envelope. Requested envelopes are checked against security.allowed_envelopes before routing, approval, or Cortex execution. Auto and envelope-only modes are trusted, opt-in modes: user config cannot enable them unless an organization policy explicitly permits the relaxed field/value, NONE is rejected before Cortex execution, and DEPLOY requires explicit confirmation.
Scenario: Build a Cortex Agent for macroeconomic analysis
User: "Analyze FINANCE__ECONOMICS. Create a Cortex agent with Cortex Analyst that can answer macro economic questions. Put assets in DB_STOCK."
Production-ready Cortex Agent deployed in one conversation, tested and immediately queryable.
subagent-cortex-code/
├── skills/
│ └── cortex-code/ # Installable skill (npx skills add)
│ ├── SKILL.md # Skill definition — loaded by Claude Code, Cursor, etc.
│ ├── cortex-snowflake-routing.mdc # Cursor auto-routing rule
│ ├── config.yaml.example
│ ├── scripts/ # Routing, execution, discovery, context
│ └── security/ # Approval, audit, cache, sanitization modules
│
├── integrations/
│ ├── claude-code/ # Claude Code-specific notes and uninstall script
│ ├── cursor/ # Cursor-specific notes and uninstall script
│ ├── codex/ # Codex install script (cortexcode-tool + config)
│ └── cli-tool/ # cortexcode-tool Python package + setup script
│
└── shared/ # Canonical source for scripts/ and security/
├── scripts/ # (copied into skills/cortex-code/ by install process)
└── security/
Cortex CLI not found:
which cortex
# If missing: curl -LsS https://ai.snowflake.com/static/cc-scripts/install.sh | shNo active connection:
cortex connections list
cortex connections create # to add oneSkill not loading (Claude Code / Cursor):
ls ~/.claude/skills/cortex-code/SKILL.md # Claude Code
ls ~/.cursor/skills/cortex-code/SKILL.md # Cursor
ls ~/.codeium/windsurf/skills/cortex-code/SKILL.md # Windsurf
# If missing, re-run: npx skills add snowflake-labs/subagent-cortex-code --copy --globalCodex command waits or needs network approval:
# Verify cortexcode-tool config exists and check approval mode
cat ~/.local/lib/cortexcode-tool/config.yaml | grep approval_mode
# Interactive installs should prefer: approval_mode: "prompt"Approve the planned Cortex Code execution in Codex chat, then retry the same foreground command with --yes.
cortexcode-tool not found (Codex / CLI):
which cortexcode-tool
# If missing: re-run the install scriptCopyright (c) Snowflake Inc. All rights reserved. Licensed under the Snowflake Skills License.
For issues: GitHub Issues
| Back | FazBrowse Home | New Git URL |