SQL Skills Generator · from your Postgres, for any AI tool

SQL skills for Claude Code, from queries your team verified

Point Chion at your Postgres and it compiles your team's verified queries into Claude SQL skills: a portable agent file, every line traceable to the query that proved it, that drops straight into Claude Code, Codex, or Cursor.

Watch the demo walkthrough

Chion compiles your team's verified SQL into CHION.md, the index for your org's SQL skills: one file per persona that routes every business question to a query your team already verified, and runs in Chion Studio or exports byte-identical to Claude Code, Codex, and Cursor. Every line is cited back to the verified query that proved it, and the library is yours to export and keep. Built on what an AI SQL workforce actually does. Switch models or tools anytime.

Read-only SELECT. AES-256-GCM credential vault. 1,000-row cap. Immutable audit log. Raw rows never leave for the LLM.

Other generators read your repo; Chion reads your database

Repo-file generators

Most agent-file tools scan your codebase and paraphrase the prose they find. They never touch the database your questions actually run against.

Prewritten Claude SQL skills

Prewritten "SQL expert" skill packs ship generic best practices. They don't know your tables, your metrics, or the joins your team already proved.

Chion compiles from your live data

Chion compiles the agent file from your verified queries, with [src=…] citations tracing every line back to the query that proved it.

Evidence-grounded: every line cites a source Deterministic: same inputs, same agent file Editable, exportable, version-controlled

One agent file per role, exported to Claude Code, Codex, and Cursor

Each CHION.md is one persona’s worth of verified SQL: finance, ops, growth, etc. Compile up to ~40 personas on the Max plan; together they’re your team’s SQL knowledge base across personas. Same database, scoped knowledge per persona. Each file is a verified SQL agent the persona owns; the library compounds as your team works.

What you get: a SQL analyst agent auto-written from your real queries

A SQL Analytics Agent file for your database, auto-written from your real queries.

Chion's SQL Skills Generator creates a CHION.md file: your portable Postgres SQL skills library. It auto-generates a SQL Analytics Agent file (the .md suffix follows the CLAUDE.md / AGENTS.md / SKILL.md convention); the four filenames are interchangeable mirrors with byte-identical content. Pick whichever your agent (Claude Code, Codex, Cursor) reads natively.

CHION.md is a SQL Analytics Agent file for your database: a portable, version-controlled instruction file an AI reads before doing any work. The difference vs. hand-written agent files: yours is auto-written from your real analytics conversations, fully editable, and re-exportable on every refresh. Every verified SQL query teaches it; every PII column closes off; every business rule is cited back to the row that proved it.

The export ships as one folder any AI tool can read: CHION.md at the root + a three-tier .claude/skills/ cascade beneath it (workspace catalog → department catalog → role SKILL.md with verified scripts). Sister-paired roles within each department cover complementary axes (recognized vs. forecast, between-warehouse vs. inside-warehouse, acquisition vs. in-product) so cross-axis questions resolve without the agent inventing a join.

Generate a Claude skill from your Postgres database

Three steps: upload, ask, export. Deterministic, not generated-on-the-fly.

Connect & upload

Connect Postgres and bulk-upload your saved verified queries (hundreds at once, or one at a time). Chion ingests them as evidence for the agent file.

Ask & chart

Ask analytics questions in plain English. Chion generates SQL, runs it read-only, and returns interactive charts. Every answer enriches the skill.

Auto-compile per persona

Chion auto-compiles CHION.md, CLAUDE.md, AGENTS.md, SKILL.md mirrors plus the per-persona skills/ cascade. One Claude Opus pass per persona; deterministic; same input → same output. Natively compatible with Claude Code, Codex, and Cursor.

One compile per persona. Same input → same agent file. Deterministic, not generated-on-the-fly.

Every line traces back to the query that proved it

Frontmatter contract, persona, curated rule pack, evidence-grounded slots.

A real Northwind Logistics agent file. Every Layer 2 line cites [src=…] back to the row that proved it. No hallucinated columns.

Key facts. Frontmatter contract: 11 fields. Framework version: 7. Layer 2: 11–13 density-gated slots, every line [src=…]-cited. One Claude Opus compile per persona; deterministic; same input → same output. Fully editable; export as CHION.md / CLAUDE.md / AGENTS.md / SKILL.md.

CHION.md · Northwind Logistics
---
artifact_type: domain_sql_sme_prompt
artifact_version: 2.5.0
framework_version: 7
archetype: logistics_supply_chain
chosen_primitives: [pre_aggregate_grain, snapshot_latest,
                    ratio_reconstruction, period_over_period_lag]
refreshed_at: 2026-04-30T18:22:11Z
---

# Analyst Persona
You are Northwind Logistics' supply-chain analyst. Your day is
shipments, lanes, carriers, and SLA breaches. You reason in
on-time-delivery rates and cost-per-mile. You refuse avg_of_ratios;
you reconstruct ratios from numerator + denominator at lane-grain.

