Logo Snowflake

Snowflake

Cộng đồng
d-padmanabhan
snowflake

Snowflake playbook. Workflows for RBAC rollout, warehouse sizing and cost control, secure data sharing, Streams/Tasks/Snowpipe pipelines, permissions audit, and Time Travel / Fail-safe recovery. Use when designing, operating, or auditing Snowflake.

Tổng quan

Nhà phát hànhd-padmanabhan
Kho mãagent-engineering-handbook
Tên kỹ năngsnowflake
Sao
20
Bản fork
3
Tệp đi kèm
1
Giấy phépMIT
Liên kết
  • Hướng dẫn bằng Markdown

    Tệp SKILL.md được mô hình tải khi cần, nên chỉ tốn token khi có yêu cầu thực sự phù hợp.

  • Dùng được với mọi LLM

    Kỹ năng AI dùng hướng dẫn viết bằng Markdown thay vì mã dành riêng cho một nhà cung cấp, nên dùng được với GPT, Claude, Gemini, Grok hoặc mô hình cục bộ.

  • 1 tệp đi kèm

    Các tập lệnh, mẫu và tài liệu tham khảo mà mô hình có thể đọc khi làm việc. Các tệp chỉ cho phép đọc và không bao giờ được thực thi.

  • Mã nguồn mở

    Được d-padmanabhan công bố trên GitHub. Hãy đọc các tệp nguồn trước khi cài đặt.

Cài đặt

Cài đặt kỹ năng AI Snowflake trong TypingMind để dùng với bất kỳ LLM nào, hoặc thêm vào một tác nhân AI khác có thể đọc SKILL.md.

1

Cài đặt trong TypingMind

TypingMind cài đặt kỹ năng trực tiếp từ thư mục GitHub — đọc SKILL.md, đóng gói các tệp tài nguyên và lưu kết quả trên máy.

  1. Mở ứng dụng và vào Plugin → Kỹ năng.
  2. Chọn "Cài đặt từ GitHub".
  3. Dán URL của thư mục kỹ năng được hiển thị bên dưới rồi xác nhận.
    https://github.com/d-padmanabhan/agent-engineering-handbook/tree/main/skills/snowflake
  4. Bật kỹ năng trong từng cuộc trò chuyện mà bạn muốn sử dụng kỹ năng đó.
Plugin → Kỹ năng → Thêm kỹ năng → Từ URL GitHub, sau đó dán URL thư mục và nhấn Tiếp tục.
2

Cài đặt trong tác nhân AI khác

Bất kỳ tác nhân AI nào đọc được định dạng Agent Skills đều có thể dùng kỹ năng này — hãy sao chép thư mục vào thư mục kỹ năng của tác nhân AI đó.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/d-padmanabhan/agent-engineering-handbook.git /tmp/agent-engineering-handbook
mkdir -p .claude/skills
cp -r /tmp/agent-engineering-handbook/skills/snowflake .claude/skills/snowflake
Khởi động lại Claude Code sau khi sao chép để ứng dụng nhận kỹ năng mới.

Sử dụng trong TypingMind

Bật Snowflake trong bất kỳ cuộc trò chuyện nào trên TypingMind, mô hình sẽ tự xử lý phần còn lại. Tên và mô tả của kỹ năng nằm trong prompt hệ thống. Ngay khi có yêu cầu phù hợp, mô hình tự tải toàn bộ hướng dẫn — bạn không cần gọi thủ công và kỹ năng không tốn token cho đến khi thực sự được dùng.

Mô hình tự nạp Snowflake ngay khi có yêu cầu phù hợp.

Dùng được với mọi mô hình AI

Kỹ năng AI là các hướng dẫn Markdown thuần túy, không phải mã dành riêng cho một nhà cung cấp, nên bạn có thể dùng Snowflake với cả những mô hình khác ngoài mô hình ban đầu. Chỉ cần cài đặt một lần trong TypingMind rồi dùng với GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama hoặc mô hình cục bộ do bạn tự chạy — tất cả đều dùng khóa API của riêng bạn.

  • Chỉ tải khi cần

    Prompt hệ thống chỉ chứa tên và mô tả. Hướng dẫn được tải khi có yêu cầu phù hợp đầu tiên, nên khi kỹ năng chưa được dùng, bạn không tốn token cho phần hướng dẫn.

  • Đổi mô hình ngay trong cuộc trò chuyện

    Vì kỹ năng là hướng dẫn chứ không phải mã, việc đổi mô hình không làm kỹ năng ngừng hoạt động — mô hình tiếp theo vẫn đọc cùng tệp SKILL.md.

Hướng dẫn của kỹ năng

Đây là nội dung SKILL.md mà mô hình tải. Hãy đọc trước khi cài đặt — kỹ năng là những hướng dẫn mà mô hình của bạn sẽ làm theo.

