Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

cortex-code

БесплатноЗапускает вложенные скриптыНе проверен

Routes Snowflake-related operations to Cortex Code CLI for specialized Snowflake expertise. Use when user asks about Snowflake databases, data warehouses, SQL…

Snowflake-Labsот Snowflake-Labs★ 65 звёзд на GitHub

Об этом скилле

Cortex Code Integration Skill

This skill enables Claude Code to leverage Cortex Code's specialized Snowflake expertise by intelligently routing Snowflake-related operations to Cortex Code CLI in headless mode.

Architecture Overview

Routing Principle: ONLY Snowflake operations → Cortex Code. Everything else → Claude Code.

Key Components:

  • Dynamic skill discovery at session initialization
  • LLM-based semantic routing (not keyword matching)
  • Security wrapper with approval modes (prompt/auto/envelope_only)
  • Stateless Cortex execution with context enrichment
  • Hybrid memory management
  • Audit logging for compliance

Security

The skill includes a security wrapper around Cortex execution with three approval modes:

Approval Modes

  1. prompt (default): High security

    • User shown approval prompt with predicted tools and confidence
    • User must approve before execution
    • No audit logging required
    • Best for: Interactive sessions, untrusted prompts, production
  2. auto: Medium security

    • All operations auto-approved
    • Mandatory audit logging
    • Envelopes still enforced
    • Best for: Automated workflows, trusted environments
  3. envelope_only: Medium security

    • No tool prediction (faster)
    • Auto-approved with audit logging
    • Relies on envelope blocklist only
    • Best for: Trusted environments, low latency needs

Configuration: Set in ~/.claude/skills/cortex-code/config.yaml or organization policy.

Built-in Protections

  • Prompt Sanitization: Automatic PII removal and injection detection
  • Credential Blocking: Prevents routing when credential paths detected
  • Secure Caching: SHA256-validated cache in ~/.cache/cortex-skill/
  • Audit Logging: Structured JSONL logs (mandatory for auto/envelope_only)
  • Organization Policy: Enterprise override via ~/.snowflake/cortex/claude-skill-policy.yaml

Session Initialization

When this skill is first loaded in a Claude Code session:

Step 1: Discover Cortex Capabilities

python scripts/discover_cortex.py

This script:

  1. Runs cortex skill list to enumerate all available Cortex skills
  2. Reads each skill's SKILL.md frontmatter and trigger patterns
  3. Caches capabilities with CacheManager in the configured cache directory
  4. Returns structured data about what Cortex can handle

Expected output: JSON mapping of skill names to their trigger patterns and capabilities.

Step 2: Load Routing Context

The discovered capabilities are loaded into memory to inform routing decisions throughout the session.

Workflow: Handling User Requests

Step 1: Analyze Request with LLM-Based Routing

Before taking any action, analyze the user's request:

python scripts/route_request.py --prompt "USER_PROMPT_HERE"

This script:

  1. Loads Cortex capabilities from cache
  2. Uses LLM reasoning to classify the request
  3. Returns routing decision with confidence score

Routing Logic:

  • Route to Cortex if request involves:

    • Snowflake databases, warehouses, schemas, tables
    • SQL queries specifically for Snowflake
    • Cortex AI features (Cortex Search, Cortex Analyst, ML functions)
    • Snowpark, dynamic tables, streams, tasks
    • Data governance, data quality, or security in Snowflake context
    • User explicitly mentions "Cortex" or "Snowflake"
  • Route to Claude Code if request involves:

    • Local file operations (reading, writing, editing local files)
    • General programming (Python, JavaScript, etc. not Snowflake-specific)
    • Non-Snowflake databases (PostgreSQL, MySQL, MongoDB, etc.)
    • Web development, frontend work
    • Infrastructure/DevOps unrelated to Snowflake
    • Git operations, GitHub, version control

Step 2: Execute Based on Routing Decision

If routed to Claude Code:

Handle the request directly using Claude Code's built-in capabilities. No Cortex involvement.

If routed to Cortex Code:

Proceed to Step 3.

Step 3: Choose Security Envelope and Handle Approval

Before executing Cortex, the security wrapper handles approval based on configured mode.

Step 3a: Check Approval Mode

Read configuration to determine approval behavior:

  • auto mode (trusted opt-in): Auto-approve with audit logging, skip to Step 4
  • envelope_only mode: Auto-approve, no tool prediction, skip to Step 4
  • prompt mode: Requires user approval, proceed to Step 3b

Note: The shipped Claude Code config defaults to approval_mode: "prompt". Only skip Step 3b when the user or organization policy explicitly opts into auto or envelope_only.

Step 3b: Handle Approval (prompt mode only)

Only use this step if approval_mode is "prompt". Otherwise skip to Step 4.

If using prompt mode:

python scripts/security_wrapper.py \
  --prompt "ENRICHED_PROMPT" \
  --envelope '{"mode":"RW"}'

This will:

  1. Predict required tools using LLM
  2. Display approval prompt to user:
    Cortex Code needs to execute the following tools:
    
Полный SKILL.md на GitHub

Установить cortex-code в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

README.mdSECURITY.mdSECURITY_GUIDE.mdconfig.yamlconfig.yaml.exampleinstall.shuninstall.sh

FAQ

Что делает скилл cortex-code?

Routes Snowflake-related operations to Cortex Code CLI for specialized Snowflake expertise. Use when user asks about Snowflake databases, data warehouses, SQL queries on Snowflake, Cortex AI features, Snowpark, dynamic tables, data governance in Snowflake, Snowflake security, or mentions "Cortex" explicitly. Do NOT use for general programming, local file operations, non-Snowflake databases, web development, or infrastructure tasks unrelated to Snowflake.

Как установить скилл cortex-code?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл cortex-code запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить cortex-code с