agentsclimarketplace

Db

Skill eddmann/agent-toolkit/skills/db

Collection of reusable skills and extensions for AI coding agents - prompts, Pi extensions, and other bits and pieces.

Install
npx -y skills add eddmann/agent-toolkit --skill db

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
  • 2 stars2 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Query and modify databases (PostgreSQL, MySQL/MariaDB, SQLite). Use when the user asks to inspect, query, or write to a database, or when you need to understand a database schema.

SKILL.md

4.4 KB, as published. Nobody here has run it

Database Access

Single CLI for PostgreSQL, MySQL/MariaDB, and SQLite. All output is JSON. Use ${CLAUDE_SKILL_DIR}/scripts/db for all commands.

Connections

Connections are stored in ~/.config/agent-db/connections.json (override path with $DB_CONFIG_DIR). The user must manage this file directly — never create or edit it yourself. Ask the user to add their connection if the alias they want is missing.

Example connections.json:

{
  "connections": {
    "prod": "postgres://user:pass@host:5432/mydb",
    "local": "sqlite:///path/to/data.db",
    "staging": "mysql://user:pass@host:3306/app",
    "remote": {
      "url": "mysql://user:[email protected]:3306/mydb",
      "ssh": {"host": "server.example.com", "user": "deploy", "port": 22}
    }
  }
}

Connections can be a plain URL string or an object with url + ssh keys for SSH-tunnelled access. The ssh object supports host (required), user, port (default 22), and key (path to private key, defaults to SSH agent).

scripts/db --alias <alias> ping    # test a connection

Every command requires --alias <name> before the subcommand to specify which connection to use. If the alias doesn't exist, tell the user to update connections.json.

Schema exploration

Always explore schema before writing queries against an unfamiliar database.

scripts/db --alias <alias> databases                          # list databases on server
scripts/db --alias <alias> schemas                            # list schemas in current database
scripts/db --alias <alias> tables [--views] [--schema <name>] # list tables [and views]
scripts/db --alias <alias> describe <table> [--schema <name>] # columns, FKs, indexes
scripts/db --alias <alias> schema [--table <name>]            # full schema or single table

--schema <name> selects a non-public schema (postgres only, default: public).

Queries

scripts/db --alias <alias> query "SELECT * FROM users WHERE id = ?" --params '[42]'
scripts/db --alias <alias> query "SELECT * FROM users"              # default limit: 500 rows
scripts/db --alias <alias> query "SELECT * FROM users" --limit 0    # unlimited
cat query.sql | scripts/db --alias <alias> query -                  # SQL from stdin

Writes

scripts/db --alias <alias> exec "INSERT INTO t (a, b) VALUES (?, ?)" --params '["x", 1]'
scripts/db --alias <alias> exec "CREATE TABLE t (id SERIAL PRIMARY KEY, name TEXT)"
cat migration.sql | scripts/db --alias <alias> exec -               # multi-statement (no --params)

exec auto-commits on success, rolls back on error. Returns rows_affected and supports RETURNING.

Output format

JSON to stdout. Errors: {"error": "..."} to stderr with non-zero exit.

// query
{"db_type": "postgres", "rows": [{"id": 1, "name": "Alice"}], "truncated": true, "limit": 500}
// exec
{"ok": true, "db_type": "postgres", "rows_affected": 3, "statements": 1}
// schema commands return db_type + structured metadata (columns, foreign_keys, indexes)

Parameterisation — MANDATORY

Always use --params with ? placeholders. Never concatenate values into SQL.

# CORRECT
scripts/db --alias <alias> query "SELECT * FROM users WHERE email = ?" --params '["[email protected]"]'
# WRONG — SQL injection risk
scripts/db --alias <alias> query "SELECT * FROM users WHERE email = '[email protected]'"

? is auto-converted to the backend's native format. Exception: DDL and queries with no user-supplied data don't need --params.

Rules

  1. Parameterise all data values — no exceptions for reads or writes
  2. Explore schema first — run schema or describe before querying unfamiliar tables
  3. Prefer query over exec — only use exec to modify data
  4. Confirm destructive operations — show SQL and get user approval before DELETE, DROP, TRUNCATE, or UPDATE without WHERE
  5. Respect limits — don't use --limit 0 unless you know the result set is small

Notes

  • $VAR / ${VAR} in URLs expand at connect time
  • Timeouts: connect 10s (DB_CONNECT_TIMEOUT), statement 30s (DB_STATEMENT_TIMEOUT)
  • --schema is postgres-only — errors on MySQL/SQLite
  • Parse db_type from output to determine SQL dialect

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.