davila7/claude-code-templates/environment
- community
Checking that the SKILL.md file is still in the repository.
Query, stage, and apply configuration changes for Railway environments. Use for ANY variable or env var operations, service configuration (source, build settings, deploy settings), lifecycle (delete service), and applying changes. Prefer over railway-status skill for any configuration or variable queries.
Install
npx vskill@latest install davila7/claude-code-templates/environmentSKILL.md
Environment Configuration
Query, stage, and apply configuration changes for Railway environments.
Shell Escaping
CRITICAL: When running GraphQL queries via bash, you MUST wrap in heredoc to prevent shell escaping issues:
Without the heredoc wrapper, multi-line commands break and exclamation marks in GraphQL non-null types get escaped, causing query failures.
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 railway-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
- User says "apply changes", "commit changes", "deploy changes"
- Auto-fixing build errors detected in logs
Create Environment
Create a new environment in the linked project:
Duplicate an existing environment:
With service-specific variables:
Switch Environment
Link a different environment to the current directory:
Or by ID:
Get Context
Extract:
project.id- for service lookupenvironment.id- for the mutationsservice.id- default service if user doesn't specify one
Resolve Service ID
If user specifies a service by name, query project services:
Match the service name (case-insensitive) to get the service ID.
Query Configuration
Fetch current environment configuration and staged changes.
Example:
Response Structure
The config field contains current configuration:
The patch field in environmentStagedChanges contains pending changes. The effective configuration is the base config merged with the staged patch.
For complete field reference, see reference/environment-config.md.
For variable syntax and service wiring patterns, see reference/variables.md.
Get Rendered Variables
The GraphQL queries above return 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:
When to use:
- Debugging connection issues (see actual URLs/ports)
- Verifying variable resolution is correct
- Viewing Railway-injected values (RAILWAY_*)
Stage Changes
Stage configuration changes via the environmentStageChanges mutation. Use merge: true to automatically merge with existing staged changes.
Important: Always use variables (not inline input) because service IDs are UUIDs which can't be used as unquoted GraphQL object keys.
Example:
Delete Service
Use isDeleted: true:
Stage and Apply Immediately
For single changes that should deploy right away, use environmentPatchCommit to stage and apply in one call.
Example:
When to use: Single change, no need to batch, user wants immediate deployment.
When NOT to use: Multiple related changes to batch, or user says "stage only" / "don't deploy yet".
Apply Staged Changes
Commit staged changes and trigger deployments.
Note: There is no railway apply CLI command. Use the mutation below or direct users to the web UI.
Apply Mutation
Mutation name: `environmentPatchCommitStaged`
Example:
Parameters
| Field | Type | Default | Description | |
|---|---|---|---|---|
environmentId | String! | - | Environment ID from status | |
message | String | null | Short description of changes | |
skipDeploys | Boolean | false | Skip deploys (only if user explicitly asks) |
Commit Message
Keep very short - one sentence max. Examples:
- "set build command to fix npm error"
- "add API_KEY variable"
- "increase replicas to 3"
Leave empty if no meaningful description.
Default Behavior
Always deploy unless user explicitly asks to skip. Only set skipDeploys: true if user says "apply without deploying", "commit but don't deploy", or "skip deploys".
Returns a workflow ID (string) on success.
Auto-Apply Behavior
By default, apply changes immediately.
Flow
Single change: Use environmentPatchCommit to stage and apply in one call.
Multiple changes or batching: Use environmentStageChanges with merge: true for each change, then environmentPatchCommitStaged to apply.
When NOT to Auto-Apply
- User explicitly says "stage only", "don't deploy yet", or similar
- User is making multiple related changes that should deploy together
When you don't auto-apply, tell the user:
Changes staged. Apply them at: https://railway.com/project/{projectId}Or ask me to apply them.
Get projectId from railway status --json → project.id
Error Handling
Service Not Found
No Staged Changes
There are no staged changes to commit. Stage changes first.
Invalid Configuration
Common issues:
buildCommandandstartCommandcannot be identicalbuildCommandonly valid with NIXPACKS builderdockerfilePathonly valid with DOCKERFILE builder
No Permission
No Linked Project
Composability
- Create service: Use railway-service skill
- View logs: Use railway-deployment skill
- Add domains: Use railway-domain skill
- Deploy local code: Use railway-deploy skill
Security
- Security scanPassed, 90 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingcli-tool/components/skills/railway/environment/SKILL.md
Popularity
- Repository stars
- 23,431
- Repository forks
- 2,247
- Repository npm downloads, 7 days
- 3,146
- 7-day trend score
- 70
Stars and forks are for the whole GitHub repository, not this skill alone. Downloads are for the repository's npm package. Refreshed 23 Mar 2026, 7 months ago.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/davila7/claude-code-templates/environment)