ggsql Query Writer
Turns plain-language chart requests into valid ggsql queries — SQL plus a grammar-of-graphics visualization syntax.
Data & AnalyticsIntermediate★ 486⑂ 46AI score 8/10Last updated: Aug 28, 2026
What it does
- Converts a described chart into a complete ggsql query (optional SQL/CTE part plus the required
VISUALISEpart). - Embeds a full syntax reference for
DRAW,PLACE,SCALE,FACET,PROJECT, andLABEL, with a hard rule against inventing clauses, settings, aesthetics, layers, or palette names. - Picks the right layer type (point, line, path, bar, histogram, density, boxplot, violin, smooth, area, ribbon, segment, rule, text, rect, polygon, range) with its required aesthetics and stats.
- Covers coordinate systems (cartesian/polar), axis transforms (log, date, sqrt...), named color palettes, faceting, and label overrides.
- Tells you how to check the result with
ggsql validateor render it withggsql exec.
Who it's for
- Data analysts and engineers using ggsql over DuckDB or another SQL backend.
- ggplot2 users who know the grammar of graphics but not yet ggsql's exact syntax.
- Anyone producing many chart queries for reports or dashboards.
Examples
- "Scatter of bill length vs depth colored by species" →
VISUALISE bill_len AS x, bill_dep AS y, species AS fill FROM ggsql:penguins DRAW point. - "Monthly revenue as a donut chart" → aggregation CTE +
DRAW bar+PROJECT TO polar SETTING inner => 0.5. - "Temperature and ozone as two lines with a date x-axis" → multiple
DRAW linelayers +SCALE x VIA date+LABEL title, then verified withggsql validate.
· · · Install guide · · ·
Try it now, no install
Paste this into Claude to use the skill without installing anything.
Read the instructions in this file and follow them to help me: https://raw.githubusercontent.com/posit-dev/skills/HEAD/ggsql/ggsql/SKILL.md What I want: (describe your task here)
If Claude can't open the link, open it yourself and paste the contents instead.
↓ If it works for you, download the ZIP below and install it. Then it runs on its own — no pasting each time.
Install in the Claude app (no terminal)
- Download the ZIP with the button below.
- In Claude, open Settings → Capabilities and turn on 'Code execution and file creation'. (one time)
- Go to Customize → Skills → + → 'Upload a skill' and upload the ZIP.
Install in Claude Code
Let Claude do it — paste this into Claude Code
Install the skill I found on Claude Skill Mart. Copy the ggsql/ggsql folder from the GitHub repo posit-dev/skills into my ~/.claude/skills/ggsql/. When it's done, tell me in one line what this skill can do.
Install with a command instead
git clone https://github.com/posit-dev/skills.git /tmp/posit-skills && mkdir -p ~/.claude/skills && cp -r /tmp/posit-skills/ggsql/ggsql ~/.claude/skills/ggsql⚠ This is a third-party skill. Check the source repository before installing.
- Open a terminal.
- Clone the repo:
git clone https://github.com/posit-dev/skills.git /tmp/posit-skills - Create the skills folder:
mkdir -p ~/.claude/skills - Copy just this skill:
cp -r /tmp/posit-skills/ggsql/ggsql ~/.claude/skills/ggsql - Install the
ggsqlCLI and make sure it is on your PATH (ggsql --helpshould work) if you want validation and rendering. - Restart Claude Code and try a prompt like "write a ggsql query for a stacked bar chart" to confirm the skill triggers.
View source on GitHub ↗License: MIT