production
Production debugging assistant for Railway-hosted apps, emphasizing safe access and env var management.
Install
mkdir -p .claude/skills/production && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/14712" && unzip -o skill.zip -d .claude/skills/production && rm skill.zipInstalls to .claude/skills/production
Activation
This is the description your AI agent reads to decide when to run this skill — the better it matches your request, the more reliably it fires.
Production debugging guidance for diplicity-react — Railway CLI token conflict pattern, pgweb queries, write safety rules, and staging environments. Use when debugging production issues, querying the production database, or deploying PR staging environments.Key capabilities
- →Manage Railway CLI tokens for account-scoped and project-scoped commands
- →Query the production database using pgweb
- →Deploy PR staging environments with cloned production databases
- →Access Railway deployment health and logs
- →Filter Railway logs by error or endpoint
- →Enforce write safety rules when interacting with the live production database
How it works
The skill provides guidance and commands for interacting with Railway deployments and the production database, emphasizing token management, read-only operations, and staging environment deployment.
Inputs & outputs
When to use production
- →Debugging production env var conflicts
- →Safely querying live databases
- →Troubleshooting Railway service deployments
About this skill
Production Debugging
App deployed on Railway (project: devoted-rejoicing, service: diplicity-react).
Railway CLI — Token Conflict
Two tokens, different scopes:
| Variable | Scope | Used for |
|---|---|---|
RAILWAY_API_TOKEN | Account | whoami, status, logs |
RAILWAY_TOKEN | Project | railway run (inject prod env vars) |
When both are set, Railway CLI v5 gives RAILWAY_TOKEN priority for all commands, breaking account-scoped ones with "Unauthorized". Always unset the irrelevant token:
# Account-scoped
env -u RAILWAY_TOKEN railway whoami
env -u RAILWAY_TOKEN railway status
env -u RAILWAY_TOKEN railway logs --lines 50
# Project-scoped
env -u RAILWAY_API_TOKEN railway run --service diplicity-react python manage.py shell
Access Tiers
- Owner / trusted contributor: both tokens configured — all commands available
- Casual contributor: no tokens — Railway commands unavailable
If any railway command fails with an auth or "not logged in" error, stop immediately. Tell the user:
"Railway is not configured in this session. Set
RAILWAY_API_TOKENin the Claude Code on the web environment, and allowlist*.railway.comand*.railway.appunder Custom network access."
Write Safety
railway run injects production env vars and runs locally against the live production database. Do not write to production unless the user asks you to.
Admin superuser
service/entrypoint.sh creates the superuser account from DJANGO_SUPERUSER_PASSWORD only when it does not exist, and never rewrites it. Changing the variable does not change the password: the user rotates it in the Django admin or with manage.py changepassword superuser.
Common Commands
env -u RAILWAY_TOKEN railway status # deployment health
env -u RAILWAY_TOKEN railway logs --lines 50 # recent logs
env -u RAILWAY_TOKEN railway logs --lines 200 | grep ERROR # filter errors
env -u RAILWAY_TOKEN railway logs --lines 200 | grep "GET /api" # filter by endpoint
Production Database Queries (pgweb)
Cloud sessions can't reach the production DB via railway run (Railway's internal hostname is not externally resolvable). Use pgweb instead — a web-based PostgreSQL client deployed as a Railway service over HTTPS.
Required env vars (set in cloud environment config; session-start hook exports them):
PGWEB_URL— e.g.https://pgweb-production-124e.up.railway.appPGWEB_USER/PGWEB_PASSWORD— basic-auth credentials
# Write SQL to a file first (avoids shell escaping issues)
cat > /tmp/query.sql << 'EOF'
SELECT status, COUNT(*) FROM game_game GROUP BY status ORDER BY count DESC
EOF
curl -s -u "$PGWEB_USER:$PGWEB_PASSWORD" \
-X POST "$PGWEB_URL/api/query" \
--data-urlencode "query@/tmp/query.sql" \
| python3 -c "
import json, sys
d = json.load(sys.stdin)
print('\t'.join(d['columns']))
for row in d['rows']:
print('\t'.join(str(c) for c in row))
"
Use the /prod-query skill for guided read-only queries.
pgweb is read-only by configuration.
Check https://status.railway.com for platform-wide incidents.
PR Staging Environments
Staging is one persistent Railway environment at https://diplicity-react-staging.up.railway.app. It has its own Postgres and allowlisted variables, with no production data or secrets. Never fork production or restore its database into staging.
Deploy
Add the deploy-to-staging label to a same-repository PR. .github/workflows/pr-staging.yml resolves the target from current labels after acquiring the shared staging concurrency group, with cancellation disabled. The latest request wins, including requests whose queued runs were replaced.
- Build
service/Dockerfile's production target with the commit'sGIT_SHA, using the GitHub Actions layer cache, and pushghcr.io/johnpooch/diplicity-service:<full sha>. - Point the staging Django instance at the image and deploy it. Its existing pre-deploy command resets the schema; startup migrates and runs
seed_staging --skip-if-seeded. - Wait for that exact deployment to succeed, then deploy and wait for the worker at the same image tag.
- Smoke-test email login and the test account's paginated games list.
- Comment on the target PR with its branch and SHA, backend, Netlify preview and run links, plus the test login.
The backend is shared by every Netlify preview (https://deploy-preview-<number>--diplicity-react.netlify.app). Previews pre-fill [email protected] / password. Email/password login is available; Google OAuth is not configured.
Redeploy
The label stays on the holder. Pushing to it redeploys its current head; pushing to another PR skips deployment. Deploying a different PR removes the label from every other open PR and comments on each displaced PR. Fork PRs are skipped without credentials.
Every deployment resets the schema before migrations and seeds fresh data. Restarts do not reset it. Failed pre-deploy, migrations or seeding fail the deployment; staging may be broken until the next successful deploy. A failed image build never changes Railway.
Return to main
A push to main or a manual PR Staging Environment workflow run deploys main and removes the label from open PRs, with a moved comment. Closing or merging the holder deploys another labelled open PR if one exists, otherwise main. Closing a non-holder does nothing. The environment is never torn down.
Safety
- Railway project:
39039c2c-4f5d-4a37-8c0d-f8e4279fce61; staging environment:3082daa9-9287-4eef-9439-162ab737beb8. - Production environment
0372f6a0-88ab-4a58-b472-16789135ad71is guarded against all mutations. Never delete a production repo trigger when switching staging to images. - The workflow uses
RAILWAY_ACCOUNT_TOKENfor GraphQL. Do not add staging variables or change the pre-deploy command. - Images must be publicly pullable. If GHCR creates a private package, ask John to make it public; do not add registry credentials.
- Do not remove
DATABASE_PUBLIC_URLorRAILWAY_TOKEN; bundle releases still use them.
When not to use it
- →When modifying production data directly
- →When Railway is not configured in the session
- →When the application is not deployed on Railway
Prerequisites
Limitations
- →Cloud sessions cannot reach the production DB via `railway run` directly
- →Production changes must go through a migration or controlled admin process
- →Email/password login only for staging environments; Google OAuth is not configured
How it compares
This skill offers specific, safety-conscious procedures for debugging and querying a live Railway-deployed application, including token conflict resolution and pgweb usage, unlike general cloud debugging practices.
Compared to similar skills
production side by side with the closest alternatives in the catalog.
| Skill | Installs | Updated | Safety | Difficulty |
|---|---|---|---|---|
| production (this skill) | 0 | 4mo | Review | Intermediate |
| iot-engineer | 0 | 7mo | No flags | Advanced |
| cisco-network-diagram | 8 | 1y | Review | Intermediate |
| signals-scout-data-pipelines | 0 | 4mo | No flags | Intermediate |
Try saying
Example prompts that trigger this skill in your AI assistant.
You might also like
iot-engineer
Sneha-1608
Use when designing and deploying IoT solutions requiring expertise in device management, edge computing, cloud integration, and handling challenges like massive device scale, complex connectivity scenarios, or real-time data pipelines.
cisco-network-diagram
neuro-synapse
Generate Draw.io network topology diagrams from Cisco router and switch configurations. Use when asked to visualize network topology, create network diagrams, map network infrastructure, or generate visual representations from Cisco device configs. Supports parsing show commands, configuration files, CDP/LLDP neighbor data, and routing protocol information to automatically create professional network diagrams.
signals-scout-data-pipelines
PostHog
>
ops
denniszielke
>
azure-functions
aj-geddes
Create serverless functions on Azure with triggers, bindings, authentication, and monitoring. Use for event-driven computing without managing infrastructure.
ml-pipeline-workflow
wshobson
Build end-to-end MLOps pipelines from data preparation through model training, validation, and production deployment. Use when creating ML pipelines, implementing MLOps practices, or automating model training and deployment workflows.