{"id":"b8da37f5-f9f2-4304-8ca9-b87ba9e45a0f","shortId":"yYGJkz","kind":"skill","title":"snowflake-development","tagline":"Comprehensive Snowflake development assistant covering SQL best practices, data pipeline design (Dynamic Tables, Streams, Tasks, Snowpipe), Cortex AI functions, Cortex Agents, Snowpark Python, dbt integration, performance tuning, and security hardening.","description":"# Snowflake Development\n\nYou are a Snowflake development expert. Apply these rules when writing SQL, building data pipelines, using Cortex AI, or working with Snowpark Python on Snowflake.\n\n## When to Use\n- When the user asks for help with Snowflake SQL, data pipelines, Cortex AI, or Snowpark Python.\n- When you need Snowflake-specific guidance for dbt, performance tuning, or security hardening.\n\n## SQL Best Practices\n\n### Naming and Style\n\n- Use `snake_case` for all identifiers. Avoid double-quoted identifiers — they create case-sensitive names requiring 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).\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 raises \"invalid identifier\" errors.\n\nBAD:\n```sql\nCREATE PROCEDURE my_proc(p_id INT) RETURNS STRING LANGUAGE SQL AS\nBEGIN\n    LET result STRING;\n    SELECT name INTO result FROM users WHERE id = p_id;\n    RETURN result;\nEND;\n```\n\nGOOD:\n```sql\nCREATE PROCEDURE my_proc(p_id INT) RETURNS STRING LANGUAGE SQL AS\nBEGIN\n    LET result STRING;\n    SELECT name INTO :result FROM users WHERE id = :p_id;\n    RETURN result;\nEND;\n```\n\n### Semi-Structured Data\n\n- VARIANT, OBJECT, ARRAY for JSON/Avro/Parquet/ORC.\n- Access nested fields: `src:customer.name::STRING`. Always cast: `src:price::NUMBER(10,2)`.\n- VARIANT null vs SQL NULL: JSON `null` is stored as `\"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## 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. |\n| Snowpipe | Continuous file loading from 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 top, looser at bottom.\n- Incremental DTs **cannot** depend on Full refresh DTs.\n- `SELECT *` breaks on schema changes — use explicit column lists.\n- Change tracking must stay enabled on base tables.\n- Views cannot sit between two Dynamic Tables.\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 */1 * * * America/Los_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## Cortex AI\n\n### Function Reference\n\n| Function | Purpose |\n|----------|---------|\n| `AI_COMPLETE` | LLM completion (text, images, documents) |\n| `AI_CLASSIFY` | Classify into categories (up to 500 labels) |\n| `AI_FILTER` | Boolean filter on text/images |\n| `AI_EXTRACT` | Structured extraction from text/images/documents |\n| `AI_SENTIMENT` | Sentiment score (-1 to 1) |\n| `AI_PARSE_DOCUMENT` | OCR or layout extraction |\n| `AI_REDACT` | PII removal |\n\n**Deprecated (do NOT use):** `COMPLETE`, `CLASSIFY_TEXT`, `EXTRACT_ANSWER`, `PARSE_DOCUMENT`, `SUMMARIZE`, `TRANSLATE`, `SENTIMENT`, `EMBED_TEXT_768`.\n\n### TO_FILE — Common Error Source\n\nStage path and filename are **SEPARATE** arguments:\n\n```sql\n-- BAD: TO_FILE('@stage/file.pdf')\n-- GOOD:\nTO_FILE('@db.schema.mystage', 'invoice.pdf')\n```\n\n### Use AI_CLASSIFY for Classification (Not AI_COMPLETE)\n\n```sql\nSELECT AI_CLASSIFY(ticket_text,\n    ['billing', 'technical', 'account']):labels[0]::VARCHAR AS category\nFROM tickets;\n```\n\n### Cortex Agents\n\n```sql\nCREATE OR REPLACE AGENT my_db.my_schema.sales_agent\nFROM SPECIFICATION $spec$\n{\n    \"models\": {\"orchestration\": \"auto\"},\n    \"instructions\": {\n        \"orchestration\": \"You are SalesBot...\",\n        \"response\": \"Be concise.\"\n    },\n    \"tools\": [{\"tool_spec\": {\"type\": \"cortex_analyst_text_to_sql\", \"name\": \"Sales\", \"description\": \"Queries sales...\"}}],\n    \"tool_resources\": {\"Sales\": {\"semantic_model_file\": \"@stage/model.yaml\"}}\n}\n$spec$;\n```\n\nAgent rules:\n- Use `$spec$` delimiter (not `$$`).\n- `models` must be an object, not an array.\n- `tool_resources` is a separate top-level object, not nested inside tools.\n- Do NOT include empty/null values in edit specs — clears existing values.\n- Tool descriptions are the #1 quality factor.\n- Never modify production agents directly — clone first.\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.\n- DataFrames are lazy — executed on `collect()`/`show()`.\n- Do NOT use `collect()` on large DataFrames — process server-side.\n- Use **vectorized UDFs** (10-100x faster) for batch/ML workloads instead of scalar UDFs.\n\n## dbt on Snowflake\n\nDynamic table materialization (streaming/near-real-time marts):\n```sql\n{{ config(materialized='dynamic_table', snowflake_warehouse='transforming', target_lag='1 hour') }}\n```\n\nIncremental materialization (large fact tables):\n```sql\n{{ config(materialized='incremental', unique_key='event_id') }}\n```\n\nSnowflake-specific configs (combine with any materialization):\n```sql\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/near-real-time marts.\n\n## Performance\n\n- **Cluster keys**: Only multi-TB tables, on WHERE/JOIN/GROUP BY columns.\n- **Search Optimization**: `ALTER TABLE t ADD SEARCH OPTIMIZATION ON EQUALITY(col);`\n- **Warehouse sizing**: Start X-Small, scale up. `AUTO_SUSPEND = 60`, `AUTO_RESUME = TRUE`.\n- **Separate warehouses** per workload.\n- Estimate AI costs first: `SELECT SUM(AI_COUNT_TOKENS('claude-4-sonnet', text)) FROM table;`\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## Common Error Patterns\n\n| Error | Cause | Fix |\n|-------|-------|-----|\n| \"Object does not exist\" | Wrong context or missing grants | Fully qualify names, check grants |\n| \"Invalid identifier\" in proc | Missing colon prefix | Use `:variable_name` |\n| \"Numeric value not recognized\" | VARIANT not cast | `src:field::NUMBER(10,2)` |\n| Task not running | Forgot to resume | `ALTER TASK ... RESUME` |\n| DT refresh failing | Schema change or tracking disabled | Use explicit columns, check change tracking |\n\n## Limitations\n- Use this skill only when the task clearly matches the scope described above.\n- Do not treat the output as a substitute for environment-specific validation, testing, or expert review.\n- Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.","tags":["snowflake","development","antigravity","awesome","skills","sickn33","agent-skills","agentic-skills","ai-agent-skills","ai-agents","ai-coding","ai-workflows"],"capabilities":["skill","source-sickn33","skill-snowflake-development","topic-agent-skills","topic-agentic-skills","topic-ai-agent-skills","topic-ai-agents","topic-ai-coding","topic-ai-workflows","topic-antigravity","topic-antigravity-skills","topic-claude-code","topic-claude-code-skills","topic-codex-cli","topic-codex-skills"],"categories":["antigravity-awesome-skills"],"synonyms":[],"warnings":[],"endpointUrl":"https://skills.sh/sickn33/antigravity-awesome-skills/snowflake-development","protocol":"skill","transport":"skills-sh","auth":{"type":"none","details":{"cli":"npx skills add sickn33/antigravity-awesome-skills","source_repo":"https://github.com/sickn33/antigravity-awesome-skills","install_from":"skills.sh"}},"qualityScore":"0.700","qualityRationale":"deterministic score 0.70 from registry signals: · indexed on github topic:agent-skills · 34515 github stars · SKILL.md body (7,937 chars)","verified":false,"liveness":"unknown","lastLivenessCheck":null,"agentReviews":{"count":0,"score_avg":null,"cost_usd_avg":null,"success_rate":null,"latency_p50_ms":null,"narrative_summary":null,"summary_updated_at":null},"enrichmentModel":"deterministic:skill-github:v1","enrichmentVersion":1,"enrichedAt":"2026-04-22T12:51:48.287Z","embedding":null,"createdAt":"2026-04-18T21:45:11.347Z","updatedAt":"2026-04-22T12:51:48.287Z","lastSeenAt":"2026-04-22T12:51:48.287Z","tsv":"'-1':549 '-100':784 '-4':913 '/1':481 '0':480,620 '1':551,713,812 '10':262,783,1001 '2':263,1002 '5':386 '500':531 '60':895 '768':579 'access':251,954 'account':618,734,737 'accountadmin':933,939 'add':879 'agent':24,627,632,634,671,719 'ai':21,53,76,512,517,524,533,539,545,552,559,603,608,612,904,909 'allowlist':945 'alter':506,876,1009 'alway':257 'america/los_angeles':482 'analyst':654 'answer':571 'appli':42 'approach':340,341 'argument':591 'array':248,283,684 'ask':67,1059 'assist':7 'audit':932 'auto':640,893,896 'avoid':106 'bad':180,593 'base':445 'batch/ml':788 'begin':159,194,225 'best':10,95 'bill':616 'block':161 'boolean':535 'bottom':421 'boundari':1067 'break':431 'build':48 'call':367 'cannot':424,448 'case':102,114 'case-sensit':113 'cast':258,997 'categori':528,623 'caus':965 'cdc':360 'chang':434,439,1016,1024 'check':979,1023 'choic':350 'choos':338 'clarif':1061 'classif':606 'classifi':525,526,568,604,613 'claud':912 'claus':123 'clean':382,493 'clear':706,1034 'clone':721 'cluster':863 'col':884 'collect':767,772 'colon':152,168,986 'column':136,149,437,873,951,1022 'columnar':144 'combin':831 'common':582,961 'complet':518,520,567,609 'comprehens':4 'concis':648 'config':803,820,830,836 'constant':118 'context':972 'continu':369 'copi':839 'cortex':20,23,52,75,511,626,653 'cost':905 'count':910 'cover':8 'creat':112,128,182,213,377,458,468,629,758 'credenti':761 'criteria':1070 'cron':479 'ctes':121 'current':320,334 'customer.name':255 'daili':845 'data':12,49,73,245,336,487 'databas':752,925 'datafram':762,775 'db':754 'db.schema.mystage':600 'dbt':27,88,794 'ddl':133 'declar':347 'default':349 'defin':351 'delimit':675 'depend':425 'deprec':563 'describ':1038 'descript':660,710 'design':14 'develop':3,6,35,40 'direct':720 'disabl':1019 'document':523,554,573 'doubl':108 'double-quot':107 'dt':1012 'dts':423,429 'dynam':15,345,374,380,452,797,805,856 'edit':704 'emb':577 'empty/null':701 'enabl':443 'end':160,210,241 'environ':1050 'environment-specif':1049 'equal':883 'error':179,583,962,964 'estim':903 'event':383,393,395,399,403,405,467,473,494,509,825 'execut':765 'exist':707,970 'expert':41,1055 'explicit':135,436,1021 'extract':540,542,558,570 'f':296 'f.value':285 'fact':817 'factor':715 'fail':1014 'faster':786 'field':253,999 'file':370,581,595,599,668 'filenam':588 'filter':534,536 'first':722,906 'fix':966 'flatten':282,292 'follow':919 'forgot':1006 'full':427 'fulli':976 'function':22,513,515 'good':211,597 'grant':840,931,936,975,980 'guard':854 'guidanc':86 'handl':355 'hardcod':760 'harden':33,93 'help':69 'hour':813 'id':187,205,207,218,236,238,327,394,398,826 'idempot':132 'identifi':105,110,178,982 'imag':522 'imper':359 'import':728,730 'includ':700 'increment':422,814,822,853 'input':293,1064 'insert':326,491 'insid':170,696 'instead':790 'instruct':641 'int':188,219 'integr':28 'invalid':177,981 'invoice.pdf':601 'ip':944 'isol':960 'item':295 'json':269 'json/avro/parquet/orc':250 'key':410,824,864 'label':532,619 'lag':385,414,811 'languag':191,222 'larg':774,816 'later':291 'layout':557 'lazi':764 'least':921 'least-privileg':920 'let':195,226 'level':692,930 'limit':1026 'list':137,438 'llm':519 'load':281,371 'logic':364 'looser':419 'mart':801,861 'mask':947 'match':312,324,1035 'materi':799,804,815,821,834,858 'merg':297,301 'minut':387 'miss':974,985,1072 'model':638,667,677 'modifi':717 'multi':867,958 'multi-tb':866 'multi-ten':957 'must':165,441,503,678 'my_db.my_schema.sales':633 'name':97,116,199,230,286,328,658,978,990 'need':82 'nest':125,252,695 'network':941 'never':138,716,759 'null':265,268,270,274,277,409 'number':261,1000 'numer':991 'object':247,681,693,929,967 'object-level':928 'ocr':555 'optim':875,881 'orchestr':639,642 'os':731 'os.environ':735,739,743 'output':1044 'p':186,206,217,237 'paramet':164 'pars':553,572 'password':742,745 'path':586 'pattern':963 'per':901 'perform':29,89,862 'permiss':1065 'pii':561,950 'pipelin':13,50,74,337 'polici':942,948,955 'practic':11,96 'prefix':153,169,987 'price':260 'privileg':922 'proc':185,216,984 'procedur':151,158,183,214,363,366 'process':472,508,776 'product':141,718 'progress':415 'purpos':516 'python':26,58,79,724,725 'qualifi':977 'qualiti':714 'queri':353,661,842 'quot':109,119 'rais':176 'raw':402,462,466,488,497 'rbac':923 'recogn':994 'redact':560 'refer':514 'referenc':148 'refresh':356,428,1013 'regular':934 'remov':562 'replac':130,379,460,470,631 'requir':117,1063 'resourc':664,686 'respons':646 'result':196,201,209,227,232,240 'resum':504,510,897,1008,1011 'return':189,208,220,239 'review':1056 'role':746,748,926,938 'row':953 'rule':44,154,411,672 'run':1005 's.id':310,332 's.name':317,333 's3/gcs/azure':373 'safeti':1066 'sale':659,662,665 'salesbot':645 'scalar':792 'scale':891 'scan':146 'schedul':477 'schema':433,755,757,1015 'scope':1037 'score':548 'search':874,880 'secur':32,92,918 'select':139,198,229,284,392,430,495,611,907 'semant':666 'semi':243 'semi-structur':242 'sensit':115 'sentiment':546,547,576 'separ':590,689,899 'server':778 'server-sid':777 'session':729,732 'session.builder.configs':733 'set':315,412 'show':768,935 'side':779 'sit':449 'size':886 'skill':1029 'skill-snowflake-development' 'small':890 'snake':101 'snowflak':2,5,34,39,60,71,84,142,175,354,736,740,744,796,807,828 'snowflake-develop':1 'snowflake-specif':83,827 'snowflake.snowpark':727 'snowpark':25,57,78,723 'snowpip':19,368 'sonnet':914 'sourc':306,584 'source-sickn33' 'spec':637,651,670,674,705 'specif':85,636,829,1051 'sql':9,47,72,94,156,171,181,192,212,223,267,300,376,457,592,610,628,657,802,819,835 'src':254,259,294,998 'stage':585 'stage/file.pdf':596 'stage/model.yaml':669 'start':500,887 'statement':172 'stay':442 'stop':1057 'storag':145 'store':150,157,272,365 'stream':17,357,454,461,463,485,489,498 'streaming/near-real-time':800,860 'string':190,197,221,228,256,287 'strip':276 'structur':244,541 'style':99 'subqueri':126 'substitut':1047 'success':1069 'sum':908 'summar':574 'suspend':501,894 'system':484 't.id':309 't.name':316 't.updated':318 'tabl':16,290,346,375,381,446,453,465,798,806,818,857,869,877,917 'tag':843 'target':303,384,413,810 'task':18,358,456,471,499,507,1003,1010,1033 'tb':868 'team':844 'technic':617 'tenant':959 'test':1053 'text':521,569,578,615,655,915 'text/images':538 'text/images/documents':544 'ticket':614,625 'tighter':416 'timestamp':321,335,400 'token':911 'tool':649,650,663,685,697,709 'top':418,691 'top-level':690 'topic-agent-skills' 'topic-agentic-skills' 'topic-ai-agent-skills' 'topic-ai-agents' 'topic-ai-coding' 'topic-ai-workflows' 'topic-antigravity' 'topic-antigravity-skills' 'topic-claude-code' 'topic-claude-code-skills' 'topic-codex-cli' 'topic-codex-skills' 'track':440,1018,1025 'transform':348,389,475,809 'transient':837 'translat':575 'treat':1042 'true':279,838,841,898 'tune':30,90 'two':451 'type':396,406,652 'udf':782,793 'uniqu':823 'updat':314,329 'upsert':299 'use':51,63,100,120,127,134,166,275,305,344,361,435,478,566,602,673,771,780,848,855,924,940,946,988,1020,1027 'user':66,203,234,397,738,741 'valid':1052 'valu':278,331,702,708,992 'varchar':621 'variabl':162,989 'variant':246,264,995 'vector':781 'view':447 'vs':266 'warehous':388,474,749,808,885,900 'wh':390,476,751 'where/join/group':871 'without':173,850 'work':55 'workload':789,902 'write':46 'wrong':971 'x':785,889 'x-small':888","prices":[{"id":"bbbbc79d-b35b-401e-82b5-a48866dd3ed1","listingId":"b8da37f5-f9f2-4304-8ca9-b87ba9e45a0f","amountUsd":"0","unit":"free","nativeCurrency":null,"nativeAmount":null,"chain":null,"payTo":null,"paymentMethod":"skill-free","isPrimary":true,"details":{"org":"sickn33","category":"antigravity-awesome-skills","install_from":"skills.sh"},"createdAt":"2026-04-18T21:45:11.347Z"}],"sources":[{"listingId":"b8da37f5-f9f2-4304-8ca9-b87ba9e45a0f","source":"github","sourceId":"sickn33/antigravity-awesome-skills/snowflake-development","sourceUrl":"https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/snowflake-development","isPrimary":false,"firstSeenAt":"2026-04-18T21:45:11.347Z","lastSeenAt":"2026-04-22T12:51:48.287Z"}],"details":{"listingId":"b8da37f5-f9f2-4304-8ca9-b87ba9e45a0f","quickStartSnippet":null,"exampleRequest":null,"exampleResponse":null,"schema":null,"openapiUrl":null,"agentsTxtUrl":null,"citations":[],"useCases":[],"bestFor":[],"notFor":[],"kindDetails":{"org":"sickn33","slug":"snowflake-development","github":{"repo":"sickn33/antigravity-awesome-skills","stars":34515,"topics":["agent-skills","agentic-skills","ai-agent-skills","ai-agents","ai-coding","ai-workflows","antigravity","antigravity-skills","claude-code","claude-code-skills","codex-cli","codex-skills","cursor","cursor-skills","developer-tools","gemini-cli","gemini-skills","kiro","mcp","skill-library"],"license":"mit","html_url":"https://github.com/sickn33/antigravity-awesome-skills","pushed_at":"2026-04-22T06:40:00Z","description":"Installable GitHub library of 1,400+ agentic skills for Claude Code, Cursor, Codex CLI, Gemini CLI, Antigravity, and more. Includes installer CLI, bundles, workflows, and official/community skill collections.","skill_md_sha":"e4bee7bb8a9719ba6e87aae30df89b4378323267","skill_md_path":"skills/snowflake-development/SKILL.md","default_branch":"main","skill_tree_url":"https://github.com/sickn33/antigravity-awesome-skills/tree/main/skills/snowflake-development"},"layout":"multi","source":"github","category":"antigravity-awesome-skills","frontmatter":{"name":"snowflake-development","description":"Comprehensive Snowflake development assistant covering SQL best practices, data pipeline design (Dynamic Tables, Streams, Tasks, Snowpipe), Cortex AI functions, Cortex Agents, Snowpark Python, dbt integration, performance tuning, and security hardening."},"skills_sh_url":"https://skills.sh/sickn33/antigravity-awesome-skills/snowflake-development"},"updatedAt":"2026-04-22T12:51:48.287Z"}}