Skip to content
Back to skills

Db Query

ASecurity

Use this skill to run SQL queries against the jishono database. Trigger for requests like "query the database", "run a SQL query", "check the data", "look up rows", "count entries", or any task that requires reading from or writing to the PostgreSQL database. Supports both the local dev database (via Docker) and the prod database (on localhost:5433).

  • 3 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added September 22, 2026
databasesbashsqlnodedockerdatabasebackend

Security analysis

A100/100

Scanned September 22, 2026

npx -y skills add jishono/jishono-backend --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: A — Skills Directory](https://www.skillsdirectory.com/api/skills/jishono-db-query/badge)](https://www.skillsdirectory.com/skills/jishono-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: Use this skill to run SQL queries against the jishono database. Trigger for requests like "query the database", "run a SQL query", "check the data", "look up rows", "count entries", or any task that requires reading from or writing to the PostgreSQL database. Supports both the local dev database (via Docker) and the prod database (on localhost:5433).
---

# Database Query — jishono-backend

Run SQL queries against the jishono PostgreSQL database.

## Connection details

### Local dev database (default)

Accessed via the Docker `postgres` service. The local dev DB is exposed on **localhost:5432**.

```bash
docker compose exec -T postgres psql -U postgres -d jishono -c "<SQL>"
```

For multi-line or complex queries, use a heredoc:

```bash
docker compose exec -T postgres psql -U postgres -d jishono <<'SQL'
SELECT ...
FROM ...
WHERE ...;
SQL
```

### Production database

The prod database is tunneled/available on **localhost:5433**. Use `psql` directly (not via Docker):
Source the `.env.prod` file first:

```bash
source /Users/pg/kode/jisho/jishono-backend/.env.prod && PGPASSWORD="$DB_PASS_ADMIN_NODE" psql -h localhost -p 5433 -U "$DB_USER_ADMIN_NODE" -d jishono -c "<SQL>"
```

## Which database to use

- Default to **local dev** unless the user explicitly says "prod", "production", or "live".
- Always confirm before running **write operations** (INSERT, UPDATE, DELETE) on prod.
- SELECT queries on prod are safe to run without confirmation.

## Useful tips

- Use `\x` or `--expanded` for wide result sets.
- Use `LIMIT` on exploratory queries to avoid dumping huge tables.
- For CSV output: `psql ... -A -F',' -c "SELECT ..."`
- The `-T` flag on `docker compose exec` is important to avoid TTY issues.

## Key tables

- `oppslag` — dictionary entries (lemma_id, oppslag, boy_tabell, etc.)
- `definisjon` — definitions linked to oppslag via lemma_id
- `boyning` tables — `subst_boy`, `verb_boy`, `adj_boy`, `adv_boy`, `det_boy`, `pron_boy`
- `brukere` — users
- `forslag` — definition suggestions
- `oppslag_forslag` — new entry suggestions
- `veggen_innlegg` — community wall posts
- `page_traffic` — page visit tracking

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…