[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7BQP5SW6H4NVA0KMP30ZD94":3,"skill-same:01M7BQP5SW6H4NVA0KMP30ZD94":67},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":30,"ownerDescription":31,"updatedAt":32,"install":33,"resources":46},"01M7BQP5SW6H4NVA0KMP30ZD94","snowflake-development",null,"Use when writing Snowflake SQL, building data pipelines with Dynamic Tables or Streams\u002FTasks, using Cortex AI functions, creating Cortex Agents, writing Snowpark Python, configuring dbt for Snowflake, or troubleshooting Snowflake errors.","devlify-marketplace\u002Fdevlify-skills","devlify-marketplace","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F196752365?v=4","01M7BPJC94F4G2AG0T3N220BQ3","Sadiq Abdullahi","01M7BPJC9QENFCHFM5NEFAJR1Y",1,"MIT","https:\u002F\u002Fgithub.com\u002Fdevlify-marketplace\u002Fdevlify-skills\u002Fblob\u002Fmain\u002Fengineering-team\u002Fsnowflake-development\u002Fskills\u002Fsnowflake-development\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: \"snowflake-development\"\ndescription: \"Use when writing Snowflake SQL, building data pipelines with Dynamic Tables or Streams\u002FTasks, using Cortex AI functions, creating Cortex Agents, writing Snowpark Python, configuring dbt for Snowflake, or troubleshooting Snowflake errors.\"\n---\n\n# Snowflake Development\n\nSnowflake SQL, data pipelines, Cortex AI, and Snowpark Python development. Covers the colon-prefix rule, semi-structured data, MERGE upserts, Dynamic Tables, Streams+Tasks, Cortex AI functions, agent specs, performance tuning, and security hardening.\n\n> Originally contributed by [James Cha-Earley](https:\u002F\u002Fgithub.com\u002Fjamescha-earley) — enhanced and integrated by the claude-skills team.\n\n## Quick Start\n\n```bash\n# Generate a MERGE upsert template\npython scripts\u002Fsnowflake_query_helper.py merge --target customers --source staging_customers --key customer_id --columns name,email,updated_at\n\n# Generate a Dynamic Table template\npython scripts\u002Fsnowflake_query_helper.py dynamic-table --name cleaned_events --warehouse transform_wh --lag \"5 minutes\"\n\n# Generate RBAC grant statements\npython scripts\u002Fsnowflake_query_helper.py grant --role analyst_role --database analytics --schemas public,staging --privileges SELECT,USAGE\n```\n\n---\n\n## SQL Best Practices\n\n### Naming and Style\n\n- Use `snake_case` for all identifiers. Avoid double-quoted identifiers -- they force case-sensitive names that require constant quoting.\n- Use CTEs (`WITH` clauses) over nested subqueries.\n- Use `CREATE OR REPLACE` for idempotent DDL.\n- Use explicit column lists -- never `SELECT *` in production. Snowflake's columnar storage scans only referenced columns, so explicit lists reduce I\u002FO.\n\n### Stored Procedures -- Colon Prefix Rule\n\nIn SQL stored procedures (BEGIN...END blocks), variables and parameters **must** use the colon `:` prefix inside SQL statements. Without it, Snowflake treats them as column identifiers and raises \"invalid identifier\" errors.\n\n```sql\n-- WRONG: missing colon prefix\nSELECT name INTO result FROM users WHERE id = p_id;\n\n-- CORRECT: colon prefix on both variable and parameter\nSELECT name INTO :result FROM users WHERE id = :p_id;\n```\n\nThis applies to DECLARE variables, LET variables, and procedure parameters when used inside SELECT, INSERT, UPDATE, DELETE, or MERGE.\n\n### Semi-Structured Data\n\n- VARIANT, OBJECT, ARRAY for JSON\u002FAvro\u002FParquet\u002FORC.\n- Access nested fields: `src:customer.name::STRING`. Always cast with `::TYPE`.\n- VARIANT null vs SQL NULL: JSON `null` is stored as the string `\"null\"`. Use `STRIP_NULL_VALUE = TRUE` on load.\n- Flatten arrays: `SELECT f.value:name::STRING FROM my_table, LATERAL FLATTEN(input => src:items) f;`\n\n### MERGE for Upserts\n\n```sql\nMERGE INTO target t USING source s ON t.id = s.id\nWHEN MATCHED THEN UPDATE SET t.name = s.name, t.updated_at = CURRENT_TIMESTAMP()\nWHEN NOT MATCHED THEN INSERT (id, name, updated_at) VALUES (s.id, s.name, CURRENT_TIMESTAMP());\n```\n\n> See `references\u002Fsnowflake_sql_and_pipelines.md` for deeper SQL patterns and anti-patterns.\n\n---\n\n## Data Pipelines\n\n### Choosing Your Approach\n\n| Approach | When to Use |\n|----------|-------------|\n| Dynamic Tables | Declarative transformations. **Default choice.** Define the query, Snowflake handles refresh. |\n| Streams + Tasks | Imperative CDC. Use for procedural logic, stored procedure calls, complex branching. |\n| Snowpipe | Continuous file loading from cloud storage (S3, GCS, Azure). |\n\n### Dynamic Tables\n\n```sql\nCREATE OR REPLACE DYNAMIC TABLE cleaned_events\n    TARGET_LAG = '5 minutes'\n    WAREHOUSE = transform_wh\n    AS\n    SELECT event_id, event_type, user_id, event_timestamp\n    FROM raw_events\n    WHERE event_type IS NOT NULL;\n```\n\nKey rules:\n- Set `TARGET_LAG` progressively: tighter at the top of the DAG, looser downstream.\n- Incremental DTs cannot depend on Full-refresh DTs.\n- `SELECT *` breaks on upstream schema changes -- use explicit column lists.\n- Views cannot sit between two Dynamic Tables in the DAG.\n\n### Streams and Tasks\n\n```sql\nCREATE OR REPLACE STREAM raw_stream ON TABLE raw_events;\n\nCREATE OR REPLACE TASK process_events\n    WAREHOUSE = transform_wh\n    SCHEDULE = 'USING CRON 0 *\u002F1 * * * America\u002FLos_Angeles'\n    WHEN SYSTEM$STREAM_HAS_DATA('raw_stream')\n    AS INSERT INTO cleaned_events SELECT ... FROM raw_stream;\n\n-- Tasks start SUSPENDED. You MUST resume them.\nALTER TASK process_events RESUME;\n```\n\n> See `references\u002Fsnowflake_sql_and_pipelines.md` for DT debugging queries and Snowpipe patterns.\n\n---\n\n## Cortex AI\n\n### Function Reference\n\n| Function | Purpose |\n|----------|---------|\n| `AI_COMPLETE` | LLM completion (text, images, documents) |\n| `AI_CLASSIFY` | Classify text into categories (up to 500 labels) |\n| `AI_FILTER` | Boolean filter on text or images |\n| `AI_EXTRACT` | Structured extraction from text\u002Fimages\u002Fdocuments |\n| `AI_SENTIMENT` | Sentiment score (-1 to 1) |\n| `AI_PARSE_DOCUMENT` | OCR or layout extraction from documents |\n| `AI_REDACT` | PII removal from text |\n\n**Deprecated names (do NOT use):** `COMPLETE`, `CLASSIFY_TEXT`, `EXTRACT_ANSWER`, `PARSE_DOCUMENT`, `SUMMARIZE`, `TRANSLATE`, `SENTIMENT`, `EMBED_TEXT_768`.\n\n### TO_FILE -- Common Pitfall\n\nStage path and filename are **separate** arguments:\n\n```sql\n-- WRONG: single combined argument\nTO_FILE('@stage\u002Ffile.pdf')\n\n-- CORRECT: two arguments\nTO_FILE('@db.schema.mystage', 'invoice.pdf')\n```\n\n### Cortex Agents\n\nAgent specs use a JSON structure with top-level keys: `models`, `instructions`, `tools`, `tool_resources`.\n\n- Use `$spec$` delimiter (not `$$`).\n- `models` must be an object, not an array.\n- `tool_resources` is a separate top-level key, not nested inside `tools`.\n- Tool descriptions are the single biggest factor in agent quality.\n\n> See `references\u002Fcortex_ai_and_agents.md` for full agent spec examples and Cortex Search patterns.\n\n---\n\n## Snowpark Python\n\n```python\nfrom snowflake.snowpark import Session\nimport os\n\nsession = Session.builder.configs({\n    \"account\": os.environ[\"SNOWFLAKE_ACCOUNT\"],\n    \"user\": os.environ[\"SNOWFLAKE_USER\"],\n    \"password\": os.environ[\"SNOWFLAKE_PASSWORD\"],\n    \"role\": \"my_role\", \"warehouse\": \"my_wh\",\n    \"database\": \"my_db\", \"schema\": \"my_schema\"\n}).create()\n```\n\n- Never hardcode credentials. Use environment variables or key pair auth.\n- DataFrames are lazy -- executed on `collect()` \u002F `show()`.\n- Do NOT call `collect()` on large DataFrames. Process server-side with DataFrame operations.\n- Use **vectorized UDFs** (10-100x faster) for batch and ML workloads.\n\n## dbt on Snowflake\n\n```sql\n-- Dynamic table materialization (streaming\u002Fnear-real-time marts):\n{{ config(materialized='dynamic_table', snowflake_warehouse='transforming', target_lag='1 hour') }}\n\n-- Incremental materialization (large fact tables):\n{{ config(materialized='incremental', unique_key='event_id') }}\n\n-- Snowflake-specific configs (combine with any materialization):\n{{ config(transient=true, copy_grants=true, query_tag='team_daily') }}\n```\n\n- Do NOT use `{{ this }}` without `{% if is_incremental() %}` guard.\n- Use `dynamic_table` materialization for streaming or near-real-time marts.\n\n## Performance\n\n- **Cluster keys**: Only for multi-TB tables. Apply on WHERE \u002F JOIN \u002F GROUP BY columns.\n- **Search Optimization**: `ALTER TABLE t ADD SEARCH OPTIMIZATION ON EQUALITY(col);`\n- **Warehouse sizing**: Start X-Small, scale up. Set `AUTO_SUSPEND = 60`, `AUTO_RESUME = TRUE`.\n- **Separate warehouses** per workload (load, transform, query).\n\n## Security\n\n- Follow least-privilege RBAC. Use database roles for object-level grants.\n- Audit ACCOUNTADMIN regularly: `SHOW GRANTS OF ROLE ACCOUNTADMIN;`\n- Use network policies for IP allowlisting.\n- Use masking policies for PII columns and row access policies for multi-tenant isolation.\n\n---\n\n## Proactive Triggers\n\nSurface these issues without being asked when you notice them in context:\n\n- **Missing colon prefix** in SQL stored procedures -- flag immediately, this causes \"invalid identifier\" at runtime.\n- **`SELECT *` in Dynamic Tables** -- flag as a schema-change time bomb.\n- **Deprecated Cortex function names** (`CLASSIFY_TEXT`, `SUMMARIZE`, etc.) -- suggest the current `AI_*` equivalents.\n- **Task not resumed** after creation -- remind that tasks start SUSPENDED.\n- **Hardcoded credentials** in Snowpark code -- flag as a security risk.\n\n---\n\n## Common Errors\n\n| Error | Cause | Fix |\n|-------|-------|-----|\n| \"Object does not exist\" | Wrong database\u002Fschema context or missing grants | Fully qualify names (`db.schema.table`), check grants |\n| \"Invalid identifier\" in procedure | Missing colon prefix on variable | Use `:variable_name` inside SQL statements |\n| \"Numeric value not recognized\" | VARIANT field not cast | Cast explicitly: `src:field::NUMBER(10,2)` |\n| Task not running | Forgot to resume after creation | `ALTER TASK task_name RESUME;` |\n| DT refresh failing | Schema change upstream or tracking disabled | Use explicit columns, verify change tracking |\n| TO_FILE error | Combined path as single argument | Split into two args: `TO_FILE('@stage', 'file.pdf')` |\n\n---\n\n## Practical Workflows\n\n### Workflow 1: Build a Reporting Pipeline (30 min)\n\n1. **Stage raw data**: Create external stage pointing to S3\u002FGCS\u002FAzure, set up Snowpipe for auto-ingest\n2. **Clean with Dynamic Table**: Create DT with `TARGET_LAG = '5 minutes'` that filters nulls, casts types, deduplicates\n3. **Aggregate with downstream DT**: Second DT that joins cleaned data with dimension tables, computes metrics\n4. **Expose via Secure View**: Create `SECURE VIEW` for the BI tool \u002F API layer\n5. **Grant access**: Use `snowflake_query_helper.py grant` to generate RBAC statements\n\n### Workflow 2: Add AI Classification to Existing Data\n\n1. **Identify the column**: Find the text column to classify (e.g., support tickets, reviews)\n2. **Test with AI_CLASSIFY**: `SELECT AI_CLASSIFY(text_col, ['bug', 'feature', 'question']) FROM table LIMIT 10;`\n3. **Create enrichment DT**: Dynamic Table that runs `AI_CLASSIFY` on new rows automatically\n4. **Monitor costs**: Cortex AI is billed per token — sample before running on full tables\n\n### Workflow 3: Debug a Failing Pipeline\n\n1. **Check task history**: `SELECT * FROM TABLE(INFORMATION_SCHEMA.TASK_HISTORY()) WHERE STATE = 'FAILED' ORDER BY SCHEDULED_TIME DESC;`\n2. **Check DT refresh**: `SELECT * FROM TABLE(INFORMATION_SCHEMA.DYNAMIC_TABLE_REFRESH_HISTORY('my_dt')) ORDER BY REFRESH_END_TIME DESC;`\n3. **Check stream staleness**: `SHOW STREAMS; -- check stale_after column`\n4. **Consult troubleshooting reference**: See `references\u002Ftroubleshooting.md` for error-specific fixes\n\n---\n\n## Anti-Patterns\n\n| Anti-Pattern | Why It Fails | Better Approach |\n|---|---|---|\n| `SELECT *` in Dynamic Tables | Schema changes upstream break the DT silently | Use explicit column lists |\n| Missing colon prefix in procedures | \"Invalid identifier\" runtime error | Always use `:variable_name` in SQL blocks |\n| Single warehouse for all workloads | Contention between load, transform, and query | Separate warehouses per workload type |\n| Hardcoded credentials in Snowpark | Security risk, breaks in CI\u002FCD | Use `os.environ[]` or key pair auth |\n| `collect()` on large DataFrames | Pulls entire result set to client memory | Process server-side with DataFrame operations |\n| Nested subqueries instead of CTEs | Unreadable, hard to debug, Snowflake optimizes CTEs better | Use `WITH` clauses |\n| Using deprecated Cortex functions | `CLASSIFY_TEXT`, `SUMMARIZE` etc. will be removed | Use `AI_CLASSIFY`, `AI_COMPLETE` etc. |\n| Tasks without `WHEN SYSTEM$STREAM_HAS_DATA` | Task runs on schedule even with no new data, wasting credits | Add the WHEN clause for stream-driven tasks |\n| Double-quoted identifiers | Forces case-sensitive names across all queries | Use `snake_case` unquoted identifiers |\n\n---\n\n## Cross-References\n\n| Skill | Relationship |\n|-------|-------------|\n| `engineering\u002Fsql-database-assistant` | General SQL patterns — use for non-Snowflake databases |\n| `engineering\u002Fdatabase-designer` | Schema design — use for data modeling before Snowflake implementation |\n| `engineering-team\u002Fsenior-data-engineer` | Broader data engineering — pipelines, Spark, Airflow, data quality |\n| `engineering-team\u002Fsenior-data-scientist` | Analytics and ML — use alongside Snowpark for feature engineering |\n| `engineering-team\u002Fsenior-devops` | CI\u002FCD for Snowflake deployments (Terraform, GitHub Actions) |\n\n---\n\n## Reference Documentation\n\n| Document | Contents |\n|----------|----------|\n| `references\u002Fsnowflake_sql_and_pipelines.md` | SQL patterns, MERGE templates, Dynamic Table debugging, Snowpipe, anti-patterns |\n| `references\u002Fcortex_ai_and_agents.md` | Cortex AI functions, agent spec structure, Cortex Search, Snowpark |\n| `references\u002Ftroubleshooting.md` | Error reference, debugging queries, common fixes |\n","# Snowflake Development\n\nSnowflake SQL, data pipelines, Cortex AI, and Snowpark Python development. Covers the colon-prefix rule, semi-structured data, MERGE upserts, Dynamic Tables, Streams+Tasks, Cortex AI functions, agent specs, performance tuning, and security hardening.\n\n> Originally contributed by [James Cha-Earley](https:\u002F\u002Fgithub.com\u002Fjamescha-earley) — enhanced and integrated by the claude-skills team.\n\n## Quick Start\n\n```bash\n# Generate a MERGE upsert template\npython scripts\u002Fsnowflake_query_helper.py merge --target customers --source staging_customers --key customer_id --columns name,email,updated_at\n\n# Generate a Dynamic Table template\npython scripts\u002Fsnowflake_query_helper.py dynamic-table --name cleaned_events --warehouse transform_wh --lag \"5 minutes\"\n\n# Generate RBAC grant statements\npython scripts\u002Fsnowflake_query_helper.py grant --role analyst_role --database analytics --schemas public,staging --privileges SELECT,USAGE\n```\n\n---\n\n## SQL Best Practices\n\n### Naming and Style\n\n- Use `snake_case` for all identifiers. Avoid double-quoted identifiers -- they force case-sensitive names that require constant quoting.\n- Use CTEs (`WITH` clauses) over nested subqueries.\n- Use `CREATE OR REPLACE` for idempotent DDL.\n- Use explicit column lists -- never `SELECT *` in production. Snowflake's columnar storage scans only referenced columns, so explicit lists reduce I\u002FO.\n\n### Stored Procedures -- Colon Prefix Rule\n\nIn SQL stored procedures (BEGIN...END blocks), variables and parameters **must** use the colon `:` prefix inside SQL statements. Without it, Snowflake treats them as column identifiers and raises \"invalid identifier\" errors.\n\n```sql\n-- WRONG: missing colon prefix\nSELECT name INTO result FROM users WHERE id = p_id;\n\n-- CORRECT: colon prefix on both variable and parameter\nSELECT name INTO :result FROM users WHERE id = :p_id;\n```\n\nThis applies to DECLARE variables, LET variables, and procedure parameters when used inside SELECT, INSERT, UPDATE, DELETE, or MERGE.\n\n### Semi-Structured Data\n\n- VARIANT, OBJECT, ARRAY for JSON\u002FAvro\u002FParquet\u002FORC.\n- Access nested fields: `src:customer.name::STRING`. Always cast with `::TYPE`.\n- VARIANT null vs SQL NULL: JSON `null` is stored as the string `\"null\"`. Use `STRIP_NULL_VALUE = TRUE` on load.\n- Flatten arrays: `SELECT f.value:name::STRING FROM my_table, LATERAL FLATTEN(input => src:items) f;`\n\n### MERGE for Upserts\n\n```sql\nMERGE INTO target t USING source s ON t.id = s.id\nWHEN MATCHED THEN UPDATE SET t.name = s.name, t.updated_at = CURRENT_TIMESTAMP()\nWHEN NOT MATCHED THEN INSERT (id, name, updated_at) VALUES (s.id, s.name, CURRENT_TIMESTAMP());\n```\n\n> See `references\u002Fsnowflake_sql_and_pipelines.md` for deeper SQL patterns and anti-patterns.\n\n---\n\n## Data Pipelines\n\n### Choosing Your Approach\n\n| Approach | When to Use |\n|----------|-------------|\n| Dynamic Tables | Declarative transformations. **Default choice.** Define the query, Snowflake handles refresh. |\n| Streams + Tasks | Imperative CDC. Use for procedural logic, stored procedure calls, complex branching. |\n| Snowpipe | Continuous file loading from cloud storage (S3, GCS, Azure). |\n\n### Dynamic Tables\n\n```sql\nCREATE OR REPLACE DYNAMIC TABLE cleaned_events\n    TARGET_LAG = '5 minutes'\n    WAREHOUSE = transform_wh\n    AS\n    SELECT event_id, event_type, user_id, event_timestamp\n    FROM raw_events\n    WHERE event_type IS NOT NULL;\n```\n\nKey rules:\n- Set `TARGET_LAG` progressively: tighter at the top of the DAG, looser downstream.\n- Incremental DTs cannot depend on Full-refresh DTs.\n- `SELECT *` breaks on upstream schema changes -- use explicit column lists.\n- Views cannot sit between two Dynamic Tables in the DAG.\n\n### Streams and Tasks\n\n```sql\nCREATE OR REPLACE STREAM raw_stream ON TABLE raw_events;\n\nCREATE OR REPLACE TASK process_events\n    WAREHOUSE = transform_wh\n    SCHEDULE = 'USING CRON 0 *\u002F1 * * * America\u002FLos_Angeles'\n    WHEN SYSTEM$STREAM_HAS_DATA('raw_stream')\n    AS INSERT INTO cleaned_events SELECT ... FROM raw_stream;\n\n-- Tasks start SUSPENDED. You MUST resume them.\nALTER TASK process_events RESUME;\n```\n\n> See `references\u002Fsnowflake_sql_and_pipelines.md` for DT debugging queries and Snowpipe patterns.\n\n---\n\n## Cortex AI\n\n### Function Reference\n\n| Function | Purpose |\n|----------|---------|\n| `AI_COMPLETE` | LLM completion (text, images, documents) |\n| `AI_CLASSIFY` | Classify text into categories (up to 500 labels) |\n| `AI_FILTER` | Boolean filter on text or images |\n| `AI_EXTRACT` | Structured extraction from text\u002Fimages\u002Fdocuments |\n| `AI_SENTIMENT` | Sentiment score (-1 to 1) |\n| `AI_PARSE_DOCUMENT` | OCR or layout extraction from documents |\n| `AI_REDACT` | PII removal from text |\n\n**Deprecated names (do NOT use):** `COMPLETE`, `CLASSIFY_TEXT`, `EXTRACT_ANSWER`, `PARSE_DOCUMENT`, `SUMMARIZE`, `TRANSLATE`, `SENTIMENT`, `EMBED_TEXT_768`.\n\n### TO_FILE -- Common Pitfall\n\nStage path and filename are **separate** arguments:\n\n```sql\n-- WRONG: single combined argument\nTO_FILE('@stage\u002Ffile.pdf')\n\n-- CORRECT: two arguments\nTO_FILE('@db.schema.mystage', 'invoice.pdf')\n```\n\n### Cortex Agents\n\nAgent specs use a JSON structure with top-level keys: `models`, `instructions`, `tools`, `tool_resources`.\n\n- Use `$spec$` delimiter (not `$$`).\n- `models` must be an object, not an array.\n- `tool_resources` is a separate top-level key, not nested inside `tools`.\n- Tool descriptions are the single biggest factor in agent quality.\n\n> See `references\u002Fcortex_ai_and_agents.md` for full agent spec examples and Cortex Search patterns.\n\n---\n\n## Snowpark Python\n\n```python\nfrom snowflake.snowpark import Session\nimport os\n\nsession = Session.builder.configs({\n    \"account\": os.environ[\"SNOWFLAKE_ACCOUNT\"],\n    \"user\": os.environ[\"SNOWFLAKE_USER\"],\n    \"password\": os.environ[\"SNOWFLAKE_PASSWORD\"],\n    \"role\": \"my_role\", \"warehouse\": \"my_wh\",\n    \"database\": \"my_db\", \"schema\": \"my_schema\"\n}).create()\n```\n\n- Never hardcode credentials. Use environment variables or key pair auth.\n- DataFrames are lazy -- executed on `collect()` \u002F `show()`.\n- Do NOT call `collect()` on large DataFrames. Process server-side with DataFrame operations.\n- Use **vectorized UDFs** (10-100x faster) for batch and ML workloads.\n\n## dbt on Snowflake\n\n```sql\n-- Dynamic table materialization (streaming\u002Fnear-real-time marts):\n{{ config(materialized='dynamic_table', snowflake_warehouse='transforming', target_lag='1 hour') }}\n\n-- Incremental materialization (large fact tables):\n{{ config(materialized='incremental', unique_key='event_id') }}\n\n-- Snowflake-specific configs (combine with any materialization):\n{{ config(transient=true, copy_grants=true, query_tag='team_daily') }}\n```\n\n- Do NOT use `{{ this }}` without `{% if is_incremental() %}` guard.\n- Use `dynamic_table` materialization for streaming or near-real-time marts.\n\n## Performance\n\n- **Cluster keys**: Only for multi-TB tables. Apply on WHERE \u002F JOIN \u002F GROUP BY columns.\n- **Search Optimization**: `ALTER TABLE t ADD SEARCH OPTIMIZATION ON EQUALITY(col);`\n- **Warehouse sizing**: Start X-Small, scale up. Set `AUTO_SUSPEND = 60`, `AUTO_RESUME = TRUE`.\n- **Separate warehouses** per workload (load, transform, query).\n\n## Security\n\n- Follow least-privilege RBAC. Use database roles for object-level grants.\n- Audit ACCOUNTADMIN regularly: `SHOW GRANTS OF ROLE ACCOUNTADMIN;`\n- Use network policies for IP allowlisting.\n- Use masking policies for PII columns and row access policies for multi-tenant isolation.\n\n---\n\n## Proactive Triggers\n\nSurface these issues without being asked when you notice them in context:\n\n- **Missing colon prefix** in SQL stored procedures -- flag immediately, this causes \"invalid identifier\" at runtime.\n- **`SELECT *` in Dynamic Tables** -- flag as a schema-change time bomb.\n- **Deprecated Cortex function names** (`CLASSIFY_TEXT`, `SUMMARIZE`, etc.) -- suggest the current `AI_*` equivalents.\n- **Task not resumed** after creation -- remind that tasks start SUSPENDED.\n- **Hardcoded credentials** in Snowpark code -- flag as a security risk.\n\n---\n\n## Common Errors\n\n| Error | Cause | Fix |\n|-------|-------|-----|\n| \"Object does not exist\" | Wrong database\u002Fschema context or missing grants | Fully qualify names (`db.schema.table`), check grants |\n| \"Invalid identifier\" in procedure | Missing colon prefix on variable | Use `:variable_name` inside SQL statements |\n| \"Numeric value not recognized\" | VARIANT field not cast | Cast explicitly: `src:field::NUMBER(10,2)` |\n| Task not running | Forgot to resume after creation | `ALTER TASK task_name RESUME;` |\n| DT refresh failing | Schema change upstream or tracking disabled | Use explicit columns, verify change tracking |\n| TO_FILE error | Combined path as single argument | Split into two args: `TO_FILE('@stage', 'file.pdf')` |\n\n---\n\n## Practical Workflows\n\n### Workflow 1: Build a Reporting Pipeline (30 min)\n\n1. **Stage raw data**: Create external stage pointing to S3\u002FGCS\u002FAzure, set up Snowpipe for auto-ingest\n2. **Clean with Dynamic Table**: Create DT with `TARGET_LAG = '5 minutes'` that filters nulls, casts types, deduplicates\n3. **Aggregate with downstream DT**: Second DT that joins cleaned data with dimension tables, computes metrics\n4. **Expose via Secure View**: Create `SECURE VIEW` for the BI tool \u002F API layer\n5. **Grant access**: Use `snowflake_query_helper.py grant` to generate RBAC statements\n\n### Workflow 2: Add AI Classification to Existing Data\n\n1. **Identify the column**: Find the text column to classify (e.g., support tickets, reviews)\n2. **Test with AI_CLASSIFY**: `SELECT AI_CLASSIFY(text_col, ['bug', 'feature', 'question']) FROM table LIMIT 10;`\n3. **Create enrichment DT**: Dynamic Table that runs `AI_CLASSIFY` on new rows automatically\n4. **Monitor costs**: Cortex AI is billed per token — sample before running on full tables\n\n### Workflow 3: Debug a Failing Pipeline\n\n1. **Check task history**: `SELECT * FROM TABLE(INFORMATION_SCHEMA.TASK_HISTORY()) WHERE STATE = 'FAILED' ORDER BY SCHEDULED_TIME DESC;`\n2. **Check DT refresh**: `SELECT * FROM TABLE(INFORMATION_SCHEMA.DYNAMIC_TABLE_REFRESH_HISTORY('my_dt')) ORDER BY REFRESH_END_TIME DESC;`\n3. **Check stream staleness**: `SHOW STREAMS; -- check stale_after column`\n4. **Consult troubleshooting reference**: See `references\u002Ftroubleshooting.md` for error-specific fixes\n\n---\n\n## Anti-Patterns\n\n| Anti-Pattern | Why It Fails | Better Approach |\n|---|---|---|\n| `SELECT *` in Dynamic Tables | Schema changes upstream break the DT silently | Use explicit column lists |\n| Missing colon prefix in procedures | \"Invalid identifier\" runtime error | Always use `:variable_name` in SQL blocks |\n| Single warehouse for all workloads | Contention between load, transform, and query | Separate warehouses per workload type |\n| Hardcoded credentials in Snowpark | Security risk, breaks in CI\u002FCD | Use `os.environ[]` or key pair auth |\n| `collect()` on large DataFrames | Pulls entire result set to client memory | Process server-side with DataFrame operations |\n| Nested subqueries instead of CTEs | Unreadable, hard to debug, Snowflake optimizes CTEs better | Use `WITH` clauses |\n| Using deprecated Cortex functions | `CLASSIFY_TEXT`, `SUMMARIZE` etc. will be removed | Use `AI_CLASSIFY`, `AI_COMPLETE` etc. |\n| Tasks without `WHEN SYSTEM$STREAM_HAS_DATA` | Task runs on schedule even with no new data, wasting credits | Add the WHEN clause for stream-driven tasks |\n| Double-quoted identifiers | Forces case-sensitive names across all queries | Use `snake_case` unquoted identifiers |\n\n---\n\n## Cross-References\n\n| Skill | Relationship |\n|-------|-------------|\n| `engineering\u002Fsql-database-assistant` | General SQL patterns — use for non-Snowflake databases |\n| `engineering\u002Fdatabase-designer` | Schema design — use for data modeling before Snowflake implementation |\n| `engineering-team\u002Fsenior-data-engineer` | Broader data engineering — pipelines, Spark, Airflow, data quality |\n| `engineering-team\u002Fsenior-data-scientist` | Analytics and ML — use alongside Snowpark for feature engineering |\n| `engineering-team\u002Fsenior-devops` | CI\u002FCD for Snowflake deployments (Terraform, GitHub Actions) |\n\n---\n\n## Reference Documentation\n\n| Document | Contents |\n|----------|----------|\n| `references\u002Fsnowflake_sql_and_pipelines.md` | SQL patterns, MERGE templates, Dynamic Table debugging, Snowpipe, anti-patterns |\n| `references\u002Fcortex_ai_and_agents.md` | Cortex AI functions, agent spec structure, Cortex Search, Snowpark |\n| `references\u002Ftroubleshooting.md` | Error reference, debugging queries, common fixes |\n",{"name":5,"description":7},"main","7e219d4f922f94392cb65883ba910846c3c2e71b","engineering-team\u002Fsnowflake-development\u002Fskills\u002Fsnowflake-development",0,"https:\u002F\u002Fgithub.com\u002Fdevlify-marketplace\u002Fdevlify-skills","https:\u002F\u002Fgithub.com\u002Fdevlify-marketplace","devlify.com.ng","Software Developer & full-stack dev building secure web and mobile applications, AI\u002FML solutions, and scalable digital products. Founder of Devlify ","2026-08-30 00:40:50",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add devlify-marketplace\u002Fdevlify-skills --skill snowflake-development",{"tool":39,"command":40},"bunx","bunx skills add devlify-marketplace\u002Fdevlify-skills --skill snowflake-development",{"tool":42,"command":43},"pnpm","pnpm dlx skills add devlify-marketplace\u002Fdevlify-skills --skill snowflake-development","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fdevlify-marketplace\u002Fdevlify-skills\u002Fblob\u002Fmain\u002Fengineering-team\u002Fsnowflake-development\u002Fskills\u002Fsnowflake-development\u002FSKILL.md",true,[47,53,57,61],{"path":48,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":51,"sourceHtmlUrl":52},"references\u002Fcortex_ai_and_agents.md","REFERENCE","参考文档",7724,"https:\u002F\u002Fgithub.com\u002Fdevlify-marketplace\u002Fdevlify-skills\u002Fblob\u002Fmain\u002Fengineering-team\u002Fsnowflake-development\u002Fskills\u002Fsnowflake-development\u002Freferences\u002Fcortex_ai_and_agents.md",{"path":54,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":55,"sourceHtmlUrl":56},"references\u002Fsnowflake_sql_and_pipelines.md",7553,"https:\u002F\u002Fgithub.com\u002Fdevlify-marketplace\u002Fdevlify-skills\u002Fblob\u002Fmain\u002Fengineering-team\u002Fsnowflake-development\u002Fskills\u002Fsnowflake-development\u002Freferences\u002Fsnowflake_sql_and_pipelines.md",{"path":58,"resourceType":49,"resourceTypeDesc":50,"sizeBytes":59,"sourceHtmlUrl":60},"references\u002Ftroubleshooting.md",5364,"https:\u002F\u002Fgithub.com\u002Fdevlify-marketplace\u002Fdevlify-skills\u002Fblob\u002Fmain\u002Fengineering-team\u002Fsnowflake-development\u002Fskills\u002Fsnowflake-development\u002Freferences\u002Ftroubleshooting.md",{"path":62,"resourceType":63,"resourceTypeDesc":64,"sizeBytes":65,"sourceHtmlUrl":66},"scripts\u002Fsnowflake_query_helper.py","SCRIPT","脚本",8444,"https:\u002F\u002Fgithub.com\u002Fdevlify-marketplace\u002Fdevlify-skills\u002Fblob\u002Fmain\u002Fengineering-team\u002Fsnowflake-development\u002Fskills\u002Fsnowflake-development\u002Fscripts\u002Fsnowflake_query_helper.py",[68,75,82,89,96,103],{"skillNo":69,"name":70,"nameZh":6,"description":71,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":72,"categories":73,"keywords":74,"publishedAt":19},"01M7BRV5Q3BJT22HG25WJFTKZN","syllabus","Generates a curated supplementary reading list from any course syllabus using Consensus academic search. Grill-me intake (syllabus input format + course audience + year range) plus a grouping forcing-options checkpoint before any search runs — so the reading list matches the course's level and recency need. Parses the syllabus to extract topics and learning outcomes, searches Consensus for recent peer-reviewed papers per topic, and produces a professionally formatted .docx with clickable Consensus links, plain-language summaries calibrated to audience level, and Bloom-higher-order discussion questions tied to course learning goals. Use when the user uploads a syllabus, course outline, or curriculum document and wants supplementary readings (e.g., 'create a reading list from this syllabus', 'find recent papers for my course') — even casual mentions with a syllabus attached should trigger this skill.","https:\u002F\u002Fgithub.com\u002Fdevlify-marketplace\u002Fdevlify-skills\u002Fblob\u002Fmain\u002Fresearch\u002Fsyllabus\u002Fskills\u002Fsyllabus\u002FSKILL.md",[],[],{"skillNo":76,"name":77,"nameZh":6,"description":78,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":79,"categories":80,"keywords":81,"publishedAt":19},"01M7BRTW6RRTHXT6SBE41AY5GD","research","Default entry point for any research request — a hybrid router that classifies the question deterministically and either delegates to a specialist research skill (pulse for trends\u002Fsentiment, grants for NIH funding, litreview for academic literature, syllabus for course reading, patent for prior-art + IP landscape, dossier for entity research, deepread for evidence-first reading of supplied documents) or runs its own plan-decompose-multi-source-search-synthesize-cite fallback workflow when no specialist matches. Always surfaces the routing decision so users can override. Use when the user makes any research request that doesn't obviously match a more-specific specialist skill (e.g., \"research [topic]\", \"look into [topic]\", \"what do we know about [topic]\", \"investigate [topic]\", \"find me information on [topic]\", \"do some research on [topic]\", \"I need to understand [topic]\"). Output is a markdown briefing (default) or .docx document (on request) with full citations and an audit log.","https:\u002F\u002Fgithub.com\u002Fdevlify-marketplace\u002Fdevlify-skills\u002Fblob\u002Fmain\u002Fresearch\u002Fresearch\u002Fskills\u002Fresearch\u002FSKILL.md",[],[],{"skillNo":83,"name":84,"nameZh":6,"description":85,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":88,"publishedAt":19},"01M7BRTMK3PGPNH76R2HY57AKC","pulse","Multi-source recency research skill that takes the pulse of any topic across Reddit, Hacker News, the open web, and optionally X\u002FTwitter within a configurable recent window (default 30 days). Forcing intake clarifies topic specificity, angle (trend\u002Fsentiment\u002Fproblems\u002Fopportunities\u002Fcomparison), time window, and platform scope before searching. Returns a synthesized briefing with citations, engagement metrics, and cross-platform pattern analysis. Use when the user requests multi-source recency intelligence on a topic (e.g., 'pulse on [topic]', 'what's happening with [topic]', 'what are people saying about [topic]', 'current conversation about [topic]', 'take the pulse of [topic]', 'trending: [topic]', 'find me info on [topic]'), and for competitor research, trend discovery, tool comparisons, and audience sentiment analysis.","https:\u002F\u002Fgithub.com\u002Fdevlify-marketplace\u002Fdevlify-skills\u002Fblob\u002Fmain\u002Fresearch\u002Fpulse\u002Fskills\u002Fpulse\u002FSKILL.md",[],[],{"skillNo":90,"name":91,"nameZh":6,"description":92,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":93,"categories":94,"keywords":95,"publishedAt":19},"01M7BRTAR0YJWNZ2AP3QTH39BW","patent","Patent prior-art and landscape intelligence skill — not generic patent help. Commits to one of five sub-use-cases via forcing intake (novelty search \u002F freedom-to-operate \u002F competitive landscape \u002F acquisition diligence \u002F litigation prior-art) before any search runs. Searches Google Patents, Espacenet, USPTO, and optionally Lens.org for citation-graph signals. Output is an editable Word document (.docx) with verdict, ranked closest art (claim-text extracted), CPC-class-aware landscape, family-resolved hits, geographic coverage, FTO flags where applicable, strategy recommendations, and full audit log. Use when the user asks for patent searching or analysis (e.g., 'prior art search for [invention]', 'freedom to operate analysis for [product]'). Produces search signal, not legal advice — always recommends consulting a patent attorney before filing or licensing decisions. Trademark, copyright, and trade-secret questions are out of scope.","https:\u002F\u002Fgithub.com\u002Fdevlify-marketplace\u002Fdevlify-skills\u002Fblob\u002Fmain\u002Fresearch\u002Fpatent\u002Fskills\u002Fpatent\u002FSKILL.md",[],[],{"skillNo":97,"name":98,"nameZh":6,"description":99,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":100,"categories":101,"keywords":102,"publishedAt":19},"01M7BRT3J0V5A9V3VJ96G97AGW","notebooklm","Browser automation skill for controlling Google's NotebookLM. Use when the user wants anything done in NotebookLM (e.g., 'open NotebookLM', 'check my [name] notebook', 'ask my notebook about X', 'add [source] to NotebookLM', 'generate a Video Overview from my notebook', 'use NotebookLM Studio'). Handles reading and querying notebooks, adding sources (URLs, text, files, YouTube links, synthesized content), generating Studio outputs (Audio\u002FVideo Overviews, Mind Maps, Reports incl. Briefing Doc\u002FStudy Guide\u002FFAQ, Flashcards, Quiz, slide decks, infographics — discover the exact set from the live Studio panel; the UI evolves fast), and creating new notebooks. Requires browser automation environment — fails gracefully when unavailable.","https:\u002F\u002Fgithub.com\u002Fdevlify-marketplace\u002Fdevlify-skills\u002Fblob\u002Fmain\u002Fresearch\u002Fnotebooklm\u002Fskills\u002Fnotebooklm\u002FSKILL.md",[],[],{"skillNo":104,"name":105,"nameZh":6,"description":106,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":107,"categories":108,"keywords":109,"publishedAt":19},"01M7BRSS7P0CJP7X9ERDFYN6GC","litreview","Academic literature orientation skill that searches papers via free keyless APIs (PubMed E-utilities + OpenAlex) by default — with the Consensus MCP as an optional enhancement lane when connected — builds a strategic search plan using PICO (default) or SPIDER \u002F Decomposition \u002F hybrid as fallbacks, and synthesizes findings into a formatted Word (.docx) research guide. Grill-me intake (research question specificity + framework hint + tentative depth) before the recon search; a second forcing checkpoint after Phase 2 confirms framework + sub-areas + depth before searches consume budget. Configurable depth (5\u002F10\u002F20 queries) controls coverage vs. speed. Output is a 'launching pad' — an orientation guide that lets a researcher dive in confidently, not a finished review. Use when the user starts literature-oriented research (e.g., 'litreview on [topic]', 'literature review on [topic]', 'I'm starting a literature review on X', 'I'm writing a paper on X', 'help me research X', 'I'm doing research on X', 'can you help me research X'). Do NOT use for single one-off paper searches wanting a quick list — that's a plain PubMed\u002FOpenAlex (or Consensus) query.","https:\u002F\u002Fgithub.com\u002Fdevlify-marketplace\u002Fdevlify-skills\u002Fblob\u002Fmain\u002Fresearch\u002Flitreview\u002Fskills\u002Flitreview\u002FSKILL.md",[],[]]