# Curated SQL Rule Pack
### snapshot_latest
  use-when: balance-style metrics (inventory_on_hand)
  sql-shape: SELECT … ORDER BY ts DESC LIMIT 1 per entity
  guards: never SUM across snapshots

### ratio_reconstruction
  use-when: on_time_rate, fill_rate, defect_rate
  guards: SUM(numerator) / NULLIF(SUM(denominator),0)

# Layer 2 — Domain Profile
## 2.1 Questions You Compute
- on_time_rate = SUM(delivered_on_time) / NULLIF(SUM(shipments),0)
  [src=column_profiles:shipments.delivered_on_time, kpi_metrics:otd]
- avg_cost_per_mile = SUM(total_cost) / NULLIF(SUM(miles),0)
  [src=metric_concepts:cpm_lane]

## 2.6 Stop Signals
- never SUM(inventory_on_hand) across days
  [src=donts:snapshot_sum, decision_record:wh_audit_2026q1]
- never AVG(rates) — reconstruct from numerator + denominator
  [src=donts:avg_of_ratios, decision_record:metric_audit_2026q1]
Frontmatter is the contract. 11 fields. Your agent parses this before reading anything else.
Persona is curated, not invented. Names verbatim tables and metrics from your schema.
Every Layer 2 line cites [src=…]. Trace every claim back to the row that proved it.
11–13 slots, density-gated. Empty slots are bugs, not filler.

Workspace cascade, indexes, and frontmatter

Three tiers: workspace → department → role SKILL.md with verified scripts under each.

Department is the top-level axis; role is the brain. Each department contains two sister-paired roles: finance (finance-analystfp-and-a-analyst), operations (ops-supply-chainwarehouse-operations), growth (growth-marketingproduct-analytics). Verified queries land under the role that owns the data shape; cross-axis questions route to both sister roles.

Each role's scripts/ folder mirrors every verified query under that role as a {README.md, query.sql} pair the agent wraps as a CTE rather than rewriting.

chion-skills-workspace/
├── CHION.md                                      ← root agent file (canonical)
├── README.md
├── LICENSE
└── .claude/skills/
    ├── _INDEX.md                                 ← workspace catalog · vocabulary · routing
    │
    ├── finance/                                  ← department · 2 sister-paired roles
    │   ├── _INDEX.md                             ← department catalog · sister-pair logic
    │   ├── finance-analyst/                      ← recognized revenue · ARR/MRR · margin
    │   │   ├── SKILL.md                          ← persona brain · rule pack · scripts index
    │   │   └── scripts/
    │   │       ├── arr-by-segment/{README.md, query.sql}
    │   │       ├── mrr-trend-12mo/{README.md, query.sql}
    │   │       └── …
    │   └── fp-and-a-analyst/                     ← forecast · variance · runway · burn
    │       ├── SKILL.md
    │       └── scripts/…
    │
    ├── operations/                               (between-warehouse + inside-warehouse)
    │   ├── _INDEX.md
    │   ├── ops-supply-chain/{SKILL.md, scripts/}
    │   └── warehouse-operations/{SKILL.md, scripts/}
    │
    └── growth/                                   (acquisition + in-product)
        ├── _INDEX.md
        ├── growth-marketing/{SKILL.md, scripts/}
        └── product-analytics/{SKILL.md, scripts/}

A typical SKILL.md frontmatter: name + description drive native AI-tool skill discovery; trigger-keywords + department/role drive the CHION.md cascade:

---
name: finance-analyst
description: |
  The default analyst role for the finance department.
  Owns recognized-revenue P&L, segment-margin reconstruction,
  ARR/MRR roll-ups, and renewal recognition.
must-read: [_INDEX.md, ../_INDEX.md]
trigger-keywords: [revenue, recognized revenue, ARR, MRR,
                   GAAP, gross margin, segment margin, renewal]
department: finance
role: finance-analyst
archetype: saas_finance
chosen_primitives: [pre_aggregate_grain,
                    period_over_period_lag,
                    ratio_reconstruction]
status: verified
---

Bottom of every SKILL.md carries a deterministic Scripts Index: trigger phrases mapped to verified scripts/ folders. No LLM judgment between trigger match and SQL execution.

Run it in any AI tool

One agent file. Four integration paths: Claude Code, Codex, Cursor, or chat with it inside Chion.

Claude Code

CLAUDE.md

Drop CHION.md (or its CLAUDE.md mirror) at the repo root. Claude Code reads it on every conversation. Fully editable. Re-export anytime.

Codex

AGENTS.md

Drop AGENTS.md. Same content, Codex contract. Identical compile, identical schema. Fully editable. Re-export anytime.

Cursor / your IDE

.cursor/rules

Import as Cursor rules or drop at repo root. Your agent inherits the workspace SQL Analytics Agent file. Fully editable. Re-export anytime.

Inside Chion

Chion runtime

Chat with your CHION.md inside Chion. Every answer routes to a verified query in the agent file. No LLM-each-turn risk, no hallucinated SQL.

See a real CHION.md.

Chion's open-source skills workspace: a published mock you can read end-to-end.

GitHub

jonfdag-dot / postgres-claude-skills-generator

The Chion Skills Workspace: six analyst personas, 15 verified Postgres scripts, three sister-role pairings, published as the exact folder shape Chion exports. Natively compatible with Claude Code, Codex, and Cursor; every answer cites the verified script that produced it.

Open-source · MIT Re-compilable from your DBBrowse on GitHub

Scope skills per persona.

Connect, use, skills auto-generate. No data pipeline migrations required.

Verified queries  →  1 Opus pass per persona  →  6 agent files
                                                 ┌─ finance-analyst, fp-and-a-analyst
                                                 ├─ ops-supply-chain, warehouse-operations
                                                 └─ growth-marketing, product-analytics

Max plan economics. ~20 credits per persona compile · 750 credits/month on Max → up to ~40 per-persona agent files, each carrying 10+ verified queries. One ship covers a full ~40-person data team. Re-compile any persona anytime; supersedes the prior version cleanly.

Per-query skill capture: building the SQL skill library

Every verified query becomes a candidate skill in your team’s SQL skill library, indexed at skills/<name>/SKILL.md with auto-generated frontmatter, trigger keywords, and reference docs. Promotion frequency surfaces as confidence badges (✓ / ✓✓ / ✓✓✓) so your team's analytical instincts compound, exportable as CHION.md / CLAUDE.md / AGENTS.md / SKILL.md.

Per-employee scoping

Database permissions already scope data; CHION.md scopes knowledge, organized by persona. Finance gets personas/finance-analyst/skills/revenue-recognition/; Ops gets personas/ops-supply-chain/skills/lane-comparisons/; Growth gets personas/growth-marketing/skills/cohort-retention/. Same database, different agent files.

Indexable, navigable, version-controlled. Diff your agent file across releases the same way you diff code.

Frequently asked questions

Answers about CHION.md and the SQL Analytics Agent file pattern.

can I export verified SQL queries to Claude Code, Cursor, or Codex

Yes. The SQL skills you build in Chion Studio export as a portable SKILL.md / Chion.md file that runs in any AI coding tool: Claude Code, Cursor, and Codex. Export the AGENTS.md mirror for Codex or use CHION.md for Cursor, both byte-identical to the file Claude Code reads; drop it at the root of your repo and the tool routes matching questions to your verified read-only queries. Same questions resolve to the same read-only queries wherever you run them. No lock-in: the skills are yours to take with you.

what is a SKILL.md file for an AI coding agent

A SKILL.md file is a markdown file that packages one capability for an AI tool like Claude Code. Chion's SQL skills generator compiles your verified SQL into SKILL.md files, so the Claude Code skills you export run the same read-only queries anywhere.
See the SQL skills generator →

how do I give Claude Code reusable SQL skills for my database

Connect your Postgres in Chion Studio, ask and verify the questions your team cares about, then compile and download your skills as a CHION.md file plus the skills folder. Drop CHION.md at the root of your repo and Claude Code reads it on the next conversation, routing questions to the verified read-only queries inside. The file and skills folder travel with the export; your live query history, the profiled semantic layer, and the audit log stay in Chion Studio. To update, verify new questions and recompile: the compile is deterministic, so the same verified queries always produce the same file and you can diff it across releases. No new SQL is generated against your database; it runs the queries your team already trusted.
Generate SQL skills →

difference between CLAUDE.md, AGENTS.md, and SKILL.md agent files

They are byte-identical mirrors of the same compiled agent, named for the tool that reads them. Claude Code reads CLAUDE.md natively, Codex reads AGENTS.md, Cursor reads either, and SKILL.md packages a single capability. CHION.md is the root file Chion generates; the others are the same content under the filename each tool expects. Same brain, four idiomatic addresses, so you pick the filename your agent prefers.

how do you scope an AI SQL agent to a role like finance or ops

A persona is a role, like finance, ops, or growth. Chion compiles one agent file per persona, scoped to the verified queries and trigger keywords that role uses, so the finance agent answers finance questions and the ops agent answers ops questions. The same database can produce different agent files for different personas, which is how a team shares one Postgres connection but each person gets the skills that fit their work.

what makes an AI-generated SQL query verified

A verified query is one your team ran in Chion Studio with the exact read-only SQL visible beneath the chart, reviewed, and accepted. Every verified query becomes a candidate skill, tagged by persona and ranked by how often it is reused. When you compile, the high-confidence queries promote into the agent file, each carrying a citation back to the query that proved it. Nothing is invented; the skill is the SQL your team already trusts.

Last reviewed: July 4, 2026

Generate your SQL Analytics Agent file

Connect Postgres. Ask a few questions. Export CHION.md, CLAUDE.md, AGENTS.md, and SKILL.md: ~40 per-persona agents on one Max plan.

Watch the demo walkthrough GitHub