progremir/pglr
Overview
This skill provides a secure PostgreSQL CLI tailored for AI agents to inspect and query databases without exposing connection credentials. It supports schema discovery, table listing, table description, and parameterized queries while enforcing read-only defaults and row limits. Use it to explore data structure and run safe queries during analysis tasks.
How this skill works
The CLI runs commands that return JSON-formatted results for queries, table listings, and schema inspection. It requires a human to configure the connection once; the skill cannot read or modify credentials. Queries default to read-only; write operations require an explicit flag from the user. Results include success status, row count, execution time, and optional truncation metadata.
When to use it
- Explore database structure before building queries or data pipelines
- List tables and inspect column definitions to design queries
- Run parameterized SELECT queries for analysis and reporting
- Safely query production-like databases without exposing credentials
- Check schema or table metadata during debugging or migrations
Best practices
- Always run schema or table description first (schema, describe <table>) to understand types and relationships
- Use parameterized queries to prevent SQL injection (pglr query with --params)
- Limit result size with LIMIT or rely on the 1000-row cap when sampling large tables
- Avoid write operations unless the user explicitly requests them and then use --allow-writes
- When multiple connections exist, specify --connection to target the correct database
Example use cases
- Quickly list all tables with pglr tables to find a target dataset
- Describe a table (pglr describe users) before composing a select for analytics
- Run a parameterized query to fetch recent orders for a dashboard
- Get a full schema overview (pglr schema) when onboarding to a new database
- Execute a controlled insert into logs only after explicit user approval with --allow-writes
FAQ
Ask the user to run the connect command; a human must configure connections (pglr connect <connection-string>).
Can the skill modify database credentials?
No. The skill cannot view or modify connection credentials; it only uses configured connections.