Agent skill

Railway Database

by davila7 in davila7/claude-code-templates

Add official Railway database services (Postgres, Redis, MySQL, MongoDB).

MITAuto-check passedDatabases

Install Railway Database

skills CLI
$ npx skills add davila7/claude-code-templates --skill railway-database -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install davila7/claude-code-templates railway-database --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/davila7/claude-code-templates.git skills-src && mkdir -p .claude/skills && cp -r skills-src/cli-tool/components/skills/railway/database .claude/skills/railway-database && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
railway-database
GitHub stars
32k
Token cost
~1.9k tokens
SKILL.md length
545 words
Files
1
Skills in repo
478
Repo updated
First seen
Licence
MIT

At a glance

Add official Railway database services (Postgres, Redis, MySQL, MongoDB).

  • Works in 2 steps: Fetch Template → Deploy Template
  • User wants to add a database
  • SKILL.md covers When to Use, Decision Flow, Check for Existing Databases and Available Databases, plus 9 more sections
  • Calls railway and bash

What it does

Railway Database is an agent skill from davila7/claude-code-templates. Add official Railway database services (Postgres, Redis, MySQL, MongoDB). Use when user wants to add a database, says "add postgres", "add redis", "add database", "connect to database", or "wire up the database". For other templates (Ghost, Strapi, n8n), use the railway-templates skill.

Its SKILL.md is about 1.9k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in Databases, covering NoSQL databases and Workflow automation. It works with PostgreSQL, Redis, MySQL and MongoDB. The repository describes itself as: CLI tool for configuring and monitoring Claude Code. The licence is MIT.

When your agent uses it

  • User wants to add a database
  • Says add postgres
  • Connect to database
  • Wire up the database

Example prompts

  • “add postgres”
  • “add redis”
  • “add database”
  • “/railway-database”

Requirements

  • Pre-approved tools (allowed-tools): Bash(railway:*)

Workflow steps

2 steps, taken from the step headings in SKILL.md.

  1. Fetch Template
  2. Deploy Template

What it can do on your machine

Read from SKILL.md and the folder at commit 46b4d8b. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Bash(railway:*)

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • railway
    • bash

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Railway Database loads about 1.9k tokens when it runs. Until then it costs about 76 tokens; SKILL.md has 545 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~76
When it runs · the whole SKILL.md, loaded when a task matches
~1.9k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from davila7/claude-code-templates at commit 46b4d8b, republished under its MIT licence (© davila7). 545 words, ~1,943 tokens.

Download SKILL.mdSave it as .claude/skills/railway-database/SKILL.md (or your agent's skills folder).
name
railway-database
description
Add official Railway database services (Postgres, Redis, MySQL, MongoDB). Use when user wants to add a database, says "add postgres", "add redis", "add database", "connect to database", or "wire up the database". For other templates (Ghost, Strapi, n8n), use the railway-templates skill.
allowed-tools
Bash(railway:*)
version
1.0.0
author
Railway
license
MIT
tags
Railway, Database, Postgres, Redis, MySQL, MongoDB, Infrastructure, Deployment, Template
dependencies
railway-cli

Railway Database

Add official Railway database services. These are maintained templates with pre-configured volumes, networking, and connection variables.

For non-database templates, see the railway-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.

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

DatabaseTemplate Code
PostgreSQLpostgres
Redisredis
MySQLmysql
MongoDBmongodb

Prerequisites

Get project context:

bash
railway status --json

Extract:

  • id - project ID
  • environments.edges[0].node.id - environment ID

Get workspace ID (not in status output):

bash
bash <<'SCRIPT'
${CLAUDE_PLUGIN_ROOT}/skills/lib/railway-api.sh \
  'query getWorkspace($projectId: String!) {
    project(id: $projectId) { workspaceId }
  }' \
  '{"projectId": "PROJECT_ID"}'
SCRIPT

Adding a Database

Step 1: Fetch Template
bash
bash <<'SCRIPT'
${CLAUDE_PLUGIN_ROOT}/skills/lib/railway-api.sh \
  'query template($code: String!) {
    template(code: $code) {
      id
      name
      serializedConfig
    }
  }' \
  '{"code": "postgres"}'
SCRIPT

This returns the template's id and serializedConfig needed for deployment.

Step 2: Deploy Template
bash
bash <<'SCRIPT'
${CLAUDE_PLUGIN_ROOT}/skills/lib/railway-api.sh \
  'mutation deployTemplate($input: TemplateDeployV2Input!) {
    templateDeployV2(input: $input) {
      projectId
      workflowId
    }
  }' \
  '{
    "input": {
      "templateId": "TEMPLATE_ID",
      "serializedConfig": SERIALIZED_CONFIG,
      "projectId": "PROJECT_ID",
      "environmentId": "ENVIRONMENT_ID",
      "workspaceId": "WORKSPACE_ID"
    }
  }'
SCRIPT

Important: serializedConfig is the exact object from the template query, not a string.

Connecting to the Database

After deployment, other services connect using reference variables.

For complete variable reference syntax and wiring patterns, see variables.md.

Backend Services (Server-side)

Use the private/internal URL for server-to-server communication:

DatabaseVariable Reference
PostgreSQL${{Postgres.DATABASE_URL}}
Redis${{Redis.REDIS_URL}}
MySQL${{MySQL.MYSQL_URL}}
MongoDB${{MongoDB.MONGO_URL}}
Frontend Applications

Important: Frontends run in the user's browser and cannot access Railway's private network. They must use public URLs or go through a backend API.

For direct database access from frontend (not recommended):

  • Use the public URL variables (e.g., ${{MongoDB.MONGO_PUBLIC_URL}})
  • Requires TCP proxy to be enabled

Better pattern: Frontend → Backend API → Database

Example: Add PostgreSQL

bash
bash <<'SCRIPT'
# 1. Get context
railway status --json
# Extract project.id and environment.id

# 2. Get workspace ID
${CLAUDE_PLUGIN_ROOT}/skills/lib/railway-api.sh \
  'query { project(id: "proj-id") { workspaceId } }' '{}'

# 3. Fetch Postgres template
${CLAUDE_PLUGIN_ROOT}/skills/lib/railway-api.sh \
  'query { template(code: "postgres") { id serializedConfig } }' '{}'

# 4. Deploy template
${CLAUDE_PLUGIN_ROOT}/skills/lib/railway-api.sh \
  'mutation deploy($input: TemplateDeployV2Input!) {
    templateDeployV2(input: $input) { projectId workflowId }
  }' \
  '{"input": {"templateId": "...", "serializedConfig": {...}, "projectId": "...", "environmentId": "...", "workspaceId": "..."}}'
SCRIPT
Then Connect From Another Service

Use railway-environment skill to add the variable reference:

json
{
  "services": {
    "<backend-service-id>": {
      "variables": {
        "DATABASE_URL": { "value": "${{Postgres.DATABASE_URL}}" }
      }
    }
  }
}

Response

Successful deployment returns:

json
{
  "data": {
    "templateDeployV2": {
      "projectId": "e63baedb-e308-49e9-8c06-c25336f861c7",
      "workflowId": "deployTemplate/project/e63baedb-e308-49e9-8c06-c25336f861c7/xxx"
    }
  }
}
Show full SKILL.md (230 more words)Show less

What Gets Created

Each database template creates:

  • A service with the database image
  • A volume for data persistence
  • Environment variables for connection strings
  • TCP proxy for external access (where applicable)

Error Handling

ErrorCauseSolution
Template not foundInvalid template codeUse: postgres, redis, mysql, mongodb
Permission deniedUser lacks accessNeed DEVELOPER role or higher
Project not foundInvalid project IDRun railway status --json for correct ID

Example Workflows

"add postgres and connect to the server"
  1. Check existing DBs via env config query
  2. If postgres exists: Skip to step 5
  3. If not exists: Deploy postgres template (fetch template → deploy)
  4. Wait for deployment to complete
  5. Identify target service (ask if multiple, or use linked service)
  6. Use railway-environment skill to stage: DATABASE_URL: { "value": "${{Postgres.DATABASE_URL}}" }
  7. Apply changes
"add postgres"
  1. Check existing DBs via env config query
  2. If exists: "Postgres already exists in this project"
  3. If not exists: Deploy postgres template
  4. Inform user: "Postgres created. Connect a service with: DATABASE_URL=${{Postgres.DATABASE_URL}}"
"connect the server to redis"
  1. Check existing DBs via env config query
  2. If redis exists: Wire up REDIS_URL via environment skill → apply
  3. If no redis: Ask "No Redis found. Create one?"
    • Deploy redis template
    • Wire REDIS_URL → apply

Composability

  • Connect services: Use railway-environment skill to add variable references
  • View database service: Use railway-service skill
  • Check logs: Use railway-deployment skill

© davila7, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in cli-tool/components/skills/railway/database of davila7/claude-code-templates.

Open the folder on GitHubat commit 46b4d8b

Compare with similar skills

Railway Database next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Railway Database compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Railway Database this skilldavila7/claude-code-templates32k—~1.9kAutomated safety check: PassMIT
Svc Databases0ld13rr/pentestcode828—~379Automated safety check: PassMIT
Use Sealoshashgraph-online/awesome-codex-plugins1.3k—~2.2kAutomated safety check: PassApache-2.0
Prisma Database Setupcurvenote/curvenote1703 repos~1.4kAutomated safety check: PassMIT
Rhctlsaidake/rhctl106—~4kAutomated safety check: NotesApache-2.0
Database Expertcin12211/orca-q224—~2.8kAutomated safety check: PassMIT

