sql-cookbook SKILL.md skillA

sql-cookbook from vm0-ai/vm0-skills is an agent skill: a SKILL.md folder an AI agent loads when a task calls for it.

Install it, pinned
mdr add vm0-ai/vm0-skills/sql-cookbook@git:20260417.8c5d7c1

Pins git:20260417.8c5d7c1 in mdr.lock. Pin the fingerprint instead.

Audit grade
A, 17 of 17 checks passed
Kind
SKILL.md skill
Repository
vm0-ai/vm0-skills
Path
sql-cookbook/SKILL.md
Versions recorded
3
Latest version
git:20260417.8c5d7c1, committed Apr 17, 2026
First version recorded
Mar 13, 2026
Size
11,492 bytes
Repository stars
81
License
none declared

Craft and optimize SQL for any warehouse dialect — Snowflake, BigQuery, Databricks, Redshift, PostgreSQL. Covers window functions, CTEs, aggregations, joins, funnel queries, cohort retention, deduplication, dialect translation, slow query tuning, and cross-platform syntax differences.

Collected from public GitHub. Every version is saved exactly as it was and never changes. Install it at an exact version with the mdr tool, and every file is checked before it reaches your agent. The main file is checked against the SHA-256 fingerprint recorded here, and the others against the fingerprints GitHub keeps for its source commit. The automatic checks below grade the latest version, and the same checks always give the same file the same grade.

What the file says

## Platform-Specific Syntax Guide

### PostgreSQL (Aurora, RDS, Supabase, Neon)

**Working with dates and times:**
```sql
-- Today and now
CURRENT_DATE, CURRENT_TIMESTAMP, NOW()

-- Adding and subtracting intervals
some_date + INTERVAL '7 days'
some_date - INTERVAL '1 month'

-- Round down to a time boundary
DATE_TRUNC('month', event_ts)

-- Pull out individual components
EXTRACT(YEAR FROM event_ts)
EXTRACT(DOW FROM event_ts)  -- Sunday = 0

-- Render as formatted text
TO_CHAR(event_ts, 'YYYY-MM-DD')
```

**Text operations:**
```sql
-- Joining strings together
first_name || ' ' || last_name
CONCAT(first_name, ' ', last_name)

-- Flexible matching
col ILIKE '%term%'  -- ignores case
col ~ '^regex$'     -- POSIX regex

-- Splitting and extracting
LEFT(str, n), RIGHT(str, n)
SPLIT_PART(str, delimiter, part_num)
REGEXP_REPLACE(str, pattern, replacement)
```

**JSON and array handling:**
```sql
-- Accessing JSON fields
payload->>'key'             -- returns text
payload->'nested'->'field'  -- returns json object
payload#>>'{a,b,c}'        -- deep path as text

-- Array utilities
ARRAY_AGG(col)
ANY(arr_col)
arr_col @> ARRAY['val']
```

**Tuning guidance:**
…

Read the whole file at its exact version.

How to install

The exact contents, by fingerprint
mdr add vm0-ai/vm0-skills/sql-cookbook@sha256:655dc051c4b9d29c

The line at the top of this page pins the label git:20260417.8c5d7c1, which is what most people want. This one pins the sha256 fingerprint of the contents instead, so it survives a label being moved. Either way the exact version is written to mdr.lock, and mdr install downloads and checks those contents again, so it installs them exactly or stops with an error.

Badge

mdr badge

