db-cli
Query the petclinic Postgres database (owners, pets, vets, visits, types, specialties) by calling the project's Postgres MCP server as a shell command. Use…
от victorrentea★ 17 звёзд на GitHub
Установить db-cli в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Database access when MCP servers are disabled
The postgres-db MCP server declared in .mcp.json is not connected in this
session. The same server is still reachable from the shell: db-cli.py starts
it and speaks MCP to it over stdio (stdlib-only Python, needs just python3 and
npx). Same tools, same parameters, same answers — only the transport differs,
and nothing about the server changes once MCP access is restored. The answers
print as TOON, not JSON, to spend fewer tokens on repeated row keys.
Run everything below from the repo root.
1. Discover what the server offers
.claude/skills/db-cli/db-cli.py tools
Prints every tool with its parameter signature and description — the same information an MCP client would put in your tool list. Run this first if you are unsure what is available.
2. Call a tool
.claude/skills/db-cli/db-cli.py call <tool_name> --params '<json>'
The two tools this server exposes:
# run SQL
.claude/skills/db-cli/db-cli.py call execute_sql \
--params '{"sql":"select count(*) from owners"}'
# explore the schema without guessing table names
.claude/skills/db-cli/db-cli.py call search_objects \
--params '{"object_type":"table"}'
3. Read the output
The default output is TOON. A result set is one header plus one line per row:
success: true
data:
statements[1]:
- sql: select name from types
rows[2]{name}:
dog
cat
count: 2
source_id: default
Only the rows matter most of the time: read rows[N]{...}: and the lines under it.
Never pass --json to get data you will read or reuse yourself, not even to feed
it into a script (an Excel, a chart, a report): the same 10-row result is ~540 chars
as TOON and ~1,460 as JSON. Read the values off the TOON rows and carry them on
yourself. --json is only for piping straight into jq in the same shell command
(| jq -c '.data.statements[0].rows'), so the JSON itself never reaches the conversation.
When it fails
The script prints dbhub's own stderr, so read that first. Two causes have bitten before, and the script already handles both:
npxlives undernvm, which is not on a non-interactive agent shell's PATH (that shell never sources~/.zshrc). The script looks in~/.nvm/versions/node/*/binitself.- On a machine that has never run this dbhub version,
npxdownloads it on first use. The script waits up to 120s (DB_CLI_TIMEOUT) for the first answer.
ECONNREFUSED in the output means Postgres is not running: ./start-database.sh.
Schema cheat-sheet
owners, pets (type_id → types, owner_id → owners), visits
(pet_id), vets, specialties, vet_specialties, users, roles.
Full model: see the ER model section in AGENTS.md.
Rules
- Read-only. No INSERT / UPDATE / DELETE / DDL unless explicitly asked.
- Prefer one aggregated SQL query over several small ones — each call pays a ~2s server startup.
- An empty database is usually not a bug: Flyway seeds it when the backend
boots (see
AGENTS.md→ Database).
Why not a direct Postgres client
There is deliberately only one way into the database: the dbhub MCP
server. It is reachable two ways — as an MCP tool where the harness supports
MCP, and through this CLI bridge where it does not. Both hit the same server,
so its guardrails and behaviour are identical either way.
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
- 01
Bash(.claude/skills/db-cli/db-cli.py:*) - 02
Bash(jq:*)
Вложенные файлы
- db-cli.env
- db-cli.py
- eval/README.md
- eval/db-cli-runs.json
- eval/db-cli-skill.html
- eval/pretty_report.html
- eval/pretty_report.py
- eval/report.py
- eval/run.py
- eval/tasks.json
FAQ
Что делает скилл db-cli?
Query the petclinic Postgres database (owners, pets, vets, visits, types, specialties) by calling the project's Postgres MCP server as a shell command. Use whenever a task needs to read or inspect petclinic data or schema AND no database MCP tools are available (no mcp__postgres-db__* tools). Also use when explicitly asked to "use the db-cli skill".
Как установить скилл db-cli?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл db-cli запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
skill-creator
AnthropicCreate new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an…
discernment-nudge
AnthropicAfter you give a substantive answer or draft that the user may act on — advice or recommendations, drafted artifacts such as goals, plans, pitches, proposals…
data-consolidate
AnthropicJoins the plant's scheduled exports and connector data into one working dataset — ERP items (NetSuite or Infor M3), sales orders, production work orders…
inspection-to-capa
AnthropicRuns the quality chain end to end: writes the nonconformance against the requirement it violates, searches history at the moment of writing to say whether…