agentleFS
dmzoneilldmzoneill/skills/debug-local-db/SKILL.md

debug-local-db

Skill2 starsChanged 3 months agoApache-2.0View on GitHub

Debug database issues in local/ephemeral environments - PostgreSQL, SQLite, Podman containers. Use when user says "debug local DB", "local database", "PostgreSQL local", "SQLite workflow".

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    If dump_schema: pg_dump() — full schema dump

    line 37
  2. Distinctive:

    Check lock contention in locks output

    line 46
  3. Distinctive:

    Check container logs for "fatal" or "error"

    line 48

≈ “Common” is an estimate: at least 1 in 5 of the 213,895 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Debug Local Database

Debug database issues in local or ephemeral environments. Uses Podman (not Docker) for container operations.

Inputs

InputTypeDefaultPurpose
databasestring"local"local, ephemeral, workflow
issue_descriptionstring""Issue description
dump_schemaboolfalseDump full schema for analysis

Workflow

1. Bootstrap

  • persona_load("developer") — database and Podman tools
  • check_known_issues("psql"), check_known_issues("podman"), check_known_issues("database")

2. Podman Container Checks

  • podman_logs(container="postgres") — database logs
  • podman_exec(container="postgres", command="psql --version") — PostgreSQL version

3. PostgreSQL Checks

  • psql_connections() — active connections
  • psql_activity() — current activity
  • psql_locks() — lock contention
  • psql_size() — database size
  • psql_tables() — list tables
  • psql_schemas() — list schemas
  • psql_query("SELECT pid, now() - pg_stat_activity.query_start AS duration, query, state FROM pg_stat_activity WHERE (now() - pg_stat_activity.query_start) > interval '5 seconds' ORDER BY duration DESC LIMIT 10;") — long-running queries
  • psql_describe(table="pg_stat_user_tables") — key tables
  • If dump_schema: pg_dump() — full schema dump

4. SQLite (if database == "workflow")

  • sqlite_tables() — tables
  • sqlite_schema() — schema
  • sqlite_query("SELECT name, type FROM sqlite_master WHERE type='table' ORDER BY name;") — basic stats
  • sqlite_vacuum() — vacuum

5. Analysis

  • Check lock contention in locks output
  • Flag long-running queries (>5s)
  • Check container logs for "fatal" or "error"
  • Parse connection count; flag if > 50

6. Failure Learning

  • "connection refused" → learn_tool_fix("psql_connections", "connection refused", "PostgreSQL not running", "Start with podman start postgres")
  • "no such container" → learn_tool_fix("podman_logs", "no such container", "Container does not exist", "Create with podman run -d --name postgres postgres:latest")

7. Memory

  • memory_session_log("Debug local database ({database})", "healthy=X, issues=Y")

Key MCP Tools

  • persona_load, check_known_issues, learn_tool_fix, memory_session_log
  • podman_logs, podman_exec
  • psql_connections, psql_activity, psql_locks, psql_size, psql_tables, psql_schemas, psql_describe, psql_query, pg_dump
  • sqlite_tables, sqlite_schema, sqlite_query, sqlite_vacuum

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.