Skip to main content
Agent skill

Database Cli

Use pre-installed database client CLIs from the sandbox: mongosh for MongoDB, psql/pgdump/pgrestore for PostgreSQL, and mysql/mysqldump for MySQL or MariaDB. Emphasizes safe read-only inspection, secret handling, and confirmation before destructive queries or restore operations.

Get started

Get the complete skill folder, including its scripts and reference files.

When to use this skill

Use Database Cli when an AI agent needs a reusable SKILL.md workflow for this job: Use pre-installed database client CLIs from the sandbox: mongosh for MongoDB, psql/pgdump/pgrestore for PostgreSQL, and mysql/mysqldump for MySQL or MariaDB. Emphasizes safe read-only inspection, secret handling, and confirmation before destructive queries or restore operations.

When not to use it

Skip Database Cli when the task is outside the writing category, or when a more specific skill in this directory already covers the same workflow with clearer triggers.

How to install

Where will you use it?

Install scope
Claude Code folder setup
mkdir -p ~/.claude/skills/database-cli
# Save SKILL.md to ~/.claude/skills/database-cli/SKILL.md
  1. Claude Code personal install: place the skill and its bundled files at ~/.claude/skills/database-cli/SKILL.md. For a shared project, commit the folder at .claude/skills/database-cli/ instead.
  2. Current Claude Code detects SKILL.md changes in watched directories during the session. If you just created a top-level skills directory, run /reload-skills. Check that the skill is listed before testing its trigger.
  3. For Claude chat or Cowork in the Desktop app, manage uploaded skills in Customize > Skills; copying files into a local Claude Code folder is not a Desktop install. Other agents may use different install locations.

Full install guide for Claude, Cursor, and Codex →

Try a starter prompt

After installing the skill, paste this starter prompt into your agent to verify it triggers on a small task.

Starter prompt
Use the Database Cli skill for this task: Use Database Cli when this documented workflow matches the task. Confirm any required inputs or files before making changes.

What supports this recommendation?

70/100 provisional content score. This measures documentation, practical detail and source signals. It is not a measured task success rate or a security certification.

Documentation
77/100
Practical detail
68/100
Source evidence
63/100
Source signals
70/100
Model compatibility evidence
  • claudeuntested

    No model-specific signal or recorded compatibility test was found.

  • chatgptuntested

    No model-specific signal or recorded compatibility test was found.

  • geminiuntested

    No model-specific signal or recorded compatibility test was found.

  • copilotuntested

    No model-specific signal or recorded compatibility test was found.

  • llamauntested

    No model-specific signal or recorded compatibility test was found.

  • perplexityuntested

    No model-specific signal or recorded compatibility test was found.

  • mistraluntested

    No model-specific signal or recorded compatibility test was found.

  • grokuntested

    No model-specific signal or recorded compatibility test was found.

Inferred compatibility is based on content signals. Check the app, its available tools and setup requirements before running a skill.

What this skill does

# Database CLI

Use this skill when the user asks to inspect or operate a MongoDB, PostgreSQL, MySQL, or MariaDB database from the sandbox.

The sandbox runtime image pre-installs:

- MongoDB: `mongosh` - PostgreSQL: `psql`, `pg_dump`, `pg_restore` - MySQL/MariaDB: `mysql`, `mysqldump`

If one is missing, report that the sandbox runtime image is missing that binary; do not spend the turn installing it.

## Credentials

Nuphos does not currently mint database credentials. Use credentials only when:

- The user provides a connection string or host/user/database details. - The user points to a Kubernetes Secret and explicitly approves reading the relevant keys. - The credentials are already available in the sandbox environment.

Never echo passwords, tokens, or full connection strings. Redact userinfo and query-string secrets when summarizing.

## Read-only First

Start with low-risk identity and schema checks.

### MongoDB

```bash mongosh "$MONGODB_URI" --quiet --eval 'db.runCommand({ connectionStatus: 1 }).authInfo.authenticatedUsers' mongosh "$MONGODB_URI" --quiet --eval 'db.getName(); db.getCollectionNames()' mongosh "$MONGODB_URI" --quiet --eval 'db.<collection>.findOne()' ```

### PostgreSQL

```bash psql "$DATABASE_URL" -c 'select current_database(), current_user, version();' psql "$DATABASE_URL" -c '\dt' psql "$DATABASE_URL" -c 'select count(*) from <table>;' ```

### MySQL / MariaDB

```bash mysql "$MYSQL_URL" -e 'select database(), current_user(), version();' mysql "$MYSQL_URL" -e 'show tables;' mysql "$MYSQL_URL" -e 'select count(*) from <table>;' ```

If a URL form is not supported by the installed client, pass host/user/database with environment variables so the password is not printed:

```bash PGPASSWORD="$PGPASSWORD" psql -h "$PGHOST" -U "$PGUSER" -d "$PGDATABASE" -c 'select 1;' MYSQL_PWD="$MYSQL_PWD" mysql -h "$MYSQL_HOST" -u "$MYSQL_USER" "$MYSQL_DATABASE" -e 'select 1;' ```

## Mutations

Ask for explicit confirmation before running:

- `insert`, `update`, `delete`, `drop`, `truncate`, `alter`, `create index` - MongoDB write commands such as `updateMany`, `deleteMany`, `drop`, or migration scripts - `pg_restore`, `psql -f`, `mysql < file.sql` - Any dump/restore against production data

Before mutating, summarize:

- Database type and connection target, with secrets redacted - Database/schema/table/collection scope - Exact statement or script path - Whether there is a backup or rollback path

## Dumps and Backups

Prefer dumps to local files in `/tmp` or `/workspace`; do not print dump contents into chat.

```bash # PostgreSQL pg_dump "$DATABASE_URL" --format=custom --file=/tmp/db.dump pg_restore --list /tmp/db.dump

# MySQL / MariaDB MYSQL_PWD="$MYSQL_PWD" mysqldump -h "$MYSQL_HOST" -u "$MYSQL_USER" \ --single-transaction --quick --set-gtid-purged=OFF "$MYSQL_DATABASE" > /tmp/db.sql ```

For MongoDB, `mongodump` is not guaranteed to be present. If the user needs logical backup/restore tooling beyond `mongosh`, say that the current runtime has `mongosh` and ask whether to proceed with shell-level export logic or use a dedicated backup job.

## Safety

- Read-only by default. - Add `limit` clauses or collection query limits when sampling rows/documents. - Do not run unbounded `select *` on large tables. - Do not print PII, secrets, or raw customer records unless the user explicitly asks and the scope is narrow. - Use transactions for PostgreSQL/MySQL mutations when possible, and show the user the statements before committing.

Intended uses

  • Use Database Cli when this documented workflow matches the task.

Implementation notes

  • Review the source instructions and adapt inputs before running the workflow.

Try it, then tell us how it went

A copied prompt does not tell us whether the task worked. Report your result after checking the output. We collect your tool and outcome, never your files or prompt.