[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-anthropic-sql-queries":3,"mdc-xxoyos-key":37,"related-repo-anthropic-sql-queries":2901,"related-org-anthropic-sql-queries":3018},{"slug":4,"name":4,"fn":5,"description":6,"org":7,"tags":12,"stars":26,"repoUrl":27,"updatedAt":28,"license":29,"forks":30,"topics":31,"repo":32,"sourceUrl":35,"mdContent":36},"sql-queries","write performant SQL across data warehouses","Write correct, performant SQL across all major data warehouse dialects (Snowflake, BigQuery, Databricks, PostgreSQL, etc.). Use when writing queries, optimizing slow SQL, translating between dialects, or building complex analytical queries with CTEs, window functions, or aggregations.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},"anthropic","Anthropic","https:\u002F\u002Fpexgzepcugksgbtrxkhf.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Forg-logos\u002Fanthropic.png","anthropics",[13,17,20,23],{"name":14,"slug":15,"type":16},"Performance","performance","tag",{"name":18,"slug":19,"type":16},"Data Engineering","data-engineering",{"name":21,"slug":22,"type":16},"Database","database",{"name":24,"slug":25,"type":16},"SQL","sql",22885,"https:\u002F\u002Fgithub.com\u002Fanthropics\u002Fknowledge-work-plugins","2026-04-06T17:57:25.390653",null,2736,[],{"repoUrl":27,"stars":26,"forks":30,"topics":33,"description":34},[],"Open source repository of plugins primarily intended for knowledge workers to use in Claude Cowork","https:\u002F\u002Fgithub.com\u002Fanthropics\u002Fknowledge-work-plugins\u002Ftree\u002FHEAD\u002Fdata\u002Fskills\u002Fsql-queries","---\nname: sql-queries\ndescription: Write correct, performant SQL across all major data warehouse dialects (Snowflake, BigQuery, Databricks, PostgreSQL, etc.). Use when writing queries, optimizing slow SQL, translating between dialects, or building complex analytical queries with CTEs, window functions, or aggregations.\nuser-invocable: false\n---\n\n# SQL Queries Skill\n\nWrite correct, performant, readable SQL across all major data warehouse dialects.\n\n## Dialect-Specific Reference\n\n### PostgreSQL (including Aurora, RDS, Supabase, Neon)\n\n**Date\u002Ftime:**\n```sql\n-- Current date\u002Ftime\nCURRENT_DATE, CURRENT_TIMESTAMP, NOW()\n\n-- Date arithmetic\ndate_column + INTERVAL '7 days'\ndate_column - INTERVAL '1 month'\n\n-- Truncate to period\nDATE_TRUNC('month', created_at)\n\n-- Extract parts\nEXTRACT(YEAR FROM created_at)\nEXTRACT(DOW FROM created_at)  -- 0=Sunday\n\n-- Format\nTO_CHAR(created_at, 'YYYY-MM-DD')\n```\n\n**String functions:**\n```sql\n-- Concatenation\nfirst_name || ' ' || last_name\nCONCAT(first_name, ' ', last_name)\n\n-- Pattern matching\ncolumn ILIKE '%pattern%'  -- case-insensitive\ncolumn ~ '^regex_pattern$'  -- regex\n\n-- String manipulation\nLEFT(str, n), RIGHT(str, n)\nSPLIT_PART(str, delimiter, position)\nREGEXP_REPLACE(str, pattern, replacement)\n```\n\n**Arrays and JSON:**\n```sql\n-- JSON access\ndata->>'key'  -- text\ndata->'nested'->'key'  -- json\ndata#>>'{path,to,key}'  -- nested text\n\n-- Array operations\nARRAY_AGG(column)\nANY(array_column)\narray_column @> ARRAY['value']\n```\n\n**Performance tips:**\n- Use `EXPLAIN ANALYZE` to profile queries\n- Create indexes on frequently filtered\u002Fjoined columns\n- Use `EXISTS` over `IN` for correlated subqueries\n- Partial indexes for common filter conditions\n- Use connection pooling for concurrent access\n\n---\n\n### Snowflake\n\n**Date\u002Ftime:**\n```sql\n-- Current date\u002Ftime\nCURRENT_DATE(), CURRENT_TIMESTAMP(), SYSDATE()\n\n-- Date arithmetic\nDATEADD(day, 7, date_column)\nDATEDIFF(day, start_date, end_date)\n\n-- Truncate to period\nDATE_TRUNC('month', created_at)\n\n-- Extract parts\nYEAR(created_at), MONTH(created_at), DAY(created_at)\nDAYOFWEEK(created_at)\n\n-- Format\nTO_CHAR(created_at, 'YYYY-MM-DD')\n```\n\n**String functions:**\n```sql\n-- Case-insensitive by default (depends on collation)\ncolumn ILIKE '%pattern%'\nREGEXP_LIKE(column, 'pattern')\n\n-- Parse JSON\ncolumn:key::string  -- dot notation for VARIANT\nPARSE_JSON('{\"key\": \"value\"}')\nGET_PATH(variant_col, 'path.to.key')\n\n-- Flatten arrays\u002Fobjects\nSELECT f.value FROM table, LATERAL FLATTEN(input => array_col) f\n```\n\n**Semi-structured data:**\n```sql\n-- VARIANT type access\ndata:customer:name::STRING\ndata:items[0]:price::NUMBER\n\n-- Flatten nested structures\nSELECT\n    t.id,\n    item.value:name::STRING as item_name,\n    item.value:qty::NUMBER as quantity\nFROM my_table t,\nLATERAL FLATTEN(input => t.data:items) item\n```\n\n**Performance tips:**\n- Use clustering keys on large tables (not traditional indexes)\n- Filter on clustering key columns for partition pruning\n- Set appropriate warehouse size for query complexity\n- Use `RESULT_SCAN(LAST_QUERY_ID())` to avoid re-running expensive queries\n- Use transient tables for staging\u002Ftemp data\n\n---\n\n### BigQuery (Google Cloud)\n\n**Date\u002Ftime:**\n```sql\n-- Current date\u002Ftime\nCURRENT_DATE(), CURRENT_TIMESTAMP()\n\n-- Date arithmetic\nDATE_ADD(date_column, INTERVAL 7 DAY)\nDATE_SUB(date_column, INTERVAL 1 MONTH)\nDATE_DIFF(end_date, start_date, DAY)\nTIMESTAMP_DIFF(end_ts, start_ts, HOUR)\n\n-- Truncate to period\nDATE_TRUNC(created_at, MONTH)\nTIMESTAMP_TRUNC(created_at, HOUR)\n\n-- Extract parts\nEXTRACT(YEAR FROM created_at)\nEXTRACT(DAYOFWEEK FROM created_at)  -- 1=Sunday\n\n-- Format\nFORMAT_DATE('%Y-%m-%d', date_column)\nFORMAT_TIMESTAMP('%Y-%m-%d %H:%M:%S', ts_column)\n```\n\n**String functions:**\n```sql\n-- No ILIKE, use LOWER()\nLOWER(column) LIKE '%pattern%'\nREGEXP_CONTAINS(column, r'pattern')\nREGEXP_EXTRACT(column, r'pattern')\n\n-- String manipulation\nSPLIT(str, delimiter)  -- returns ARRAY\nARRAY_TO_STRING(array, delimiter)\n```\n\n**Arrays and structs:**\n```sql\n-- Array operations\nARRAY_AGG(column)\nUNNEST(array_column)\nARRAY_LENGTH(array_column)\nvalue IN UNNEST(array_column)\n\n-- Struct access\nstruct_column.field_name\n```\n\n**Performance tips:**\n- Always filter on partition columns (usually date) to reduce bytes scanned\n- Use clustering for frequently filtered columns within partitions\n- Use `APPROX_COUNT_DISTINCT()` for large-scale cardinality estimates\n- Avoid `SELECT *` -- billing is per-byte scanned\n- Use `DECLARE` and `SET` for parameterized scripts\n- Preview query cost with dry run before executing large queries\n\n---\n\n### Redshift (Amazon)\n\n**Date\u002Ftime:**\n```sql\n-- Current date\u002Ftime\nCURRENT_DATE, GETDATE(), SYSDATE\n\n-- Date arithmetic\nDATEADD(day, 7, date_column)\nDATEDIFF(day, start_date, end_date)\n\n-- Truncate to period\nDATE_TRUNC('month', created_at)\n\n-- Extract parts\nEXTRACT(YEAR FROM created_at)\nDATE_PART('dow', created_at)\n```\n\n**String functions:**\n```sql\n-- Case-insensitive\ncolumn ILIKE '%pattern%'\nREGEXP_INSTR(column, 'pattern') > 0\n\n-- String manipulation\nSPLIT_PART(str, delimiter, position)\nLISTAGG(column, ', ') WITHIN GROUP (ORDER BY column)\n```\n\n**Performance tips:**\n- Design distribution keys for collocated joins (DISTKEY)\n- Use sort keys for frequently filtered columns (SORTKEY)\n- Use `EXPLAIN` to check query plan\n- Avoid cross-node data movement (watch for DS_BCAST and DS_DIST)\n- `ANALYZE` and `VACUUM` regularly\n- Use late-binding views for schema flexibility\n\n---\n\n### Databricks SQL\n\n**Date\u002Ftime:**\n```sql\n-- Current date\u002Ftime\nCURRENT_DATE(), CURRENT_TIMESTAMP()\n\n-- Date arithmetic\nDATE_ADD(date_column, 7)\nDATEDIFF(end_date, start_date)\nADD_MONTHS(date_column, 1)\n\n-- Truncate to period\nDATE_TRUNC('MONTH', created_at)\nTRUNC(date_column, 'MM')\n\n-- Extract parts\nYEAR(created_at), MONTH(created_at)\nDAYOFWEEK(created_at)\n```\n\n**Delta Lake features:**\n```sql\n-- Time travel\nSELECT * FROM my_table TIMESTAMP AS OF '2024-01-15'\nSELECT * FROM my_table VERSION AS OF 42\n\n-- Describe history\nDESCRIBE HISTORY my_table\n\n-- Merge (upsert)\nMERGE INTO target USING source\nON target.id = source.id\nWHEN MATCHED THEN UPDATE SET *\nWHEN NOT MATCHED THEN INSERT *\n```\n\n**Performance tips:**\n- Use Delta Lake's `OPTIMIZE` and `ZORDER` for query performance\n- Leverage Photon engine for compute-intensive queries\n- Use `CACHE TABLE` for frequently accessed datasets\n- Partition by low-cardinality date columns\n\n---\n\n## Common SQL Patterns\n\n### Window Functions\n\n```sql\n-- Ranking\nROW_NUMBER() OVER (PARTITION BY user_id ORDER BY created_at DESC)\nRANK() OVER (PARTITION BY category ORDER BY revenue DESC)\nDENSE_RANK() OVER (ORDER BY score DESC)\n\n-- Running totals \u002F moving averages\nSUM(revenue) OVER (ORDER BY date_col ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) as running_total\nAVG(revenue) OVER (ORDER BY date_col ROWS BETWEEN 6 PRECEDING AND CURRENT ROW) as moving_avg_7d\n\n-- Lag \u002F Lead\nLAG(value, 1) OVER (PARTITION BY entity ORDER BY date_col) as prev_value\nLEAD(value, 1) OVER (PARTITION BY entity ORDER BY date_col) as next_value\n\n-- First \u002F Last value\nFIRST_VALUE(status) OVER (PARTITION BY user_id ORDER BY created_at ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)\nLAST_VALUE(status) OVER (PARTITION BY user_id ORDER BY created_at ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)\n\n-- Percent of total\nrevenue \u002F SUM(revenue) OVER () as pct_of_total\nrevenue \u002F SUM(revenue) OVER (PARTITION BY category) as pct_of_category\n```\n\n### CTEs for Readability\n\n```sql\nWITH\n-- Step 1: Define the base population\nbase_users AS (\n    SELECT user_id, created_at, plan_type\n    FROM users\n    WHERE created_at >= DATE '2024-01-01'\n      AND status = 'active'\n),\n\n-- Step 2: Calculate user-level metrics\nuser_metrics AS (\n    SELECT\n        u.user_id,\n        u.plan_type,\n        COUNT(DISTINCT e.session_id) as session_count,\n        SUM(e.revenue) as total_revenue\n    FROM base_users u\n    LEFT JOIN events e ON u.user_id = e.user_id\n    GROUP BY u.user_id, u.plan_type\n),\n\n-- Step 3: Aggregate to summary level\nsummary AS (\n    SELECT\n        plan_type,\n        COUNT(*) as user_count,\n        AVG(session_count) as avg_sessions,\n        SUM(total_revenue) as total_revenue\n    FROM user_metrics\n    GROUP BY plan_type\n)\n\nSELECT * FROM summary ORDER BY total_revenue DESC;\n```\n\n### Cohort Retention\n\n```sql\nWITH cohorts AS (\n    SELECT\n        user_id,\n        DATE_TRUNC('month', first_activity_date) as cohort_month\n    FROM users\n),\nactivity AS (\n    SELECT\n        user_id,\n        DATE_TRUNC('month', activity_date) as activity_month\n    FROM user_activity\n)\nSELECT\n    c.cohort_month,\n    COUNT(DISTINCT c.user_id) as cohort_size,\n    COUNT(DISTINCT CASE\n        WHEN a.activity_month = c.cohort_month THEN a.user_id\n    END) as month_0,\n    COUNT(DISTINCT CASE\n        WHEN a.activity_month = c.cohort_month + INTERVAL '1 month' THEN a.user_id\n    END) as month_1,\n    COUNT(DISTINCT CASE\n        WHEN a.activity_month = c.cohort_month + INTERVAL '3 months' THEN a.user_id\n    END) as month_3\nFROM cohorts c\nLEFT JOIN activity a ON c.user_id = a.user_id\nGROUP BY c.cohort_month\nORDER BY c.cohort_month;\n```\n\n### Funnel Analysis\n\n```sql\nWITH funnel AS (\n    SELECT\n        user_id,\n        MAX(CASE WHEN event = 'page_view' THEN 1 ELSE 0 END) as step_1_view,\n        MAX(CASE WHEN event = 'signup_start' THEN 1 ELSE 0 END) as step_2_start,\n        MAX(CASE WHEN event = 'signup_complete' THEN 1 ELSE 0 END) as step_3_complete,\n        MAX(CASE WHEN event = 'first_purchase' THEN 1 ELSE 0 END) as step_4_purchase\n    FROM events\n    WHERE event_date >= CURRENT_DATE - INTERVAL '30 days'\n    GROUP BY user_id\n)\nSELECT\n    COUNT(*) as total_users,\n    SUM(step_1_view) as viewed,\n    SUM(step_2_start) as started_signup,\n    SUM(step_3_complete) as completed_signup,\n    SUM(step_4_purchase) as purchased,\n    ROUND(100.0 * SUM(step_2_start) \u002F NULLIF(SUM(step_1_view), 0), 1) as view_to_start_pct,\n    ROUND(100.0 * SUM(step_3_complete) \u002F NULLIF(SUM(step_2_start), 0), 1) as start_to_complete_pct,\n    ROUND(100.0 * SUM(step_4_purchase) \u002F NULLIF(SUM(step_3_complete), 0), 1) as complete_to_purchase_pct\nFROM funnel;\n```\n\n### Deduplication\n\n```sql\n-- Keep the most recent record per key\nWITH ranked AS (\n    SELECT\n        *,\n        ROW_NUMBER() OVER (\n            PARTITION BY entity_id\n            ORDER BY updated_at DESC\n        ) as rn\n    FROM source_table\n)\nSELECT * FROM ranked WHERE rn = 1;\n```\n\n## Error Handling and Debugging\n\nWhen a query fails:\n\n1. **Syntax errors**: Check for dialect-specific syntax (e.g., `ILIKE` not available in BigQuery, `SAFE_DIVIDE` only in BigQuery)\n2. **Column not found**: Verify column names against schema -- check for typos, case sensitivity (PostgreSQL is case-sensitive for quoted identifiers)\n3. **Type mismatches**: Cast explicitly when comparing different types (`CAST(col AS DATE)`, `col::DATE`)\n4. **Division by zero**: Use `NULLIF(denominator, 0)` or dialect-specific safe division\n5. **Ambiguous columns**: Always qualify column names with table alias in JOINs\n6. **Group by errors**: All non-aggregated columns must be in GROUP BY (except in BigQuery which allows grouping by alias)\n",{"data":38,"body":40},{"name":4,"description":6,"user-invocable":39},false,{"type":41,"children":42},"root",[43,52,58,65,72,81,236,244,345,353,431,439,492,496,502,509,633,640,733,741,835,842,877,880,886,893,1054,1061,1130,1138,1206,1213,1276,1279,1285,1292,1392,1399,1458,1465,1518,1521,1527,1534,1652,1660,1761,1768,1813,1816,1822,1828,1991,1997,2276,2282,2504,2510,2681,2687,2780,2786,2791,2895],{"type":44,"tag":45,"props":46,"children":48},"element","h1",{"id":47},"sql-queries-skill",[49],{"type":50,"value":51},"text","SQL Queries Skill",{"type":44,"tag":53,"props":54,"children":55},"p",{},[56],{"type":50,"value":57},"Write correct, performant, readable SQL across all major data warehouse dialects.",{"type":44,"tag":59,"props":60,"children":62},"h2",{"id":61},"dialect-specific-reference",[63],{"type":50,"value":64},"Dialect-Specific Reference",{"type":44,"tag":66,"props":67,"children":69},"h3",{"id":68},"postgresql-including-aurora-rds-supabase-neon",[70],{"type":50,"value":71},"PostgreSQL (including Aurora, RDS, Supabase, Neon)",{"type":44,"tag":53,"props":73,"children":74},{},[75],{"type":44,"tag":76,"props":77,"children":78},"strong",{},[79],{"type":50,"value":80},"Date\u002Ftime:",{"type":44,"tag":82,"props":83,"children":87},"pre",{"className":84,"code":85,"language":25,"meta":86,"style":86},"language-sql shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","-- Current date\u002Ftime\nCURRENT_DATE, CURRENT_TIMESTAMP, NOW()\n\n-- Date arithmetic\ndate_column + INTERVAL '7 days'\ndate_column - INTERVAL '1 month'\n\n-- Truncate to period\nDATE_TRUNC('month', created_at)\n\n-- Extract parts\nEXTRACT(YEAR FROM created_at)\nEXTRACT(DOW FROM created_at)  -- 0=Sunday\n\n-- Format\nTO_CHAR(created_at, 'YYYY-MM-DD')\n","",[88],{"type":44,"tag":89,"props":90,"children":91},"code",{"__ignoreMap":86},[92,103,112,122,131,140,149,157,166,175,183,192,201,210,218,227],{"type":44,"tag":93,"props":94,"children":97},"span",{"class":95,"line":96},"line",1,[98],{"type":44,"tag":93,"props":99,"children":100},{},[101],{"type":50,"value":102},"-- Current date\u002Ftime\n",{"type":44,"tag":93,"props":104,"children":106},{"class":95,"line":105},2,[107],{"type":44,"tag":93,"props":108,"children":109},{},[110],{"type":50,"value":111},"CURRENT_DATE, CURRENT_TIMESTAMP, NOW()\n",{"type":44,"tag":93,"props":113,"children":115},{"class":95,"line":114},3,[116],{"type":44,"tag":93,"props":117,"children":119},{"emptyLinePlaceholder":118},true,[120],{"type":50,"value":121},"\n",{"type":44,"tag":93,"props":123,"children":125},{"class":95,"line":124},4,[126],{"type":44,"tag":93,"props":127,"children":128},{},[129],{"type":50,"value":130},"-- Date arithmetic\n",{"type":44,"tag":93,"props":132,"children":134},{"class":95,"line":133},5,[135],{"type":44,"tag":93,"props":136,"children":137},{},[138],{"type":50,"value":139},"date_column + INTERVAL '7 days'\n",{"type":44,"tag":93,"props":141,"children":143},{"class":95,"line":142},6,[144],{"type":44,"tag":93,"props":145,"children":146},{},[147],{"type":50,"value":148},"date_column - INTERVAL '1 month'\n",{"type":44,"tag":93,"props":150,"children":152},{"class":95,"line":151},7,[153],{"type":44,"tag":93,"props":154,"children":155},{"emptyLinePlaceholder":118},[156],{"type":50,"value":121},{"type":44,"tag":93,"props":158,"children":160},{"class":95,"line":159},8,[161],{"type":44,"tag":93,"props":162,"children":163},{},[164],{"type":50,"value":165},"-- Truncate to period\n",{"type":44,"tag":93,"props":167,"children":169},{"class":95,"line":168},9,[170],{"type":44,"tag":93,"props":171,"children":172},{},[173],{"type":50,"value":174},"DATE_TRUNC('month', created_at)\n",{"type":44,"tag":93,"props":176,"children":178},{"class":95,"line":177},10,[179],{"type":44,"tag":93,"props":180,"children":181},{"emptyLinePlaceholder":118},[182],{"type":50,"value":121},{"type":44,"tag":93,"props":184,"children":186},{"class":95,"line":185},11,[187],{"type":44,"tag":93,"props":188,"children":189},{},[190],{"type":50,"value":191},"-- Extract parts\n",{"type":44,"tag":93,"props":193,"children":195},{"class":95,"line":194},12,[196],{"type":44,"tag":93,"props":197,"children":198},{},[199],{"type":50,"value":200},"EXTRACT(YEAR FROM created_at)\n",{"type":44,"tag":93,"props":202,"children":204},{"class":95,"line":203},13,[205],{"type":44,"tag":93,"props":206,"children":207},{},[208],{"type":50,"value":209},"EXTRACT(DOW FROM created_at)  -- 0=Sunday\n",{"type":44,"tag":93,"props":211,"children":213},{"class":95,"line":212},14,[214],{"type":44,"tag":93,"props":215,"children":216},{"emptyLinePlaceholder":118},[217],{"type":50,"value":121},{"type":44,"tag":93,"props":219,"children":221},{"class":95,"line":220},15,[222],{"type":44,"tag":93,"props":223,"children":224},{},[225],{"type":50,"value":226},"-- Format\n",{"type":44,"tag":93,"props":228,"children":230},{"class":95,"line":229},16,[231],{"type":44,"tag":93,"props":232,"children":233},{},[234],{"type":50,"value":235},"TO_CHAR(created_at, 'YYYY-MM-DD')\n",{"type":44,"tag":53,"props":237,"children":238},{},[239],{"type":44,"tag":76,"props":240,"children":241},{},[242],{"type":50,"value":243},"String functions:",{"type":44,"tag":82,"props":245,"children":247},{"className":84,"code":246,"language":25,"meta":86,"style":86},"-- Concatenation\nfirst_name || ' ' || last_name\nCONCAT(first_name, ' ', last_name)\n\n-- Pattern matching\ncolumn ILIKE '%pattern%'  -- case-insensitive\ncolumn ~ '^regex_pattern$'  -- regex\n\n-- String manipulation\nLEFT(str, n), RIGHT(str, n)\nSPLIT_PART(str, delimiter, position)\nREGEXP_REPLACE(str, pattern, replacement)\n",[248],{"type":44,"tag":89,"props":249,"children":250},{"__ignoreMap":86},[251,259,267,275,282,290,298,306,313,321,329,337],{"type":44,"tag":93,"props":252,"children":253},{"class":95,"line":96},[254],{"type":44,"tag":93,"props":255,"children":256},{},[257],{"type":50,"value":258},"-- Concatenation\n",{"type":44,"tag":93,"props":260,"children":261},{"class":95,"line":105},[262],{"type":44,"tag":93,"props":263,"children":264},{},[265],{"type":50,"value":266},"first_name || ' ' || last_name\n",{"type":44,"tag":93,"props":268,"children":269},{"class":95,"line":114},[270],{"type":44,"tag":93,"props":271,"children":272},{},[273],{"type":50,"value":274},"CONCAT(first_name, ' ', last_name)\n",{"type":44,"tag":93,"props":276,"children":277},{"class":95,"line":124},[278],{"type":44,"tag":93,"props":279,"children":280},{"emptyLinePlaceholder":118},[281],{"type":50,"value":121},{"type":44,"tag":93,"props":283,"children":284},{"class":95,"line":133},[285],{"type":44,"tag":93,"props":286,"children":287},{},[288],{"type":50,"value":289},"-- Pattern matching\n",{"type":44,"tag":93,"props":291,"children":292},{"class":95,"line":142},[293],{"type":44,"tag":93,"props":294,"children":295},{},[296],{"type":50,"value":297},"column ILIKE '%pattern%'  -- case-insensitive\n",{"type":44,"tag":93,"props":299,"children":300},{"class":95,"line":151},[301],{"type":44,"tag":93,"props":302,"children":303},{},[304],{"type":50,"value":305},"column ~ '^regex_pattern$'  -- regex\n",{"type":44,"tag":93,"props":307,"children":308},{"class":95,"line":159},[309],{"type":44,"tag":93,"props":310,"children":311},{"emptyLinePlaceholder":118},[312],{"type":50,"value":121},{"type":44,"tag":93,"props":314,"children":315},{"class":95,"line":168},[316],{"type":44,"tag":93,"props":317,"children":318},{},[319],{"type":50,"value":320},"-- String manipulation\n",{"type":44,"tag":93,"props":322,"children":323},{"class":95,"line":177},[324],{"type":44,"tag":93,"props":325,"children":326},{},[327],{"type":50,"value":328},"LEFT(str, n), RIGHT(str, n)\n",{"type":44,"tag":93,"props":330,"children":331},{"class":95,"line":185},[332],{"type":44,"tag":93,"props":333,"children":334},{},[335],{"type":50,"value":336},"SPLIT_PART(str, delimiter, position)\n",{"type":44,"tag":93,"props":338,"children":339},{"class":95,"line":194},[340],{"type":44,"tag":93,"props":341,"children":342},{},[343],{"type":50,"value":344},"REGEXP_REPLACE(str, pattern, replacement)\n",{"type":44,"tag":53,"props":346,"children":347},{},[348],{"type":44,"tag":76,"props":349,"children":350},{},[351],{"type":50,"value":352},"Arrays and JSON:",{"type":44,"tag":82,"props":354,"children":356},{"className":84,"code":355,"language":25,"meta":86,"style":86},"-- JSON access\ndata->>'key'  -- text\ndata->'nested'->'key'  -- json\ndata#>>'{path,to,key}'  -- nested text\n\n-- Array operations\nARRAY_AGG(column)\nANY(array_column)\narray_column @> ARRAY['value']\n",[357],{"type":44,"tag":89,"props":358,"children":359},{"__ignoreMap":86},[360,368,376,384,392,399,407,415,423],{"type":44,"tag":93,"props":361,"children":362},{"class":95,"line":96},[363],{"type":44,"tag":93,"props":364,"children":365},{},[366],{"type":50,"value":367},"-- JSON access\n",{"type":44,"tag":93,"props":369,"children":370},{"class":95,"line":105},[371],{"type":44,"tag":93,"props":372,"children":373},{},[374],{"type":50,"value":375},"data->>'key'  -- text\n",{"type":44,"tag":93,"props":377,"children":378},{"class":95,"line":114},[379],{"type":44,"tag":93,"props":380,"children":381},{},[382],{"type":50,"value":383},"data->'nested'->'key'  -- json\n",{"type":44,"tag":93,"props":385,"children":386},{"class":95,"line":124},[387],{"type":44,"tag":93,"props":388,"children":389},{},[390],{"type":50,"value":391},"data#>>'{path,to,key}'  -- nested text\n",{"type":44,"tag":93,"props":393,"children":394},{"class":95,"line":133},[395],{"type":44,"tag":93,"props":396,"children":397},{"emptyLinePlaceholder":118},[398],{"type":50,"value":121},{"type":44,"tag":93,"props":400,"children":401},{"class":95,"line":142},[402],{"type":44,"tag":93,"props":403,"children":404},{},[405],{"type":50,"value":406},"-- Array operations\n",{"type":44,"tag":93,"props":408,"children":409},{"class":95,"line":151},[410],{"type":44,"tag":93,"props":411,"children":412},{},[413],{"type":50,"value":414},"ARRAY_AGG(column)\n",{"type":44,"tag":93,"props":416,"children":417},{"class":95,"line":159},[418],{"type":44,"tag":93,"props":419,"children":420},{},[421],{"type":50,"value":422},"ANY(array_column)\n",{"type":44,"tag":93,"props":424,"children":425},{"class":95,"line":168},[426],{"type":44,"tag":93,"props":427,"children":428},{},[429],{"type":50,"value":430},"array_column @> ARRAY['value']\n",{"type":44,"tag":53,"props":432,"children":433},{},[434],{"type":44,"tag":76,"props":435,"children":436},{},[437],{"type":50,"value":438},"Performance tips:",{"type":44,"tag":440,"props":441,"children":442},"ul",{},[443,457,462,482,487],{"type":44,"tag":444,"props":445,"children":446},"li",{},[447,449,455],{"type":50,"value":448},"Use ",{"type":44,"tag":89,"props":450,"children":452},{"className":451},[],[453],{"type":50,"value":454},"EXPLAIN ANALYZE",{"type":50,"value":456}," to profile queries",{"type":44,"tag":444,"props":458,"children":459},{},[460],{"type":50,"value":461},"Create indexes on frequently filtered\u002Fjoined columns",{"type":44,"tag":444,"props":463,"children":464},{},[465,466,472,474,480],{"type":50,"value":448},{"type":44,"tag":89,"props":467,"children":469},{"className":468},[],[470],{"type":50,"value":471},"EXISTS",{"type":50,"value":473}," over ",{"type":44,"tag":89,"props":475,"children":477},{"className":476},[],[478],{"type":50,"value":479},"IN",{"type":50,"value":481}," for correlated subqueries",{"type":44,"tag":444,"props":483,"children":484},{},[485],{"type":50,"value":486},"Partial indexes for common filter conditions",{"type":44,"tag":444,"props":488,"children":489},{},[490],{"type":50,"value":491},"Use connection pooling for concurrent access",{"type":44,"tag":493,"props":494,"children":495},"hr",{},[],{"type":44,"tag":66,"props":497,"children":499},{"id":498},"snowflake",[500],{"type":50,"value":501},"Snowflake",{"type":44,"tag":53,"props":503,"children":504},{},[505],{"type":44,"tag":76,"props":506,"children":507},{},[508],{"type":50,"value":80},{"type":44,"tag":82,"props":510,"children":512},{"className":84,"code":511,"language":25,"meta":86,"style":86},"-- Current date\u002Ftime\nCURRENT_DATE(), CURRENT_TIMESTAMP(), SYSDATE()\n\n-- Date arithmetic\nDATEADD(day, 7, date_column)\nDATEDIFF(day, start_date, end_date)\n\n-- Truncate to period\nDATE_TRUNC('month', created_at)\n\n-- Extract parts\nYEAR(created_at), MONTH(created_at), DAY(created_at)\nDAYOFWEEK(created_at)\n\n-- Format\nTO_CHAR(created_at, 'YYYY-MM-DD')\n",[513],{"type":44,"tag":89,"props":514,"children":515},{"__ignoreMap":86},[516,523,531,538,545,553,561,568,575,582,589,596,604,612,619,626],{"type":44,"tag":93,"props":517,"children":518},{"class":95,"line":96},[519],{"type":44,"tag":93,"props":520,"children":521},{},[522],{"type":50,"value":102},{"type":44,"tag":93,"props":524,"children":525},{"class":95,"line":105},[526],{"type":44,"tag":93,"props":527,"children":528},{},[529],{"type":50,"value":530},"CURRENT_DATE(), CURRENT_TIMESTAMP(), SYSDATE()\n",{"type":44,"tag":93,"props":532,"children":533},{"class":95,"line":114},[534],{"type":44,"tag":93,"props":535,"children":536},{"emptyLinePlaceholder":118},[537],{"type":50,"value":121},{"type":44,"tag":93,"props":539,"children":540},{"class":95,"line":124},[541],{"type":44,"tag":93,"props":542,"children":543},{},[544],{"type":50,"value":130},{"type":44,"tag":93,"props":546,"children":547},{"class":95,"line":133},[548],{"type":44,"tag":93,"props":549,"children":550},{},[551],{"type":50,"value":552},"DATEADD(day, 7, date_column)\n",{"type":44,"tag":93,"props":554,"children":555},{"class":95,"line":142},[556],{"type":44,"tag":93,"props":557,"children":558},{},[559],{"type":50,"value":560},"DATEDIFF(day, start_date, end_date)\n",{"type":44,"tag":93,"props":562,"children":563},{"class":95,"line":151},[564],{"type":44,"tag":93,"props":565,"children":566},{"emptyLinePlaceholder":118},[567],{"type":50,"value":121},{"type":44,"tag":93,"props":569,"children":570},{"class":95,"line":159},[571],{"type":44,"tag":93,"props":572,"children":573},{},[574],{"type":50,"value":165},{"type":44,"tag":93,"props":576,"children":577},{"class":95,"line":168},[578],{"type":44,"tag":93,"props":579,"children":580},{},[581],{"type":50,"value":174},{"type":44,"tag":93,"props":583,"children":584},{"class":95,"line":177},[585],{"type":44,"tag":93,"props":586,"children":587},{"emptyLinePlaceholder":118},[588],{"type":50,"value":121},{"type":44,"tag":93,"props":590,"children":591},{"class":95,"line":185},[592],{"type":44,"tag":93,"props":593,"children":594},{},[595],{"type":50,"value":191},{"type":44,"tag":93,"props":597,"children":598},{"class":95,"line":194},[599],{"type":44,"tag":93,"props":600,"children":601},{},[602],{"type":50,"value":603},"YEAR(created_at), MONTH(created_at), DAY(created_at)\n",{"type":44,"tag":93,"props":605,"children":606},{"class":95,"line":203},[607],{"type":44,"tag":93,"props":608,"children":609},{},[610],{"type":50,"value":611},"DAYOFWEEK(created_at)\n",{"type":44,"tag":93,"props":613,"children":614},{"class":95,"line":212},[615],{"type":44,"tag":93,"props":616,"children":617},{"emptyLinePlaceholder":118},[618],{"type":50,"value":121},{"type":44,"tag":93,"props":620,"children":621},{"class":95,"line":220},[622],{"type":44,"tag":93,"props":623,"children":624},{},[625],{"type":50,"value":226},{"type":44,"tag":93,"props":627,"children":628},{"class":95,"line":229},[629],{"type":44,"tag":93,"props":630,"children":631},{},[632],{"type":50,"value":235},{"type":44,"tag":53,"props":634,"children":635},{},[636],{"type":44,"tag":76,"props":637,"children":638},{},[639],{"type":50,"value":243},{"type":44,"tag":82,"props":641,"children":643},{"className":84,"code":642,"language":25,"meta":86,"style":86},"-- Case-insensitive by default (depends on collation)\ncolumn ILIKE '%pattern%'\nREGEXP_LIKE(column, 'pattern')\n\n-- Parse JSON\ncolumn:key::string  -- dot notation for VARIANT\nPARSE_JSON('{\"key\": \"value\"}')\nGET_PATH(variant_col, 'path.to.key')\n\n-- Flatten arrays\u002Fobjects\nSELECT f.value FROM table, LATERAL FLATTEN(input => array_col) f\n",[644],{"type":44,"tag":89,"props":645,"children":646},{"__ignoreMap":86},[647,655,663,671,678,686,694,702,710,717,725],{"type":44,"tag":93,"props":648,"children":649},{"class":95,"line":96},[650],{"type":44,"tag":93,"props":651,"children":652},{},[653],{"type":50,"value":654},"-- Case-insensitive by default (depends on collation)\n",{"type":44,"tag":93,"props":656,"children":657},{"class":95,"line":105},[658],{"type":44,"tag":93,"props":659,"children":660},{},[661],{"type":50,"value":662},"column ILIKE '%pattern%'\n",{"type":44,"tag":93,"props":664,"children":665},{"class":95,"line":114},[666],{"type":44,"tag":93,"props":667,"children":668},{},[669],{"type":50,"value":670},"REGEXP_LIKE(column, 'pattern')\n",{"type":44,"tag":93,"props":672,"children":673},{"class":95,"line":124},[674],{"type":44,"tag":93,"props":675,"children":676},{"emptyLinePlaceholder":118},[677],{"type":50,"value":121},{"type":44,"tag":93,"props":679,"children":680},{"class":95,"line":133},[681],{"type":44,"tag":93,"props":682,"children":683},{},[684],{"type":50,"value":685},"-- Parse JSON\n",{"type":44,"tag":93,"props":687,"children":688},{"class":95,"line":142},[689],{"type":44,"tag":93,"props":690,"children":691},{},[692],{"type":50,"value":693},"column:key::string  -- dot notation for VARIANT\n",{"type":44,"tag":93,"props":695,"children":696},{"class":95,"line":151},[697],{"type":44,"tag":93,"props":698,"children":699},{},[700],{"type":50,"value":701},"PARSE_JSON('{\"key\": \"value\"}')\n",{"type":44,"tag":93,"props":703,"children":704},{"class":95,"line":159},[705],{"type":44,"tag":93,"props":706,"children":707},{},[708],{"type":50,"value":709},"GET_PATH(variant_col, 'path.to.key')\n",{"type":44,"tag":93,"props":711,"children":712},{"class":95,"line":168},[713],{"type":44,"tag":93,"props":714,"children":715},{"emptyLinePlaceholder":118},[716],{"type":50,"value":121},{"type":44,"tag":93,"props":718,"children":719},{"class":95,"line":177},[720],{"type":44,"tag":93,"props":721,"children":722},{},[723],{"type":50,"value":724},"-- Flatten arrays\u002Fobjects\n",{"type":44,"tag":93,"props":726,"children":727},{"class":95,"line":185},[728],{"type":44,"tag":93,"props":729,"children":730},{},[731],{"type":50,"value":732},"SELECT f.value FROM table, LATERAL FLATTEN(input => array_col) f\n",{"type":44,"tag":53,"props":734,"children":735},{},[736],{"type":44,"tag":76,"props":737,"children":738},{},[739],{"type":50,"value":740},"Semi-structured data:",{"type":44,"tag":82,"props":742,"children":744},{"className":84,"code":743,"language":25,"meta":86,"style":86},"-- VARIANT type access\ndata:customer:name::STRING\ndata:items[0]:price::NUMBER\n\n-- Flatten nested structures\nSELECT\n    t.id,\n    item.value:name::STRING as item_name,\n    item.value:qty::NUMBER as quantity\nFROM my_table t,\nLATERAL FLATTEN(input => t.data:items) item\n",[745],{"type":44,"tag":89,"props":746,"children":747},{"__ignoreMap":86},[748,756,764,772,779,787,795,803,811,819,827],{"type":44,"tag":93,"props":749,"children":750},{"class":95,"line":96},[751],{"type":44,"tag":93,"props":752,"children":753},{},[754],{"type":50,"value":755},"-- VARIANT type access\n",{"type":44,"tag":93,"props":757,"children":758},{"class":95,"line":105},[759],{"type":44,"tag":93,"props":760,"children":761},{},[762],{"type":50,"value":763},"data:customer:name::STRING\n",{"type":44,"tag":93,"props":765,"children":766},{"class":95,"line":114},[767],{"type":44,"tag":93,"props":768,"children":769},{},[770],{"type":50,"value":771},"data:items[0]:price::NUMBER\n",{"type":44,"tag":93,"props":773,"children":774},{"class":95,"line":124},[775],{"type":44,"tag":93,"props":776,"children":777},{"emptyLinePlaceholder":118},[778],{"type":50,"value":121},{"type":44,"tag":93,"props":780,"children":781},{"class":95,"line":133},[782],{"type":44,"tag":93,"props":783,"children":784},{},[785],{"type":50,"value":786},"-- Flatten nested structures\n",{"type":44,"tag":93,"props":788,"children":789},{"class":95,"line":142},[790],{"type":44,"tag":93,"props":791,"children":792},{},[793],{"type":50,"value":794},"SELECT\n",{"type":44,"tag":93,"props":796,"children":797},{"class":95,"line":151},[798],{"type":44,"tag":93,"props":799,"children":800},{},[801],{"type":50,"value":802},"    t.id,\n",{"type":44,"tag":93,"props":804,"children":805},{"class":95,"line":159},[806],{"type":44,"tag":93,"props":807,"children":808},{},[809],{"type":50,"value":810},"    item.value:name::STRING as item_name,\n",{"type":44,"tag":93,"props":812,"children":813},{"class":95,"line":168},[814],{"type":44,"tag":93,"props":815,"children":816},{},[817],{"type":50,"value":818},"    item.value:qty::NUMBER as quantity\n",{"type":44,"tag":93,"props":820,"children":821},{"class":95,"line":177},[822],{"type":44,"tag":93,"props":823,"children":824},{},[825],{"type":50,"value":826},"FROM my_table t,\n",{"type":44,"tag":93,"props":828,"children":829},{"class":95,"line":185},[830],{"type":44,"tag":93,"props":831,"children":832},{},[833],{"type":50,"value":834},"LATERAL FLATTEN(input => t.data:items) item\n",{"type":44,"tag":53,"props":836,"children":837},{},[838],{"type":44,"tag":76,"props":839,"children":840},{},[841],{"type":50,"value":438},{"type":44,"tag":440,"props":843,"children":844},{},[845,850,855,860,872],{"type":44,"tag":444,"props":846,"children":847},{},[848],{"type":50,"value":849},"Use clustering keys on large tables (not traditional indexes)",{"type":44,"tag":444,"props":851,"children":852},{},[853],{"type":50,"value":854},"Filter on clustering key columns for partition pruning",{"type":44,"tag":444,"props":856,"children":857},{},[858],{"type":50,"value":859},"Set appropriate warehouse size for query complexity",{"type":44,"tag":444,"props":861,"children":862},{},[863,864,870],{"type":50,"value":448},{"type":44,"tag":89,"props":865,"children":867},{"className":866},[],[868],{"type":50,"value":869},"RESULT_SCAN(LAST_QUERY_ID())",{"type":50,"value":871}," to avoid re-running expensive queries",{"type":44,"tag":444,"props":873,"children":874},{},[875],{"type":50,"value":876},"Use transient tables for staging\u002Ftemp data",{"type":44,"tag":493,"props":878,"children":879},{},[],{"type":44,"tag":66,"props":881,"children":883},{"id":882},"bigquery-google-cloud",[884],{"type":50,"value":885},"BigQuery (Google Cloud)",{"type":44,"tag":53,"props":887,"children":888},{},[889],{"type":44,"tag":76,"props":890,"children":891},{},[892],{"type":50,"value":80},{"type":44,"tag":82,"props":894,"children":896},{"className":84,"code":895,"language":25,"meta":86,"style":86},"-- Current date\u002Ftime\nCURRENT_DATE(), CURRENT_TIMESTAMP()\n\n-- Date arithmetic\nDATE_ADD(date_column, INTERVAL 7 DAY)\nDATE_SUB(date_column, INTERVAL 1 MONTH)\nDATE_DIFF(end_date, start_date, DAY)\nTIMESTAMP_DIFF(end_ts, start_ts, HOUR)\n\n-- Truncate to period\nDATE_TRUNC(created_at, MONTH)\nTIMESTAMP_TRUNC(created_at, HOUR)\n\n-- Extract parts\nEXTRACT(YEAR FROM created_at)\nEXTRACT(DAYOFWEEK FROM created_at)  -- 1=Sunday\n\n-- Format\nFORMAT_DATE('%Y-%m-%d', date_column)\nFORMAT_TIMESTAMP('%Y-%m-%d %H:%M:%S', ts_column)\n",[897],{"type":44,"tag":89,"props":898,"children":899},{"__ignoreMap":86},[900,907,915,922,929,937,945,953,961,968,975,983,991,998,1005,1012,1020,1028,1036,1045],{"type":44,"tag":93,"props":901,"children":902},{"class":95,"line":96},[903],{"type":44,"tag":93,"props":904,"children":905},{},[906],{"type":50,"value":102},{"type":44,"tag":93,"props":908,"children":909},{"class":95,"line":105},[910],{"type":44,"tag":93,"props":911,"children":912},{},[913],{"type":50,"value":914},"CURRENT_DATE(), CURRENT_TIMESTAMP()\n",{"type":44,"tag":93,"props":916,"children":917},{"class":95,"line":114},[918],{"type":44,"tag":93,"props":919,"children":920},{"emptyLinePlaceholder":118},[921],{"type":50,"value":121},{"type":44,"tag":93,"props":923,"children":924},{"class":95,"line":124},[925],{"type":44,"tag":93,"props":926,"children":927},{},[928],{"type":50,"value":130},{"type":44,"tag":93,"props":930,"children":931},{"class":95,"line":133},[932],{"type":44,"tag":93,"props":933,"children":934},{},[935],{"type":50,"value":936},"DATE_ADD(date_column, INTERVAL 7 DAY)\n",{"type":44,"tag":93,"props":938,"children":939},{"class":95,"line":142},[940],{"type":44,"tag":93,"props":941,"children":942},{},[943],{"type":50,"value":944},"DATE_SUB(date_column, INTERVAL 1 MONTH)\n",{"type":44,"tag":93,"props":946,"children":947},{"class":95,"line":151},[948],{"type":44,"tag":93,"props":949,"children":950},{},[951],{"type":50,"value":952},"DATE_DIFF(end_date, start_date, DAY)\n",{"type":44,"tag":93,"props":954,"children":955},{"class":95,"line":159},[956],{"type":44,"tag":93,"props":957,"children":958},{},[959],{"type":50,"value":960},"TIMESTAMP_DIFF(end_ts, start_ts, HOUR)\n",{"type":44,"tag":93,"props":962,"children":963},{"class":95,"line":168},[964],{"type":44,"tag":93,"props":965,"children":966},{"emptyLinePlaceholder":118},[967],{"type":50,"value":121},{"type":44,"tag":93,"props":969,"children":970},{"class":95,"line":177},[971],{"type":44,"tag":93,"props":972,"children":973},{},[974],{"type":50,"value":165},{"type":44,"tag":93,"props":976,"children":977},{"class":95,"line":185},[978],{"type":44,"tag":93,"props":979,"children":980},{},[981],{"type":50,"value":982},"DATE_TRUNC(created_at, MONTH)\n",{"type":44,"tag":93,"props":984,"children":985},{"class":95,"line":194},[986],{"type":44,"tag":93,"props":987,"children":988},{},[989],{"type":50,"value":990},"TIMESTAMP_TRUNC(created_at, HOUR)\n",{"type":44,"tag":93,"props":992,"children":993},{"class":95,"line":203},[994],{"type":44,"tag":93,"props":995,"children":996},{"emptyLinePlaceholder":118},[997],{"type":50,"value":121},{"type":44,"tag":93,"props":999,"children":1000},{"class":95,"line":212},[1001],{"type":44,"tag":93,"props":1002,"children":1003},{},[1004],{"type":50,"value":191},{"type":44,"tag":93,"props":1006,"children":1007},{"class":95,"line":220},[1008],{"type":44,"tag":93,"props":1009,"children":1010},{},[1011],{"type":50,"value":200},{"type":44,"tag":93,"props":1013,"children":1014},{"class":95,"line":229},[1015],{"type":44,"tag":93,"props":1016,"children":1017},{},[1018],{"type":50,"value":1019},"EXTRACT(DAYOFWEEK FROM created_at)  -- 1=Sunday\n",{"type":44,"tag":93,"props":1021,"children":1023},{"class":95,"line":1022},17,[1024],{"type":44,"tag":93,"props":1025,"children":1026},{"emptyLinePlaceholder":118},[1027],{"type":50,"value":121},{"type":44,"tag":93,"props":1029,"children":1031},{"class":95,"line":1030},18,[1032],{"type":44,"tag":93,"props":1033,"children":1034},{},[1035],{"type":50,"value":226},{"type":44,"tag":93,"props":1037,"children":1039},{"class":95,"line":1038},19,[1040],{"type":44,"tag":93,"props":1041,"children":1042},{},[1043],{"type":50,"value":1044},"FORMAT_DATE('%Y-%m-%d', date_column)\n",{"type":44,"tag":93,"props":1046,"children":1048},{"class":95,"line":1047},20,[1049],{"type":44,"tag":93,"props":1050,"children":1051},{},[1052],{"type":50,"value":1053},"FORMAT_TIMESTAMP('%Y-%m-%d %H:%M:%S', ts_column)\n",{"type":44,"tag":53,"props":1055,"children":1056},{},[1057],{"type":44,"tag":76,"props":1058,"children":1059},{},[1060],{"type":50,"value":243},{"type":44,"tag":82,"props":1062,"children":1064},{"className":84,"code":1063,"language":25,"meta":86,"style":86},"-- No ILIKE, use LOWER()\nLOWER(column) LIKE '%pattern%'\nREGEXP_CONTAINS(column, r'pattern')\nREGEXP_EXTRACT(column, r'pattern')\n\n-- String manipulation\nSPLIT(str, delimiter)  -- returns ARRAY\nARRAY_TO_STRING(array, delimiter)\n",[1065],{"type":44,"tag":89,"props":1066,"children":1067},{"__ignoreMap":86},[1068,1076,1084,1092,1100,1107,1114,1122],{"type":44,"tag":93,"props":1069,"children":1070},{"class":95,"line":96},[1071],{"type":44,"tag":93,"props":1072,"children":1073},{},[1074],{"type":50,"value":1075},"-- No ILIKE, use LOWER()\n",{"type":44,"tag":93,"props":1077,"children":1078},{"class":95,"line":105},[1079],{"type":44,"tag":93,"props":1080,"children":1081},{},[1082],{"type":50,"value":1083},"LOWER(column) LIKE '%pattern%'\n",{"type":44,"tag":93,"props":1085,"children":1086},{"class":95,"line":114},[1087],{"type":44,"tag":93,"props":1088,"children":1089},{},[1090],{"type":50,"value":1091},"REGEXP_CONTAINS(column, r'pattern')\n",{"type":44,"tag":93,"props":1093,"children":1094},{"class":95,"line":124},[1095],{"type":44,"tag":93,"props":1096,"children":1097},{},[1098],{"type":50,"value":1099},"REGEXP_EXTRACT(column, r'pattern')\n",{"type":44,"tag":93,"props":1101,"children":1102},{"class":95,"line":133},[1103],{"type":44,"tag":93,"props":1104,"children":1105},{"emptyLinePlaceholder":118},[1106],{"type":50,"value":121},{"type":44,"tag":93,"props":1108,"children":1109},{"class":95,"line":142},[1110],{"type":44,"tag":93,"props":1111,"children":1112},{},[1113],{"type":50,"value":320},{"type":44,"tag":93,"props":1115,"children":1116},{"class":95,"line":151},[1117],{"type":44,"tag":93,"props":1118,"children":1119},{},[1120],{"type":50,"value":1121},"SPLIT(str, delimiter)  -- returns ARRAY\n",{"type":44,"tag":93,"props":1123,"children":1124},{"class":95,"line":159},[1125],{"type":44,"tag":93,"props":1126,"children":1127},{},[1128],{"type":50,"value":1129},"ARRAY_TO_STRING(array, delimiter)\n",{"type":44,"tag":53,"props":1131,"children":1132},{},[1133],{"type":44,"tag":76,"props":1134,"children":1135},{},[1136],{"type":50,"value":1137},"Arrays and structs:",{"type":44,"tag":82,"props":1139,"children":1141},{"className":84,"code":1140,"language":25,"meta":86,"style":86},"-- Array operations\nARRAY_AGG(column)\nUNNEST(array_column)\nARRAY_LENGTH(array_column)\nvalue IN UNNEST(array_column)\n\n-- Struct access\nstruct_column.field_name\n",[1142],{"type":44,"tag":89,"props":1143,"children":1144},{"__ignoreMap":86},[1145,1152,1159,1167,1175,1183,1190,1198],{"type":44,"tag":93,"props":1146,"children":1147},{"class":95,"line":96},[1148],{"type":44,"tag":93,"props":1149,"children":1150},{},[1151],{"type":50,"value":406},{"type":44,"tag":93,"props":1153,"children":1154},{"class":95,"line":105},[1155],{"type":44,"tag":93,"props":1156,"children":1157},{},[1158],{"type":50,"value":414},{"type":44,"tag":93,"props":1160,"children":1161},{"class":95,"line":114},[1162],{"type":44,"tag":93,"props":1163,"children":1164},{},[1165],{"type":50,"value":1166},"UNNEST(array_column)\n",{"type":44,"tag":93,"props":1168,"children":1169},{"class":95,"line":124},[1170],{"type":44,"tag":93,"props":1171,"children":1172},{},[1173],{"type":50,"value":1174},"ARRAY_LENGTH(array_column)\n",{"type":44,"tag":93,"props":1176,"children":1177},{"class":95,"line":133},[1178],{"type":44,"tag":93,"props":1179,"children":1180},{},[1181],{"type":50,"value":1182},"value IN UNNEST(array_column)\n",{"type":44,"tag":93,"props":1184,"children":1185},{"class":95,"line":142},[1186],{"type":44,"tag":93,"props":1187,"children":1188},{"emptyLinePlaceholder":118},[1189],{"type":50,"value":121},{"type":44,"tag":93,"props":1191,"children":1192},{"class":95,"line":151},[1193],{"type":44,"tag":93,"props":1194,"children":1195},{},[1196],{"type":50,"value":1197},"-- Struct access\n",{"type":44,"tag":93,"props":1199,"children":1200},{"class":95,"line":159},[1201],{"type":44,"tag":93,"props":1202,"children":1203},{},[1204],{"type":50,"value":1205},"struct_column.field_name\n",{"type":44,"tag":53,"props":1207,"children":1208},{},[1209],{"type":44,"tag":76,"props":1210,"children":1211},{},[1212],{"type":50,"value":438},{"type":44,"tag":440,"props":1214,"children":1215},{},[1216,1221,1226,1238,1251,1271],{"type":44,"tag":444,"props":1217,"children":1218},{},[1219],{"type":50,"value":1220},"Always filter on partition columns (usually date) to reduce bytes scanned",{"type":44,"tag":444,"props":1222,"children":1223},{},[1224],{"type":50,"value":1225},"Use clustering for frequently filtered columns within partitions",{"type":44,"tag":444,"props":1227,"children":1228},{},[1229,1230,1236],{"type":50,"value":448},{"type":44,"tag":89,"props":1231,"children":1233},{"className":1232},[],[1234],{"type":50,"value":1235},"APPROX_COUNT_DISTINCT()",{"type":50,"value":1237}," for large-scale cardinality estimates",{"type":44,"tag":444,"props":1239,"children":1240},{},[1241,1243,1249],{"type":50,"value":1242},"Avoid ",{"type":44,"tag":89,"props":1244,"children":1246},{"className":1245},[],[1247],{"type":50,"value":1248},"SELECT *",{"type":50,"value":1250}," -- billing is per-byte scanned",{"type":44,"tag":444,"props":1252,"children":1253},{},[1254,1255,1261,1263,1269],{"type":50,"value":448},{"type":44,"tag":89,"props":1256,"children":1258},{"className":1257},[],[1259],{"type":50,"value":1260},"DECLARE",{"type":50,"value":1262}," and ",{"type":44,"tag":89,"props":1264,"children":1266},{"className":1265},[],[1267],{"type":50,"value":1268},"SET",{"type":50,"value":1270}," for parameterized scripts",{"type":44,"tag":444,"props":1272,"children":1273},{},[1274],{"type":50,"value":1275},"Preview query cost with dry run before executing large queries",{"type":44,"tag":493,"props":1277,"children":1278},{},[],{"type":44,"tag":66,"props":1280,"children":1282},{"id":1281},"redshift-amazon",[1283],{"type":50,"value":1284},"Redshift (Amazon)",{"type":44,"tag":53,"props":1286,"children":1287},{},[1288],{"type":44,"tag":76,"props":1289,"children":1290},{},[1291],{"type":50,"value":80},{"type":44,"tag":82,"props":1293,"children":1295},{"className":84,"code":1294,"language":25,"meta":86,"style":86},"-- Current date\u002Ftime\nCURRENT_DATE, GETDATE(), SYSDATE\n\n-- Date arithmetic\nDATEADD(day, 7, date_column)\nDATEDIFF(day, start_date, end_date)\n\n-- Truncate to period\nDATE_TRUNC('month', created_at)\n\n-- Extract parts\nEXTRACT(YEAR FROM created_at)\nDATE_PART('dow', created_at)\n",[1296],{"type":44,"tag":89,"props":1297,"children":1298},{"__ignoreMap":86},[1299,1306,1314,1321,1328,1335,1342,1349,1356,1363,1370,1377,1384],{"type":44,"tag":93,"props":1300,"children":1301},{"class":95,"line":96},[1302],{"type":44,"tag":93,"props":1303,"children":1304},{},[1305],{"type":50,"value":102},{"type":44,"tag":93,"props":1307,"children":1308},{"class":95,"line":105},[1309],{"type":44,"tag":93,"props":1310,"children":1311},{},[1312],{"type":50,"value":1313},"CURRENT_DATE, GETDATE(), SYSDATE\n",{"type":44,"tag":93,"props":1315,"children":1316},{"class":95,"line":114},[1317],{"type":44,"tag":93,"props":1318,"children":1319},{"emptyLinePlaceholder":118},[1320],{"type":50,"value":121},{"type":44,"tag":93,"props":1322,"children":1323},{"class":95,"line":124},[1324],{"type":44,"tag":93,"props":1325,"children":1326},{},[1327],{"type":50,"value":130},{"type":44,"tag":93,"props":1329,"children":1330},{"class":95,"line":133},[1331],{"type":44,"tag":93,"props":1332,"children":1333},{},[1334],{"type":50,"value":552},{"type":44,"tag":93,"props":1336,"children":1337},{"class":95,"line":142},[1338],{"type":44,"tag":93,"props":1339,"children":1340},{},[1341],{"type":50,"value":560},{"type":44,"tag":93,"props":1343,"children":1344},{"class":95,"line":151},[1345],{"type":44,"tag":93,"props":1346,"children":1347},{"emptyLinePlaceholder":118},[1348],{"type":50,"value":121},{"type":44,"tag":93,"props":1350,"children":1351},{"class":95,"line":159},[1352],{"type":44,"tag":93,"props":1353,"children":1354},{},[1355],{"type":50,"value":165},{"type":44,"tag":93,"props":1357,"children":1358},{"class":95,"line":168},[1359],{"type":44,"tag":93,"props":1360,"children":1361},{},[1362],{"type":50,"value":174},{"type":44,"tag":93,"props":1364,"children":1365},{"class":95,"line":177},[1366],{"type":44,"tag":93,"props":1367,"children":1368},{"emptyLinePlaceholder":118},[1369],{"type":50,"value":121},{"type":44,"tag":93,"props":1371,"children":1372},{"class":95,"line":185},[1373],{"type":44,"tag":93,"props":1374,"children":1375},{},[1376],{"type":50,"value":191},{"type":44,"tag":93,"props":1378,"children":1379},{"class":95,"line":194},[1380],{"type":44,"tag":93,"props":1381,"children":1382},{},[1383],{"type":50,"value":200},{"type":44,"tag":93,"props":1385,"children":1386},{"class":95,"line":203},[1387],{"type":44,"tag":93,"props":1388,"children":1389},{},[1390],{"type":50,"value":1391},"DATE_PART('dow', created_at)\n",{"type":44,"tag":53,"props":1393,"children":1394},{},[1395],{"type":44,"tag":76,"props":1396,"children":1397},{},[1398],{"type":50,"value":243},{"type":44,"tag":82,"props":1400,"children":1402},{"className":84,"code":1401,"language":25,"meta":86,"style":86},"-- Case-insensitive\ncolumn ILIKE '%pattern%'\nREGEXP_INSTR(column, 'pattern') > 0\n\n-- String manipulation\nSPLIT_PART(str, delimiter, position)\nLISTAGG(column, ', ') WITHIN GROUP (ORDER BY column)\n",[1403],{"type":44,"tag":89,"props":1404,"children":1405},{"__ignoreMap":86},[1406,1414,1421,1429,1436,1443,1450],{"type":44,"tag":93,"props":1407,"children":1408},{"class":95,"line":96},[1409],{"type":44,"tag":93,"props":1410,"children":1411},{},[1412],{"type":50,"value":1413},"-- Case-insensitive\n",{"type":44,"tag":93,"props":1415,"children":1416},{"class":95,"line":105},[1417],{"type":44,"tag":93,"props":1418,"children":1419},{},[1420],{"type":50,"value":662},{"type":44,"tag":93,"props":1422,"children":1423},{"class":95,"line":114},[1424],{"type":44,"tag":93,"props":1425,"children":1426},{},[1427],{"type":50,"value":1428},"REGEXP_INSTR(column, 'pattern') > 0\n",{"type":44,"tag":93,"props":1430,"children":1431},{"class":95,"line":124},[1432],{"type":44,"tag":93,"props":1433,"children":1434},{"emptyLinePlaceholder":118},[1435],{"type":50,"value":121},{"type":44,"tag":93,"props":1437,"children":1438},{"class":95,"line":133},[1439],{"type":44,"tag":93,"props":1440,"children":1441},{},[1442],{"type":50,"value":320},{"type":44,"tag":93,"props":1444,"children":1445},{"class":95,"line":142},[1446],{"type":44,"tag":93,"props":1447,"children":1448},{},[1449],{"type":50,"value":336},{"type":44,"tag":93,"props":1451,"children":1452},{"class":95,"line":151},[1453],{"type":44,"tag":93,"props":1454,"children":1455},{},[1456],{"type":50,"value":1457},"LISTAGG(column, ', ') WITHIN GROUP (ORDER BY column)\n",{"type":44,"tag":53,"props":1459,"children":1460},{},[1461],{"type":44,"tag":76,"props":1462,"children":1463},{},[1464],{"type":50,"value":438},{"type":44,"tag":440,"props":1466,"children":1467},{},[1468,1473,1478,1490,1495,1513],{"type":44,"tag":444,"props":1469,"children":1470},{},[1471],{"type":50,"value":1472},"Design distribution keys for collocated joins (DISTKEY)",{"type":44,"tag":444,"props":1474,"children":1475},{},[1476],{"type":50,"value":1477},"Use sort keys for frequently filtered columns (SORTKEY)",{"type":44,"tag":444,"props":1479,"children":1480},{},[1481,1482,1488],{"type":50,"value":448},{"type":44,"tag":89,"props":1483,"children":1485},{"className":1484},[],[1486],{"type":50,"value":1487},"EXPLAIN",{"type":50,"value":1489}," to check query plan",{"type":44,"tag":444,"props":1491,"children":1492},{},[1493],{"type":50,"value":1494},"Avoid cross-node data movement (watch for DS_BCAST and DS_DIST)",{"type":44,"tag":444,"props":1496,"children":1497},{},[1498,1504,1505,1511],{"type":44,"tag":89,"props":1499,"children":1501},{"className":1500},[],[1502],{"type":50,"value":1503},"ANALYZE",{"type":50,"value":1262},{"type":44,"tag":89,"props":1506,"children":1508},{"className":1507},[],[1509],{"type":50,"value":1510},"VACUUM",{"type":50,"value":1512}," regularly",{"type":44,"tag":444,"props":1514,"children":1515},{},[1516],{"type":50,"value":1517},"Use late-binding views for schema flexibility",{"type":44,"tag":493,"props":1519,"children":1520},{},[],{"type":44,"tag":66,"props":1522,"children":1524},{"id":1523},"databricks-sql",[1525],{"type":50,"value":1526},"Databricks SQL",{"type":44,"tag":53,"props":1528,"children":1529},{},[1530],{"type":44,"tag":76,"props":1531,"children":1532},{},[1533],{"type":50,"value":80},{"type":44,"tag":82,"props":1535,"children":1537},{"className":84,"code":1536,"language":25,"meta":86,"style":86},"-- Current date\u002Ftime\nCURRENT_DATE(), CURRENT_TIMESTAMP()\n\n-- Date arithmetic\nDATE_ADD(date_column, 7)\nDATEDIFF(end_date, start_date)\nADD_MONTHS(date_column, 1)\n\n-- Truncate to period\nDATE_TRUNC('MONTH', created_at)\nTRUNC(date_column, 'MM')\n\n-- Extract parts\nYEAR(created_at), MONTH(created_at)\nDAYOFWEEK(created_at)\n",[1538],{"type":44,"tag":89,"props":1539,"children":1540},{"__ignoreMap":86},[1541,1548,1555,1562,1569,1577,1585,1593,1600,1607,1615,1623,1630,1637,1645],{"type":44,"tag":93,"props":1542,"children":1543},{"class":95,"line":96},[1544],{"type":44,"tag":93,"props":1545,"children":1546},{},[1547],{"type":50,"value":102},{"type":44,"tag":93,"props":1549,"children":1550},{"class":95,"line":105},[1551],{"type":44,"tag":93,"props":1552,"children":1553},{},[1554],{"type":50,"value":914},{"type":44,"tag":93,"props":1556,"children":1557},{"class":95,"line":114},[1558],{"type":44,"tag":93,"props":1559,"children":1560},{"emptyLinePlaceholder":118},[1561],{"type":50,"value":121},{"type":44,"tag":93,"props":1563,"children":1564},{"class":95,"line":124},[1565],{"type":44,"tag":93,"props":1566,"children":1567},{},[1568],{"type":50,"value":130},{"type":44,"tag":93,"props":1570,"children":1571},{"class":95,"line":133},[1572],{"type":44,"tag":93,"props":1573,"children":1574},{},[1575],{"type":50,"value":1576},"DATE_ADD(date_column, 7)\n",{"type":44,"tag":93,"props":1578,"children":1579},{"class":95,"line":142},[1580],{"type":44,"tag":93,"props":1581,"children":1582},{},[1583],{"type":50,"value":1584},"DATEDIFF(end_date, start_date)\n",{"type":44,"tag":93,"props":1586,"children":1587},{"class":95,"line":151},[1588],{"type":44,"tag":93,"props":1589,"children":1590},{},[1591],{"type":50,"value":1592},"ADD_MONTHS(date_column, 1)\n",{"type":44,"tag":93,"props":1594,"children":1595},{"class":95,"line":159},[1596],{"type":44,"tag":93,"props":1597,"children":1598},{"emptyLinePlaceholder":118},[1599],{"type":50,"value":121},{"type":44,"tag":93,"props":1601,"children":1602},{"class":95,"line":168},[1603],{"type":44,"tag":93,"props":1604,"children":1605},{},[1606],{"type":50,"value":165},{"type":44,"tag":93,"props":1608,"children":1609},{"class":95,"line":177},[1610],{"type":44,"tag":93,"props":1611,"children":1612},{},[1613],{"type":50,"value":1614},"DATE_TRUNC('MONTH', created_at)\n",{"type":44,"tag":93,"props":1616,"children":1617},{"class":95,"line":185},[1618],{"type":44,"tag":93,"props":1619,"children":1620},{},[1621],{"type":50,"value":1622},"TRUNC(date_column, 'MM')\n",{"type":44,"tag":93,"props":1624,"children":1625},{"class":95,"line":194},[1626],{"type":44,"tag":93,"props":1627,"children":1628},{"emptyLinePlaceholder":118},[1629],{"type":50,"value":121},{"type":44,"tag":93,"props":1631,"children":1632},{"class":95,"line":203},[1633],{"type":44,"tag":93,"props":1634,"children":1635},{},[1636],{"type":50,"value":191},{"type":44,"tag":93,"props":1638,"children":1639},{"class":95,"line":212},[1640],{"type":44,"tag":93,"props":1641,"children":1642},{},[1643],{"type":50,"value":1644},"YEAR(created_at), MONTH(created_at)\n",{"type":44,"tag":93,"props":1646,"children":1647},{"class":95,"line":220},[1648],{"type":44,"tag":93,"props":1649,"children":1650},{},[1651],{"type":50,"value":611},{"type":44,"tag":53,"props":1653,"children":1654},{},[1655],{"type":44,"tag":76,"props":1656,"children":1657},{},[1658],{"type":50,"value":1659},"Delta Lake features:",{"type":44,"tag":82,"props":1661,"children":1663},{"className":84,"code":1662,"language":25,"meta":86,"style":86},"-- Time travel\nSELECT * FROM my_table TIMESTAMP AS OF '2024-01-15'\nSELECT * FROM my_table VERSION AS OF 42\n\n-- Describe history\nDESCRIBE HISTORY my_table\n\n-- Merge (upsert)\nMERGE INTO target USING source\nON target.id = source.id\nWHEN MATCHED THEN UPDATE SET *\nWHEN NOT MATCHED THEN INSERT *\n",[1664],{"type":44,"tag":89,"props":1665,"children":1666},{"__ignoreMap":86},[1667,1675,1683,1691,1698,1706,1714,1721,1729,1737,1745,1753],{"type":44,"tag":93,"props":1668,"children":1669},{"class":95,"line":96},[1670],{"type":44,"tag":93,"props":1671,"children":1672},{},[1673],{"type":50,"value":1674},"-- Time travel\n",{"type":44,"tag":93,"props":1676,"children":1677},{"class":95,"line":105},[1678],{"type":44,"tag":93,"props":1679,"children":1680},{},[1681],{"type":50,"value":1682},"SELECT * FROM my_table TIMESTAMP AS OF '2024-01-15'\n",{"type":44,"tag":93,"props":1684,"children":1685},{"class":95,"line":114},[1686],{"type":44,"tag":93,"props":1687,"children":1688},{},[1689],{"type":50,"value":1690},"SELECT * FROM my_table VERSION AS OF 42\n",{"type":44,"tag":93,"props":1692,"children":1693},{"class":95,"line":124},[1694],{"type":44,"tag":93,"props":1695,"children":1696},{"emptyLinePlaceholder":118},[1697],{"type":50,"value":121},{"type":44,"tag":93,"props":1699,"children":1700},{"class":95,"line":133},[1701],{"type":44,"tag":93,"props":1702,"children":1703},{},[1704],{"type":50,"value":1705},"-- Describe history\n",{"type":44,"tag":93,"props":1707,"children":1708},{"class":95,"line":142},[1709],{"type":44,"tag":93,"props":1710,"children":1711},{},[1712],{"type":50,"value":1713},"DESCRIBE HISTORY my_table\n",{"type":44,"tag":93,"props":1715,"children":1716},{"class":95,"line":151},[1717],{"type":44,"tag":93,"props":1718,"children":1719},{"emptyLinePlaceholder":118},[1720],{"type":50,"value":121},{"type":44,"tag":93,"props":1722,"children":1723},{"class":95,"line":159},[1724],{"type":44,"tag":93,"props":1725,"children":1726},{},[1727],{"type":50,"value":1728},"-- Merge (upsert)\n",{"type":44,"tag":93,"props":1730,"children":1731},{"class":95,"line":168},[1732],{"type":44,"tag":93,"props":1733,"children":1734},{},[1735],{"type":50,"value":1736},"MERGE INTO target USING source\n",{"type":44,"tag":93,"props":1738,"children":1739},{"class":95,"line":177},[1740],{"type":44,"tag":93,"props":1741,"children":1742},{},[1743],{"type":50,"value":1744},"ON target.id = source.id\n",{"type":44,"tag":93,"props":1746,"children":1747},{"class":95,"line":185},[1748],{"type":44,"tag":93,"props":1749,"children":1750},{},[1751],{"type":50,"value":1752},"WHEN MATCHED THEN UPDATE SET *\n",{"type":44,"tag":93,"props":1754,"children":1755},{"class":95,"line":194},[1756],{"type":44,"tag":93,"props":1757,"children":1758},{},[1759],{"type":50,"value":1760},"WHEN NOT MATCHED THEN INSERT *\n",{"type":44,"tag":53,"props":1762,"children":1763},{},[1764],{"type":44,"tag":76,"props":1765,"children":1766},{},[1767],{"type":50,"value":438},{"type":44,"tag":440,"props":1769,"children":1770},{},[1771,1791,1796,1808],{"type":44,"tag":444,"props":1772,"children":1773},{},[1774,1776,1782,1783,1789],{"type":50,"value":1775},"Use Delta Lake's ",{"type":44,"tag":89,"props":1777,"children":1779},{"className":1778},[],[1780],{"type":50,"value":1781},"OPTIMIZE",{"type":50,"value":1262},{"type":44,"tag":89,"props":1784,"children":1786},{"className":1785},[],[1787],{"type":50,"value":1788},"ZORDER",{"type":50,"value":1790}," for query performance",{"type":44,"tag":444,"props":1792,"children":1793},{},[1794],{"type":50,"value":1795},"Leverage Photon engine for compute-intensive queries",{"type":44,"tag":444,"props":1797,"children":1798},{},[1799,1800,1806],{"type":50,"value":448},{"type":44,"tag":89,"props":1801,"children":1803},{"className":1802},[],[1804],{"type":50,"value":1805},"CACHE TABLE",{"type":50,"value":1807}," for frequently accessed datasets",{"type":44,"tag":444,"props":1809,"children":1810},{},[1811],{"type":50,"value":1812},"Partition by low-cardinality date columns",{"type":44,"tag":493,"props":1814,"children":1815},{},[],{"type":44,"tag":59,"props":1817,"children":1819},{"id":1818},"common-sql-patterns",[1820],{"type":50,"value":1821},"Common SQL Patterns",{"type":44,"tag":66,"props":1823,"children":1825},{"id":1824},"window-functions",[1826],{"type":50,"value":1827},"Window Functions",{"type":44,"tag":82,"props":1829,"children":1831},{"className":84,"code":1830,"language":25,"meta":86,"style":86},"-- Ranking\nROW_NUMBER() OVER (PARTITION BY user_id ORDER BY created_at DESC)\nRANK() OVER (PARTITION BY category ORDER BY revenue DESC)\nDENSE_RANK() OVER (ORDER BY score DESC)\n\n-- Running totals \u002F moving averages\nSUM(revenue) OVER (ORDER BY date_col ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) as running_total\nAVG(revenue) OVER (ORDER BY date_col ROWS BETWEEN 6 PRECEDING AND CURRENT ROW) as moving_avg_7d\n\n-- Lag \u002F Lead\nLAG(value, 1) OVER (PARTITION BY entity ORDER BY date_col) as prev_value\nLEAD(value, 1) OVER (PARTITION BY entity ORDER BY date_col) as next_value\n\n-- First \u002F Last value\nFIRST_VALUE(status) OVER (PARTITION BY user_id ORDER BY created_at ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)\nLAST_VALUE(status) OVER (PARTITION BY user_id ORDER BY created_at ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)\n\n-- Percent of total\nrevenue \u002F SUM(revenue) OVER () as pct_of_total\nrevenue \u002F SUM(revenue) OVER (PARTITION BY category) as pct_of_category\n",[1832],{"type":44,"tag":89,"props":1833,"children":1834},{"__ignoreMap":86},[1835,1843,1851,1859,1867,1874,1882,1890,1898,1905,1913,1921,1929,1936,1944,1952,1960,1967,1975,1983],{"type":44,"tag":93,"props":1836,"children":1837},{"class":95,"line":96},[1838],{"type":44,"tag":93,"props":1839,"children":1840},{},[1841],{"type":50,"value":1842},"-- Ranking\n",{"type":44,"tag":93,"props":1844,"children":1845},{"class":95,"line":105},[1846],{"type":44,"tag":93,"props":1847,"children":1848},{},[1849],{"type":50,"value":1850},"ROW_NUMBER() OVER (PARTITION BY user_id ORDER BY created_at DESC)\n",{"type":44,"tag":93,"props":1852,"children":1853},{"class":95,"line":114},[1854],{"type":44,"tag":93,"props":1855,"children":1856},{},[1857],{"type":50,"value":1858},"RANK() OVER (PARTITION BY category ORDER BY revenue DESC)\n",{"type":44,"tag":93,"props":1860,"children":1861},{"class":95,"line":124},[1862],{"type":44,"tag":93,"props":1863,"children":1864},{},[1865],{"type":50,"value":1866},"DENSE_RANK() OVER (ORDER BY score DESC)\n",{"type":44,"tag":93,"props":1868,"children":1869},{"class":95,"line":133},[1870],{"type":44,"tag":93,"props":1871,"children":1872},{"emptyLinePlaceholder":118},[1873],{"type":50,"value":121},{"type":44,"tag":93,"props":1875,"children":1876},{"class":95,"line":142},[1877],{"type":44,"tag":93,"props":1878,"children":1879},{},[1880],{"type":50,"value":1881},"-- Running totals \u002F moving averages\n",{"type":44,"tag":93,"props":1883,"children":1884},{"class":95,"line":151},[1885],{"type":44,"tag":93,"props":1886,"children":1887},{},[1888],{"type":50,"value":1889},"SUM(revenue) OVER (ORDER BY date_col ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) as running_total\n",{"type":44,"tag":93,"props":1891,"children":1892},{"class":95,"line":159},[1893],{"type":44,"tag":93,"props":1894,"children":1895},{},[1896],{"type":50,"value":1897},"AVG(revenue) OVER (ORDER BY date_col ROWS BETWEEN 6 PRECEDING AND CURRENT ROW) as moving_avg_7d\n",{"type":44,"tag":93,"props":1899,"children":1900},{"class":95,"line":168},[1901],{"type":44,"tag":93,"props":1902,"children":1903},{"emptyLinePlaceholder":118},[1904],{"type":50,"value":121},{"type":44,"tag":93,"props":1906,"children":1907},{"class":95,"line":177},[1908],{"type":44,"tag":93,"props":1909,"children":1910},{},[1911],{"type":50,"value":1912},"-- Lag \u002F Lead\n",{"type":44,"tag":93,"props":1914,"children":1915},{"class":95,"line":185},[1916],{"type":44,"tag":93,"props":1917,"children":1918},{},[1919],{"type":50,"value":1920},"LAG(value, 1) OVER (PARTITION BY entity ORDER BY date_col) as prev_value\n",{"type":44,"tag":93,"props":1922,"children":1923},{"class":95,"line":194},[1924],{"type":44,"tag":93,"props":1925,"children":1926},{},[1927],{"type":50,"value":1928},"LEAD(value, 1) OVER (PARTITION BY entity ORDER BY date_col) as next_value\n",{"type":44,"tag":93,"props":1930,"children":1931},{"class":95,"line":203},[1932],{"type":44,"tag":93,"props":1933,"children":1934},{"emptyLinePlaceholder":118},[1935],{"type":50,"value":121},{"type":44,"tag":93,"props":1937,"children":1938},{"class":95,"line":212},[1939],{"type":44,"tag":93,"props":1940,"children":1941},{},[1942],{"type":50,"value":1943},"-- First \u002F Last value\n",{"type":44,"tag":93,"props":1945,"children":1946},{"class":95,"line":220},[1947],{"type":44,"tag":93,"props":1948,"children":1949},{},[1950],{"type":50,"value":1951},"FIRST_VALUE(status) OVER (PARTITION BY user_id ORDER BY created_at ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)\n",{"type":44,"tag":93,"props":1953,"children":1954},{"class":95,"line":229},[1955],{"type":44,"tag":93,"props":1956,"children":1957},{},[1958],{"type":50,"value":1959},"LAST_VALUE(status) OVER (PARTITION BY user_id ORDER BY created_at ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING)\n",{"type":44,"tag":93,"props":1961,"children":1962},{"class":95,"line":1022},[1963],{"type":44,"tag":93,"props":1964,"children":1965},{"emptyLinePlaceholder":118},[1966],{"type":50,"value":121},{"type":44,"tag":93,"props":1968,"children":1969},{"class":95,"line":1030},[1970],{"type":44,"tag":93,"props":1971,"children":1972},{},[1973],{"type":50,"value":1974},"-- Percent of total\n",{"type":44,"tag":93,"props":1976,"children":1977},{"class":95,"line":1038},[1978],{"type":44,"tag":93,"props":1979,"children":1980},{},[1981],{"type":50,"value":1982},"revenue \u002F SUM(revenue) OVER () as pct_of_total\n",{"type":44,"tag":93,"props":1984,"children":1985},{"class":95,"line":1047},[1986],{"type":44,"tag":93,"props":1987,"children":1988},{},[1989],{"type":50,"value":1990},"revenue \u002F SUM(revenue) OVER (PARTITION BY category) as pct_of_category\n",{"type":44,"tag":66,"props":1992,"children":1994},{"id":1993},"ctes-for-readability",[1995],{"type":50,"value":1996},"CTEs for Readability",{"type":44,"tag":82,"props":1998,"children":2000},{"className":84,"code":1999,"language":25,"meta":86,"style":86},"WITH\n-- Step 1: Define the base population\nbase_users AS (\n    SELECT user_id, created_at, plan_type\n    FROM users\n    WHERE created_at >= DATE '2024-01-01'\n      AND status = 'active'\n),\n\n-- Step 2: Calculate user-level metrics\nuser_metrics AS (\n    SELECT\n        u.user_id,\n        u.plan_type,\n        COUNT(DISTINCT e.session_id) as session_count,\n        SUM(e.revenue) as total_revenue\n    FROM base_users u\n    LEFT JOIN events e ON u.user_id = e.user_id\n    GROUP BY u.user_id, u.plan_type\n),\n\n-- Step 3: Aggregate to summary level\nsummary AS (\n    SELECT\n        plan_type,\n        COUNT(*) as user_count,\n        AVG(session_count) as avg_sessions,\n        SUM(total_revenue) as total_revenue\n    FROM user_metrics\n    GROUP BY plan_type\n)\n\nSELECT * FROM summary ORDER BY total_revenue DESC;\n",[2001],{"type":44,"tag":89,"props":2002,"children":2003},{"__ignoreMap":86},[2004,2012,2020,2028,2036,2044,2052,2060,2068,2075,2083,2091,2099,2107,2115,2123,2131,2139,2147,2155,2162,2170,2179,2188,2196,2205,2214,2223,2232,2241,2250,2259,2267],{"type":44,"tag":93,"props":2005,"children":2006},{"class":95,"line":96},[2007],{"type":44,"tag":93,"props":2008,"children":2009},{},[2010],{"type":50,"value":2011},"WITH\n",{"type":44,"tag":93,"props":2013,"children":2014},{"class":95,"line":105},[2015],{"type":44,"tag":93,"props":2016,"children":2017},{},[2018],{"type":50,"value":2019},"-- Step 1: Define the base population\n",{"type":44,"tag":93,"props":2021,"children":2022},{"class":95,"line":114},[2023],{"type":44,"tag":93,"props":2024,"children":2025},{},[2026],{"type":50,"value":2027},"base_users AS (\n",{"type":44,"tag":93,"props":2029,"children":2030},{"class":95,"line":124},[2031],{"type":44,"tag":93,"props":2032,"children":2033},{},[2034],{"type":50,"value":2035},"    SELECT user_id, created_at, plan_type\n",{"type":44,"tag":93,"props":2037,"children":2038},{"class":95,"line":133},[2039],{"type":44,"tag":93,"props":2040,"children":2041},{},[2042],{"type":50,"value":2043},"    FROM users\n",{"type":44,"tag":93,"props":2045,"children":2046},{"class":95,"line":142},[2047],{"type":44,"tag":93,"props":2048,"children":2049},{},[2050],{"type":50,"value":2051},"    WHERE created_at >= DATE '2024-01-01'\n",{"type":44,"tag":93,"props":2053,"children":2054},{"class":95,"line":151},[2055],{"type":44,"tag":93,"props":2056,"children":2057},{},[2058],{"type":50,"value":2059},"      AND status = 'active'\n",{"type":44,"tag":93,"props":2061,"children":2062},{"class":95,"line":159},[2063],{"type":44,"tag":93,"props":2064,"children":2065},{},[2066],{"type":50,"value":2067},"),\n",{"type":44,"tag":93,"props":2069,"children":2070},{"class":95,"line":168},[2071],{"type":44,"tag":93,"props":2072,"children":2073},{"emptyLinePlaceholder":118},[2074],{"type":50,"value":121},{"type":44,"tag":93,"props":2076,"children":2077},{"class":95,"line":177},[2078],{"type":44,"tag":93,"props":2079,"children":2080},{},[2081],{"type":50,"value":2082},"-- Step 2: Calculate user-level metrics\n",{"type":44,"tag":93,"props":2084,"children":2085},{"class":95,"line":185},[2086],{"type":44,"tag":93,"props":2087,"children":2088},{},[2089],{"type":50,"value":2090},"user_metrics AS (\n",{"type":44,"tag":93,"props":2092,"children":2093},{"class":95,"line":194},[2094],{"type":44,"tag":93,"props":2095,"children":2096},{},[2097],{"type":50,"value":2098},"    SELECT\n",{"type":44,"tag":93,"props":2100,"children":2101},{"class":95,"line":203},[2102],{"type":44,"tag":93,"props":2103,"children":2104},{},[2105],{"type":50,"value":2106},"        u.user_id,\n",{"type":44,"tag":93,"props":2108,"children":2109},{"class":95,"line":212},[2110],{"type":44,"tag":93,"props":2111,"children":2112},{},[2113],{"type":50,"value":2114},"        u.plan_type,\n",{"type":44,"tag":93,"props":2116,"children":2117},{"class":95,"line":220},[2118],{"type":44,"tag":93,"props":2119,"children":2120},{},[2121],{"type":50,"value":2122},"        COUNT(DISTINCT e.session_id) as session_count,\n",{"type":44,"tag":93,"props":2124,"children":2125},{"class":95,"line":229},[2126],{"type":44,"tag":93,"props":2127,"children":2128},{},[2129],{"type":50,"value":2130},"        SUM(e.revenue) as total_revenue\n",{"type":44,"tag":93,"props":2132,"children":2133},{"class":95,"line":1022},[2134],{"type":44,"tag":93,"props":2135,"children":2136},{},[2137],{"type":50,"value":2138},"    FROM base_users u\n",{"type":44,"tag":93,"props":2140,"children":2141},{"class":95,"line":1030},[2142],{"type":44,"tag":93,"props":2143,"children":2144},{},[2145],{"type":50,"value":2146},"    LEFT JOIN events e ON u.user_id = e.user_id\n",{"type":44,"tag":93,"props":2148,"children":2149},{"class":95,"line":1038},[2150],{"type":44,"tag":93,"props":2151,"children":2152},{},[2153],{"type":50,"value":2154},"    GROUP BY u.user_id, u.plan_type\n",{"type":44,"tag":93,"props":2156,"children":2157},{"class":95,"line":1047},[2158],{"type":44,"tag":93,"props":2159,"children":2160},{},[2161],{"type":50,"value":2067},{"type":44,"tag":93,"props":2163,"children":2165},{"class":95,"line":2164},21,[2166],{"type":44,"tag":93,"props":2167,"children":2168},{"emptyLinePlaceholder":118},[2169],{"type":50,"value":121},{"type":44,"tag":93,"props":2171,"children":2173},{"class":95,"line":2172},22,[2174],{"type":44,"tag":93,"props":2175,"children":2176},{},[2177],{"type":50,"value":2178},"-- Step 3: Aggregate to summary level\n",{"type":44,"tag":93,"props":2180,"children":2182},{"class":95,"line":2181},23,[2183],{"type":44,"tag":93,"props":2184,"children":2185},{},[2186],{"type":50,"value":2187},"summary AS (\n",{"type":44,"tag":93,"props":2189,"children":2191},{"class":95,"line":2190},24,[2192],{"type":44,"tag":93,"props":2193,"children":2194},{},[2195],{"type":50,"value":2098},{"type":44,"tag":93,"props":2197,"children":2199},{"class":95,"line":2198},25,[2200],{"type":44,"tag":93,"props":2201,"children":2202},{},[2203],{"type":50,"value":2204},"        plan_type,\n",{"type":44,"tag":93,"props":2206,"children":2208},{"class":95,"line":2207},26,[2209],{"type":44,"tag":93,"props":2210,"children":2211},{},[2212],{"type":50,"value":2213},"        COUNT(*) as user_count,\n",{"type":44,"tag":93,"props":2215,"children":2217},{"class":95,"line":2216},27,[2218],{"type":44,"tag":93,"props":2219,"children":2220},{},[2221],{"type":50,"value":2222},"        AVG(session_count) as avg_sessions,\n",{"type":44,"tag":93,"props":2224,"children":2226},{"class":95,"line":2225},28,[2227],{"type":44,"tag":93,"props":2228,"children":2229},{},[2230],{"type":50,"value":2231},"        SUM(total_revenue) as total_revenue\n",{"type":44,"tag":93,"props":2233,"children":2235},{"class":95,"line":2234},29,[2236],{"type":44,"tag":93,"props":2237,"children":2238},{},[2239],{"type":50,"value":2240},"    FROM user_metrics\n",{"type":44,"tag":93,"props":2242,"children":2244},{"class":95,"line":2243},30,[2245],{"type":44,"tag":93,"props":2246,"children":2247},{},[2248],{"type":50,"value":2249},"    GROUP BY plan_type\n",{"type":44,"tag":93,"props":2251,"children":2253},{"class":95,"line":2252},31,[2254],{"type":44,"tag":93,"props":2255,"children":2256},{},[2257],{"type":50,"value":2258},")\n",{"type":44,"tag":93,"props":2260,"children":2262},{"class":95,"line":2261},32,[2263],{"type":44,"tag":93,"props":2264,"children":2265},{"emptyLinePlaceholder":118},[2266],{"type":50,"value":121},{"type":44,"tag":93,"props":2268,"children":2270},{"class":95,"line":2269},33,[2271],{"type":44,"tag":93,"props":2272,"children":2273},{},[2274],{"type":50,"value":2275},"SELECT * FROM summary ORDER BY total_revenue DESC;\n",{"type":44,"tag":66,"props":2277,"children":2279},{"id":2278},"cohort-retention",[2280],{"type":50,"value":2281},"Cohort Retention",{"type":44,"tag":82,"props":2283,"children":2285},{"className":84,"code":2284,"language":25,"meta":86,"style":86},"WITH cohorts AS (\n    SELECT\n        user_id,\n        DATE_TRUNC('month', first_activity_date) as cohort_month\n    FROM users\n),\nactivity AS (\n    SELECT\n        user_id,\n        DATE_TRUNC('month', activity_date) as activity_month\n    FROM user_activity\n)\nSELECT\n    c.cohort_month,\n    COUNT(DISTINCT c.user_id) as cohort_size,\n    COUNT(DISTINCT CASE\n        WHEN a.activity_month = c.cohort_month THEN a.user_id\n    END) as month_0,\n    COUNT(DISTINCT CASE\n        WHEN a.activity_month = c.cohort_month + INTERVAL '1 month' THEN a.user_id\n    END) as month_1,\n    COUNT(DISTINCT CASE\n        WHEN a.activity_month = c.cohort_month + INTERVAL '3 months' THEN a.user_id\n    END) as month_3\nFROM cohorts c\nLEFT JOIN activity a ON c.user_id = a.user_id\nGROUP BY c.cohort_month\nORDER BY c.cohort_month;\n",[2286],{"type":44,"tag":89,"props":2287,"children":2288},{"__ignoreMap":86},[2289,2297,2304,2312,2320,2327,2334,2342,2349,2356,2364,2372,2379,2386,2394,2402,2410,2418,2426,2433,2441,2449,2456,2464,2472,2480,2488,2496],{"type":44,"tag":93,"props":2290,"children":2291},{"class":95,"line":96},[2292],{"type":44,"tag":93,"props":2293,"children":2294},{},[2295],{"type":50,"value":2296},"WITH cohorts AS (\n",{"type":44,"tag":93,"props":2298,"children":2299},{"class":95,"line":105},[2300],{"type":44,"tag":93,"props":2301,"children":2302},{},[2303],{"type":50,"value":2098},{"type":44,"tag":93,"props":2305,"children":2306},{"class":95,"line":114},[2307],{"type":44,"tag":93,"props":2308,"children":2309},{},[2310],{"type":50,"value":2311},"        user_id,\n",{"type":44,"tag":93,"props":2313,"children":2314},{"class":95,"line":124},[2315],{"type":44,"tag":93,"props":2316,"children":2317},{},[2318],{"type":50,"value":2319},"        DATE_TRUNC('month', first_activity_date) as cohort_month\n",{"type":44,"tag":93,"props":2321,"children":2322},{"class":95,"line":133},[2323],{"type":44,"tag":93,"props":2324,"children":2325},{},[2326],{"type":50,"value":2043},{"type":44,"tag":93,"props":2328,"children":2329},{"class":95,"line":142},[2330],{"type":44,"tag":93,"props":2331,"children":2332},{},[2333],{"type":50,"value":2067},{"type":44,"tag":93,"props":2335,"children":2336},{"class":95,"line":151},[2337],{"type":44,"tag":93,"props":2338,"children":2339},{},[2340],{"type":50,"value":2341},"activity AS (\n",{"type":44,"tag":93,"props":2343,"children":2344},{"class":95,"line":159},[2345],{"type":44,"tag":93,"props":2346,"children":2347},{},[2348],{"type":50,"value":2098},{"type":44,"tag":93,"props":2350,"children":2351},{"class":95,"line":168},[2352],{"type":44,"tag":93,"props":2353,"children":2354},{},[2355],{"type":50,"value":2311},{"type":44,"tag":93,"props":2357,"children":2358},{"class":95,"line":177},[2359],{"type":44,"tag":93,"props":2360,"children":2361},{},[2362],{"type":50,"value":2363},"        DATE_TRUNC('month', activity_date) as activity_month\n",{"type":44,"tag":93,"props":2365,"children":2366},{"class":95,"line":185},[2367],{"type":44,"tag":93,"props":2368,"children":2369},{},[2370],{"type":50,"value":2371},"    FROM user_activity\n",{"type":44,"tag":93,"props":2373,"children":2374},{"class":95,"line":194},[2375],{"type":44,"tag":93,"props":2376,"children":2377},{},[2378],{"type":50,"value":2258},{"type":44,"tag":93,"props":2380,"children":2381},{"class":95,"line":203},[2382],{"type":44,"tag":93,"props":2383,"children":2384},{},[2385],{"type":50,"value":794},{"type":44,"tag":93,"props":2387,"children":2388},{"class":95,"line":212},[2389],{"type":44,"tag":93,"props":2390,"children":2391},{},[2392],{"type":50,"value":2393},"    c.cohort_month,\n",{"type":44,"tag":93,"props":2395,"children":2396},{"class":95,"line":220},[2397],{"type":44,"tag":93,"props":2398,"children":2399},{},[2400],{"type":50,"value":2401},"    COUNT(DISTINCT c.user_id) as cohort_size,\n",{"type":44,"tag":93,"props":2403,"children":2404},{"class":95,"line":229},[2405],{"type":44,"tag":93,"props":2406,"children":2407},{},[2408],{"type":50,"value":2409},"    COUNT(DISTINCT CASE\n",{"type":44,"tag":93,"props":2411,"children":2412},{"class":95,"line":1022},[2413],{"type":44,"tag":93,"props":2414,"children":2415},{},[2416],{"type":50,"value":2417},"        WHEN a.activity_month = c.cohort_month THEN a.user_id\n",{"type":44,"tag":93,"props":2419,"children":2420},{"class":95,"line":1030},[2421],{"type":44,"tag":93,"props":2422,"children":2423},{},[2424],{"type":50,"value":2425},"    END) as month_0,\n",{"type":44,"tag":93,"props":2427,"children":2428},{"class":95,"line":1038},[2429],{"type":44,"tag":93,"props":2430,"children":2431},{},[2432],{"type":50,"value":2409},{"type":44,"tag":93,"props":2434,"children":2435},{"class":95,"line":1047},[2436],{"type":44,"tag":93,"props":2437,"children":2438},{},[2439],{"type":50,"value":2440},"        WHEN a.activity_month = c.cohort_month + INTERVAL '1 month' THEN a.user_id\n",{"type":44,"tag":93,"props":2442,"children":2443},{"class":95,"line":2164},[2444],{"type":44,"tag":93,"props":2445,"children":2446},{},[2447],{"type":50,"value":2448},"    END) as month_1,\n",{"type":44,"tag":93,"props":2450,"children":2451},{"class":95,"line":2172},[2452],{"type":44,"tag":93,"props":2453,"children":2454},{},[2455],{"type":50,"value":2409},{"type":44,"tag":93,"props":2457,"children":2458},{"class":95,"line":2181},[2459],{"type":44,"tag":93,"props":2460,"children":2461},{},[2462],{"type":50,"value":2463},"        WHEN a.activity_month = c.cohort_month + INTERVAL '3 months' THEN a.user_id\n",{"type":44,"tag":93,"props":2465,"children":2466},{"class":95,"line":2190},[2467],{"type":44,"tag":93,"props":2468,"children":2469},{},[2470],{"type":50,"value":2471},"    END) as month_3\n",{"type":44,"tag":93,"props":2473,"children":2474},{"class":95,"line":2198},[2475],{"type":44,"tag":93,"props":2476,"children":2477},{},[2478],{"type":50,"value":2479},"FROM cohorts c\n",{"type":44,"tag":93,"props":2481,"children":2482},{"class":95,"line":2207},[2483],{"type":44,"tag":93,"props":2484,"children":2485},{},[2486],{"type":50,"value":2487},"LEFT JOIN activity a ON c.user_id = a.user_id\n",{"type":44,"tag":93,"props":2489,"children":2490},{"class":95,"line":2216},[2491],{"type":44,"tag":93,"props":2492,"children":2493},{},[2494],{"type":50,"value":2495},"GROUP BY c.cohort_month\n",{"type":44,"tag":93,"props":2497,"children":2498},{"class":95,"line":2225},[2499],{"type":44,"tag":93,"props":2500,"children":2501},{},[2502],{"type":50,"value":2503},"ORDER BY c.cohort_month;\n",{"type":44,"tag":66,"props":2505,"children":2507},{"id":2506},"funnel-analysis",[2508],{"type":50,"value":2509},"Funnel Analysis",{"type":44,"tag":82,"props":2511,"children":2513},{"className":84,"code":2512,"language":25,"meta":86,"style":86},"WITH funnel AS (\n    SELECT\n        user_id,\n        MAX(CASE WHEN event = 'page_view' THEN 1 ELSE 0 END) as step_1_view,\n        MAX(CASE WHEN event = 'signup_start' THEN 1 ELSE 0 END) as step_2_start,\n        MAX(CASE WHEN event = 'signup_complete' THEN 1 ELSE 0 END) as step_3_complete,\n        MAX(CASE WHEN event = 'first_purchase' THEN 1 ELSE 0 END) as step_4_purchase\n    FROM events\n    WHERE event_date >= CURRENT_DATE - INTERVAL '30 days'\n    GROUP BY user_id\n)\nSELECT\n    COUNT(*) as total_users,\n    SUM(step_1_view) as viewed,\n    SUM(step_2_start) as started_signup,\n    SUM(step_3_complete) as completed_signup,\n    SUM(step_4_purchase) as purchased,\n    ROUND(100.0 * SUM(step_2_start) \u002F NULLIF(SUM(step_1_view), 0), 1) as view_to_start_pct,\n    ROUND(100.0 * SUM(step_3_complete) \u002F NULLIF(SUM(step_2_start), 0), 1) as start_to_complete_pct,\n    ROUND(100.0 * SUM(step_4_purchase) \u002F NULLIF(SUM(step_3_complete), 0), 1) as complete_to_purchase_pct\nFROM funnel;\n",[2514],{"type":44,"tag":89,"props":2515,"children":2516},{"__ignoreMap":86},[2517,2525,2532,2539,2547,2555,2563,2571,2579,2587,2595,2602,2609,2617,2625,2633,2641,2649,2657,2665,2673],{"type":44,"tag":93,"props":2518,"children":2519},{"class":95,"line":96},[2520],{"type":44,"tag":93,"props":2521,"children":2522},{},[2523],{"type":50,"value":2524},"WITH funnel AS (\n",{"type":44,"tag":93,"props":2526,"children":2527},{"class":95,"line":105},[2528],{"type":44,"tag":93,"props":2529,"children":2530},{},[2531],{"type":50,"value":2098},{"type":44,"tag":93,"props":2533,"children":2534},{"class":95,"line":114},[2535],{"type":44,"tag":93,"props":2536,"children":2537},{},[2538],{"type":50,"value":2311},{"type":44,"tag":93,"props":2540,"children":2541},{"class":95,"line":124},[2542],{"type":44,"tag":93,"props":2543,"children":2544},{},[2545],{"type":50,"value":2546},"        MAX(CASE WHEN event = 'page_view' THEN 1 ELSE 0 END) as step_1_view,\n",{"type":44,"tag":93,"props":2548,"children":2549},{"class":95,"line":133},[2550],{"type":44,"tag":93,"props":2551,"children":2552},{},[2553],{"type":50,"value":2554},"        MAX(CASE WHEN event = 'signup_start' THEN 1 ELSE 0 END) as step_2_start,\n",{"type":44,"tag":93,"props":2556,"children":2557},{"class":95,"line":142},[2558],{"type":44,"tag":93,"props":2559,"children":2560},{},[2561],{"type":50,"value":2562},"        MAX(CASE WHEN event = 'signup_complete' THEN 1 ELSE 0 END) as step_3_complete,\n",{"type":44,"tag":93,"props":2564,"children":2565},{"class":95,"line":151},[2566],{"type":44,"tag":93,"props":2567,"children":2568},{},[2569],{"type":50,"value":2570},"        MAX(CASE WHEN event = 'first_purchase' THEN 1 ELSE 0 END) as step_4_purchase\n",{"type":44,"tag":93,"props":2572,"children":2573},{"class":95,"line":159},[2574],{"type":44,"tag":93,"props":2575,"children":2576},{},[2577],{"type":50,"value":2578},"    FROM events\n",{"type":44,"tag":93,"props":2580,"children":2581},{"class":95,"line":168},[2582],{"type":44,"tag":93,"props":2583,"children":2584},{},[2585],{"type":50,"value":2586},"    WHERE event_date >= CURRENT_DATE - INTERVAL '30 days'\n",{"type":44,"tag":93,"props":2588,"children":2589},{"class":95,"line":177},[2590],{"type":44,"tag":93,"props":2591,"children":2592},{},[2593],{"type":50,"value":2594},"    GROUP BY user_id\n",{"type":44,"tag":93,"props":2596,"children":2597},{"class":95,"line":185},[2598],{"type":44,"tag":93,"props":2599,"children":2600},{},[2601],{"type":50,"value":2258},{"type":44,"tag":93,"props":2603,"children":2604},{"class":95,"line":194},[2605],{"type":44,"tag":93,"props":2606,"children":2607},{},[2608],{"type":50,"value":794},{"type":44,"tag":93,"props":2610,"children":2611},{"class":95,"line":203},[2612],{"type":44,"tag":93,"props":2613,"children":2614},{},[2615],{"type":50,"value":2616},"    COUNT(*) as total_users,\n",{"type":44,"tag":93,"props":2618,"children":2619},{"class":95,"line":212},[2620],{"type":44,"tag":93,"props":2621,"children":2622},{},[2623],{"type":50,"value":2624},"    SUM(step_1_view) as viewed,\n",{"type":44,"tag":93,"props":2626,"children":2627},{"class":95,"line":220},[2628],{"type":44,"tag":93,"props":2629,"children":2630},{},[2631],{"type":50,"value":2632},"    SUM(step_2_start) as started_signup,\n",{"type":44,"tag":93,"props":2634,"children":2635},{"class":95,"line":229},[2636],{"type":44,"tag":93,"props":2637,"children":2638},{},[2639],{"type":50,"value":2640},"    SUM(step_3_complete) as completed_signup,\n",{"type":44,"tag":93,"props":2642,"children":2643},{"class":95,"line":1022},[2644],{"type":44,"tag":93,"props":2645,"children":2646},{},[2647],{"type":50,"value":2648},"    SUM(step_4_purchase) as purchased,\n",{"type":44,"tag":93,"props":2650,"children":2651},{"class":95,"line":1030},[2652],{"type":44,"tag":93,"props":2653,"children":2654},{},[2655],{"type":50,"value":2656},"    ROUND(100.0 * SUM(step_2_start) \u002F NULLIF(SUM(step_1_view), 0), 1) as view_to_start_pct,\n",{"type":44,"tag":93,"props":2658,"children":2659},{"class":95,"line":1038},[2660],{"type":44,"tag":93,"props":2661,"children":2662},{},[2663],{"type":50,"value":2664},"    ROUND(100.0 * SUM(step_3_complete) \u002F NULLIF(SUM(step_2_start), 0), 1) as start_to_complete_pct,\n",{"type":44,"tag":93,"props":2666,"children":2667},{"class":95,"line":1047},[2668],{"type":44,"tag":93,"props":2669,"children":2670},{},[2671],{"type":50,"value":2672},"    ROUND(100.0 * SUM(step_4_purchase) \u002F NULLIF(SUM(step_3_complete), 0), 1) as complete_to_purchase_pct\n",{"type":44,"tag":93,"props":2674,"children":2675},{"class":95,"line":2164},[2676],{"type":44,"tag":93,"props":2677,"children":2678},{},[2679],{"type":50,"value":2680},"FROM funnel;\n",{"type":44,"tag":66,"props":2682,"children":2684},{"id":2683},"deduplication",[2685],{"type":50,"value":2686},"Deduplication",{"type":44,"tag":82,"props":2688,"children":2690},{"className":84,"code":2689,"language":25,"meta":86,"style":86},"-- Keep the most recent record per key\nWITH ranked AS (\n    SELECT\n        *,\n        ROW_NUMBER() OVER (\n            PARTITION BY entity_id\n            ORDER BY updated_at DESC\n        ) as rn\n    FROM source_table\n)\nSELECT * FROM ranked WHERE rn = 1;\n",[2691],{"type":44,"tag":89,"props":2692,"children":2693},{"__ignoreMap":86},[2694,2702,2710,2717,2725,2733,2741,2749,2757,2765,2772],{"type":44,"tag":93,"props":2695,"children":2696},{"class":95,"line":96},[2697],{"type":44,"tag":93,"props":2698,"children":2699},{},[2700],{"type":50,"value":2701},"-- Keep the most recent record per key\n",{"type":44,"tag":93,"props":2703,"children":2704},{"class":95,"line":105},[2705],{"type":44,"tag":93,"props":2706,"children":2707},{},[2708],{"type":50,"value":2709},"WITH ranked AS (\n",{"type":44,"tag":93,"props":2711,"children":2712},{"class":95,"line":114},[2713],{"type":44,"tag":93,"props":2714,"children":2715},{},[2716],{"type":50,"value":2098},{"type":44,"tag":93,"props":2718,"children":2719},{"class":95,"line":124},[2720],{"type":44,"tag":93,"props":2721,"children":2722},{},[2723],{"type":50,"value":2724},"        *,\n",{"type":44,"tag":93,"props":2726,"children":2727},{"class":95,"line":133},[2728],{"type":44,"tag":93,"props":2729,"children":2730},{},[2731],{"type":50,"value":2732},"        ROW_NUMBER() OVER (\n",{"type":44,"tag":93,"props":2734,"children":2735},{"class":95,"line":142},[2736],{"type":44,"tag":93,"props":2737,"children":2738},{},[2739],{"type":50,"value":2740},"            PARTITION BY entity_id\n",{"type":44,"tag":93,"props":2742,"children":2743},{"class":95,"line":151},[2744],{"type":44,"tag":93,"props":2745,"children":2746},{},[2747],{"type":50,"value":2748},"            ORDER BY updated_at DESC\n",{"type":44,"tag":93,"props":2750,"children":2751},{"class":95,"line":159},[2752],{"type":44,"tag":93,"props":2753,"children":2754},{},[2755],{"type":50,"value":2756},"        ) as rn\n",{"type":44,"tag":93,"props":2758,"children":2759},{"class":95,"line":168},[2760],{"type":44,"tag":93,"props":2761,"children":2762},{},[2763],{"type":50,"value":2764},"    FROM source_table\n",{"type":44,"tag":93,"props":2766,"children":2767},{"class":95,"line":177},[2768],{"type":44,"tag":93,"props":2769,"children":2770},{},[2771],{"type":50,"value":2258},{"type":44,"tag":93,"props":2773,"children":2774},{"class":95,"line":185},[2775],{"type":44,"tag":93,"props":2776,"children":2777},{},[2778],{"type":50,"value":2779},"SELECT * FROM ranked WHERE rn = 1;\n",{"type":44,"tag":59,"props":2781,"children":2783},{"id":2782},"error-handling-and-debugging",[2784],{"type":50,"value":2785},"Error Handling and Debugging",{"type":44,"tag":53,"props":2787,"children":2788},{},[2789],{"type":50,"value":2790},"When a query fails:",{"type":44,"tag":2792,"props":2793,"children":2794},"ol",{},[2795,2821,2831,2857,2875,2885],{"type":44,"tag":444,"props":2796,"children":2797},{},[2798,2803,2805,2811,2813,2819],{"type":44,"tag":76,"props":2799,"children":2800},{},[2801],{"type":50,"value":2802},"Syntax errors",{"type":50,"value":2804},": Check for dialect-specific syntax (e.g., ",{"type":44,"tag":89,"props":2806,"children":2808},{"className":2807},[],[2809],{"type":50,"value":2810},"ILIKE",{"type":50,"value":2812}," not available in BigQuery, ",{"type":44,"tag":89,"props":2814,"children":2816},{"className":2815},[],[2817],{"type":50,"value":2818},"SAFE_DIVIDE",{"type":50,"value":2820}," only in BigQuery)",{"type":44,"tag":444,"props":2822,"children":2823},{},[2824,2829],{"type":44,"tag":76,"props":2825,"children":2826},{},[2827],{"type":50,"value":2828},"Column not found",{"type":50,"value":2830},": Verify column names against schema -- check for typos, case sensitivity (PostgreSQL is case-sensitive for quoted identifiers)",{"type":44,"tag":444,"props":2832,"children":2833},{},[2834,2839,2841,2847,2849,2855],{"type":44,"tag":76,"props":2835,"children":2836},{},[2837],{"type":50,"value":2838},"Type mismatches",{"type":50,"value":2840},": Cast explicitly when comparing different types (",{"type":44,"tag":89,"props":2842,"children":2844},{"className":2843},[],[2845],{"type":50,"value":2846},"CAST(col AS DATE)",{"type":50,"value":2848},", ",{"type":44,"tag":89,"props":2850,"children":2852},{"className":2851},[],[2853],{"type":50,"value":2854},"col::DATE",{"type":50,"value":2856},")",{"type":44,"tag":444,"props":2858,"children":2859},{},[2860,2865,2867,2873],{"type":44,"tag":76,"props":2861,"children":2862},{},[2863],{"type":50,"value":2864},"Division by zero",{"type":50,"value":2866},": Use ",{"type":44,"tag":89,"props":2868,"children":2870},{"className":2869},[],[2871],{"type":50,"value":2872},"NULLIF(denominator, 0)",{"type":50,"value":2874}," or dialect-specific safe division",{"type":44,"tag":444,"props":2876,"children":2877},{},[2878,2883],{"type":44,"tag":76,"props":2879,"children":2880},{},[2881],{"type":50,"value":2882},"Ambiguous columns",{"type":50,"value":2884},": Always qualify column names with table alias in JOINs",{"type":44,"tag":444,"props":2886,"children":2887},{},[2888,2893],{"type":44,"tag":76,"props":2889,"children":2890},{},[2891],{"type":50,"value":2892},"Group by errors",{"type":50,"value":2894},": All non-aggregated columns must be in GROUP BY (except in BigQuery which allows grouping by alias)",{"type":44,"tag":2896,"props":2897,"children":2898},"style",{},[2899],{"type":50,"value":2900},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"items":2902,"total":3017},[2903,2919,2935,2949,2967,2986,3002],{"slug":2904,"name":2904,"fn":2905,"description":2906,"org":2907,"tags":2908,"stars":26,"repoUrl":27,"updatedAt":2918},"accessibility-review","run WCAG accessibility audits","Run a WCAG 2.1 AA accessibility audit on a design or page. Trigger with \"audit accessibility\", \"check a11y\", \"is this accessible?\", or when reviewing a design for color contrast, keyboard navigation, touch target size, or screen reader behavior before handoff.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[2909,2912,2915],{"name":2910,"slug":2911,"type":16},"Accessibility","accessibility",{"name":2913,"slug":2914,"type":16},"Design","design",{"name":2916,"slug":2917,"type":16},"WCAG","wcag","2026-04-06T17:58:05.682394",{"slug":2920,"name":2920,"fn":2921,"description":2922,"org":2923,"tags":2924,"stars":26,"repoUrl":27,"updatedAt":2934},"account-research","research accounts for sales intel","Research a company or person and get actionable sales intel. Works standalone with web search, supercharged when you connect enrichment tools or your CRM. Trigger with \"research [company]\", \"look up [person]\", \"intel on [prospect]\", \"who is [name] at [company]\", or \"tell me about [company]\".",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[2925,2928,2931],{"name":2926,"slug":2927,"type":16},"CRM","crm",{"name":2929,"slug":2930,"type":16},"Research","research",{"name":2932,"slug":2933,"type":16},"Sales","sales","2026-04-06T17:56:41.410418",{"slug":2936,"name":2936,"fn":2937,"description":2938,"org":2939,"tags":2940,"stars":26,"repoUrl":27,"updatedAt":2948},"analyze","answer data questions and run analyses","Answer data questions -- from quick lookups to full analyses. Use when looking up a single metric, investigating what's driving a trend or drop, comparing segments over time, or preparing a formal data report for stakeholders.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[2941,2944,2947],{"name":2942,"slug":2943,"type":16},"Analytics","analytics",{"name":2945,"slug":2946,"type":16},"Data Analysis","data-analysis",{"name":24,"slug":25,"type":16},"2026-04-06T17:57:21.593647",{"slug":2950,"name":2950,"fn":2951,"description":2952,"org":2953,"tags":2954,"stars":26,"repoUrl":27,"updatedAt":2966},"architecture","create and evaluate architecture decision records","Create or evaluate an architecture decision record (ADR). Use when choosing between technologies (e.g., Kafka vs SQS), documenting a design decision with trade-offs and consequences, reviewing a system design proposal, or designing a new component from requirements and constraints.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[2955,2958,2960,2963],{"name":2956,"slug":2957,"type":16},"ADR","adr",{"name":2959,"slug":2950,"type":16},"Architecture",{"name":2961,"slug":2962,"type":16},"Documentation","documentation",{"name":2964,"slug":2965,"type":16},"Engineering","engineering","2026-04-06T17:57:49.26444",{"slug":2968,"name":2968,"fn":2969,"description":2970,"org":2971,"tags":2972,"stars":26,"repoUrl":27,"updatedAt":2985},"audit-support","support SOX 404 control testing","Support SOX 404 compliance with control testing methodology, sample selection, and documentation standards. Use when generating testing workpapers, selecting audit samples, classifying control deficiencies, or preparing for internal or external audits.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[2973,2976,2979,2982],{"name":2974,"slug":2975,"type":16},"Audit","audit",{"name":2977,"slug":2978,"type":16},"Finance","finance",{"name":2980,"slug":2981,"type":16},"Regulatory Compliance","regulatory-compliance",{"name":2983,"slug":2984,"type":16},"SOX","sox","2026-04-06T17:57:36.714815",{"slug":2987,"name":2987,"fn":2988,"description":2989,"org":2990,"tags":2991,"stars":26,"repoUrl":27,"updatedAt":3001},"brand-review","review content against brand voice","Review content against your brand voice, style guide, and messaging pillars, flagging deviations by severity with specific before\u002Fafter fixes. Use when checking a draft before it ships, when auditing copy for voice consistency and terminology, or when screening for unsubstantiated claims, missing disclaimers, and other legal flags.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[2992,2995,2998],{"name":2993,"slug":2994,"type":16},"Branding","branding",{"name":2996,"slug":2997,"type":16},"Marketing","marketing",{"name":2999,"slug":3000,"type":16},"Writing","writing","2026-04-06T17:58:19.548331",{"slug":3003,"name":3003,"fn":3004,"description":3005,"org":3006,"tags":3007,"stars":26,"repoUrl":27,"updatedAt":3016},"brand-voice-enforcement","enforce brand voice in content","This skill applies brand guidelines to content creation. It should be used when the user asks to \"write an email\", \"draft a proposal\", \"create a pitch deck\", \"write a LinkedIn post\", \"draft a presentation\", \"write a Slack message\", \"draft sales content\", or any content creation request where brand voice should be applied. Also triggers on \"on-brand\", \"brand voice\", \"enforce voice\", \"apply brand guidelines\", \"brand-aligned content\", \"write in our voice\", \"use our brand tone\", \"make this sound like us\", \"rewrite this in our tone\", or \"this doesn't sound on-brand\". Not for generating guidelines from scratch (use guideline-generation) or discovering brand materials (use discover-brand).\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[3008,3009,3012,3015],{"name":2993,"slug":2994,"type":16},{"name":3010,"slug":3011,"type":16},"Communications","communications",{"name":3013,"slug":3014,"type":16},"Content Creation","content-creation",{"name":2999,"slug":3000,"type":16},"2026-04-06T18:00:23.528956",200,{"items":3019,"total":3194},[3020,3039,3051,3063,3082,3093,3114,3134,3144,3159,3167,3180],{"slug":3021,"name":3021,"fn":3022,"description":3023,"org":3024,"tags":3025,"stars":3036,"repoUrl":3037,"updatedAt":3038},"algorithmic-art","create algorithmic art with p5.js","Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists' work to avoid copyright violations.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[3026,3029,3030,3033],{"name":3027,"slug":3028,"type":16},"Creative","creative",{"name":2913,"slug":2914,"type":16},{"name":3031,"slug":3032,"type":16},"Generative Art","generative-art",{"name":3034,"slug":3035,"type":16},"JavaScript","javascript",161831,"https:\u002F\u002Fgithub.com\u002Fanthropics\u002Fskills","2026-04-06T17:56:15.455818",{"slug":3040,"name":3040,"fn":3041,"description":3042,"org":3043,"tags":3044,"stars":3036,"repoUrl":3037,"updatedAt":3050},"brand-guidelines","apply Anthropic brand colors and typography","Applies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[3045,3046,3047],{"name":2993,"slug":2994,"type":16},{"name":2913,"slug":2914,"type":16},{"name":3048,"slug":3049,"type":16},"Typography","typography","2026-04-06T17:56:05.042852",{"slug":3052,"name":3052,"fn":3053,"description":3054,"org":3055,"tags":3056,"stars":3036,"repoUrl":3037,"updatedAt":3062},"canvas-design","create posters and visual art as PNG or PDF","Create beautiful visual art in .png and .pdf documents using design philosophy. You should use this skill when the user asks to create a poster, piece of art, design, or other static piece. Create original visual designs, never copying existing artists' work to avoid copyright violations.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[3057,3058,3059],{"name":3027,"slug":3028,"type":16},{"name":2913,"slug":2914,"type":16},{"name":3060,"slug":3061,"type":16},"PDF","pdf","2026-04-06T17:56:03.794732",{"slug":3064,"name":3064,"fn":3065,"description":3066,"org":3067,"tags":3068,"stars":3036,"repoUrl":3037,"updatedAt":3081},"claude-api","build apps with the Claude API","Reference for the Claude API \u002F Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration.\nTRIGGER — read BEFORE opening the target file; don't skip because it \"looks like a one-liner\" — whenever: the prompt names Claude\u002FAnthropic in any form (Claude, Anthropic, Fable, Opus, Sonnet, Haiku, `anthropic`, `@anthropic-ai`, `claude-*`, `us.anthropic.*`, `[1m]`); the user asks about an LLM (pricing\u002Fmodel choice\u002Flimits\u002Fcaching) — never answer from memory; OR the task is LLM-shaped with provider unstated (agent\u002FMCP\u002Ftool-definition\u002Fmulti-agent\u002FRAG\u002FLLM-judge\u002Fcomputer-use; generate\u002Fsummarize\u002Fextract\u002Fclassify\u002Frewrite\u002Fconverse over NL; debugging refusals\u002Fcutoffs\u002Fstreaming\u002Ftool-calls\u002Ftokens).\nSKIP only when another provider is being worked on (overrides all triggers): OpenAI\u002FGPT\u002FGemini\u002FLlama\u002FMistral\u002FCohere\u002FOllama named in the query; OR `grep -rE 'openai|langchain_openai|google.generativeai|genai|mistralai|cohere|ollama'` over the project hits (run this grep FIRST if no provider named — don't Read the file).",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[3069,3072,3073,3076,3078],{"name":3070,"slug":3071,"type":16},"Agents","agents",{"name":9,"slug":8,"type":16},{"name":3074,"slug":3075,"type":16},"Anthropic SDK","anthropic-sdk",{"name":3077,"slug":3064,"type":16},"Claude API",{"name":3079,"slug":3080,"type":16},"LLM","llm","2026-07-28T05:36:08.213335",{"slug":3083,"name":3083,"fn":3084,"description":3085,"org":3086,"tags":3087,"stars":3036,"repoUrl":3037,"updatedAt":3092},"doc-coauthoring","co-author documentation and technical specs","Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision docs, or similar structured content. This workflow helps users efficiently transfer context, refine content through iteration, and verify the doc works for readers. Trigger when user mentions writing docs, creating proposals, drafting specs, or similar documentation tasks.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[3088,3089],{"name":2961,"slug":2962,"type":16},{"name":3090,"slug":3091,"type":16},"Technical Writing","technical-writing","2026-04-06T17:56:14.18897",{"slug":3094,"name":3094,"fn":3095,"description":3096,"org":3097,"tags":3098,"stars":3036,"repoUrl":3037,"updatedAt":3113},"docx","create and edit Word documents","Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', '.dotx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx or .dotx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[3099,3102,3104,3107,3110],{"name":3100,"slug":3101,"type":16},"Documents","documents",{"name":3103,"slug":3094,"type":16},"DOCX",{"name":3105,"slug":3106,"type":16},"Office","office",{"name":3108,"slug":3109,"type":16},"Templates","templates",{"name":3111,"slug":3112,"type":16},"Word","word","2026-07-18T05:16:23.136271",{"slug":3115,"name":3115,"fn":3116,"description":3117,"org":3118,"tags":3119,"stars":3036,"repoUrl":3037,"updatedAt":3133},"frontend-design","design production-grade frontend interfaces","Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[3120,3121,3124,3127,3130],{"name":2913,"slug":2914,"type":16},{"name":3122,"slug":3123,"type":16},"Frontend","frontend",{"name":3125,"slug":3126,"type":16},"React","react",{"name":3128,"slug":3129,"type":16},"Tailwind CSS","tailwind-css",{"name":3131,"slug":3132,"type":16},"UI Components","ui-components","2026-04-06T17:56:16.723469",{"slug":3135,"name":3135,"fn":3136,"description":3137,"org":3138,"tags":3139,"stars":3036,"repoUrl":3037,"updatedAt":3143},"internal-comms","write internal company communications","A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill whenever asked to write some sort of internal communications (status reports, leadership updates, 3P updates, company newsletters, FAQs, incident reports, project updates, etc.).",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[3140,3141,3142],{"name":3010,"slug":3011,"type":16},{"name":3108,"slug":3109,"type":16},{"name":2999,"slug":3000,"type":16},"2026-04-06T17:56:20.695522",{"slug":3145,"name":3145,"fn":3146,"description":3147,"org":3148,"tags":3149,"stars":3036,"repoUrl":3037,"updatedAt":3158},"mcp-builder","build MCP servers","Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node\u002FTypeScript (MCP SDK).",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[3150,3151,3154,3155],{"name":3070,"slug":3071,"type":16},{"name":3152,"slug":3153,"type":16},"API Development","api-development",{"name":3079,"slug":3080,"type":16},{"name":3156,"slug":3157,"type":16},"MCP","mcp","2026-04-06T17:56:10.357665",{"slug":3061,"name":3061,"fn":3160,"description":3161,"org":3162,"tags":3163,"stars":3036,"repoUrl":3037,"updatedAt":3166},"read edit and manipulate PDF files","Use this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text\u002Ftables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting\u002Fdecrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[3164,3165],{"name":3100,"slug":3101,"type":16},{"name":3060,"slug":3061,"type":16},"2026-04-06T17:56:02.483316",{"slug":3168,"name":3168,"fn":3169,"description":3170,"org":3171,"tags":3172,"stars":3036,"repoUrl":3037,"updatedAt":3179},"pptx","create and edit PowerPoint presentations","Use this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or presentations; reading, parsing, or extracting text from any .pptx or .potx file (even if the extracted content will be used elsewhere, like in an email or summary); editing, modifying, or updating existing presentations; combining or splitting slide files; working with templates (.potx), layouts, speaker notes, or comments. Trigger whenever the user mentions \"deck,\" \"slides,\" \"presentation,\" or references a .pptx or .potx filename, regardless of what they plan to do with the content afterward. If a .pptx or .potx file needs to be opened, created, or touched, use this skill.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[3173,3176],{"name":3174,"slug":3175,"type":16},"PowerPoint","powerpoint",{"name":3177,"slug":3178,"type":16},"Presentations","presentations","2026-07-18T05:16:24.1471",{"slug":3181,"name":3181,"fn":3182,"description":3183,"org":3184,"tags":3185,"stars":3036,"repoUrl":3037,"updatedAt":3193},"skill-creator","create and optimize agent skills","Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[3186,3187,3188,3191,3192],{"name":3070,"slug":3071,"type":16},{"name":2961,"slug":2962,"type":16},{"name":3189,"slug":3190,"type":16},"Evals","evals",{"name":14,"slug":15,"type":16},{"name":3090,"slug":3091,"type":16},"2026-04-19T06:45:40.804",490]