sql2json

A command-line skill for running SQL queries and database changes and printing results as JSON, CSV, or Excel files.

In plain words
What is it for?
Use it with supported SQLAlchemy databases, named queries, live repository database checks, and read-only queries when changes must be prevented.
Why use it?
It avoids writing a separate database script for routine reads, writes, schema changes, and output formatting.

Skill for Claude CodeCodex

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/fsistemas/sql2json/sql2json
Any agent
npx skills add fsistemas/sql2json --skill sql2json
Clone the repo
git clone --depth 1 https://github.com/fsistemas/sql2json

Made for: Claude Code, Codex.

Per session 75 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,295 The whole file, excluding the scripts and references it only reads on demand.
Security scan B 1 finding. 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.00075 $0.03295
Opus 5 $0.00037 $0.01648
Sonnet 5 $0.00015 $0.00659
Haiku 4.5 $0.00007 $0.00330

Measured yesterday against content hash baac1e5a0180, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade B, and why

sql2json scanned grade B with 1 finding 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 yesterday.

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.

Asks for rootmediumPrivilege escalation

A mod that escalates privileges can change anything on the machine, not only the project.

sudo podman run --rm --platform linux/arm64 --pull=always \
skills/sql2json/SKILL.md · 322 lines

How it starts

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

sql2json

Overview

sql2json is a lightweight CLI that runs SQLAlchemy-supported queries and prints JSON, CSV, or Excel output directly to stdout or a file. It works with any project — there is no built-in assumption about which database or schema you are using.

Install once as an isolated tool, with the Postgres and MySQL drivers bundled, and use it from any project:

uv tool install "sql2json[postgres,mysql]"
# or
pipx install "sql2json[postgres,mysql]"

These methods work on externally-managed systems (Manjaro/Arch, Debian 12+, Ubuntu 23.04+, Homebrew Python), where a bare pip install is refused with error: externally-managed-environment (PEP 668), and they put sql2json on PATH without touching project environments.

Quote the extras — in bash/zsh the brackets are glob characters, so "sql2json[postgres,mysql]" must be quoted (PowerShell: 'sql2json[postgres,mysql]'). Bare sql2json is SQLite only; add [postgres] and/or [mysql] for those databases (other drivers, e.g. pyodbc for MS SQL, install alongside). For library/project use, add it as a dependency instead: uv add "sql2json[postgres,mysql]" or, in a venv, pip install "sql2json[postgres,mysql]".

Upgrade (keep the extras so drivers stay installed):

uv tool upgrade sql2json      # or: uv tool install "sql2json[postgres,mysql]" --force
pipx upgrade sql2json
pip install --upgrade "sql2json[postgres,mysql]"   # inside a venv

Examples here use the sql2json command, available since v0.2.1. On 0.2.0 and earlier — or if the command is not on PATH — use the equivalent python -m sql2json ... form instead (on Windows, py -m sql2json ...).

When to Use

Use this skill when you need to:

  • Run a named query from ~/.sql2json/config.json
  • Execute a one-off SQL statement and get JSON back quickly
  • Pipe database results into jq, scripts, or other CLI tools
  • Export query results as CSV or Excel
  • Write to the database (INSERT / UPDATE / DELETE / DDL) — the command commits by default

Read the full file on GitHub · 322 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. yesterday First seen · 322 lines · 75 tokens per session scan B baac1e5a0180

Subscribe to this mod's changes

sql2json is a skill published in the GitHub repository fsistemas/sql2json (55 stars, last pushed 2mo ago), licensed MIT. It adds 75 tokens to every session and 3,295 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it B with 1 finding (asks for root). 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

fastapi

FastAPI best practices and conventions. Use when working with FastAPI APIs, Pydantic models, dependencies, streaming responses including Server-Sent Events (SSE), and serving frontend apps. Keeps FastAPI code clean and up to date with the latest features and patterns.

fastapi/fastapi · 57 tokens

chdb-datastore

Use when the user has tabular data (pandas DataFrame, parquet, csv, Arrow, json) and wants to filter, group, aggregate, join, or speed up slow pandas. Provides chDB DataStore — same pandas API, ClickHouse engine underneath. Also handles reading from S3, MySQL, PostgreSQL, MongoDB, ClickHouse Cloud, Iceberg, Delta Lake…

chdb-io/chdb · 168 tokens

chdb-sql

Use when the user wants to run SQL — especially analytical SQL — on local files (parquet/csv/json), URLs, S3 paths, or remote databases (Postgres, MySQL, MongoDB, ClickHouse Cloud, Iceberg, Delta Lake) without setting up a server. Provides chDB — embedded ClickHouse SQL in Python with 1000+ functions, Session for…

chdb-io/chdb · 214 tokens

knowledge_graph_skill

Skill for searching and evolving the SQLite-backed Knowledge Graph. Use this when you need structured fact/concept/link search across one or more teams, NPCs, or directory scopes. The Knowledge Graph (KG) is stored in the application's database (not YAML). It is scoped by (teamname, npcname, directorypath). Facts and…

NPC-Worldwide/npcpy · 474 tokens

knowledge_sememolution_skill

Skill for population-based Knowledge Graph evolution via Sememolution. Use this when the user wants creative cross-domain synthesis, speculative reasoning, or when a single KG search might be too narrow. Sememolution maintains a population of KG "individuals". Each individual has its own graph (different facts…

NPC-Worldwide/npcpy · 366 tokens

knowledge_store_skill

Skill for working with local .knowledge.yaml files via KnowledgeStore. Use this when you need to recall, search, or manage directory-local memories and knowledge links stored in plain YAML alongside the user's project files. KnowledgeStore is directory-scoped. Each directory that contains a .knowledge.yaml file…

NPC-Worldwide/npcpy · 346 tokens