Skip to content
Back to skills

Db Query

BSecurity

Query the local Postgres database of the active Aspire worktree via psql.

  • 438 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added May 26, 2026
developmentrustshellsqldatabase

Works with

  • cli
  • mcp

Security analysis

B75/100
  • criticalSends environment variables or credentials to an external URL

Pro shows the line behind each finding and how to fix it

Scanned May 27, 2026

npx -y skills add platformplatform/PlatformPlatform --skill db-query --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Db Query?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Db Query
[![Security: B — Skills Directory](https://www.skillsdirectory.com/api/skills/platformplatform-db-query/badge)](https://www.skillsdirectory.com/skills/platformplatform-db-query)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: db-query
description: Query the local Postgres database of the active Aspire worktree via psql.
---

# Database Query

**Port = `.workspace/port.txt` base + 4. Never trust Aspire MCP for the port — a common critical failure that silently runs SQL on another worktree's database.**

**Read-only. Every write needs explicit user approval for that exact statement, every time — prior approvals never carry over.**

**For destructive operations (DROP, TRUNCATE, DELETE, ALTER, or anything that loses data), take extreme care. If anything in the request is even slightly unclear about the scope, target, or intent, stop and ask for clarification before executing. Always assume the most conservative interpretation.**

## Prerequisites

If `psql --version` fails, tell the user:

> `psql` is not installed. Install:
> - **macOS**: `brew install libpq && brew link --force libpq`
> - **Linux**: `sudo apt install postgresql-client`
> - **Windows**: `winget install PostgreSQL.PostgreSQL.17`

## Connection

Aspire must be running.

- Host `localhost`, port = `<base> + 4` where `<base>` is the integer in `.workspace/port.txt`.
- User `postgres`.
- Password: `export PGPASSWORD=$(dotnet user-secrets list --project application/AppHost/AppHost.csproj | sed -n 's/^postgres-password = //p')` (keeps it out of shell history).

## Databases

Each SCS has its own database. List them:

```sql
SELECT datname FROM pg_database WHERE datistemplate = false AND datname <> 'postgres';
```

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.