railway-project-management
Railway.comでプロジェクトの立ち上げから環境構築、サービス設定、変数管理、PR環境の管理まで、鉄道インフラ全体を効率的に整理・運用するための包括的なプロジェクト管理を支援するSkill。
📜 元の英語説明(参考)
Comprehensive Railway.com project, environment, and variable management. Use when creating Railway projects, managing environments, configuring services, setting variables, syncing environments, managing PR environments, or organizing Railway infrastructure.
🇯🇵 日本人クリエイター向け解説
Railway.comでプロジェクトの立ち上げから環境構築、サービス設定、変数管理、PR環境の管理まで、鉄道インフラ全体を効率的に整理・運用するための包括的なプロジェクト管理を支援するSkill。
※ jpskill.com 編集部が日本のビジネス現場向けに補足した解説です。Skill本体の挙動とは独立した参考情報です。
下記のコマンドをコピーしてターミナル(Mac/Linux)または PowerShell(Windows)に貼り付けてください。 ダウンロード → 解凍 → 配置まで全自動。
mkdir -p ~/.claude/skills && cd ~/.claude/skills && curl -L -o railway-project-management.zip https://jpskill.com/download/9476.zip && unzip -o railway-project-management.zip && rm railway-project-management.zip
$d = "$env:USERPROFILE\.claude\skills"; ni -Force -ItemType Directory $d | Out-Null; iwr https://jpskill.com/download/9476.zip -OutFile "$d\railway-project-management.zip"; Expand-Archive "$d\railway-project-management.zip" -DestinationPath $d -Force; ri "$d\railway-project-management.zip"
完了後、Claude Code を再起動 → 普通に「動画プロンプト作って」のように話しかけるだけで自動発動します。
💾 手動でダウンロードしたい(コマンドが難しい人向け)
- 1. 下の青いボタンを押して
railway-project-management.zipをダウンロード - 2. ZIPファイルをダブルクリックで解凍 →
railway-project-managementフォルダができる - 3. そのフォルダを
C:\Users\あなたの名前\.claude\skills\(Win)または~/.claude/skills/(Mac)へ移動 - 4. Claude Code を再起動
⚠️ ダウンロード・利用は自己責任でお願いします。当サイトは内容・動作・安全性について責任を負いません。
🎯 このSkillでできること
下記の説明文を読むと、このSkillがあなたに何をしてくれるかが分かります。Claudeにこの分野の依頼をすると、自動で発動します。
📦 インストール方法 (3ステップ)
- 1. 上の「ダウンロード」ボタンを押して .skill ファイルを取得
- 2. ファイル名の拡張子を .skill から .zip に変えて展開(macは自動展開可)
- 3. 展開してできたフォルダを、ホームフォルダの
.claude/skills/に置く- · macOS / Linux:
~/.claude/skills/ - · Windows:
%USERPROFILE%\.claude\skills\
- · macOS / Linux:
Claude Code を再起動すれば完了。「このSkillを使って…」と話しかけなくても、関連する依頼で自動的に呼び出されます。
詳しい使い方ガイドを見る →- 最終更新
- 2026-05-18
- 取得日時
- 2026-05-18
- 同梱ファイル
- 1
📖 Skill本文(日本語訳)
※ 原文(英語/中国語)を Gemini で日本語化したものです。Claude 自身は原文を読みます。誤訳がある場合は原文をご確認ください。
Railway プロジェクト管理
Railway CLI を使用して、Railway.com のプロジェクト、環境、サービス、および変数を包括的に管理します。
概要
このスキルは、以下のための完全なワークフローを提供します。
- Railway プロジェクトの作成とリンク
- 環境の管理(production、staging、PR 環境)
- GitHub、Docker、またはローカルソースからのサービスの追加
- 変数の構成(service、shared、reference、sealed)
- 環境の同期と複製
- プロジェクト設定と検証
前提条件
- Railway CLI がインストールされ、認証されていること(
railway-authスキルを使用) - Git リポジトリ(GitHub 連携用)
- Docker(オプション、コンテナデプロイメント用)
ワークフロー
1. プロジェクトの作成とリンク
新しい Railway プロジェクトの作成:
# 新しいプロジェクトをインタラクティブに初期化
railway init
# 特定の名前でプロジェクトを作成
railway init --name "my-project"
# 既存のプロジェクトにリンク(インタラクティブ)
railway link
# 特定のプロジェクトを ID でリンク
railway link -p <project-id>
# 特定の環境とサービスを持つプロジェクトにリンク
railway link -p <project-id> -e <environment-id> -s <service-id>
# 現在のプロジェクトの状態を確認
railway status
プロジェクト情報:
# プロジェクトの詳細を表示
railway status
# ブラウザでプロジェクトを表示
railway open
# 現在のプロジェクトからリンクを解除
railway unlink
2. 環境管理
環境の作成と切り替え:
# すべての環境をリスト表示
railway environment
# 新しい空の環境を作成
railway environment --name staging
# 現在の環境の複製を作成
railway environment --name production-backup --duplicate
# 特定の環境に切り替え
railway environment production
# 環境を削除(インタラクティブ)
railway environment delete
環境の種類:
- Production: メインのデプロイメント環境
- Staging: 本番前テスト
- PR Environments: プルリクエストごとに自動作成
- Custom: 特定のニーズに対応する任意の名前付き環境
詳細なガイドについては、references/environment-types.md を参照してください。
3. サービス操作
さまざまなソースからサービスを追加:
# GitHub リポジトリからサービスを追加
railway add --repo owner/repo
# 現在のディレクトリからサービスを追加
railway add
# Docker イメージを追加
railway add --image postgres:15
# テンプレートを追加(例:データベース)
railway add --template postgres
サービスソース:
- GitHub: リポジトリから自動デプロイ
- Docker: コンテナイメージをデプロイ
- Local: 現在のディレクトリからデプロイ
- Templates: 事前構成されたサービス(データベースなど)
詳細な構成については、references/service-sources.md を参照してください。
4. 変数管理
異なるスコープで変数を設定:
# サービス変数を設定(現在のサービスのみ)
railway variables set API_KEY=secret123
# 共有変数を設定(環境内のすべてのサービス)
railway variables set --shared DATABASE_URL=postgres://...
# シールド変数を設定(セキュリティ強化)
railway variables set --sealed STRIPE_KEY=sk_live_...
# 別のサービスから変数を参照
railway variables set API_URL='${{ api-service.PUBLIC_URL }}'
# 変数を削除
railway variables delete API_KEY
# すべての変数をリスト表示
railway variables list
変数の種類:
- Service Variables: 特定のサービスに分離
- Shared Variables: 環境内のすべてのサービスで利用可能
- Reference Variables:
${{ service.VAR }}構文を使用して他のサービス変数を参照 - Sealed Variables: セキュリティが強化され、作成後にアンシールまたは表示できません
変数のスコープ:
Project
├── Environment (production)
│ ├── Service A
│ │ ├── Service variables (API_KEY)
│ │ └── Can access shared variables
│ ├── Service B
│ │ ├── Service variables (DB_PASSWORD)
│ │ └── Can access shared variables
│ └── Shared variables (LOG_LEVEL, NODE_ENV)
高度なパターンについては、references/variable-scoping.md を参照してください。
5. 構成と設定
プロジェクト設定:
# ブラウザでプロジェクト設定を表示
railway open --settings
# PR 環境を有効/構成
# (ダッシュボード経由 - PR ごとに自動化)
# デプロイメントトリガーを構成
# (ダッシュボード経由 - ブランチフィルター、パス)
サービス設定:
# ブラウザでサービスを表示
railway open
# railway.json または railway.toml 経由で構成
cat > railway.json <<EOF
{
"build": {
"builder": "NIXPACKS",
"buildCommand": "npm run build"
},
"deploy": {
"startCommand": "npm start",
"healthcheckPath": "/health",
"restartPolicyType": "ON_FAILURE"
}
}
EOF
高度な構成:
- ヘルスチェックと再起動ポリシー
- リソース制限(CPU、メモリ)
- カスタムビルドコマンド
- ルートディレクトリのオーバーライド
- ネットワークとドメイン
6. 検証
プロジェクト設定の検証:
# プロジェクトの状態を確認
railway status
# すべての環境をリスト表示
railway environment
# サービスをリスト表示
railway list
# 変数を確認
railway variables list
# ログを表示
railway logs
# ブラウザで開いて視覚的に検証
railway open
一般的な検証チェック:
- ✅ プロジェクトが正しくリンクされている
- ✅ 環境が作成されている(production、staging)
- ✅ サービスが正常にデプロイされている
- ✅ 変数が正しいスコープで設定されている
- ✅ PR 環境が有効になっている(必要な場合)
- ✅ すべてのサービスが正常である
一般的なワークフロー
新しいフルスタックプロジェクトの初期化
自動化スクリプトを使用します。
.claude/skills/railway-project-management/scripts/init-project.sh
または手動で:
# 1. プロジェクトを初期化
railway init --name my-app
# 2. 環境を作成
railway environment --name staging
railway environment --name production
# 3. サービスを追加(production 環境で)
railway environment production
railway add --repo owner/frontend-repo
railway add --repo owner/api-repo
railway add --template postgres
# 4. 共有変数を設定
railway variables set --shared NODE_ENV=production
railway variables set --shared LOG_LEVEL=info
# 5. staging 環境に複製
railway environment staging
# (staging 環境固有の変数を設定)
# 6. En
(原文がここで切り詰められています) 📜 原文 SKILL.md(Claudeが読む英語/中国語)を展開
Railway Project Management
Comprehensive management of Railway.com projects, environments, services, and variables using the Railway CLI.
Overview
This skill provides complete workflows for:
- Creating and linking Railway projects
- Managing environments (production, staging, PR environments)
- Adding services from GitHub, Docker, or local sources
- Configuring variables (service, shared, reference, sealed)
- Syncing and duplicating environments
- Project settings and validation
Prerequisites
- Railway CLI installed and authenticated (use
railway-authskill) - Git repository (for GitHub integrations)
- Docker (optional, for container deployments)
Workflow
1. Project Creation and Linking
Create new Railway project:
# Initialize new project interactively
railway init
# Create project with specific name
railway init --name "my-project"
# Link to existing project (interactive)
railway link
# Link to specific project by ID
railway link -p <project-id>
# Link to project with specific environment and service
railway link -p <project-id> -e <environment-id> -s <service-id>
# Check current project status
railway status
Project information:
# View project details
railway status
# View project in browser
railway open
# Unlink from current project
railway unlink
2. Environment Management
Create and switch environments:
# List all environments
railway environment
# Create new empty environment
railway environment --name staging
# Create duplicate of current environment
railway environment --name production-backup --duplicate
# Switch to specific environment
railway environment production
# Delete environment (interactive)
railway environment delete
Environment types:
- Production: Main deployment environment
- Staging: Pre-production testing
- PR Environments: Auto-created per pull request
- Custom: Any named environment for specific needs
See references/environment-types.md for detailed guide.
3. Service Operations
Add services from different sources:
# Add service from GitHub repository
railway add --repo owner/repo
# Add service from current directory
railway add
# Add Docker image
railway add --image postgres:15
# Add template (e.g., database)
railway add --template postgres
Service sources:
- GitHub: Auto-deploy from repository
- Docker: Deploy container images
- Local: Deploy from current directory
- Templates: Pre-configured services (databases, etc.)
See references/service-sources.md for detailed configurations.
4. Variable Management
Set variables at different scopes:
# Set service variable (current service only)
railway variables set API_KEY=secret123
# Set shared variable (all services in environment)
railway variables set --shared DATABASE_URL=postgres://...
# Set sealed variable (enhanced security)
railway variables set --sealed STRIPE_KEY=sk_live_...
# Reference variable from another service
railway variables set API_URL='${{ api-service.PUBLIC_URL }}'
# Delete variable
railway variables delete API_KEY
# List all variables
railway variables list
Variable types:
- Service Variables: Isolated to specific service
- Shared Variables: Available to all services in environment
- Reference Variables: Reference other service variables using
${{ service.VAR }}syntax - Sealed Variables: Enhanced security, cannot be unsealed or viewed after creation
Variable scoping:
Project
├── Environment (production)
│ ├── Service A
│ │ ├── Service variables (API_KEY)
│ │ └── Can access shared variables
│ ├── Service B
│ │ ├── Service variables (DB_PASSWORD)
│ │ └── Can access shared variables
│ └── Shared variables (LOG_LEVEL, NODE_ENV)
See references/variable-scoping.md for advanced patterns.
5. Configuration and Settings
Project settings:
# View project settings in browser
railway open --settings
# Enable/configure PR environments
# (Done via dashboard - automated per PR)
# Configure deployment triggers
# (Done via dashboard - branch filters, paths)
Service settings:
# View service in browser
railway open
# Configure via railway.json or railway.toml
cat > railway.json <<EOF
{
"build": {
"builder": "NIXPACKS",
"buildCommand": "npm run build"
},
"deploy": {
"startCommand": "npm start",
"healthcheckPath": "/health",
"restartPolicyType": "ON_FAILURE"
}
}
EOF
Advanced configuration:
- Health checks and restart policies
- Resource limits (CPU, memory)
- Custom build commands
- Root directory overrides
- Networking and domains
6. Verification and Validation
Verify project setup:
# Check project status
railway status
# List all environments
railway environment
# List services
railway list
# Check variables
railway variables list
# View logs
railway logs
# Open in browser for visual verification
railway open
Common validation checks:
- ✅ Project linked correctly
- ✅ Environments created (production, staging)
- ✅ Services deployed successfully
- ✅ Variables set at correct scope
- ✅ PR environments enabled (if needed)
- ✅ All services healthy
Common Workflows
Initialize New Full-Stack Project
Use the automation script:
.claude/skills/railway-project-management/scripts/init-project.sh
Or manually:
# 1. Initialize project
railway init --name my-app
# 2. Create environments
railway environment --name staging
railway environment --name production
# 3. Add services (in production)
railway environment production
railway add --repo owner/frontend-repo
railway add --repo owner/api-repo
railway add --template postgres
# 4. Set shared variables
railway variables set --shared NODE_ENV=production
railway variables set --shared LOG_LEVEL=info
# 5. Replicate to staging
railway environment staging
# (Set staging-specific variables)
# 6. Enable PR environments (via dashboard)
railway open --settings
Sync Variables Between Environments
Use the automation script:
.claude/skills/railway-project-management/scripts/sync-env.sh production staging
Add Database to Existing Project
# 1. Switch to desired environment
railway environment production
# 2. Add database template
railway add --template postgres
# 3. Set shared DATABASE_URL
# (Usually auto-set by Railway)
# 4. Reference in other services
railway variables set DATABASE_URL='${{ postgres.DATABASE_URL }}'
Configure PR Environments
# 1. Enable in project settings
railway open --settings
# 2. Configure PR environment settings:
# - Base environment to duplicate
# - Services to include
# - Variable handling
# 3. PR environments auto-create on new PRs
# - Each PR gets isolated environment
# - Auto-deploys on PR updates
# - Auto-deletes on PR close/merge
Reference Variables Pattern
# Service A exposes PUBLIC_URL
railway variables set --service api-service PUBLIC_URL=https://api.railway.app
# Service B references it
railway variables set --service frontend API_URL='${{ api-service.PUBLIC_URL }}'
# Service C uses multiple references
railway variables set --service worker \
API_URL='${{ api-service.PUBLIC_URL }}' \
DB_URL='${{ postgres.DATABASE_URL }}'
Benefits:
- DRY (Don't Repeat Yourself)
- Auto-updates when source changes
- Type-safe service connections
- Clear dependency graph
Security Best Practices
Sealed Variables
# Use sealed for production secrets
railway environment production
railway variables set --sealed STRIPE_SECRET_KEY=sk_live_...
railway variables set --sealed AWS_SECRET_ACCESS_KEY=...
# Regular variables for non-sensitive config
railway variables set --shared NODE_ENV=production
When to use sealed variables:
- API keys and secrets
- Database passwords
- OAuth client secrets
- Encryption keys
- Any sensitive credential
Sealed variable characteristics:
- Cannot be viewed after creation (not even in UI)
- Cannot be unsealed
- Can only be overwritten or deleted
- Enhanced security for compliance
Variable Organization
# Shared variables: Cross-service configuration
railway variables set --shared NODE_ENV=production
railway variables set --shared LOG_LEVEL=info
railway variables set --shared REGION=us-west-2
# Service variables: Service-specific config
railway variables set --service api PORT=3000
railway variables set --service api API_VERSION=v1
# Sealed variables: Secrets
railway variables set --sealed DATABASE_PASSWORD=...
railway variables set --sealed JWT_SECRET=...
Environment Strategies
Strategy 1: Production + Staging
production (main branch)
├── All services
├── Production data
└── Sealed secrets
staging (develop branch)
├── All services
├── Test data
└── Staging secrets
Strategy 2: Production + PR Environments
production (main branch)
├── All services
└── Production data
PR-123 (auto-created)
├── All services (from production template)
├── Isolated test data
└── Auto-deploys on PR updates
Strategy 3: Multi-Environment Pipeline
development → staging → production
↓ ↓ ↓
Dev data Test data Prod data
Dev URLs Stage URLs Prod URLs
Troubleshooting
Project Not Linked
# Symptom: "No project linked"
# Solution:
railway link
# Or specify project ID:
railway link -p abc123
Wrong Environment
# Check current environment
railway status
# Switch to correct environment
railway environment production
Variable Not Found
# List all variables to verify
railway variables list
# Check variable scope (service vs shared)
railway variables list --service api
railway variables list --shared
# Set if missing
railway variables set VAR_NAME=value
Service Not Deploying
# Check deployment logs
railway logs --deployment
# Check service status
railway status
# Redeploy
railway up
Related Skills
- railway-auth: Authenticate with Railway CLI
- railway-deployment: Deploy services and manage deployments
- railway-troubleshooting: Debug Railway issues
- railway-cli: Core Railway CLI operations
- railway-observability: Monitor Railway services
Quick Reference
Project Operations
| Command | Description |
|---|---|
railway init |
Initialize new project |
railway link |
Link to existing project |
railway unlink |
Unlink current project |
railway status |
Show project status |
railway open |
Open project in browser |
Environment Operations
| Command | Description |
|---|---|
railway environment |
List/switch environments |
railway environment --name <name> |
Create new environment |
railway environment --duplicate |
Duplicate current environment |
railway environment delete |
Delete environment |
Service Operations
| Command | Description |
|---|---|
railway add |
Add service from current directory |
railway add --repo <owner/repo> |
Add from GitHub |
railway add --image <image> |
Add Docker image |
railway add --template <name> |
Add template service |
railway list |
List all services |
Variable Operations
| Command | Description |
|---|---|
railway variables set KEY=value |
Set service variable |
railway variables set --shared KEY=value |
Set shared variable |
railway variables set --sealed KEY=value |
Set sealed variable |
railway variables delete KEY |
Delete variable |
railway variables list |
List all variables |
Additional Resources
-
References:
references/environment-types.md: Detailed environment guidereferences/variable-scoping.md: Variable scoping patternsreferences/service-sources.md: Service deployment sources
-
Scripts:
scripts/init-project.sh: Initialize complete projectscripts/sync-env.sh: Sync variables between environments
-
Railway Documentation: