home / skills / openclaw / skills / postgres
This skill helps you manage PostgreSQL databases by running queries, handling schemas, backups, monitoring, and performance tuning.
npx playbooks add skill openclaw/skills --skill postgresReview the files below or copy the command above to add this skill to your agents.
---
name: postgres
description: PostgreSQL database management. Run queries, manage schemas, and monitor performance.
metadata: {"clawdbot":{"emoji":"🐘","always":true,"requires":{"bins":["curl","jq"]}}}
---
# PostgreSQL 🐘
PostgreSQL database management.
## Setup
```bash
export DATABASE_URL="postgresql://user:pass@localhost:5432/dbname"
```
## Features
- SQL query execution
- Schema management
- Index optimization
- Backup and restore
- Performance monitoring
- Extensions management
## Usage Examples
```
"Show all tables"
"Run query: SELECT * FROM users"
"Create index on email column"
"Show slow queries"
```
## Commands
```bash
psql "$DATABASE_URL" -c "SELECT * FROM users LIMIT 10"
```
## Safety Rules
1. **ALWAYS** confirm before destructive operations
2. **BACKUP** before schema changes
This skill manages PostgreSQL databases: run queries, manage schemas, optimize indexes, perform backups, and monitor performance. It provides command-style interactions for common tasks and safety checks to prevent accidental data loss. Use it to inspect database state, apply schema changes, and troubleshoot slow queries quickly.
The skill accepts natural-language or command-style requests (for example, run a SQL query or show slow queries) and maps them to PostgreSQL operations using the configured DATABASE_URL. It can execute read and write queries, create or modify indexes and schemas, trigger backups or restores, and report performance metrics such as slow queries and index usage. Destructive actions require explicit confirmation and recommending backups before changes.
How do I connect the skill to my database?
Set the DATABASE_URL environment variable to a valid PostgreSQL connection string before using the skill.
Will the skill perform destructive actions automatically?
No. Destructive operations require explicit confirmation and it will recommend making a backup first.