sqlspec

sqlspec is a skill for Claude Code, Codex from litestar-org/litestar-skills. It costs 54 tokens per session (3,770 once invoked), scanned A, original, MIT.

A guide for SQLSpec, a Python library that maps SQL queries to application code without being an object-relational mapper, or ORM.

In plain words
What is it for?
Use it for named SQL, filters, pagination, query drivers, data dictionaries, observers, and integrations with Litestar, FastAPI, Flask, Starlette, or Sanic.
Why use it?
It helps applications use raw SQL, query builders, or SQL files through consistent database connections, validation, parameters, and database-dialect conversion.

Skill for Claude CodeCodex

Part of the litestar plugin — 31 skills, 1 agent, 1 hook shipped together

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.

agentmods
npx agentmods add skills/litestar-org/litestar-skills/sqlspec
Any agent
npx skills add litestar-org/litestar-skills --skill sqlspec
Clone the repo
git clone --depth 1 https://github.com/litestar-org/litestar-skills

Made for: Claude Code, Codex.

Or install litestar, the plugin that ships this one along with the rest of its 31 skills, 1 agent, 1 hook.

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 sqlspec

README.md
[![agentmods](https://agentmods.dev/badge/skills/litestar-org/litestar-skills/sqlspec.svg)](https://agentmods.dev/skills/litestar-org/litestar-skills/sqlspec)
Your own site
<a href="https://agentmods.dev/skills/litestar-org/litestar-skills/sqlspec"><img src="https://agentmods.dev/badge/skills/litestar-org/litestar-skills/sqlspec.svg" alt="Measured on agentmods" height="20"></a>
Per session 54 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,770 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
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 $0.00054 $0.03770
Opus 5 $0.00027 $0.01885
Sonnet 5 $0.00011 $0.00754
Haiku 4.5 $0.00005 $0.00377

Measured 4d ago against content hash 56ceb422001d, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

sqlspec 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 4d 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.

plugins/litestar/skills/sqlspec/SKILL.md · 325 lines

How it starts

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

SQLSpec Skill

SQLSpec is a type-safe SQL query mapper for Python -- NOT an ORM. It provides flexible connectivity with consistent interfaces across 19 database adapter packages. Write raw SQL, use the builder API, or load SQL from files. Statements pass through a sqlglot-powered AST pipeline for validation, parameter handling, and dialect conversion.

Match-Your-Framework — read first

sqlspec ships first-party extensions for five web frameworks. If your project uses one of these, jump directly to the matching integration guide and skip the others:

  • Litestar — register configs on SQLSpec, then pass that registry to SQLSpecPlugin. The plugin adds DI, the litestar db CLI, and request observability. See references/extensions.md.
  • FastAPIreferences/fastapi-integration.mdDepends(plugin.provide_session()) DI, Annotated[...] handlers, filter providers.
  • Flaskreferences/flask-integration.mdplugin.init_app(app), pull-based plugin.get_session(), async-via-portal.
  • Starlettereferences/starlette-integration.mdrequest.state-based session access, lifespan wrapping, middleware variants.
  • Sanic — first-party ASGI-style extension for Sanic applications; match Sanic's app/request lifecycle instead of copying Litestar DI examples.

Shared topics that apply to every framework live in references/commit-modes.md (autocommit / manual middleware) and references/multi-database.md (multi-config registry). Read the framework guide first, then those for depth.

The rest of this SKILL.md covers framework-agnostic topics: adapter setup, query builder, driver methods, filters, observability, migrations, the ADK extension, and data-dictionary introspection.

Code Style Rules

  • from __future__ import annotations rule — SQLSpec adapter config modules and driver definitions avoid from __future__ import annotations because configs are introspected at runtime. Consumer application modules (handlers, services, tests that use a configured driver) MAY and typically SHOULD use it — canonical Litestar apps use it in 100+ files.

Read the full file on GitHub · 325 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. 4d ago First seen · 325 lines · 54 tokens per session scan A 56ceb422001d

Subscribe to this mod's changes

sqlspec is a skill published in the GitHub repository litestar-org/litestar-skills (14 stars, last pushed 14d ago), licensed MIT. It adds 54 tokens to every session and 3,770 once invoked, about $0.0003 per session on Opus 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

add-data-source

Guide the user to add a data source, connection, or API connector to a Canvas App via Power Apps Studio, then verify and continue. USE WHEN the user asks to add a data source, add a connection, add an API, add a connector, connect to SharePoint / Dataverse / SQL / Excel / OneDrive / Teams / Office 365, or any similar…

microsoft/power-platform-skills · 116 tokens

link-ticket-to-session

Link the current Claude Code session to a ticket (Linear, Jira, GitHub Issues, or GitHub Pull Requests) and cache its title/status in karma. Use when the user explicitly asks to link, attach, associate, or connect this session to a ticket, issue, or PR — e.g. "/link-ticket-to-session ABC-123", "link this session to…

JayantDevkar/claude-code-karma · 91 tokens

craft-pest

Testing Craft CMS 5 plugins and modules with Pest — test isolation, database safety, and the markhuot/craft-pest-core harness. ALWAYS load when writing, running, fixing, or reviewing tests for a Craft plugin or module, and whenever a suite touches a real Craft install. Covers why rollback is opt-in, tests/Pest.php +…

michtio/craftcms-claude-skills · 353 tokens

ddev

DDEV local development environment for Craft CMS projects. ALWAYS load this skill when running any ddev command, configuring .ddev/config.yaml, or troubleshooting local container issues. Covers config.yaml (project type, PHP/Node versions, database, docroot), shorthand commands, add-ons and built-in Mailpit, custom…

michtio/craftcms-claude-skills · 350 tokens

craft-cloud

Craft Cloud — Pixel & Tonic's serverless hosting platform for Craft CMS. Covers craft-cloud.yaml configuration, the Build → Migrate → Release deploy pipeline, the craftcms/cloud extension package, edge image transforms via Cloudflare, edge static caching with cache.rules + ESI, Cloud-managed S3 filesystem, MySQL 8 /…

michtio/craftcms-claude-skills · 354 tokens

lineage

Use when user invokes /lineage with a column name (optionally qualified with table/schema). Also triggers on "trace this column", "where does X come from", "what reads from Y table". Traces column-level data lineage through SQL, Kafka, Spark, JDBC, and ORM codebases. Produces a structured lineage path with confidence…

harnessprotocol/harness-kit · 94 tokens