Use Railway
ClineOfficialPublished by Cline
- Skill
- Tool integration
- Cloud and DevOps
- Apache-2.0
- Medium risk
- Has scripts
AutoGineer summary
Written by AutoGineer from the skill’s own files, not by the author
The use-railway skill provides a comprehensive interface for operating Railway infrastructure. It handles the full lifecycle of applications and services, from initial account setup and project creation to deployment, environment management, and troubleshooting. The skill intelligently routes requests between the Railway CLI, Remote MCP, and local CLI MCP based on the specific operational context, ensuring that tasks like deploying code, managing object storage, or analyzing database performance are executed using the most appropriate and reliable method.
What it does
- Provisions and manages Railway projects, services, and environments.
- Handles code deployments and manages service configuration and variables.
- Facilitates account sign-up, sign-in, and authentication flows.
- Provides tools for troubleshooting, including log retrieval and metric analysis.
- Manages S3-compatible object storage buckets and domain configurations.
- Configures Railway agent tooling and integrates with MCP for platform operations.
When to use it
- When you need to deploy an application or service to Railway.
- When setting up a new Railway project or managing existing infrastructure.
- When you need to troubleshoot build failures, service crashes, or performance issues.
- When configuring environment variables, domains, or storage buckets.
- When you need to perform database introspection or analysis on Railway-hosted databases.
- When you need to authenticate or onboard a user to the Railway platform.
Advantages
- Automates complex infrastructure workflows like multi-step deployments.
- Intelligently selects the best tool path (CLI vs. MCP) for the specific task.
- Simplifies authentication by handling sign-up and sign-in flows automatically.
- Provides structured, reliable output using JSON for programmatic analysis.
- Reduces manual overhead by managing context and state across Railway resources.
Usage examples
- “Deploy this directory to Railway.”
- The agent runs 'railway up' to automatically sign the user in if needed, create the project and service, and deploy the application.
- “Check the status of my production service.”
- The agent uses the appropriate Railway MCP or CLI tool to fetch and display the current deployment status, logs, and metrics.
- “I need to add a PostgreSQL database to my project.”
- The agent uses the Railway CLI to provision the database and returns the connection credentials.
- “Why is my service crashing?”
- The agent retrieves recent logs and metrics for the service, analyzes them, and reports the likely cause of the failure.
Install
Download the skill as a ZIP:
https://autogineer.com/agent-skills/cline/use-railway/downloadUnzip it into the cross-client skills folder of your project:
mkdir -p .agents/skills && unzip use-railway.zip -d .agents/skills
Documentation by Cline
Use Railway
Railway resource model
Railway organizes infrastructure in a hierarchy:
Workspace is the billing and team scope. A user belongs to one or more workspaces.
Project is a collection of services under one workspace. It maps to one deployable unit of work.
Environment is an isolated configuration plane inside a project (for example,
production,staging). Each environment has its own variables, config, and deployment history.Service is a single deployable unit inside a project. It can be an app from a repo, a Docker image, or a managed database.
Bucket is an S3-compatible object storage resource inside a project. Buckets are created at the project level and deployed to environments. Each bucket has credentials (endpoint, access key, secret key) for S3-compatible access.
Deployment is a point-in-time release of a service in an environment. It has build logs, runtime logs, and a status lifecycle.
Most CLI commands operate on the linked project/environment/service context. Use railway status --json to see the context, and --project, --environment, --service flags to override.
Tool routing
Railway has three agent-facing operation paths. Choose the path that matches the job:
Remote MCP (
https://mcp.railway.com): account/project/service discovery, deployment state, bounded logs, simple redeploys, simple project creation, or complex Railway workflows that can be handed torailway-agent. Remote MCP uses Railway OAuth and does not depend on local CLI state.Local CLI MCP (
railway mcp): CLI-backed platform operations such as variables, domains, service config, templates, metrics, HTTP summaries, buckets, volumes, docs, or deploy-from-directory.Railway CLI (
railway): workflows that depend on local machine state such as current working directory deploys,railway up,railway run, SSH, database analysis scripts, local linking, interactive setup, or exact command output.
If multiple paths are available, choose the one that preserves the needed context. Remote MCP fits OAuth-scoped platform operations that do not need local files or CLI state. Local CLI MCP or the CLI fit workflows that need the current repo, local credentials, SSH, database scripts, or commands not exposed by remote MCP.
Use scripts/railway-api.sh only when neither MCP nor CLI exposes the operation, or when a reference gives a specific GraphQL fallback.
Parsing Railway URLs
Users often paste Railway dashboard URLs. Extract IDs before doing anything else:
https://railway.com/project/<PROJECT_ID>/service/<SERVICE_ID>?environmentId=<ENV_ID>
https://railway.com/project/<PROJECT_ID>/service/<SERVICE_ID>The URL always contains projectId and serviceId. It may contain environmentId as a query parameter. If the environment ID is missing and the user specifies an environment by name (e.g., "production"), resolve it:
scripts/railway-api.sh \
'query getProject($id: String!) {
project(id: $id) {
environments { edges { node { id name } } }
}
}' \
'{"id": "<PROJECT_ID>"}'Match the environment name (case-insensitive) to get the environmentId.
Prefer passing explicit IDs to CLI commands (--project, --environment, --service) and scripts (--project-id, --environment-id, --service-id) instead of running railway link. This avoids modifying global state and is faster.
Intent-based routing
Route by user intent before running preflight checks. The preflight ceremony below is for diagnostic and configuration work — it adds friction when the user just wants to ship something or sign up.
Deploy-from-cwd intent ("deploy", "ship", "push to Railway", "deploy this app"):
Skip the
railway whoami/railway statuspreflights.Run
railway updirectly — it self-validates auth, signs the user in (the CLI opens a browser) if they're unauthenticated, and chains into project + service creation and deploy.Announce intent before invoking: "Running
railway up— it'll sign you in if needed and deploy this directory."Do NOT ask the user to run
railway loginfirst. The chain handles auth as part of the deploy.If the environment can't open a browser, the CLI prints a device-code sign-in link and waits — follow Device-code sign-in: relay the link immediately (run in background, relay the link to the user the moment it prints).
Signup intent ("sign me up", "create my Railway account", "register me", "get me on Railway"):
If the current directory has a deployable app (e.g.
package.json,requirements.txt,go.mod,Dockerfile, source to build), runrailway up— it signs the user up and deploys in one shot, landing them on a running app. A detected agent harness authorizes the project creation, so barerailway upis enough — there's no extra prompt to clear. Use it even when the user only said "sign me up": shipping their app is the goal, so don't make them pick a command and don't drop to a bare login. For scripted or agent runs,railway up -yis the robust form — it skips prompts and forces the create non-interactively even if harness detection misses.railway loginis NOT the default for signup when there's something to deploy.Only when there is nothing to deploy — an empty / non-app directory, or the user explicitly says they just want an account with no deploy — use
railway login(creates new accounts on the fly through the same OAuth surface). There is no separate signup command.Signup is the flow most likely to hit the device-code wait (brand-new users in sandboxed/headless agent environments). Follow Device-code sign-in: relay the link immediately — a signup lost to an expired code is a lost user, not a retry.
Sandbox / remote-build intent ("give me a sandbox", "spin up a scratch environment", "build this remotely", "run this remotely"):
Load sandbox.md and follow it. Sandboxes require the feature to be enabled in Priority Boarding — if a sandbox command fails with a feature-availability error, prompt the user to enable Sandboxes in Priority Boarding rather than retrying.
Other intents (querying state, listing projects, configuring variables, debugging failures):
Follow the Preflight section below.
Preflight
Before any mutation, verify the tool path and context:
command -v railway # CLI installed
RAILWAY_CALLER="skill:[email protected]" RAILWAY_AGENT_SESSION="railway-skill-$(date +%s)-$$" railway whoami --json
railway --version # check CLI versionException: railway up and railway login self-validate auth and run their own unauth-aware flows. Don't run railway whoami before them — it adds a redundant failing call without changing what you do next. See Account creation & sign-in.
Skill freshness
Once per session, alongside the preflight checks, verify the installed Railway agent tooling is current. Root help ends with an Agent tooling: health section (printed to stderr, CLI 5.9+; older CLIs print nothing — skip this check rather than retrying):
railway --help 2>&1 | grep -A4 "Agent tooling:"Act on what it reports:
Skills installed and up to date — continue; nothing to do.
An update is available (
rev <a> → <b> available) — runrailway skills update, then tell the user to restart their coding tool so the updated skills load. This session keeps running on the old skill revision until restart: finish the current request, and if this skill's guidance disagrees with the updated CLI's own output, trust the CLI.Skills or MCP server missing (
✗lines) — runrailway setup agent -y, then tell the user to restart their coding tool.
Check once per session and don't re-run it after acting; the restart prompt to the user is the resolution, not another check.
When Railway MCP is available and the job is a platform-state read, use the matching MCP read instead of shelling out. If using the CLI path, run the CLI checks above.
For Railway CLI calls made while this skill is active, prefix the command with RAILWAY_CALLER=skill:[email protected] and a stable RAILWAY_AGENT_SESSION reused for the current user request. Generate the session id once per user request, then reuse that exact value for later Railway CLI calls in the same workflow. Do not run a separate export preflight solely for telemetry; inline env prefixes keep the shell output concise and avoid leaking setup steps into every response.
Context resolution - URL IDs always win:
If the user provides a Railway URL, extract IDs from it. Do NOT run
railway status --json; it returns the locally linked project, which is usually unrelated.If no URL is given, fall back to
railway status --jsonfor the linked project/environment/service.When using MCP tools after resolving local context with
railway status --json, pass the resolved project, environment, and service IDs explicitly. Do not rely on MCP implicit linked context; MCP may not share the CLI's current working directory link.
If the CLI is missing, guide the user to install it.
bash <(curl -fsSL https://railway.com/install.sh) --agents -y # Install CLI and configure detected agents
bash <(curl -fsSL https://railway.com/install.sh) # Shell script (macOS, Linux, Windows via WSL)
npm i -g @railway/cli # npm (macOS, Linux, Windows). Requires Node.js version 16 or higher.
brew install railway # Homebrew (macOS)If not authenticated, see Account creation & sign-in below — the CLI offers unauthed railway up (deploy + sign up/in in one shot) or railway login (sign up/in only; new accounts created on the fly). If not linked and no URL was provided, run railway link --project <id-or-name>.
If a command is not recognized (for example, railway environment edit), the CLI may be outdated. Upgrade with:
railway upgradeAccount creation & sign-in
Railway uses a single unified OAuth flow for both sign-in and sign-up. The backend detects fresh accounts from durable compliance state (a CLI client that hasn't accepted ToS / Fair Use yet) and adapts the consent screen and post-auth landing page — new users land on a "Welcome to Railway!" page, existing users see the standard confirmation. The CLI does not declare signup intent up front.
Two commands surface this flow, depending on intent:
| Command | When to use |
|---|---|
railway up | Agent-friendly onboarding from the current directory. Unauthenticated → opens the browser (or device-code) to sign in / sign up. With no linked project, a detected agent harness (or -y) auto-creates a project + service and deploys; an interactive human is offered create / link-existing / cancel. Add -y to skip prompts and force the create non-interactively (works even if harness detection misses). |
railway login | Sign in — and sign up. New accounts are created on the fly through the same OAuth surface; there is no separate signup command. |
Related: railway up --new creates a fresh project + service from the current directory and deploys it even if one is already linked (use when already signed in and the user wants a new app); --name <name> overrides the project name.
Choosing the path:
Deploy from cwd → run
railway up(interactive) orrailway up -y(skips the confirm prompt). Run it yourself; don't ask the user to sign in separately first.New project from cwd when already signed in →
railway up --new.Sign up with a deployable app in cwd →
railway up(signs up and deploys — bareupworks for a detected agent, even if the user only said "sign me up"; add-yto skip prompts / force it non-interactively). Sign in, or sign up with nothing to deploy →railway login(creates new accounts on the fly).
Headless / no browser:
The CLI auto-detects SSH sessions, CI, and a missing DISPLAY and switches to the device-code flow on its own — you almost never need to force it.
Do NOT pass --browserless just because you are an agent or your shell is non-interactive. If the human is at this machine (a local IDE or desktop session — the common case), bare railway login opens their browser directly, which completes far more reliably than relaying a device code (~90% vs ~60% success for agent-driven sign-ins). Being a coding agent does not make the machine headless.
railway login --browserless # ONLY for machines with genuinely no browserForces the device-code flow (RFC 8628): prints a sign-in link and a short code for the user to open on any device. Reserve it for machines where no browser exists — SSH boxes, containers, remote VMs the auto-detection missed. When you do end up in a device-code flow, follow the relay procedure below: surface the sign-in link to the user the moment it prints.
Agent harness, human present: when the CLI detects an agent harness with a human at the keyboard, railway up opens the browser and skips the confirm prompt — the agent invocation is treated as consent. A real human still has to complete OAuth in the browser.
Device-code sign-in: relay the link immediately (CRITICAL):
When the CLI can't open a browser (sandboxed shell, container, SSH, no DISPLAY), unauthed railway up and railway login print a sign-in URL + short code and then block, polling for up to 10 minutes while the user completes sign-in. The code expires after 10 minutes. If you run this as a normal foreground command, your harness buffers the output until the command exits — the user never sees the link until the code is already dead. This is the #1 cause of failed agent-driven signups. Handle it like this:
Preferred — background execution (when the agent environment supports background commands and output polling):
Start the command in the background.
Poll its output. The instant a sign-in block appears (
Sign in with one click: <url>on newer CLIs, orSign in at: <url>/Enter this code: <code>on older ones), stop everything and relay it to the user verbatim — do not summarize, shorten, or defer it. Prefer the one-click URL when present; otherwise relay the URL and code together. Tell the user to open the link now.Leave the command running and keep polling. When the user completes sign-in, the same process picks up the session and continues into the deploy on its own. Then verify per the deploy rules below.
No background support — set expectations, use the longest timeout:
Before running, tell the user: "This will print a sign-in link — I'll show it to you the moment I have it. Please complete it promptly; the code expires in 10 minutes."
Run with the longest timeout your harness allows.
If the command times out or is killed before sign-in completed, the printed code is no longer being monitored — a late click does nothing. Relay whatever link appeared anyway for context, then immediately re-run the command and relay the new link, telling the user to always use the newest one.
Never wait silently for the command to finish before showing the link, and never report the sign-in as failed without first relaying the link and giving the user a chance to act.
The browser transport needs none of this — the CLI opens the browser on the user's machine itself.
JSON / CI modes do not auto-prompt: railway up --json and railway up --ci will NOT open a browser for an unauthed user. --json emits a structured error instead:
{"error":"Not signed in.","code":"NOT_AUTHENTICATED","hint":"Run `railway login` to authenticate, then re-run."}When you see code: NOT_AUTHENTICATED, authenticate the user with railway login, then retry the original command.
Fully unattended (no human at all): set RAILWAY_API_TOKEN (account-scoped) or RAILWAY_TOKEN (project-scoped) instead of running an interactive login. A brand-new user with no token and no human present cannot complete signup — there is no headless account-creation path.
Agent tooling
Use direct Railway CLI commands for deterministic operations. Use railway agent only when the user explicitly asks for Railway Agent, wants a natural-language investigation, or the task is broader than a single resource operation.
Set up Railway skills, MCP, and authentication with:
railway setup agent
railway setup agent -y
railway setup agent --remoterailway setup agent -y skips the interactive login flow. If the user isn't authenticated after setup, run railway login.
Install or update MCP and skills directly when the user names a target tool:
railway mcp install
railway mcp install --agent codex
railway mcp install --agent cursor --remote
railway skills
railway skills update --agent codex
railway skills remove --agent cursorSupported targets include claude-code, cursor, codex, opencode, copilot, and factory-droid. The --remote flag configures https://mcp.railway.com instead of a local railway mcp stdio server.
Use Railway Agent chat with:
railway agent
railway agent -p "why is my service crashing?"
railway agent -p "summarize the deployment status" --json
railway agent --list --json
railway agent --thread-id <thread-id>railway agent requires user OAuth authentication from railway login. Project tokens (RAILWAY_TOKEN) are not supported for Railway Agent chat. If an agent command is unavailable, upgrade with railway upgrade --yes.
Common quick operations
These are frequent enough to handle without loading a reference. Use the matching MCP tool when the job is platform-scoped and the tool is available; otherwise use the CLI:
railway status --json # current context
railway whoami --json # auth and workspace info
railway project list --json # list projects
railway service list --json # services in current environment (verify before retrying `add`)
railway add --database <type> --json # add one database; ALWAYS pass --json
railway add --service <name> --json # add empty service; ALWAYS pass --json
railway variable list --service <svc> --json # list variables
railway variable set KEY=value --service <svc> # set a variable
railway logs --service <svc> --lines 200 --json # recent logs
railway metrics --service <svc> --since 1h --json # resource and HTTP metrics summary
railway up --detach -m "<summary>" # deploy current directory (returns at QUEUED — verify before reporting)
railway deployment list --json # poll newest deployment status after a detached up
railway bucket list --json # list buckets in current environment
railway bucket info --bucket <name> --json # bucket storage and object count
railway bucket credentials --bucket <name> --json # S3-compatible credentialsRouting
For anything beyond quick operations, load the reference that matches the user's intent. Load only what you need, one reference is usually enough, two at most.
| Intent | Reference | Use for |
|---|---|---|
| Analyze a database ("analyze <url>", "analyze db", "analyze database", "analyze service", "introspect", "check my postgres/redis/mysql/mongo") | analyze-db.md | Database introspection and performance analysis. analyze-db.md directs you to the DB-specific reference. This takes priority over the status/operate routes when a Railway URL to a database service is provided alongside "analyze". |
| Create or connect resources | setup.md | Projects, services, databases, buckets, templates, workspaces |
| Ship code or manage releases | deploy.md | Deploy, redeploy, restart, build config, monorepo, Dockerfile |
| Change configuration | configure.md | Environments, variables, config patches, domains, networking |
| Check health or debug failures | operate.md | Status, logs, metrics, build/runtime triage, recovery |
| Use a sandbox or build remotely ("sandbox", "scratch environment", "ephemeral box", "build remotely", "remote build", "run this remotely") | sandbox.md | Create/fork sandboxes, run commands remotely, remote template builds, port forwarding, teardown. Requires Sandboxes enabled in Priority Boarding — if unavailable, prompt the user to enable it. |
| Request from API, docs, or community | request.md | Railway GraphQL API queries/mutations, metrics queries, Central Station, official docs |
If the request spans two areas (for example, "deploy and then check if it's healthy"), load both references and compose one response.
Execution rules
Use Railway MCP for platform operations that match an available MCP tool.
Use the local CLI for workflows that need the current repo, local shell, SSH, database scripts, or unsupported MCP coverage.
Fall back to
scripts/railway-api.shfor operations neither MCP nor CLI exposes.Use
--jsonoutput where available for reliable parsing.Resolve context before mutation. Know which project, environment, and service you're acting on.
For destructive actions (delete service, remove deployment, drop database), confirm intent and state impact before executing.
After mutations, verify the result with a read-back command or MCP read.
Never report a deploy as successful without observing a terminal SUCCESS.
railway up --detachreturning (it prints "Build queued") and a streamingrailway upcut off by a shell timeout only confirm the build started. Pollrailway deployment list --jsonuntil the newest deployment'sstatusisSUCCESS(report deployed), orFAILED/CRASHED(triage per operate.md — do not claim success). A streamingupthat exits on its own is authoritative: exit 0 = deployed, exit 1 = failed.
User-only commands (NEVER execute directly)
These commands modify database state and require the user to run them directly in their terminal. Do NOT execute these with Bash. Instead, show the command and ask the user to run it.
| Command | Why user-only |
|---|---|
python3 scripts/enable-pg-stats.py --service <name> | Modifies shared_preload_libraries, may restart database |
python3 scripts/pg-extensions.py --service <name> install <ext> | Installs database extension |
python3 scripts/pg-extensions.py --service <name> uninstall <ext> | Removes database extension |
ALTER SYSTEM SET ... | Changes PostgreSQL configuration |
DROP EXTENSION ... | Removes database extension |
CREATE EXTENSION ... | Installs database extension |
When these operations are needed:
Explain what the command does and any side effects (e.g., restart required)
Show the exact command the user must run
Wait for user confirmation that they ran it
Verify the result with a read-only query
Composition patterns
Multi-step workflows follow natural chains:
Add object storage: setup (create bucket), setup (get credentials), configure (set S3 variables on app service)
First deploy: setup (create project + service), configure (set variables and source), deploy, operate (verify healthy)
Fix a failure: operate (triage logs), configure (fix config/variables), deploy (redeploy), operate (verify recovery)
Add a domain: configure (add domain + set port), operate (verify DNS and service health)
Docs to action: request (fetch docs answer), route to the relevant operational reference
When composing, return one unified response covering all steps. Don't ask the user to invoke each step separately.
Setup decision flow
When the user wants to create or deploy something, determine the right action from current context:
If the intent is deploy-from-cwd or signup-from-cwd, skip
railway whoamiand runrailway up(orrailway up -y) directly per Intent-based routing — it handles signup, project creation, service creation, and deploy in one chain. For other setup flows that need workspace/account context first, runrailway whoami --json; if it fails with an auth error the user has no token — route through Account creation & sign-in.Run
railway status --jsonin the current directory.If linked: add a service to the existing project (
railway add --service <name>). Do not create a new project unless the user explicitly says "new project" or "separate project".If not linked: check the parent directory (
cd .. && railway status --json).Parent linked: this is likely a monorepo sub-app. Add a service and set
rootDirectoryto the sub-app path.Parent not linked: run
railway list --jsonand look for a project matching the directory name.Match found: link to it (
railway link --project <name>).No match: create a new project (
railway init --name <name>).
When multiple workspaces exist, match by name from
railway whoami --json.
Naming heuristic: app names like "flappy-bird" or "my-api" are service names, not project names. Use the directory or repo name for the project.
Response format
For all operational responses, return:
What was done (action and scope).
The result (IDs, status, key output).
What to do next (or confirmation that the task is complete).
Keep output concise. Include command evidence only when it helps the user understand what happened.
Files
- ATTRIBUTION.mdAdded by AutoGineer828 B
- LICENSELicence file added by AutoGineer10.5 KiB
- SKILL.md26.4 KiB
- references/analyze-db-mongo.md3.9 KiB
- references/analyze-db-mysql.md12.2 KiB
- references/analyze-db-postgres.md27.8 KiB
- references/analyze-db-redis.md9.5 KiB
- references/analyze-db.md16.4 KiB
- references/configure.md12.3 KiB
- references/deploy.md9.7 KiB
- references/operate.md9.0 KiB
- references/request.md9.2 KiB
- references/sandbox.md7.0 KiB
- references/setup.md14.1 KiB
- scripts/analyze-mongo.pyScript62.5 KiB
- scripts/analyze-mysql.pyScript48.6 KiB
- scripts/analyze-postgres.pyScript143.6 KiB
- scripts/analyze-redis.pyScript42.2 KiB
- scripts/dal.pyScript23.0 KiB
- scripts/enable-pg-stats.pyScript6.1 KiB
- scripts/pg-extensions.pyScript13.0 KiB
- scripts/railway-api.shScript1.4 KiB
references/analyze-db-redis.md
Redis Analysis
This reference covers Redis-specific metrics, tuning, and analysis guidance. For common analysis patterns (output structure, collection status handling, performance thinking), see analyze-db.md.
What the Script Collects
Via SSH (INFO ALL):
Overview: version, uptime, connected/blocked clients, rejected connections
Memory: used/RSS/peak memory, fragmentation ratio, maxmemory, eviction policy
Throughput: ops/sec, total commands processed, total connections
Cache Performance: keyspace hits/misses, hit rate, expired/evicted keys
Persistence: RDB last save time/status, AOF enabled/status
Command Stats: per-command call count, avg latency, total time (sorted by calls)
Keyspace: per-database key count, expires, avg TTL
Slow Log: count via
SLOWLOG LEN+ actual entries viaSLOWLOG GET 20(command, duration, timestamp)Biggest Keys: via
redis-cli --bigkeys— runs remotely over SSH on the Railway service, not locally
Via Railway API: Same infrastructure metrics (disk, CPU, memory, network with 7d and 24h trends).
Presentation Template
Present Redis analysis using grouped stat cards that mirror the sections below. Each section is a labeled group with key-value stat cards. Flag values with status indicators (healthy/warning/critical) using the thresholds table.
Full Report (SSH + Metrics + Logs all succeeded)
Overview
| Version | Uptime | Connected Clients | Blocked Clients | Rejected Connections | Total Keys |
|---|---|---|---|---|---|
| 7.2.4 | 14d 6h | 23 | 0 | 0 | 48,291 |
Flag: blocked clients > 0 = warning, rejected connections > 0 = critical.
Memory
| Used Memory | RSS Memory | Peak Memory | Fragmentation Ratio | Max Memory | Eviction Policy |
|---|---|---|---|---|---|
| 12.4 MB | 18.2 MB | 15.1 MB | 1.47 | Unlimited | noeviction |
Flag: fragmentation > 1.5 = warning, > 2.0 or < 1.0 = critical. Evicted keys > 0 with noeviction = problem.
Throughput
| Ops/sec | Total Commands | Total Connections | Slow Log Entries |
|---|---|---|---|
| 1,240 | 8.4M | 12,491 | 3 |
Flag: slow log > 100 = warning.
Cache Performance
| Hit Rate | Hits | Misses | Expired Keys | Evicted Keys |
|---|---|---|---|---|
| 97.2% | 6.1M | 178K | 892K | 0 |
Flag: hit rate >= 95% = healthy, 80-95% = warning, < 80% = critical. Evicted > 0 = warning.
Persistence
| RDB Last Save | RDB Status | AOF Enabled | AOF Rewrite Status |
|---|---|---|---|
| 2 min ago | ok | Yes | ok |
Flag: RDB status != ok = critical. AOF rewrite status != ok = critical.
Command Stats (top 20 by calls)
| Command | Calls | Avg Latency | Total Time |
|---|---|---|---|
| GET | 4.2M | 3.1µs | 13.0s |
| SET | 2.1M | 4.8µs | 10.1s |
| HGET | 890K | 5.2µs | 4.6s |
| EXPIRE | 620K | 2.1µs | 1.3s |
Slow Log Entries (if collected — up to 20 most recent)
| # | Timestamp | Duration | Command |
|---|---|---|---|
| 1 | 2m ago | 12.3ms | GET user:session:abc123... |
| 2 | 5m ago | 10.1ms | GET cache:render:page/home... |
| 3 | 12m ago | 8.7ms | HGETALL product:catalog:main |
Analysis: correlate slow commands with command stats and big keys. If slowlog shows GET and bigkeys shows large strings, the diagnosis is "large values causing high GET latency" — confirmed without user intervention.
Biggest Keys (if collected — one per type)
| Type | Key | Size/Count |
|---|---|---|
| string | cache:render:page/dashboard | 2.1 MB |
| hash | user:sessions | 14,291 fields |
| list | queue:notifications | 8,402 items |
Analysis: large keys cause latency spikes on read/write/delete. Cross-reference with slowlog — if the slow commands target these keys, that's the root cause. If bigkeys shows nothing large (all < 1KB), latency issues are likely volume-driven, not value-size-driven.
Keyspace
| Database | Keys | Expires | Avg TTL |
|---|---|---|---|
| db0 | 48,291 | 31,204 | 2.4h |
Infrastructure (7d + 24h) — show both windows so trends can be compared:
7-Day Trends
| Metric | Current | Avg | Min | Max | Trend |
|---|---|---|---|---|---|
| CPU | 0.01 vCPU | 0.01 | 0.00 | 0.10 | stable |
| Memory | 70 MB | 40 MB | 30 MB | 90 MB | stable |
| Disk | 1.1 GB | 1.11 GB | 1.07 GB | 1.16 GB | stable |
Last 24 Hours
| Metric | Current | Avg | Min | Max | Trend |
|---|---|---|---|---|---|
| CPU | 0.01 vCPU | 0.01 | 0.00 | 0.07 | stable |
| Memory | 70 MB | 55 MB | 30 MB | 90 MB | increasing (+58%) |
| Disk | 1.1 GB | 1.11 GB | 1.07 GB | 1.16 GB | stable |
Compare: "Memory increasing in 24h but stable over 7d → temporary spike, not a sustained trend."
Do NOT show cpu_limit/memory_limit columns or utilization %. Railway auto-scales — these limits are just the ceiling. See analyze-db.md autoscale rules.
Partial Report (Introspection failed, only Metrics + Logs)
When introspection fails, you have NO Redis INFO data — all overview, memory, throughput, cache, persistence, command stats, and keyspace fields will be null/empty.
NEVER suggest running redis-cli without pointing to the remote Railway service host. There is no local Redis instance — all redis-cli commands must target the Railway service. If you cannot connect, the fix is to restore remote access (see analyze-db.md), not to run commands locally.
You MUST:
State clearly: "Redis introspection failed — could not connect to the service"
Show collection status errors
Show ONLY infrastructure metrics and log analysis — do not show empty stat card sections
Do NOT produce recommendations based on null Redis metrics
Show the infrastructure table (same as full report).
Analyze logs thoroughly:
AOF rewrite frequency and growth % triggers
fsync warnings ("disk is busy?")
OOM warnings
Connection errors
Startup/restart events (note these are normal during deploys)
Summarize with counts: "Analyzed 1000 lines: 18 AOF rewrites, 1 fsync warning, 0 errors"
State what you cannot determine without SSH:
Connection health (clients, blocked, rejected)
Memory usage and fragmentation
Cache hit rate
Eviction status
Command workload profile
Keyspace composition
Slow log entries and actual slow commands
Biggest keys per type
Redis Performance Patterns
Memory Fragmentation Pattern:
mem_fragmentation_ratio > 1.5= memory is fragmented, RSS much higher than usedCaused by frequent small key deletions creating memory holes
Fix: restart Redis, or enable
activedefrag yes(Redis 4.0+)Ratio < 1.0 means Redis is using swap — critical performance issue
Cache Thrashing Pattern:
Hit rate < 80% + evicted keys > 0 = working set exceeds maxmemory
Check maxmemory_policy —
noevictionwill reject writes,allkeys-lruwill evictIf maxmemory is 0 (unlimited), Redis will consume all RAM until OOM killed
Connection Rejection Pattern:
rejected_connections > 0 = maxclients limit hit
Check connected_clients vs maxclients default (10,000)
Blocked clients = operations waiting on BLPOP/BRPOP/WAIT
Persistence Risk Pattern:
RDB last save failed + no AOF = data loss risk on restart
Check disk space if saves are failing
Long time since last save = more data at risk
AOF Rewrite Churn Pattern:
Frequent AOF rewrites (every 1-2 hours) with high growth % triggers (100-800%)
Indicates high write-to-data-size ratio — small dataset with heavy writes
Check Fork CoW size to gauge actual data size vs AOF overhead
If rewrites are fast (<1s) and CoW is small (<10 MB), this is noisy but harmless
If rewrites are slow or CoW is large, investigate write patterns
Disk Sawtooth Pattern:
Disk usage oscillating in a regular pattern = AOF growing between rewrites, then compacting
Normal behavior — the baseline is volume overhead + AOF base file
If the amplitude is growing over time, data size is increasing
Redis Thresholds
| Metric | Healthy | Warning | Critical |
|---|---|---|---|
| Hit rate | >95% | 80-95% | <80% |
| Fragmentation ratio | 1.0-1.5 | 1.5-2.0 | >2.0 or <1.0 |
| Evicted keys | 0 | >0 | Growing rapidly |
| Blocked clients | 0 | 1-5 | >5 |
| Connected clients | <80% maxclients | 80-90% | >90% |
Redis Command Stats Analysis
The top commands by call count reveal the workload pattern:
GET/SET dominant = simple key-value cache
HGET/HSET dominant = hash-based data model (sessions, objects)
LPUSH/RPOP dominant = queue pattern
High KEYS/SCAN = application iterating keys (potential performance issue at scale)
High latency on simple commands (>100µs for GET) = memory pressure or CPU saturation
Redis Autoscale Note
See analyze-db.md for full autoscale rules. For Redis specifically:
If
maxmemoryis set, compare it against actual memory usage — not the Railway memory limit.If
maxmemoryis 0 (unlimited), Redis will grow until the OS kills it. This is the default Railway config and works fine with autoscaling — Redis uses what it needs and Railway scales the container.Do NOT recommend setting maxmemory to a fraction of the Railway memory limit — the limit is the autoscale ceiling, not fixed allocation.
Validated against
Redis INFO command, SLOWLOG LEN, SLOWLOG GET, and --bigkeys
Requirements and compatibility
Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta
“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.
Needs: Declares allowed tools, Needs an MCP server, Needs network access, Needs a command-line tool, Needs Python, Needs Node.js
Security
What our scanner noticed· Medium risk
- References to credential files
- Instructions that use the network
- Downloads piped into a shell
- Scripts that your agent may run
This skill includes scripts that your agent may run. Read them before you use it.
A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.
Attribution and licence
- Published by
- Cline
- Publisher
- Cline (Official)
- Source
- cline/skills · skills/use-railway · commit 2637846
- Licence
- Apache License 2.0 (redistribution allowed)
- LICENSE (added by AutoGineer from LICENSE)
- ATTRIBUTION.md (written by AutoGineer)
- Synced
AutoGineer is not affiliated with or endorsed by Cline or Cline.
Download ZIP
The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download use-railway.zip