Operate Railway infrastructure: create projects, provision services and databases, deploy code, configure environments and variables, manage domains, troubleshoot failures, check status and metrics, and query Railway docs. Use this skill whenever the user mentions Railway, deployments, services, environments, build failures, or infrastructure operations, even if they don't say "Railway" explicitly.
Railway organizes infrastructure in a hierarchy:
production, staging). Each environment has its own variables, config, and deployment history.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.
Before any mutation, verify context:
command -v railway # CLI installed
railway whoami --json # authenticated
railway --version # check CLI version
railway status --json # linked project/environment/service
If the CLI is missing, guide the user to install it.
bash <(curl -fsSL cli.new) # Shell script (macOS, Linux, Windows via WSL)
brew install railway # Homebrew (macOS)
npm i -g @railway/cli # npm (macOS, Linux, Windows). Requires Node.js version 16 or higher.
If not authenticated, run railway login. If not linked, 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 upgrade
These are frequent enough to handle without loading a reference:
railway status --json # current context
railway whoami --json # auth and workspace info
railway project list --json # list projects
railway service status --all --json # all services in current context
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 up --detach -m "<summary>" # deploy current directory
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 |
|---|---|---|
| Create or connect resources | setup.md | Projects, services, databases, 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 |
| 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.
scripts/railway-api.sh for operations the CLI doesn't expose.--json output where available for reliable parsing.Multi-step workflows follow natural chains:
When composing, return one unified response covering all steps. Don't ask the user to invoke each step separately.
When the user wants to create or deploy something, determine the right action from current context:
railway status --json in the current directory.railway add --service <name>). Do not create a new project unless the user explicitly says "new project" or "separate project".cd .. && railway status --json).
rootDirectory to the sub-app path.railway list --json and look for a project matching the directory name.
railway link --project <name>).railway init --name <name>).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.
For all operational responses, return:
Keep output concise. Include command evidence only when it helps the user understand what happened.