RE

replit-upgrade-migration

Assists with upgrading Replit environments, changing Nix channels, and migrating database versions.

Install

mkdir -p .claude/skills/replit-upgrade-migration && curl -L -o skill.zip "https://agentskills.codes/api/skills/download/8875" && unzip -o skill.zip -d .claude/skills/replit-upgrade-migration && rm skill.zip

Installs to .claude/skills/replit-upgrade-migration

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.

Upgrade Replit Nix channels, migrate between database types, and update
71 charsno explicit “when” trigger
Advanced

Key capabilities

  • Upgrade Nix channel versions
  • Update Node.js or Python runtime packages
  • Migrate data from Replit KV to PostgreSQL
  • Change deployment targets between autoscale and reserved VM
  • Move large values from KV to Object Storage

How it works

The skill guides users through updating Nix channels and runtime packages in configuration files, followed by shell reloads and database migration scripts.

Inputs & outputs

You give it
Current .replit and replit.nix configuration
You get back
Updated environment configuration and migrated database records

When to use replit-upgrade-migration

  • Upgrade Nix channels
  • Update Node.js or Python runtimes
  • Migrate database versions
  • Detect package deprecations

About this skill

Replit Upgrade & Migration

Current State

!cat .replit 2>/dev/null | head -15 || echo 'No .replit found' !cat replit.nix 2>/dev/null || echo 'No replit.nix found'

Overview

Guide for upgrading Replit environments: Nix channel updates, package version bumps, database migrations (KV to PostgreSQL, dev to prod), deployment type changes, and Node.js/Python runtime upgrades.

Prerequisites

  • Existing Replit App with .replit and replit.nix
  • Git version control (recommended)
  • Backup of critical data before migration

Instructions

Step 1: Upgrade Nix Channel

Nix channels determine available package versions. Upgrade to get newer runtimes.

# .replit — before
[nix]
channel = "stable-23_05"

# .replit — after (2024-2025 stable)
[nix]
channel = "stable-24_05"

After changing the channel, reload the shell (exit Shell tab and re-enter). Then verify:

node --version     # Should show newer version
python3 --version  # Should show newer version

Step 2: Upgrade Node.js or Python Runtime

# replit.nix — update runtime packages

# Before (Node 18)
{ pkgs }: {
  deps = [
    pkgs.nodejs-18_x
    pkgs.nodePackages.typescript
  ];
}

# After (Node 20)
{ pkgs }: {
  deps = [
    pkgs.nodejs-20_x
    pkgs.nodePackages.typescript-language-server
    pkgs.nodePackages.pnpm
  ];
}
# .replit — update modules to match
modules = ["nodejs-20:v8-20230920-bd784b9"]

Verify after upgrade:

node --version         # v20.x.x
npm --version          # 10.x.x
npm test               # Run tests to catch breaking changes

Step 3: Migrate from Replit KV to PostgreSQL

When your app outgrows the 50 MiB KV database limit:

// scripts/migrate-kv-to-postgres.ts
import Database from '@replit/database';
import { Pool } from 'pg';

const kv = new Database();
const pool = new Pool({
  connectionString: process.env.DATABASE_URL,
  ssl: { rejectUnauthorized: false },
});

async function migrate() {
  // Create table
  await pool.query(`
    CREATE TABLE IF NOT EXISTS kv_data (
      key TEXT PRIMARY KEY,
      value JSONB NOT NULL,
      migrated_at TIMESTAMPTZ DEFAULT NOW()
    )
  `);

  // Read all KV entries
  const keys = await kv.list();
  console.log(`Migrating ${keys.length} keys...`);

  let migrated = 0;
  let errors = 0;

  for (const key of keys) {
    try {
      const value = await kv.get(key);
      await pool.query(
        'INSERT INTO kv_data (key, value) VALUES ($1, $2) ON CONFLICT (key) DO UPDATE SET value = $2',
        [key, JSON.stringify(value)]
      );
      migrated++;
    } catch (err: any) {
      console.error(`Failed to migrate key "${key}": ${err.message}`);
      errors++;
    }
  }

  console.log(`Migration complete: ${migrated} migrated, ${errors} errors`);
}

migrate().then(() => pool.end());

Step 4: Switch Deployment Type

# .replit — change deployment target

# From Autoscale (scales to zero):
[deployment]
deploymentTarget = "autoscale"
run = ["sh", "-c", "npm start"]

# To Reserved VM (always-on):
[deployment]
deploymentTarget = "cloudrun"
run = ["sh", "-c", "npm start"]

# To Static (frontend only):
[deployment]
deploymentTarget = "static"
publicDir = "dist"

