rea
Reverse engineer anything with agents, from app behavior down to native binaries.
- 472k
- TypeScript
- MIT
- 3 h ago
Claude Code skill: run read-only SQL on production Postgres safely, with a saved query library and a 3-layer SQL gate.
Repo 23blocks-OS/agentic-sql, read from GitHub 14 h ago. 23blocks-OS has not joined Take My Repo.
23blocks-OS/agentic-sql is a public repo on GitHub by 23blocks-OS. Claude Code skill: run read-only SQL on production Postgres safely, with a saved query library and a 3-layer SQL gate. It declares the MIT license on GitHub. It is written mainly in Python, has 0 stars and last changed on 2026-10-28. Nobody has reviewed it on Take My Repo yet, which says nothing about its quality. Read from GitHub on 2026-11-21.
In the maintainer's words. Shown from GitHub; Take My Repo does not keep a copy.
agentic-sql is an agent skill (SKILL.md) that lets Claude Code run SQL against production or staging Postgres safely. It checks a saved query library first, sends only read-only queries through a three-layer SQL gate, and saves useful findings back to the library before the session ends.
It works with any Postgres and any framework you investigate through psql. It is for data lookups, support-ticket investigations and data audits. It is not for sandbox databases, schema migrations or code that only builds queries.
find searches your saved queries before any new SQL is written, so the same query is not re-derived for every ticket.SELECT only, whole tree checked, function allow-list), and a LIMIT added when the query has none.scripts/safe_psql.py (launched as safe-psql) applies the gate, binds parameters on the server and refuses to run as a role that could write.safe-psql-write) proposes one INSERT or UPDATE (DELETE only if you turn hard delete on), shows a dry run that is rolled back, and applies it only after a person approves that exact statement in a terminal. It uses its own limited database login. See reference/write.md.curate runs before the final report, so reusable queries are saved instead of lost in terminal history.The skill is part of the ai-maestro plugin from ai-maestro-plugins:
claude plugin marketplace add 23blocks-OS/ai-maestro-plugins
claude plugin install ai-maestro@ai-maestro-plugins
AI Maestro's installer and updater also put safe-psql on your PATH, in a private Python environment with the packages from requirements.txt. Claude Code namespaces plugin skills, so the command may appear as /ai-maestro:agentic-sql.
git clone https://github.com/23blocks-OS/agentic-sql.git ~/.claude/skills/agentic-sql
python3 -m venv ~/.aimaestro/venvs/agentic-sql
~/.aimaestro/venvs/agentic-sql/bin/pip install -r ~/.claude/skills/agentic-sql/requirements.txt
Without AI Maestro there is no safe-psql launcher. Wherever the skill says safe-psql, run ~/.aimaestro/venvs/agentic-sql/bin/python ~/.claude/skills/agentic-sql/scripts/safe_psql.py, or put a small script with that command on your PATH. If the wrapper cannot run, the skill stops instead of falling back to raw psql.
You also need a Postgres role with SELECT and USAGE only (the wrapper refuses superusers and other roles that could write). Role setup is in reference/run.md.
/agentic-sql audit # once, to check library and schema doc paths
/agentic-sql find "customer by email" # always first
/agentic-sql run Q12 # run a saved query through the gate
/agentic-sql curate # before ending the session
Under the hood, run calls the wrapper:
safe-psql --env ACME_DATABASE_URL --query-id Q12 \
--sql "SELECT id, email FROM users WHERE id = :id" --param id=7
safe-psql --check-only --sql "..." # gate only, no database
| Command | What it does |
|---|---|
/agentic-sql find <topic> |
Search the library index for queries matching <topic>. Returns ranked matches with their purpose, schema references and parameters. Always run this first. |
/agentic-sql audit |
Health-check the library: count queries, flag orphan .sql files not in the index, flag queries with no schema reference, list queries last touched more than 90 days ago. |
/agentic-sql add |
Guided workflow for saving a new query: prompts for purpose, business case, environment, schema reference and parameters; formats the header; saves to {QUERY_DIR} as kebab-case-name.sql; updates {INDEX_PATH}. |
/agentic-sql run <query-id-or-path> |
Execute a saved query (by ID like Q12) or a freshly written one through {SAFE_PSQL_WRAPPER}, which runs the SQL gate, injects LIMIT and connects as {READ_ONLY_ROLE}. |
/agentic-sql curate |
Post-investigation review. Surface any SQL run this session that was not from the library, decide which is reusable, promote it via add. Run before ending the conversation. |
/agentic-sql write <change> |
Change data through the approval-gated write door: propose, a person approves in a terminal, apply. Needs a settings file and a limited write login; see reference/write.md. |
/agentic-sql schema <table-or-section> |
View or update {SCHEMA_DOC_PATH} for a table or section. When a new query touches an undocumented table, run this first, then add the query. |
The gate has three layers, and all are required:
SELECT and USAGE, with timeouts set on the role.SELECT, the whole syntax tree checked, functions limited to an allow-list. The statement sent to the database is regenerated from the checked tree, not your original text.LIMIT {MAX_ROWS} is added when the query has none, one statement per round trip, a fresh connection per query.Read-only transactions alone have been bypassed: Anthropic's archived reference Postgres MCP server accepted multiple statements, so COMMIT; <write> in one string ended the read-only transaction (Datadog Security Labs, 2025-08-21). The wrapper has a test suite, including that trick, writes hidden in WITH, SELECT INTO, COPY and dangerous functions in many query positions. Gate rules and role setup: reference/run.md.
The write door has its own rules and an approval step; see reference/write.md. The read command refuses any login that can write, and the write command refuses any login that can write tables you did not list.
Query results are treated as untrusted data. The skill does not write result rows or personal data to files or logs, and keeps connection strings in environment variables or a secret store.
On first invocation, the skill auto-extracts these from CLAUDE.md if present and asks for any missing values:
| Variable | Purpose | Default if missing |
|---|---|---|
{QUERY_DIR} |
Where saved queries live (relative to project root) | 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 and their connection variables | (asks) |
{READ_ONLY_ROLE} |
Postgres role with SELECT-only grants | agentic_sql_ro |
{SAFE_PSQL_WRAPPER} |
Wrapper that applies the SQL gate; ships with the skill | safe-psql (runs scripts/safe_psql.py) |
{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 before offering more | 50 |
Values persist to .claude/agentic-sql.yml for the session.
find does not surface the right query, the library failed even if the query exists.\d table gives columns but no gotchas, no join keys, no "this counter drifts under condition X" notes.scripts/ as explicit one-off scripts with dry-run gating.find because you already know the query.These are the categories that tend to recur in real production work. Use them as the taxonomy when seeding a fresh library.
| Category | Example queries | Why it's worth saving |
|---|---|---|
| Entity lookup | "Find project / user / order by name pattern" | First step of every support ticket |
| Identity reconciliation | Cross-block identity joins (e.g. talent in tenant DB vs. search index vs. auth provider) | Catches drift between microservice copies |
| Audit (read-only) | Whitespace pollution, duplicate emails, forged document numbers, denormalized counter drift | Health checks before / after cleanups |
| Cross-block joins | When data spans multiple databases / tenants and the join key is api_access_key or similar |
Pre-derived join paths avoid hallucinating columns |
| Aggregation by time bucket | Daily failure-rate breakdowns, regression-onset detection | Standard shape for "when did X start" investigations |
| Magic-link / token resolution | Resolve a customer's broken link back to who issued it, when, where | Recurring support ticket shape |
| Test-fixture selection | Find a test account / project / PCU with a specific shape for E2E tests | QA team asks for these repeatedly |
| Collision / deduplication triage | "All rows sharing canonical email/document with activity per row" | Required BEFORE any cleanup that might merge |
pip install -r requirements.txt pytest
pytest tests
The end-to-end tests start a throwaway local Postgres and are skipped when none is installed.
agentic-sql/
├── SKILL.md # skill manifest (YAML frontmatter + workflow)
├── README.md # this file
├── CHANGELOG.md
├── LICENSE # MIT
├── requirements.txt # sqlglot, psycopg, pyyaml
├── scripts/safe_psql.py # the read-only SQL gate wrapper
├── scripts/safe_psql_write.py # the write door: propose, approve, apply
├── examples/write.example.yaml # settings for the write door
├── tests/test_safe_psql.py tests/test_safe_psql_write.py
└── reference/ # one playbook per sub-command
├── audit.md find.md add.md run.md curate.md schema.md write.md
psycopg)agentic-sql ships in the ai-maestro plugin for AI Maestro, a dashboard and orchestrator for fleets of AI coding agents (source on GitHub). It also works on its own in any Claude Code setup.
See CHANGELOG.md. Contributions are welcome; see CONTRIBUTING.md.
MIT. See LICENSE.
Built by 23blocks.
23blocks-OS/agentic-sql is a public repo on GitHub by 23blocks-OS. Claude Code skill: run read-only SQL on production Postgres safely, with a saved query library and a 3-layer SQL gate.
It declares the MIT license on GitHub.
Its maker has not tagged a system, so it is unknown here. Its README says what it needs.
Open "Take it" on its page: Take My Repo writes an install plan for your machine and hands it to your AI agent (Claude Code, Codex or Cursor), which asks you before each step. Take My Repo has not tested it on any machine.
Its last change on GitHub was on 2026-10-28. Take My Repo does not judge from that whether it is maintained.
Nobody has reviewed it on Take My Repo yet, which says nothing about its quality.
Reverse engineer anything with agents, from app behavior down to native binaries.

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

