Agent skill
database
Database operations, queries, migrations, and optimization.
Install this agent skill to your Project
npx add-skill https://github.com/majiayu000/claude-skill-registry/tree/main/skills/other/other/database-niraven-pokee-deep-research-
Metadata
Additional technical details for this skill
- openclaw
-
{ "emoji": "\ud83d\uddc4\ufe0f", "category": "infrastructure" }
SKILL.md
Database
Database operations, queries, migrations, and optimization.
Supported Databases
| Database | Connection | Common Use |
|---|---|---|
| PostgreSQL | psql or connection string |
Production apps |
| SQLite | File-based | Local/dev, embedded |
| MySQL/MariaDB | mysql CLI |
Legacy apps |
| Redis | redis-cli |
Caching, sessions |
| MongoDB | mongosh |
Document stores |
Basic Operations
PostgreSQL
# Connect
psql -h localhost -U username -d database
# Run query
psql -c "SELECT * FROM users LIMIT 10;"
# Execute file
psql -f migration.sql
SQLite
# Create/open database
sqlite3 data.db
# Run query
sqlite3 data.db "SELECT * FROM logs;"
Common Tasks
1. Schema Inspection
-- PostgreSQL: List tables
\dt
-- SQLite: List tables
.tables
-- MySQL: List tables
SHOW TABLES;
2. Backup/Restore
# PostgreSQL backup
pg_dump -h localhost -U user dbname > backup.sql
# PostgreSQL restore
psql -h localhost -U user dbname < backup.sql
# SQLite backup
sqlite3 source.db ".backup backup.db"
3. Migration Pattern
migrations/
001_create_users.sql
002_add_email_index.sql
003_create_orders.sql
Run in order:
for f in migrations/*.sql; do
psql -f "$f"
done
Query Optimization
Check Slow Queries (PostgreSQL)
SELECT query, mean_time, calls
FROM pg_stat_statements
ORDER BY mean_time DESC
LIMIT 10;
Add Index
CREATE INDEX CONCURRENTLY idx_users_email ON users(email);
Best Practices
- Use connection pooling — Don't open connections per query
- Parameterized queries — Prevent SQL injection
- Index foreign keys — Automatic in most DBs, verify
- Regular backups — Automate with cron
- Monitor slow queries — Catch performance issues early
- Migrations — Version control your schema
Security
- Never commit credentials
- Use
.envfiles for connection strings - Restrict database user permissions
- Enable SSL for remote connections
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
agent-ops-spec
Manage specification documents in .agent/specs/. Use when user provides requirements, acceptance criteria, or feature descriptions that need to be tracked and validated against implementation.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-testing
Test strategy, execution, and coverage analysis. Use when designing tests, running test suites, or analyzing test results beyond baseline checks.
agent-ops-state
Maintain .agent state files. Use at session start, after meaningful steps, and before concluding: read/update constitution/memory/focus/issues/baseline consistently.
Didn't find tool you were looking for?