
database
Configure database containers with security, persistence, and health checks
- Installs
- 46
- Last 24h
- —
- Trending rank
- —
- Security
- Not audited
Install
Works with every agent the skills CLI supports.
npx skills add https://github.com/mwguerra/claude-code-plugins --skill database- 01
Install
Run the command in your project. The CLI asks which agents to install for.
- 02
Describe the task
Ask your agent for something this skill covers. It loads database automatically when relevant.
- 03
Review the result
The agent follows the SKILL.md steps, scripts and references bundled with the skill.
SKILL.md
The instructions your agent reads when the skill is triggered.
Docker Database Configuration Skill
Overview
This skill configures database containers following best practices for:
- Security (passwords, network isolation)
- Persistence (named volumes)
- Health checks
- Initialization scripts
- Backup and restore
Supported Databases
- PostgreSQL
- MySQL/MariaDB
- MongoDB
- Redis
Process
1. Consult Documentation
Read 05-databases.md for:
- Image versions
- Environment variables
- Health check configurations
- Volume paths
- Initialization patterns
2. Generate Configuration
PostgreSQL Configuration
services:
postgres:
image: postgres:16-alpine
container_name: postgres
restart: unless-stopped
shm_size: 256mb
environment:
POSTGRES_USER: ${DB_USER:-appuser}
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_DB: ${DB_NAME:-appdb}
volumes:
- postgres_data:/var/lib/postgresql/data
- ./init-scripts:/docker-entrypoint-initdb.d
ports:
- "127.0.0.1:5432:5432"
networks:
- database
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USER:-appuser} -d ${DB_NAME:-appdb}"]
interval: 10s
timeout: 5s
retries: 5
start_period: 30s
volumes:
postgres_data:
networks:
database:
internal: true
MySQL Configuration
services:
mysql:
image: mysql:8.0
container_name: mysql
restart: unless-stopped
environment:
MYSQL_ROOT_PASSWORD: ${MYSQL_ROOT_PASSWORD}
MYSQL_DATABASE: ${DB_NAME}
MYSQL_USER: ${DB_USER}
MYSQL_PASSWORD: ${DB_PASSWORD}
volumes:
- mysql_data:/var/lib/mysql
- ./init-scripts:/docker-entrypoint-initdb.d
ports:
- "127.0.0.1:3306:3306"
command: >
--default-authentication-plugin=mysql_native_password
--character-set-server=utf8mb4
--collation-server=utf8mb4_unicode_ci
healthcheck:
test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "root", "-p${MYSQL_ROOT_PASSWORD}"]
interval: 10s
timeout: 5s
retries: 5
volumes:
mysql_data:
MongoDB Configuration
services:
mongodb:
image: mongo:7
container_name: mongodb
restart: unless-stopped
environment:
MONGO_INITDB_ROOT_USERNAME: ${MONGO_USER}
MONGO_INITDB_ROOT_PASSWORD: ${MONGO_PASSWORD}
MONGO_INITDB_DATABASE: ${MONGO_DB}
volumes:
- mongo_data:/data/db
- mongo_config:/data/configdb
ports:
- "127.0.0.1:27017:27017"
healthcheck:
test: ["CMD", "mongosh", "--eval", "db.adminCommand('ping')"]
interval: 10s
timeout: 5s
retries: 5
volumes:
mongo_data:
mongo_config:
Redis Configuration
services:
redis:
image: redis:7-alpine
container_name: redis
restart: unless-stopped
command: >
redis-server
--appendonly yes
--maxmemory 256mb
--maxmemory-policy allkeys-lru
--requirepass ${REDIS_PASSWORD}
volumes:
- redis_data:/data
ports:
- "127.0.0.1:6379:6379"
healthcheck:
test: ["CMD", "redis-cli", "-a", "${REDIS_PASSWORD}", "ping"]
interval: 10s
timeout: 5s
retries: 5
volumes:
redis_data:
Connection Strings
PostgreSQL
DATABASE_URL=postgresql://user:password@db:5432/dbname
MySQL
DATABASE_URL=mysql://user:password@db:3306/dbname
MongoDB
MONGO_URI=mongodb://user:password@mongodb:27017/dbname?authSource=admin
Redis
REDIS_URL=redis://:password@redis:6379
Backup Commands
# PostgreSQL
docker compose exec -T db pg_dumpall -c -U appuser > backup.sql
# MySQL
docker compose exec -T db mysqldump -u root -p"$PASS" --all-databases > backup.sql
# MongoDB
docker compose exec -T db mongodump --archive --gzip > backup.gz
# Redis (if persistence enabled)
docker compose exec redis redis-cli -a "$PASS" BGSAVE
Restore Commands
# PostgreSQL
docker compose exec -T db psql -U appuser -d appdb < backup.sql
# MySQL
docker compose exec -T db mysql -u root -p"$PASS" < backup.sql
# MongoDB
docker compose exec -T db mongorestore --archive --gzip < backup.gz
Best Practices
- Always use named volumes for data persistence
- Bind to localhost only (127.0.0.1) unless external access needed
- Use internal networks to isolate database traffic
- Implement health checks for dependency management
- Store credentials in .env or Docker secrets
- Use initialization scripts for schema setup
- Regular backups before any risky operations
FAQ
What does the database skill do?
Configure database containers with security, persistence, and health checks
How do I install database?
Run npx skills add https://github.com/mwguerra/claude-code-plugins --skill database in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/database/ (personal) or .claude/skills/database/ (project).
Which AI agents can use database?
Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.
Is database safe to install?
No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.
Who maintains database?
It is published by mwguerra in mwguerra/claude-code-plugins. It has 46 recorded installs.
More from mwguerra/claude-code-plugins
filament-resource
mwguerra/claude-code-plugins
Generate FilamentPHP v4 resources with form, table, relation managers, and actions
Popular data & databases skills
supabase-postgres-best-practices
supabase/agent-skills
Postgres best practices maintained by Supabase, for Postgres running anywhere. Load this skill BEFORE writing or changing anything that lives in a Postgres database: creating or altering tables and columns (including choosing column types), schema design, migrations and declarative schema files, RLS policies and the tests that verify them, indexes, triggers, database functions, queues and scheduled jobs (pgcron, pgmq), vector/semantic search (pgvector), and restoring dumps (pgrestore) or importing data. Also load it when diagnosing slow queries, high CPU, timeouts, EXPLAIN plans, connection exhaustion, locking, bloat, or rows visible to the wrong user or tenant. This is not just a performance guide — schema, migration, security, and SQL authoring tasks need these rules too, even for a one-column change or a single query.
prisma-client-api
prisma/skills
Prisma Client API reference covering model queries, filters, operators, and client methods. Use when writing database queries, using CRUD operations, filtering data, or configuring Prisma Client. Triggers on "prisma query", "findMany", "create", "update", "delete", "$transaction".
prisma-database-setup
prisma/skills
Deprecated compatibility name for prisma-orm-setup. Use only when a user or existing integration explicitly invokes prisma-database-setup; otherwise select prisma-orm-setup.
prisma-cli
prisma/skills
Prisma ORM 7 CLI reference for existing Prisma 7 applications or explicitly selected Prisma 7 workflows. Covers prisma init, generate, migrate, db, dev, studio, and mcp. For setup, connection repair, or Prisma 8, use prisma-orm-setup; not the Prisma Platform CLI.
prisma-postgres
prisma/skills
Deprecated compatibility name for prisma-postgres-setup. Use only when a user or existing integration explicitly invokes prisma-postgres; otherwise select prisma-postgres-setup.
prisma-driver-adapter-implementation
prisma/skills
Required reference for Prisma ORM 7 SQL driver adapter work. Use when implementing or modifying adapters, adding database drivers, or touching SqlDriverAdapter, Transaction, savepoint, result mapping, or DriverAdapterError behavior. Covers current transaction lifecycle, optional savepoint hooks, original database-error preservation, and verification.