Token导航 LogoToken导航TokenDH.com
开发敏感数据github未标认证来源可访问clear审计异常

environmentenvironment 命令行

Agent Skill

environment 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

19,663

周安装

836

GitHub Stars

253

下载量

6,889
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:environment(environment 命令行)
来源仓库:https://github.com/railwayapp/railway-skills
仓库路径:skills/environment
安装命令:
npx skills add https://github.com/railwayapp/railway-skills --skill environment
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/railwayapp/railway-skills --skill environment

简介

读取和编辑 Railway 环境配置、变量、构建设置和服务部署参数。

  • 通过铁路环境配置 --json 获取当前环境配置,包括源、构建/部署设置、变量和网络
  • 创建新环境、使用可选的特定于服务的变量覆盖复制现有环境或在环境之间切换
  • 使用 JSON 补丁自动编辑配置:设置构建/启动命令、添加/更新/删除变量、更改副本计数、连接 GitHub 存储库或删除服务
  • 使用铁路变量 --json 在运行时查看渲染(解析)的变量值
  • 调试连接问题并验证变量解析

SKILL.md

Environment Configuration

Read and edit Railway environment configuration using the CLI.

Prerequisites

Requires Railway CLI v4.27.3+. Check with:

railway --version

If below 4.27.3, upgrade:

railway upgrade

Quick Actions

When user asks "what's the config" or "show configuration":

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:

railway environment new <name>

Duplicate an existing environment:

railway environment new staging --duplicate production

With service-specific variables:

railway environment new staging --duplicate production --service-variable api PORT=3001

Switch Environment

Link a different environment to the current directory:

railway environment <name>

Or by ID:

railway environment <environment-id>

Get Context

JSON output — project/environment IDs and service list:

railway status --json

Extract:

  • project.id — project ID
  • environment.id — environment ID

Plain output — linked service name:

railway status

Shows Service: <name> line with the currently linked service.

Resolve Service ID

Get service IDs from the environment config:

railway environment config --json | jq '.services | keys'

Map service IDs to names via status:

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:

railway environment config --json

Response Structure

{
  "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.

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

Get Rendered Variables

environment config returns unrendered variables — template syntax like ${{shared.DOMAIN}} is preserved. This is correct for management/editing.

To see rendered (resolved) values as they appear at runtime:

# Current linked service
railway variables --json

# Specific service
railway variables --service <service-name> --json

When to use:

  • Debugging connection issues (see actual URLs/ports)
  • Verifying variable resolution is correct
  • Viewing Railway-injected values (RAILWAY_*)

Edit Configuration

Pass a JSON patch to railway environment edit to apply changes. The patch is merged with existing config and committed immediately, triggering deploys.

railway environment edit --json <<< '<json-patch>'

With a commit message:

railway environment edit -m "description of change" --json <<< '<json-patch>'

Examples

Set build command:

railway environment edit --json <<< '{"services":{"SERVICE_ID":{"build":{"buildCommand":"npm run build"}}}}'

Add variable:

railway environment edit -m "add API_KEY" --json <<< '{"services":{"SERVICE_ID":{"variables":{"API_KEY":{"value":"secret"}}}}}'

Delete variable:

railway environment edit --json <<< '{"services":{"SERVICE_ID":{"variables":{"OLD_VAR":null}}}}'

Delete service:

railway environment edit --json <<< '{"services":{"SERVICE_ID":{"isDeleted":true}}}'

Set replicas:

railway environment edit --json <<< '{"services":{"SERVICE_ID":{"deploy":{"multiRegionConfig":{"us-west2":{"numReplicas":3}}}}}}'

Add shared variable:

railway environment edit --json <<< '{"sharedVariables":{"DATABASE_URL":{"value":"postgres://..."}}}'

Batching Multiple Changes

Include multiple fields in a single patch to apply them atomically:

railway environment edit -m "configure build, start, and env" --json <<< '{"services":{"SERVICE_ID":{"build":{"buildCommand":"npm run build"},"deploy":{"startCommand":"npm start"},"variables":{"NODE_ENV":{"value":"production"}}}}}'

Error Handling

Command Not Found

If railway environment edit is not recognized, upgrade the CLI:

railway upgrade

Service Not Found

Service "foo" not found in project. Available services: api, web, worker

Invalid Configuration

Common issues:

  • buildCommand and startCommand cannot be identical
  • buildCommand only valid with NIXPACKS builder
  • dockerfilePath only valid with DOCKERFILE builder

No Permission

You don't have permission to modify this environment. Check your Railway role.

No Linked Project

No project linked. Run `railway link` to link a project.

Composability

  • Create service: Use service skill
  • View logs: Use deployment skill
  • Add domains: Use domain skill
  • Deploy local code: Use deploy skill

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

25.17%
按下载量换算1,734

Cursor

23.35%
按下载量换算1,609

OpenCode

17.87%
按下载量换算1,231

Codex

12.2%
按下载量换算840

Gemini CLI

7.6%
按下载量换算524

Antigravity

3.26%
按下载量换算225

安全审计

Gen Agent Trust Hub

未通过

Socket

通过

Snyk

未通过

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。

来源信息

继续浏览同类 Skills