After changing: click "Deploy" to create a new deployment with the new type.

Step 5: Migrate Large Files to Object Storage

// Move large values from KV to Object Storage
import Database from '@replit/database';
import { Client } from '@replit/object-storage';

const kv = new Database();
const storage = new Client();

async function migrateToObjectStorage(prefix: string) {
  const keys = await kv.list(prefix);

  for (const key of keys) {
    const value = await kv.get(key);
    const content = typeof value === 'string' ? value : JSON.stringify(value);

    await storage.uploadFromText(`migrated/${key}`, content);
    await kv.delete(key);
    console.log(`Migrated: ${key}`);
  }
}

Step 6: Pre-Migration Checklist

## Before Any Upgrade
- [ ] Git commit current working state
- [ ] Back up Replit KV data: export all keys to JSON file
- [ ] Back up PostgreSQL: pg_dump or Replit snapshot
- [ ] Note current deployment URL and settings
- [ ] Run full test suite: npm test
- [ ] Document current .replit and replit.nix content

## After Upgrade
- [ ] Reload shell (exit and re-enter Shell tab)
- [ ] Verify runtime versions
- [ ] npm install / pip install (rebuild packages for new runtime)
- [ ] Run full test suite
- [ ] Test in Workspace Webview
- [ ] Deploy and verify production health check
- [ ] Monitor for 24 hours for regressions

Error Handling

ErrorCauseSolution
Package not found after channel upgradePackage renamed or removedSearch Nix packages: nix-env -qaP | grep name
node-gyp build failureNative addon incompatibleUpdate the addon or add Nix system deps
PostgreSQL connection refusedPool not using SSLAdd ssl: { rejectUnauthorized: false }
Old deployment still runningDidn't redeployClick "Deploy" to apply new config

Resources

Next Steps

For CI integration during upgrades, see replit-ci-integration.

When not to use it

  • Upgrading without backing up critical data
  • Deploying without running a test suite

Prerequisites

Existing Replit App with .replit and replit.nixGit version controlBackup of critical data

Limitations

  • Replit KV database has a 50 MiB limit
  • PostgreSQL connections require SSL configuration

How it compares

This approach automates the migration of KV data to PostgreSQL and provides specific steps for updating Nix channels compared to manual configuration changes.

Compared to similar skills

replit-upgrade-migration side by side with the closest alternatives in the catalog.

SkillInstallsUpdatedSafetyDifficulty
replit-upgrade-migration (this skill)027dReviewAdvanced
drizzle2382moNo flagsIntermediate
drizzle-orm322moNo flagsIntermediate
database-design66moReviewIntermediate

Try saying

Example prompts that trigger this skill in your AI assistant.

More by jeremylongshore

View all by jeremylongshore

analyzing-logs

jeremylongshore

Analyze application logs to detect performance issues, identify error patterns, and improve stability by extracting key insights.

14123

ollama-setup

jeremylongshore

Configure auto-configure Ollama when user needs local LLM deployment, free AI alternatives, or wants to eliminate hosted API costs. Trigger phrases: "install ollama", "local AI", "free LLM", "self-hosted AI", "replace OpenAI", "no API costs". Use when appropriate context detected. Trigger with relevant phrases based on skill purpose.

1167

backtesting-trading-strategies

jeremylongshore

Backtest crypto and traditional trading strategies against historical data. Calculates performance metrics (Sharpe, Sortino, max drawdown), generates equity curves, and optimizes strategy parameters. Use when user wants to test a trading strategy, validate signals, or compare approaches. Trigger with phrases like "backtest strategy", "test trading strategy", "historical performance", "simulate trades", "optimize parameters", or "validate signals".

1071

generating-database-seed-data

jeremylongshore

Process this skill enables AI assistant to generate realistic test data and database seed scripts for development and testing environments. it uses faker libraries to create realistic data, maintains relational integrity, and allows configurable data volumes. u... Use when working with databases or data models. Trigger with phrases like 'database', 'query', or 'schema'.

1033

cursor-codebase-indexing

jeremylongshore

Execute set up and optimize Cursor codebase indexing. Triggers on "cursor index setup", "codebase indexing", "index codebase", "cursor semantic search". Use when working with cursor codebase indexing functionality. Trigger with phrases like "cursor codebase indexing", "cursor indexing", "cursor".

885

testing-mobile-apps

jeremylongshore

Execute mobile app testing on iOS and Android devices/simulators. Use when performing specialized testing. Trigger with phrases like "test mobile app", "run iOS tests", or "validate Android functionality".

810

Search skills

Search the agent skills registry