sql-generator

sql-generator is a skill for Claude Code, Codex from ccfos/nightingale. It costs 23 tokens per session (1,013 once invoked), scanned A, original, Apache-2.0.

A helper that turns plain-language requests into SQL statements for MySQL, Doris, ClickHouse, and PostgreSQL databases. It can inspect available databases, tables, and columns before writing the query.

In plain words
What is it for?
Use it to create queries for filtering, sorting, counting, grouping, or combining data. It is also useful when you need to check the database structure before writing a query.
Why use it?
It reduces the need to remember SQL syntax and prevents queries from using the wrong table or column. You can describe the data you need in everyday language.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it to create queries for filtering, sorting, counting, grouping, or combining data. It is also useful when you need to check the database structure before writing a query.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/ccfos/nightingale/sql-generator
About the project

Nightingale is an open-source monitoring and alerting system that connects to stored metrics and log data, evaluates alert rules, and distributes notifications. Operations teams use it to manage alarms and explore observability data alongside existing data sources and collectors. Catalogue add-ons provide skills for operating Nightingale.

ccfos/nightingale · 13,364 stars · on GitHub · n9e.github.io

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add ccfos/nightingale --skill sql-generator
Clone the repo
git clone --depth 1 https://github.com/ccfos/nightingale

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for sql-generator

README.md
[![agentmods](https://agentmods.dev/badge/skills/ccfos/nightingale/sql-generator/github.svg)](https://agentmods.dev/skills/ccfos/nightingale/sql-generator)
Your own site
<a href="https://agentmods.dev/skills/ccfos/nightingale/sql-generator"><img src="https://agentmods.dev/badge/skills/ccfos/nightingale/sql-generator/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for sql-generator

Your own site · 80×15
<a href="https://agentmods.dev/skills/ccfos/nightingale/sql-generator"><img src="https://agentmods.dev/badge/skills/ccfos/nightingale/sql-generator.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 23 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,013 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00023 $0.01013
Opus 5.5 $0.00009 $0.00405
Sonnet 5.5 $0.00005 $0.00203
Haiku 4.5 $0.00002 $0.00101

Measured 1mo ago against content hash 0d8ce8b2aad6, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

sql-generator scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

aiagent/skill/embedded/builtin/sql-generator/SKILL.md · 132 lines

How it starts

The opening of the file, as written. The whole thing — 132 lines — stays where its author put it; the contents beside it link to each section on GitHub.

SQL Generation Expert

You are a SQL expert who generates correct SQL query statements based on the user's natural language description. Supports databases such as MySQL, Doris, ClickHouse, and PostgreSQL.

Workflow

  1. Understand the user's intent: Analyze what data the user wants to query, under what conditions, and in what order.
  2. Explore the database structure: Use list_databases to view the available databases.
  3. View the table list: Use list_tables to view the tables in a database.
  4. Understand the table structure: Use describe_table to get the column information of a table.
  5. Build the SQL: Build an accurate SQL query based on the table structure.

Available Tools

list_databases

List all databases in the data source.

  • No parameters

list_tables

List all tables in the specified database.

  • database: database name (required)

describe_table

Get the column structure of a table (column name, type, comment).

  • database: database name (required)
  • table: table name (required)

SQL Syntax Essentials

Basic Query

SELECT column1, column2 FROM database.table WHERE condition;

Aggregate Functions

  • COUNT(*), COUNT(DISTINCT column)
  • SUM(column), AVG(column)
  • MAX(column), MIN(column)

Grouping and Sorting

SELECT column, COUNT(*) as cnt
FROM table
GROUP BY column
HAVING cnt > 10
ORDER BY cnt DESC
LIMIT 100;

Time Handling

  • MySQL: DATE(column), DATE_SUB(NOW(), INTERVAL 7 DAY)
  • ClickHouse: toDate(column), now() - INTERVAL 7 DAY
  • Doris: DATE(column), DATE_SUB(NOW(), INTERVAL 7 DAY)

Join Query

SELECT a.*, b.name
FROM table_a a
LEFT JOIN table_b b ON a.id = b.a_id;

Differences Between Databases

MySQL

  • String concatenation: CONCAT(a, b)
  • Pagination: LIMIT offset, count or LIMIT count OFFSET offset

ClickHouse

  • String concatenation: concat(a, b)
  • Pagination: LIMIT count OFFSET offset
  • Approximate deduplication: uniqExact(column)
  • Time functions: toStartOfHour(), toStartOfDay()

Read the full file on GitHub · 132 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 132 lines · 23 tokens per session scan A 0d8ce8b2aad6

Subscribe to this mod's changes

sql-generator is a skill published in the GitHub repository ccfos/nightingale (13,364 stars, last pushed 2d ago), licensed Apache-2.0. It adds 23 tokens to every session and 1,013 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

cis-aws-database-10.8

Ensure Monitoring and Alerting is Enabled.

CyberStrikeus/CyberStrike · 17 tokens

monitoring-expert

Expert-level monitoring and observability with Prometheus, Grafana, logging, and alerting. Use when the user mentions observability, Prometheus, Grafana, logging, metrics, or alerting, or when the task involves The Three Pillars of Observability, Monitoring Fundamentals, Prometheus Configuration, or Alert Rules.

personamanagmentlayer/pcl · 70 tokens

prometheus-expert

Expert-level Prometheus monitoring, metrics collection, PromQL queries, alerting, and production operations. Use when the user mentions monitoring, metrics, observability, alerting, or PromQL, or when the task involves Prometheus Architecture, Installation on Kubernetes, ServiceMonitor, or PromQL Queries.

personamanagmentlayer/pcl · 65 tokens

datadog

Full-stack observability with Datadog APM, logs, metrics, synthetics, and RUM. Use when implementing monitoring, tracing, alerting, or cost optimization for production systems.

bobmatnyc/claude-mpm-skills · 43 tokens

observability-testing-patterns

Observability and monitoring validation patterns for dashboards, alerting, log aggregation, APM traces, and SLA/SLO verification. Use when testing monitoring infrastructure, dashboard accuracy, alert rules, or metric pipelines.

summarybotng/summarybot-ng · 47 tokens

k8s-monitoring-alerting

A Kubernetes diagnostic and repair method for Prometheus and Grafana monitoring problems, including alerts that do not trigger. Prometheus collects measurements, while Grafana displays them in dashboards.

kudig-io/kudig-database · 26 tokens