Similar skills

  • Svc Database

    s0ld13rr/pentestcode

    Database RCE paths — UDF, xpcmdshell, COPY TO PROGRAM, Redis key write.

    828 GitHub stars~379 tokensUpdated 7 days ago
    DatabasesAuto-check passed
  • Use Sealos

    hashgraph-online/awesome-codex-plugins

    Deploy and operate apps on Sealos Cloud: sign in to a Sealos account, deploy any project or self-hosted app (from the template store, an official Docker image, or project source code), provision…

    1.3k GitHub stars~2.2k tokensUpdated today
    DatabasesAuto-check passed
  • Prisma Database Setup

    curvenote/curvenote

    Guides for configuring Prisma with different database providers (PostgreSQL, MySQL, SQLite, MongoDB, etc.).

    170 GitHub starsUsed in 3 repos~1.4k tokens
    DatabasesAuto-check passed
  • Rhctl

    saidake/rhctl

    Run and author rhctl CLI workflows and remote environment scripts under scripts/ (PostgreSQL, JetStream, Docker, Redis, MongoDB, AWS LocalStack, execute/upload/patch).

    106 GitHub stars~4k tokensUpdated 3 days ago
    DatabasesAuto-check: notes
  • Database Expert

    cin12211/orca-q

    Database performance optimization, schema design, query analysis, and connection management across PostgreSQL, MySQL, MongoDB, and SQLite with ORM integration.

    224 GitHub stars~2.8k tokensUpdated 18 days ago
    DatabasesAuto-check passed
  • Database guidance for PostgreSQL, MongoDB, Redis and Oracle plus Neon, Supabase and Firestore: schema design, indexing, query tuning and cloud database choice.

    1.2k GitHub stars~2.8k tokensUpdated today
    DatabasesAuto-check passed

More from davila7/claude-code-templates

All 478 skills in this repo
  • Perplexity Web Search

    davila7/claude-code-templates

    Runs web-grounded searches through Perplexity's Sonar models over OpenRouter for current events, recent literature and cited facts beyond the model's training cutoff.

    32k GitHub starsUsed in 11 repos~3.5k tokens
    Auto-check: notes
  • Neuropixels Data Analysis

    davila7/claude-code-templates

    Analyzes Neuropixels recordings from SpikeGLX or Open Ephys through preprocessing, drift correction, Kilosort4 spike sorting, quality metrics and curation.

    32k GitHub starsUsed in 9 repos~2.8k tokens
    Auto-check passed
  • Scientific Venue Templates

    davila7/claude-code-templates

    Supplies LaTeX templates and formatting rules for journals, conferences, posters, and grant proposals, then can check a draft against them.

    32k GitHub starsUsed in 9 repos~5.1k tokens
    Auto-check: notes
  • Brand Voice Content Creator

    davila7/claude-code-templates

    Analyzes a brand's existing writing to lock in a consistent voice, then builds SEO blog posts and platform-specific social content around it.

    32k GitHub starsUsed in 3 repos~1.9k tokens
    Auto-check passed
  • CAPA Officer

    davila7/claude-code-templates

    Guides corrective and preventive action (CAPA) work in a quality management system, from initiation and root cause analysis through effectiveness verification.

    32k GitHub starsUsed in 1 repo~2k tokens
    Auto-check passed
  • Fda Consultant Specialist

    davila7/claude-code-templates

    Senior FDA consultant and specialist for medical device companies including HIPAA compliance and requirement management.

    32k GitHub starsUsed in 1 repo~2.7k tokens
    Auto-check passed

Categories

Questions about Railway Database

What does Railway Database do?

Add official Railway database services (Postgres, Redis, MySQL, MongoDB). Railway Database is an agent skill from davila7/claude-code-templates. Add official Railway database services (Postgres, Redis, MySQL, MongoDB).

When should I use Railway Database?

Railway Database fits situations like: user wants to add a database; says add postgres; connect to database; wire up the database.

How do I install Railway Database in Claude Code?

Run `npx skills add davila7/claude-code-templates --skill railway-database -a claude-code`. Or copy the skill folder (cli-tool/components/skills/railway/database in davila7/claude-code-templates) into .claude/skills/railway-database in your project. Claude Code loads it when a task matches its description.

How do I install Railway Database in Codex?

Run `npx skills add davila7/claude-code-templates --skill railway-database -a codex`. Or copy the skill folder (cli-tool/components/skills/railway/database in davila7/claude-code-templates) into .agents/skills/railway-database in your project. Codex loads it when a task matches its description.

Can I use Railway Database in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add davila7/claude-code-templates --skill railway-database -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/railway-database, .gemini/skills/railway-database, .github/skills/railway-database and .opencode/skills/railway-database in your project.

What does Railway Database need to run?

Going by SKILL.md and its folder, Railway Database needs the command-line tools its instructions call (railway and bash). Its frontmatter pre-approves these tools: Bash(railway:*).

Does Railway Database access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Railway Database safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Railway Database use?

Railway Database is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Railway Database use?

About 1.9k tokens (SKILL.md is roughly 7.8k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Railway Database?

Skills that share tags, products or a category with Railway Database: Svc Database (s0ld13rr/pentestcode, 828 stars), Use Sealos (hashgraph-online/awesome-codex-plugins, 1.3k stars), Prisma Database Setup (curvenote/curvenote, 170 stars) and Rhctl (saidake/rhctl, 106 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Railway Database?

davila7 (a GitHub user) maintains it in davila7/claude-code-templates, which has 32,483 GitHub stars. The repository holds 478 skills in this directory. The repository was last updated on October 9, 2026.

Source: davila7/claude-code-templates on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.