Snowflake - Playbook

Companion rule: 482-snowflake.mdc. This skill turns those patterns into end-to-end workflows.


When to invoke

Use when the user is:

  • Designing a new Snowflake account, database, or warehouse
  • Rolling out or auditing RBAC (roles, grants, object ownership)
  • Tuning cost (warehouse sizing, auto-suspend, query optimization, storage)
  • Building pipelines with Snowpipe, Streams, Tasks, or Dynamic Tables
  • Setting up secure data sharing (Reader Accounts, Snowflake Marketplace, Private Listings)
  • Recovering from a bad change (Time Travel, Fail-safe)
  • Governing sensitive data (masking, row access policies, tagging)

Golden Rules

  1. Roles hold privileges; users hold roles. Never grant directly to users.
  2. Use USE ROLE at the top of every script. Implicit roles cause access-denied mysteries.
  3. Warehouses suspend aggressively (60s auto-suspend for interactive; higher for streaming).
  4. Right-size warehouses; scale with multi-cluster, not with XL.
  5. Time Travel is real; Fail-safe is last-resort. Set retention deliberately per schema.
  6. Every production role chain has an owner and an audit trail.

Workflow 1 - RBAC Rollout

Design a production-grade role hierarchy and migrate away from ACCOUNTADMIN-as-default.

Steps

  1. Map your access model to Snowflake's RBAC:
    • System roles: ORGADMIN, ACCOUNTADMIN, SECURITYADMIN, USERADMIN, SYSADMIN, PUBLIC
    • Custom roles: business- and data-oriented
  2. Use the standard hierarchy:
    • Functional roles (granted to users): e.g., ANALYST_SALES, ENGINEER_DATA, ADMIN_FINOPS
    • Access roles (hold privileges on objects): e.g., DB_SALES_READ, DB_SALES_WRITE, WH_LOAD_USE
    • Functional roles inherit from access roles, not from each other
  3. Ownership:
    • Custom databases / schemas / warehouses are OWNED by a custom role (e.g., DB_SALES_OWNER), never by ACCOUNTADMIN
    • SYSADMIN sits above functional roles; custom-role-owned objects grant managed access through their owner role
  4. USE MANAGED ACCESS schemas for any schema where multiple teams grant access - centralize grant control.
  5. Separation of duties:
    • USERADMIN manages users + role grants; SECURITYADMIN manages privilege grants on objects; they do NOT overlap
    • Application service users are locked to a specific role via DEFAULT_ROLE and cannot switch
  6. Audit:
    • Snapshot GRANTS to a governance schema nightly (SNOWFLAKE.ACCOUNT_USAGE.GRANTS_TO_ROLES)
    • Alert on new grants to ACCOUNTADMIN / SECURITYADMIN
  7. Terraform / dbt:
    • Manage roles and grants via snowflake-terraform-provider (Snowflake Labs) or Permifrost (dbt Labs)
    • PR-reviewed changes; drift detection
  8. Migrate existing access incrementally; lock down ACCOUNTADMIN-for-daily-use.

Deliverable: Role hierarchy diagram, Terraform modules, audit job, migration runbook.

See references/rbac-patterns.md.


Workflow 2 - Warehouse Sizing and Cost Control

Keep Snowflake cheap without starving workloads.

Steps

  1. Classify workloads:
    • Interactive (BI, ad-hoc) - small/medium WH, multi-cluster auto-scale, short auto-suspend
    • Batch ETL - medium/large WH, single cluster, on-demand
    • Streaming (Snowpipe, Tasks) - small WH, tasks share warehouses
    • ML / heavy - large/xlarge WH, purpose-specific
  2. Start small, scale on evidence. Double warehouse size only if >50% of query time is spillage or queueing.
  3. Multi-cluster warehouses for concurrency, not for speed. A bigger warehouse makes one query faster; multi-cluster lets more concurrent queries run at the same speed.
  4. Auto-suspend:
    • Interactive: 60s
    • Batch / streaming: 60-600s depending on duty cycle
    • Never AUTO_SUSPEND = 0 in prod
  5. Resource monitors per warehouse (or per warehouse group):
    • Daily, weekly, monthly credit quotas
    • Actions: notify at 75%, suspend at 100%
    • Owner and escalation path in the notification message
  6. Query tuning:
    • EXPLAIN and QUERY_HISTORY the slow queries
    • Prune with clustering keys only when necessary (micro-partition pruning is automatic - test before adding)
    • Materialize results (tables / materialized views) for repeated heavy scans
    • Use Query Acceleration Service for BI workloads with unpredictable heavy queries
  7. Storage:
    • Time Travel retention appropriate to schema (0 for staging scratch, 1d for most, 7-90d for critical)
    • Transient / temporary tables for scratch
    • Track storage cost by database with ACCOUNT_USAGE.STORAGE_DAILY_HISTORY
  8. Reports:
    • Weekly top-N queries by credit cost
    • Weekly top-N tables by storage growth
    • Month-over-month trend

