Ggsql

From edmundmiller/dotfiles · View interactive version

Ggsql is an AI agent skill from the GitHub repository edmundmiller/dotfiles. Writes, modifies, explains, validates, and runs ggsql grammar-of-graphics visualization queries.

How to use this skill

Skill file

ggsql Query Writer

Write valid ggsql visualization queries from natural-language requests. ggsql combines SQL data shaping with a declarative grammar of graphics.

Use this skill when

Do not trigger for ordinary SQL work that has no visualization component.

Required reference

Read references/syntax.md before writing or changing a query. It is the complete upstream language reference and defines the allowed clauses, aesthetics, layers, settings, palettes, and CLI commands.

Never invent ggsql syntax. If the reference does not document a requested feature, say so and offer the closest documented form.

Workflow

  1. Identify the data source, columns, desired visual encodings, grouping, and output.
  2. Shape data with SQL or CTEs before VISUALISE when necessary.
  3. Choose the simplest documented DRAW layer and mappings.
  4. Add SCALE, FACET, PROJECT, or LABEL only when the request needs them.
  5. If ggsql is available, validate with ggsql validate. Render with ggsql exec ... -v only when output is requested.
  6. Return the complete query, then briefly explain consequential choices.

Minimal pattern

SELECT category, SUM(value) AS total
FROM 'data.parquet'
GROUP BY category
VISUALISE category AS x, total AS y
DRAW bar
LABEL
  title => 'Total by category',
  x => 'Category',
  y => 'Total'

Alternatively, let VISUALISE name the source:

VISUALISE bill_len AS x, bill_dep AS y, species AS color
FROM ggsql:penguins
DRAW point

Guardrails

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.