This skill should be used when the user wants to add a database (Postgres, Redis, MySQL, MongoDB), says "add postgres", "add redis", "add database", "connect to database", or "wire up the database". For other templates (Ghost, Strapi, n8n, etc.), use the templates skill.
View on GitHubrailwayapp/railway-skills
railway
January 20, 2026
Select agents to install to:
npx add-skill https://github.com/railwayapp/railway-skills/blob/main/plugins/railway/skills/database/SKILL.md -a claude-code --skill databaseInstallation paths:
.claude/skills/database/# Database
Add official Railway database services. These are maintained templates with pre-configured volumes, networking, and connection variables.
For non-database templates, see the `templates` skill.
## When to Use
- User asks to "add a database", "add Postgres", "add Redis", etc.
- User needs a database for their application
- User asks about connecting to a database
- User says "add postgres and connect to my server"
- User says "wire up the database"
## Decision Flow
**ALWAYS check for existing databases FIRST before creating.**
```
User mentions database
│
Check existing DBs first
(query env config for source.image)
│
┌────┴────┐
Exists Doesn't exist
│ │
│ Create database
│ (CLI or API)
│ │
│ Wait for deployment
│ │
└─────┬─────┘
│
User wants to
connect service?
│
┌─────┴─────┐
Yes No
│ │
Wire vars Done +
via env suggest wiring
skill
```
## Check for Existing Databases
Before creating a database, check if one already exists.
For full environment config structure, see [environment-config.md](references/environment-config.md).
```bash
railway status --json
```
Then query environment config and check `source.image` for each service:
```graphql
query environmentConfig($environmentId: String!) {
environment(id: $environmentId) {
config(decryptVariables: false)
}
}
```
The `config.services` object contains each service's configuration. Check `source.image` for:
- `ghcr.io/railway/postgres*` or `postgres:*` → Postgres
- `ghcr.io/railway/redis*` or `redis:*` → Redis
- `ghcr.io/railway/mysql*` or `mysql:*` → MySQL
- `ghcr.io/railway/mongo*` or `mongo:*` → MongoDB
## Available Databases
| Database | Template Code |
|----------|---------------|
| PostgreSQL | `postgres` |
| Redis | `redis` |
| MySQL | `mysql` |
| MongoDB | `mongodb` |
## Prerequisites
Get project context:
```bash
r