Deliverable: Warehouse catalog, resource monitors, dashboard, slow-query hit list.


Workflow 3 - Pipeline via Snowpipe / Streams / Tasks / Dynamic Tables

When to use which

UseWhy
SnowpipeContinuous ingestion from S3/GCS/ADLS into raw tables
StreamsCDC (change-tracking) on tables; power incremental pipelines
TasksScheduled or conditional SQL; often reads from streams
Dynamic TablesDeclarative, managed materialization (prefer over manual Stream+Task where it fits)
Snowflake Connector for KafkaDirect Kafka ingestion when latency < Snowpipe is needed

Design pattern

Cloud storage  --Snowpipe-->  raw.tableRaw (VARIANT)
                                     |
                                     | Stream cdc_raw
                                     v
staging.tableStaged  <--Task-- INSERT/MERGE from raw via stream consumption
                                     |
                                     | Stream cdc_staging
                                     v
warehouse.fact_table  <--Task-- MERGE into dimensional model

Or with Dynamic Tables:

raw.tableRaw  --> dt_staging (target lag 5 min)  --> dt_fact (target lag 15 min)

Guardrails

  • Idempotent MERGE (use stable business keys)
  • DLQ table for malformed rows
  • Monitoring: unprocessed stream rows, task failure count, ingestion latency
  • Alert thresholds and runbook for each pipeline

Workflow 4 - Secure Data Sharing

Share data without moving it.

Options

  • Listings (Snowflake Marketplace): public or private catalog-based sharing
  • Private Listings: curated access with request workflow
  • Direct Shares: account-to-account inside the same cloud region; cross-region uses Replication
  • Reader Accounts: consumer gets a Snowflake account you pay for (to share with non-Snowflake customers)

Design checklist

  • Secure views / secure UDFs for shared objects (prevent data peek via EXPLAIN)
  • Explicit column selection; no SELECT * on shared views
  • Row access policies for tenant-level filtering where applicable
  • Masking policies for any PII in shared objects
  • Document retention / SLA for the share; versioning strategy for schema changes
  • Consumer-side usage reported back via SHARE_USAGE (governance)

Workflow 5 - Permissions Audit

Quarterly or after any org change.

Steps

  1. Dump grants from SNOWFLAKE.ACCOUNT_USAGE.GRANTS_TO_USERS, GRANTS_TO_ROLES, GRANTS_ON_OBJECTS.
  2. Flag:
    • Direct grants to users (should be zero)
    • ACCOUNTADMIN / SECURITYADMIN granted to non-service identities beyond a small list
    • Privileges granted to PUBLIC
    • Objects owned by ACCOUNTADMIN (drift; should be owned by custom role)
  3. Check users:
    • Disabled / stale users still holding roles
    • Service users without scoped roles
  4. Check network policies:
    • Service users restricted to known CIDRs / PrivateLink
    • Admin roles require MFA
  5. Masking / row-access policies:
    • Cover all PII columns?
    • Applied via tags where feasible
  6. File findings with owner, severity, fix.

Workflow 6 - Recovery via Time Travel and Fail-safe

Time Travel = queryable historical data (0-90 days, per-object DATA_RETENTION_TIME_IN_DAYS).
Fail-safe = Snowflake-only recovery, 7 days, for permanent tables only, not self-serve.

Recovery playbook

  1. Quantify the blast radius: which objects, what time, which rows?

  2. Query the past with AT(OFFSET => ...), AT(TIMESTAMP => ...), BEFORE(STATEMENT => ...):

    sql
    SELECT * FROM my_table AT(OFFSET => -3600); -- 1 hour ago
    SELECT * FROM my_table BEFORE(STATEMENT => '<query_id>');
  3. Clone to isolate:

    sql
    CREATE TABLE my_table_recovered CLONE my_table AT(OFFSET => -3600);
  4. Restore selectively (SQL MERGE from clone).

  5. Undrop recently-dropped objects:

    sql
    UNDROP TABLE my_table;
  6. If Time Travel is expired, engage Snowflake support for Fail-safe recovery. Not self-serve; not a plan.

Prevention

  • Set DATA_RETENTION_TIME_IN_DAYS per schema (>= 7 for prod, >= 30 for critical)
  • TRANSIENT tables where durability matters less than cost
  • Don't DROP DATABASE in prod from a human session; use roles that cannot