AI Agent Orchestrator with Skills System - Give AI Agents superpowers: memory search, code graph queries, agent-to-agent messaging. Manage Claude Code, Codex, Grok Build or any AI Agent from one dashboard. Move Agents between computers and locations
Build complete AI agents — 150+ personalities + 7 skills + messaging + identity. The skill builder for AI Maestro.
The Landing Page by 23blocks: A simple, affordable solution for fast landing pages. Built with HTML, CSS, and JS—no complex frameworks or subscriptions. Host your landing page on AWS Amplify with free SSL and CDN. Perfect for testing ideas and Product-Market-Fit quickly!
Your AI Chief of Staff — Personal Assistant framework for Claude Code. Email, semantic memory, task management, content security. Works standalone or on AI Maestro.
TypeScript SDK for 23blocks backend-as-a-service. Build apps 10x faster with modular blocks for auth, payments, CRM, e-commerce & more. React hooks + Angular services. JSON:API compliant.
Connect Slack to your Claude Code agents - Zero API costs, full context retention, custom skills & hooks. Unlike official Claude for Slack, we connect to your RUNNING agents.
This page is also available as structured data, with the same sources and dates.
/api/v1/resources/gh/23blocks-OS/agentic-sqlTake My Repo has not tested this on your machine. Requirements come from the project's own documentation.