Skillpedia
النشر والسحابة (DevOps)33k · #8907

railway-environment

ما الذي تفعله

تقرأ هذه المهارة إعدادات مشروع Railway وتغيّرها، بما في ذلك المتغيرات وإعدادات البناء والنشر والنطاقات. وهي مناسبة للمطورين الذين يديرون إعداد Railway بالتفصيل.

متى تستخدمها

  • ✓عندما تريد إضافة متغير بيئة أو تحديثه أو حذفه في Railway.
  • ✓عندما تحتاج إلى تغيير أمر البناء أو أمر التشغيل أو مصدر الخدمة.
  • ✓عندما تريد تطبيق تغييرات إعداد مجهزة على بيئة Railway.

رابط المهارة

https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/railway/environment/SKILL.md

انسخه والصقه في الذكاء الاصطناعي الذي تستخدمه (Claude أو ChatGPT أو Cursor) واطلب منه اتباع التعليمات.

طريقة الاستخدام

أسهل طريقة: انسخ الرسالة والصقها في الذكاء الاصطناعي الذي تستخدمه. سيقرأ المهارة وينفّذ تعليماتها.

رسالة جاهزة للصق

استخدم هذه المهارة لمساعدتي: https://github.com/davila7/claude-code-templates/blob/main/cli-tool/components/skills/railway/environment/SKILL.md اقرأ ملف SKILL.md في هذا الرابط ونفّذ تعليماته لمهمتي.
تريد أن يجد الذكاء الاصطناعي مهارات مثل هذه بنفسه؟ثبّت خادم Skillpedia MCP المجاني: سطر واحد، ويبحث في 15,000+ مهارة قبل كل مهمة.ثبّته في دقيقة واحدة →

مثال على ما تطلبه من الذكاء الاصطناعي

“أضف متغير DATABASE_URL إلى خدمة الـ API لدي على Railway، وطبّق التغيير.”

5 مهارات جديدة كل أسبوع. قراءة في دقيقة واحدة.

كيف تعمل

يستعلم وكيلك إعداد البيئة، ويجهز التغيير الذي تطلبه ثم يطبقه. ويتعامل أيضا مع النسخ المتماثلة وفحوص الصحة وحذف الخدمات أو الأحجام (volumes) عندما تطلب ذلك.

المحتوى التقني (ملف SKILL.md الأصلي)

النص الأصلي من المؤلف، مباشرة من GitHub.

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:

bash <<'SCRIPT'
${CLAUDE_PLUGIN_ROOT}/skills/lib/railway-api.sh 'query ...' '{"var": "value"}'
SCRIPT

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:

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

railway status --json

Extract:

  • project.id - for service lookup
  • environment.id - for the mutations
  • service.id - default service if user doesn't specify one

Resolve Service ID

If user specifies a service by name, query project services:

query projectServices($projectId: String!) {
  project(id: $projectId) {
    services {
      edges {
        node {
          id
          name
        }
      }
    }
  }
}

Match the service name (case-insensitive) to get the service ID.

Query Configuration

Fetch current environment configuration and staged changes.

query environmentConfig($environmentId: String!) {
  environment(id: $environmentId) {
    id
    config(decryptVariables: false)
    serviceInstances {
      edges {
        node {
          id
          serviceId
        }
      }
    }
  }
  environmentStagedChanges(environmentId: $environmentId) {
    id
    patch(decryptVariables: false)
  }
}

Example:

bash <<'SCRIPT'
${CLAUDE_PLUGIN_ROOT}/skills/lib/railway-api.sh \
  'query envConfig($envId: String!) {
    environment(id: $envId) { id config(decryptVariables: false) }
    environmentStagedChanges(environmentId: $envId) { id patch(decryptVariables: false) }
  }' \
  '{"envId": "ENV_ID"}'
SCRIPT

Response Structure

The config field contains current configuration:

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

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:

# Current linked service
railway variables --json

# Specific service
railway variables --service <s
الأسئلة الشائعة

هل يستطيع حذف خدمة؟

نعم، عندما تطلب ذلك. تتعامل المهارة مع حذف الخدمات ضمن إجراءات دورة حياتها.

هل هي المهارة الصحيحة للمتغيرات؟

نعم. تقول المهارة إنها المهارة المفضلة لأي استعلام عن المتغيرات أو الإعدادات.

هل تستطيع نسخ بيئة؟

نعم. تغطي إنشاء البيئات وتكرار بيئة، مثل نسخ الإنتاج إلى بيئة التجربة.

التفاصيل

الوصف الأصلي من المؤلف

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.

repo: davila7/claude-code-templates

الشعبية

نجوم GitHub
33k
الترتيب
#8907
الترخيص
MIT
آخر تحديث
2‏/11‏/2026

هل هذه المهارة مفيدة؟

0

سجّل الدخول للتصويت.

التعليقات

  • …

المزيد من المهارات من هذا المستودع

مهارات مشابهة