
Environment
Inspect or change Railway service variables, build/deploy settings, replicas, and repo connections without clicking through the dashboard blindly.
Overview
Environment is an agent skill for the Operate phase that reads and edits Railway environment configuration—variables, build/deploy settings, replicas, and repo connections—via the Railway CLI.
Install
npx skills add https://github.com/railwayapp/railway-skills --skill environmentWhat is this skill?
- Primary read path: railway environment config --json for source, build, deploy, and per-service variables
- Resolved secrets view: railway variables --json for rendered variable values
- Covers create, duplicate, and switch environments (e.g., production to staging)
- Service operations: connect GitHub repo, change Docker image/branch/commit/root directory
- Requires Railway CLI v4.27.3+ with documented upgrade path via railway upgrade
- Requires Railway CLI v4.27.3 or newer
- Documented commands include railway environment config --json and railway variables --json
Adoption & trust: 841 installs on skills.sh; 274 GitHub stars; 1/3 security scanners passed (skills.sh audits).
What problem does it solve?
You cannot see how Railway services are wired or which env vars are set without opening five dashboard screens or risking a bad manual edit.
Who is it for?
Solo founders running a Railway-hosted SaaS or API who live in the terminal and need fast config audits or staging clones.
Skip if: Teams on other hosts (Fly, Vercel-only static) or infra defined entirely outside Railway with no CLI linked project.
When should I use this skill?
User asks what's the config, show configuration, what variables are set, environment config, service config, railway config, or wants to add/set/delete variables, change build/deploy settings, scale replicas, connect rep
What do I get? / Deliverables
You get JSON-backed visibility into each service’s config and can apply variable and deploy changes through documented CLI commands.
- Structured JSON summary of environment, build, deploy, and variables per service
- Applied CLI changes for variables, source, replicas, or environment lifecycle actions the user requested
Recommended Skills
Journey fit
Operate is the canonical shelf because the skill is triggered by live configuration—“what’s the config”, env vars, scaling, and service wiring—not greenfield app coding. Infra matches environment duplication, variable management, deploy settings, domains, and health checks on running Railway projects.
How it compares
CLI-first Railway ops skill—not a generic DevOps playbook and not an MCP server abstraction over the dashboard.
Common Questions / FAQ
Who is environment for?
Indie builders and small teams on Railway who want their coding agent to show or change live service configuration safely via the Railway CLI.
When should I use environment?
Use it in Operate when someone asks what's the config, what variables are set, to duplicate environments, scale replicas, connect repos, or adjust build and deploy settings on Railway.
Is environment safe to install?
Check the Security Audits panel on this page; the skill allows Bash(railway:*) so review CLI scope and avoid exposing rendered secrets in public logs.
SKILL.md
READMESKILL.md - Environment
# Environment Configuration Read and edit Railway environment configuration using the CLI. ## Prerequisites Requires Railway CLI **v4.27.3+**. Check with: ```bash railway --version ``` If below 4.27.3, upgrade: ```bash railway upgrade ``` ## Quick Actions **When user asks "what's the config" or "show configuration":** ```bash railway environment config --json ``` Present: source (repo/image), build settings, deploy settings, variables per service. **When user asks "what variables" or "show env vars":** Same command — `railway environment config --json` includes variables per service and shared variables. For **rendered** (resolved) variable values: `railway variables --json` ## When to Use - User wants to create a new environment - User wants to duplicate an environment (e.g., "copy production to staging") - User wants to switch to a different environment - User asks about current build/deploy settings, variables, replicas, health checks, domains - User asks to change service source (Docker image, branch, commit, root directory) - User wants to connect a service to a GitHub repo - User wants to deploy from a GitHub repo (create empty service first via `new` skill, then use this) - User asks to change build or start command - User wants to add/update/delete environment variables - User wants to change replica count or configure health checks - User asks to delete a service, volume, or bucket - Auto-fixing build errors detected in logs ## Create Environment Create a new environment in the linked project: ```bash railway environment new <name> ``` Duplicate an existing environment: ```bash railway environment new staging --duplicate production ``` With service-specific variables: ```bash railway environment new staging --duplicate production --service-variable api PORT=3001 ``` ## Switch Environment Link a different environment to the current directory: ```bash railway environment <name> ``` Or by ID: ```bash railway environment <environment-id> ``` ## Get Context **JSON output** — project/environment IDs and service list: ```bash railway status --json ``` Extract: - `project.id` — project ID - `environment.id` — environment ID **Plain output** — linked service name: ```bash railway status ``` Shows `Service: <name>` line with the currently linked service. ### Resolve Service ID Get service IDs from the environment config: ```bash railway environment config --json | jq '.services | keys' ``` Map service IDs to names via status: ```bash railway status --json ``` The `project.services` array contains `{ id, name }` for each service. Match against the service keys from `environment config`. ## Read Configuration Fetch current environment configuration: ```bash railway environment config --json ``` ### Response Structure ```json { "services": { "<serviceId>": { "source": { "repo": "...", "branch": "main" }, "build": { "buildCommand": "npm run build", "builder": "NIXPACKS" }, "deploy": { "startCommand": "npm start", "multiRegionConfig": { "us-west2": { "numReplicas": 1 } } }, "variables": { "NODE_ENV": { "value": "production" } }, "networking": { "serviceDomains": {}, "customDomains": {} } } }, "sharedVariables": { "DATABASE_URL": { "value": "..." } } } ``` For complete field reference, see [reference/environment-config.md](references/environment-config.md). For variable syntax and service wiring patterns, see [reference/variables.md](references/variables.md). ## Get Rendered Variables `environment config` returns **unrendered** variables — template syntax like `${{