[![mdr](https://markdownregistry.com/badge/art_hqkapbnth4whumqj.svg)](https://markdownregistry.com/a/art_hqkapbnth4whumqj)

3 badge image fetches in 30 days. What the badge shows.

Versions

The registry has recorded 3 versions of this file, between Mar 13, 2026 and Apr 17, 2026, about one every 17 days.

versioncommittedcommitsizeaudit
git:20260417.8c5d7c1 latest2026-04-17 8c5d7c1 11,492 BA view · diff
git:20260417.b284b7a2026-04-17 b284b7a 11,743 BA view · diff
git:20260313.d7233e42026-03-13 d7233e4 11,626 BA view

Audit of the latest version

A  17 of 17 checks passed. Fixed automatic checks with no AI involved, so the same checks give the same answer every run.
  • pass: Frontmatter block present
  • pass: Frontmatter declares a name
  • pass: Frontmatter declares a description
  • pass: Size between 200 bytes and 200 KB (11492 bytes)
  • pass: No zero-width or bidi control characters
  • pass: No instruction hidden inside an HTML comment
  • pass: No link to an exfiltration or paste host
  • pass: No credential-shaped string
  • pass: No instruction to send local credentials anywhere
  • pass: No text hidden with inline styles
  • pass: No prompt-injection phrasing
  • pass: No curl or wget piped into a shell
  • pass: No recursive delete of root, home or parent
  • pass: No instruction to read or print local credentials
  • pass: No base64 blob over 200 characters
  • pass: No link to a raw IP address
  • pass: No script tag

Source

GitHub

vm0-ai/vm0-skills · 81 stars · license none declared · pushed 2026-11-05 · branch main

API

GET https://markdownregistry.com/api/v1/artifacts/art_hqkapbnth4whumqj
GET https://markdownregistry.com/api/v1/resolve?ref=vm0-ai/vm0-skills/sql-cookbook
GET https://markdownregistry.com/api/v1/blob/655dc051c4b9d29c2d56c5ee68aa737b24792ffad1d6a1d78cd18a0415f1b6dd

Your AI assistant does the legwork. You hear about the deals worth your word. Hand yours the standing instructions at modelranch.com and it joins the network that reads files like this one.

Guides: the SKILL.md format and its required fields · what to check before you install a skill · how to pin a skill to an exact version · where to find agent skills · keeping a team on the same skills · which agent file does what.

More from vm0-ai/vm0-skills

account-reconciliation SKILL.md skill
vm0-ai/vm0-skills · account-reconciliation/SKILL.md · Reconcile accounts, ledgers, bank statements, subledgers, variances, and supporting schedules.
git:20260709.c4cfc48 · audit A · 81 stars
agentphone SKILL.md skill
vm0-ai/vm0-skills · agentphone/SKILL.md · Build AI phone agents with AgentPhone API. Use when the user wants to make phone calls, send/receive SMS, manage phone…
git:20260812.68f64b6 · audit A · 81 stars
analysis-qa SKILL.md skill
vm0-ai/vm0-skills · analysis-qa/SKILL.md · Quality-check data analysis for joins, metrics, denominators, date ranges, leakage, and statistical pitfalls.
git:20260709.c4cfc48 · audit A · 81 stars
audit-readiness SKILL.md skill
vm0-ai/vm0-skills · audit-readiness/SKILL.md · Prepare audit workpapers, control tests, samples, evidence, deficiencies, and remediation tracking.
git:20260709.c4cfc48 · audit A · 81 stars
brand-guidelines SKILL.md skill
vm0-ai/vm0-skills · brand-guidelines/SKILL.md · Define or enforce brand voice, messaging, terminology, tone, and style standards.
git:20260709.c4cfc48 · audit A · 81 stars
business-skill-index SKILL.md skill
vm0-ai/vm0-skills · business-skill-index/SKILL.md · Find task-specific structures, templates, and quality checks for business documents by domain and scenario, then read…
git:20261020.77a5bef · audit A · 81 stars
campaign-strategy SKILL.md skill
vm0-ai/vm0-skills · campaign-strategy/SKILL.md · Plan marketing campaigns, launches, audiences, channels, calendars, budgets, and KPIs.
git:20260709.c4cfc48 · audit A · 81 stars
cloudflare-tunnel SKILL.md skill
vm0-ai/vm0-skills · cloudflare-tunnel/SKILL.md · Cloudflare Tunnel API for secure tunnels. Use when user mentions "Cloudflare
git:20260417.8c5d7c1 · audit A · 81 stars
competitor-matrix SKILL.md skill
vm0-ai/vm0-skills · competitor-matrix/SKILL.md · Research competitors and produce feature matrices, positioning notes, win/loss analysis, or market briefs.
git:20260709.c4cfc48 · audit A · 81 stars
computer-use SKILL.md skill
vm0-ai/vm0-skills · computer-use/SKILL.md · Operate apps on a desktop host through Computer Use, whether surfaced as Okou Desktop or the still-supported legacy…
git:20260825.dc9bfc7 · audit A · 81 stars
computer SKILL.md skill
vm0-ai/vm0-skills · computer/SKILL.md · Computer connector for exposing local services to remote sandboxes via
git:20260417.8c5d7c1 · audit A · 81 stars
contract-redline SKILL.md skill
vm0-ai/vm0-skills · contract-redline/SKILL.md · Review commercial contracts against a playbook, flag risk, and draft redlines or fallback language.
git:20260709.c4cfc48 · audit A · 81 stars

Every file in vm0-ai/vm0-skills

Browse by kind, by grade A, or by owner.