agentic-sql

agentic-sql is a skill for Claude Code from 23blocks-OS/ai-maestro-plugins. It costs 98 tokens per session (2,868 once invoked), scanned A, original, MIT.

A guarded way to run read-only SQL queries against a production or staging database. SQL is the language used to retrieve and work with database records.

In plain words
What is it for?
Use it for safe customer lookups, support investigations, and other tasks that need data from a database without modifying it.
Why use it?
It helps prevent accidental data changes and limits overly large or long-running queries while preserving useful findings in a query library.

Skill for Claude Code

Written for Claude Code: allowed-tools in frontmatter. Also seen: mentions CLAUDE.md; mentions Claude Code.

Part of the ai-maestro plugin — 14 skills, 3 hooks shipped together

Good fit Use it for safe customer lookups, support investigations, and other tasks that need data from a database without modifying it.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/23blocks-os/ai-maestro-plugins/agentic-sql
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 23blocks-OS/ai-maestro-plugins --skill agentic-sql
Clone the repo
git clone --depth 1 https://github.com/23blocks-OS/ai-maestro-plugins

Made for: Claude Code.

Or install ai-maestro, the plugin that ships this one along with the rest of its 14 skills, 3 hooks.

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 agentic-sql

README.md
[![agentmods](https://agentmods.dev/badge/skills/23blocks-os/ai-maestro-plugins/agentic-sql/github.svg)](https://agentmods.dev/skills/23blocks-os/ai-maestro-plugins/agentic-sql)
Your own site
<a href="https://agentmods.dev/skills/23blocks-os/ai-maestro-plugins/agentic-sql"><img src="https://agentmods.dev/badge/skills/23blocks-os/ai-maestro-plugins/agentic-sql/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 agentic-sql

Your own site · 80×15
<a href="https://agentmods.dev/skills/23blocks-os/ai-maestro-plugins/agentic-sql"><img src="https://agentmods.dev/badge/skills/23blocks-os/ai-maestro-plugins/agentic-sql.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 98 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,868 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.
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.00098 $0.02868
Opus 5.5 $0.00039 $0.01147
Sonnet 5.5 $0.00020 $0.00574
Haiku 4.5 $0.00010 $0.00287

Measured 5d ago against content hash 29cadf02eb6f, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

agentic-sql 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 5d ago.

The scan reads SKILL.md. This mod also ships 2 executable files (scripts/safe_psql_write.py, scripts/safe_psql.py), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

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/ai-maestro/skills/agentic-sql/SKILL.md · 114 lines

How it starts

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

First-Time Setup

On first invocation in a project, the skill auto-extracts these from CLAUDE.md if present, then asks for any missing values. Persist them to .claude/agentic-sql.yml for the session.

Variable Purpose Example
{QUERY_DIR} Where saved queries live sql_library/queries/
{INDEX_PATH} Markdown index of the library sql_library/INDEX.md
{SCHEMA_DOC_PATH} Schema reference doc sql_library/SCHEMA.md
{DB_ENVS} Named environments + connection variables acme (ACME_DATABASE_URL), files (FILES_DATABASE_URL), …
{READ_ONLY_ROLE} Postgres role with SELECT-only grants the agent connects as agentic_sql_ro
{SAFE_PSQL_WRAPPER} The wrapper that applies the SQL gate. It ships with this skill as scripts/safe_psql.py; point this at your own only if you replace it safe-psql
{MAX_ROWS} Default LIMIT injected when query has none 1000
{STATEMENT_TIMEOUT} statement_timeout set on the read-only role 30s
{DISPLAY_ROWS} Rows shown to the user before offering more 50
{SAFE_PSQL_WRITE} The write door (only if data may be changed): ships as scripts/safe_psql_write.py safe-psql-write
{WRITE_SETTINGS} Which tables and columns may change, whether hard delete is on .safe-psql/write.yaml

Prerequisite: safe-psql must be on the PATH. AI Maestro's installer and updater set it up (a private Python environment with the packages in requirements.txt). Without AI Maestro, create one yourself: python3 -m venv ~/.aimaestro/venvs/agentic-sql && ~/.aimaestro/venvs/agentic-sql/bin/pip install -r <skill dir>/requirements.txt, then run <that venv>/bin/python <skill dir>/scripts/safe_psql.py wherever this skill says safe-psql. The wrapper refuses to run as a role that could write (see reference/run.md), so a wrong setup stops instead of working unsafely. If the wrapper cannot run, stop and tell the user. Never run psql directly against production or staging.

Read the full file on GitHub · 114 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. 5d ago Changed · +2 lines 29cadf02eb6f
  2. 7d ago Changed · +8 lines · +12 tokens per session 10f0385f39ef
  3. 9d ago First seen · 104 lines · 86 tokens per session scan A 562298503ff3

Subscribe to this mod's changes

agentic-sql is a skill published in the GitHub repository 23blocks-OS/ai-maestro-plugins (11 stars, last pushed today), licensed MIT. It adds 98 tokens to every session and 2,868 once invoked, about $0.0004 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-10-11.

Related

Other skills, from other repositories

django-orm-mastery

Master Django ORM patterns: QuerySets, selectrelated, prefetchrelated, F/Q objects, annotations, aggregations, and raw SQL safety. Use when the user writes Django database queries, asks about ORM optimization, encounters N+1 queries, or works with complex filtering and aggregation. Trigger when you see inefficient…

VersoXBT/claude-initial-setup · 71 tokens

migration-patterns

Guide for database schema migrations with zero-downtime patterns, rollback strategies, data migrations, and migration testing. Use when the user writes database migrations, asks about schema changes in production, needs zero-downtime migration patterns, or plans rollback strategies. Trigger whenever database…

VersoXBT/claude-initial-setup · 70 tokens

query-optimization

Guide for optimizing SQL queries with EXPLAIN ANALYZE, index tuning, N+1 detection, covering indexes, and query plan analysis. Use when the user has slow database queries, asks about query performance, needs to interpret EXPLAIN output, or wants to eliminate N+1 queries. Trigger whenever query performance, slow…

VersoXBT/claude-initial-setup · 78 tokens

schema-design-guide

Guide for relational database schema design with normalization, indexing strategy, constraints, naming conventions, and denormalization tradeoffs. Use when the user designs database tables, asks about normalization, needs indexing advice, or defines foreign key relationships. Trigger whenever database schema, table…

VersoXBT/claude-initial-setup · 64 tokens

caching-strategies

Implement effective caching at every layer: in-memory, Redis, CDN, and browser. Activate whenever the user asks about caching, performance optimization for repeated data access, Redis patterns, CDN configuration, cache invalidation, HTTP cache headers, memoization, or stale-while-revalidate strategies.

VersoXBT/claude-initial-setup · 63 tokens

database-expert

Use this skill when designing databases, writing queries, optimizing performance, or planning migrations. Covers SQL optimization, schema design, indexing strategies, PostgreSQL patterns, migration...

ApexIQ/skillsmith · 37 tokens