Anti-patterns

  1. Users with ACCOUNTADMIN for daily work
  2. Grants direct to users
  3. AUTO_SUSPEND disabled or very long on interactive warehouses
  4. Clustering keys added "for performance" without an EXPLAIN showing benefit
  5. SELECT * across wide VARIANT tables in production queries
  6. Secrets in SQL scripts or task definitions (use External Functions + vault)
  7. Tasks using ACCOUNTADMIN as OWNER
  8. Shares exposing base tables instead of secure views
  9. No resource monitors on shared warehouses
  10. No storage / credit dashboard

References

Related

  • Rule: 482-snowflake.mdc
  • Rule: 480-data-engineering.mdc (cross-platform data contracts, DQ, governance)
  • Rule: 475-sql.mdc (safe SQL patterns)
  • Rule: 316-zero-trust.mdc (data tier controls)
  • Skill: data-engineering (pipeline concepts)
  • Skill: database-postgresql (for comparison)

Tệp đi kèm

Khi kỹ năng đã được tải, mô hình có thể đọc các tệp này nếu cần. Các tệp này chỉ dùng để đọc và không bao giờ được thực thi.

Câu hỏi thường gặp

Kỹ năng AI Snowflake làm được gì?

Snowflake playbook. Workflows for RBAC rollout, warehouse sizing and cost control, secure data sharing, Streams/Tasks/Snowpipe pipelines, permissions audit, and Time Travel / Fail-safe recovery. Use when designing, operating, or auditing Snowflake.

Vì sao nên dùng Snowflake trên TypingMind?

Vì bạn chỉ cần cài một lần rồi dùng với bất kỳ mô hình nào. Snowflake là nội dung Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên cùng một kỹ năng có thể chạy trên GPT-5, Claude, Gemini, Grok hoặc mô hình trên thiết bị — và bạn có thể đổi mô hình ngay trong cuộc trò chuyện mà kỹ năng vẫn hoạt động. TypingMind dùng khóa API riêng của bạn, nên bạn thanh toán trực tiếp cho nhà cung cấp thay vì trả phí thuê bao theo suất người dùng, đồng thời kỹ năng và các cuộc trò chuyện vẫn nằm trong bộ lưu trữ của bạn.

Làm thế nào để cài Snowflake trong TypingMind?

Mở Plugin → Kỹ năng → Cài đặt từ GitHub trong TypingMind rồi dán https://github.com/d-padmanabhan/agent-engineering-handbook/tree/main/skills/snowflake. TypingMind đọc tệp SKILL.md, đóng gói các tệp đi kèm rồi cài đặt cả gói dưới dạng một kỹ năng mà bạn có thể bật cho từng cuộc trò chuyện.

Những mô hình AI nào có thể dùng Snowflake?

Bất kỳ mô hình nào bạn kết nối trong TypingMind. Kỹ năng AI là các hướng dẫn bằng Markdown chứ không phải mã dành riêng cho từng nhà cung cấp, nên GPT, Claude, Gemini, Grok và các mô hình chạy trên thiết bị đều có thể tải kỹ năng này khi có yêu cầu phù hợp.

Có thể dùng Snowflake với bao nhiêu mô hình AI?

Bao nhiêu cũng được. Miễn là mô hình hỗ trợ kỹ năng, bạn có thể dùng Snowflake với mô hình đó — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama và nhiều mô hình khác — tất cả đều trên TypingMind với khóa API riêng của bạn.

Kỹ năng AI Snowflake có miễn phí không?

Có. Kỹ năng này được d-padmanabhan phát hành trên GitHub theo giấy phép MIT. Bạn chỉ trả tiền cho nhà cung cấp AI của mình theo số token đã dùng.

Kỹ năng AI là gì?

Kỹ năng AI là một gói hướng dẫn có thể tái sử dụng, chỉ cho mô hình AI cách thực hiện một tác vụ cụ thể. Kỹ năng tuân theo định dạng mở Agent Skills: một tệp SKILL.md chứa tên và mô tả, cùng các tập lệnh, mẫu hoặc tệp tham khảo mà mô hình có thể cần. Mô hình chỉ đọc hướng dẫn khi yêu cầu của bạn phù hợp với kỹ năng, nên kỹ năng đã cài đặt không phát sinh chi phí cho đến khi được sử dụng.

Kỹ năng AI khác gì với plugin hoặc máy chủ MCP?

Plugin hoặc máy chủ MCP cung cấp các công cụ mới mà mô hình có thể gọi. Khi mô hình gọi một công cụ, mã của công cụ đó chạy ở đâu đó và trả về kết quả. Còn kỹ năng AI cung cấp kiến thức và quy trình: cách tiếp cận tác vụ, các bước cần thực hiện và những tiêu chí mà kết quả cần đáp ứng. Kỹ năng chỉ là nội dung Markdown, nên không cần máy chủ, khóa API hay môi trường thực thi và hoạt động với mọi mô hình.

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