LO

lokalise-upgrade-migration

Tooling for migrating Lokalise SDKs, including version assessment, breaking change detection, and automated code transformation.

Install

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

Installs to .claude/skills/lokalise-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.

Analyze, plan, and execute Lokalise SDK upgrades with breaking change
69 charsno explicit “when” trigger
Advanced

Key capabilities

  • Assess current Lokalise SDK and CLI versions
  • Review breaking changes between SDK major versions
  • Migrate SDK imports from CommonJS to ESM
  • Update pagination code for new SDK versions
  • Adjust error handling for SDK changes

How it works

The skill provides scripts and instructions to identify the current SDK version, analyze breaking changes, and guide through code transformations for imports, pagination, and error handling.

Inputs & outputs

You give it
Existing Lokalise SDK installation, codebase with SDK imports and API calls
You get back
Current and latest SDK versions, identified breaking changes, transformed code for new SDK versions, and verified API compatibility

When to use lokalise-upgrade-migration

  • Detect breaking changes for SDK upgrades
  • Migrate from CommonJS to ESM in SDK
  • Analyze current SDK installation state
  • Execute automated migration scripts

About this skill

Lokalise Upgrade Migration

Current State

!npm list @lokalise/node-api 2>/dev/null | grep lokalise || echo 'SDK not installed' !lokalise2 --version 2>/dev/null || echo 'CLI not installed' !node --version 2>/dev/null || echo 'Node.js not available' !cat package.json 2>/dev/null | grep -E '"type"|"module"' || echo 'No package.json type field'

Overview

Upgrade the @lokalise/node-api SDK between major versions with full breaking change detection, automated code transformation, and verification. The most significant migration is v8 (CommonJS) to v9+ (ESM-only), which requires changes to imports, module configuration, and potentially your build pipeline.

Prerequisites

  • Existing project using @lokalise/node-api (any version 6.x through 9.x)
  • Node.js 18+ for SDK v9 (Node.js 14+ for v8 and below)
  • Git repository with clean working tree (for safe rollback)
  • Test suite that exercises Lokalise API calls

Instructions

Step 1: Assess Current Version and Target

set -euo pipefail
echo "=== Current SDK Version ==="
CURRENT=$(npm list @lokalise/node-api --json 2>/dev/null | node -e "
  const d = JSON.parse(require('fs').readFileSync(0,'utf8'));
  const v = d.dependencies?.['@lokalise/node-api']?.version || 'not found';
  console.log(v);
")
echo "Installed: ${CURRENT}"

echo -e "\n=== Latest Available ==="
LATEST=$(npm view @lokalise/node-api version)
echo "Latest: ${LATEST}"

echo -e "\n=== All Major Versions ==="
npm view @lokalise/node-api versions --json | node -e "
  const versions = JSON.parse(require('fs').readFileSync(0,'utf8'));
  const majors = {};
  versions.forEach(v => { const m = v.split('.')[0]; majors[m] = v; });
  Object.entries(majors).forEach(([m, v]) => console.log('  v' + m + '.x latest: ' + v));
"

Step 2: Review Breaking Changes by Version

VersionNode.jsModule SystemKey Breaking Changes
9.x18+ESM onlyrequire() removed, import only. Pagination returns typed cursors. ApiError export path changed.
8.x14+CJS + ESMLast version supporting require(). Constructor accepts apiKey (not token).
7.x14+CJSCursor pagination introduced. list() methods return paginated objects.
6.x12+CJSTypeScript rewrite. Method signatures changed from callbacks to promises.

Step 3: Migrate Imports (v8 CJS to v9 ESM)

This is the most impactful change. Every require() call must become an import.

Find all Lokalise imports in your codebase:

set -euo pipefail
grep -rn "require.*lokalise\|from.*lokalise" --include="*.ts" --include="*.js" --include="*.mjs" . || echo "No imports found"

Transform patterns:

// BEFORE (v8 CommonJS)
const { LokaliseApi } = require('@lokalise/node-api');
const lok = new LokaliseApi({ apiKey: process.env.LOKALISE_API_TOKEN });

// AFTER (v9 ESM)
import { LokaliseApi } from '@lokalise/node-api';
const lok = new LokaliseApi({ apiKey: process.env.LOKALISE_API_TOKEN });

Update package.json for ESM:

{
  "type": "module"
}

Update tsconfig.json if using TypeScript:

{
  "compilerOptions": {
    "module": "ES2022",
    "moduleResolution": "bundler",
    "target": "ES2022"
  }
}

Step 4: Update Pagination Code (v6/v7 to v9)

// BEFORE (v6 offset pagination)
const keys = await lok.keys().list({
  project_id: projectId,
  page: 2,
  limit: 100,
});

// AFTER (v9 cursor pagination — preferred for large datasets)
const keys = await lok.keys().list({
  project_id: projectId,
  limit: 500,
  pagination: 'cursor',
  cursor: previousCursor,
});
// Access next cursor: keys.nextCursor
// Check for more: keys.hasNextCursor()

Step 5: Update Error Handling

// BEFORE (v8)
const { ApiError } = require('@lokalise/node-api');
try {
  await lok.projects().get(projectId);
} catch (e) {
  if (e instanceof ApiError) {
    console.error(e.message, e.code);
  }
}

// AFTER (v9 — ApiError import path unchanged, but must use import)
import { ApiError } from '@lokalise/node-api';
try {
  await lok.projects().get(projectId);
} catch (e) {
  if (e instanceof ApiError) {
    console.error(e.message, e.code);
  }
}

Step 6: Install and Verify

set -euo pipefail
# Create a safety branch
git checkout -b upgrade/lokalise-sdk-v9

# Install the target version
npm install @lokalise/node-api@latest

# Run TypeScript compilation check
npx tsc --noEmit 2>&1 | head -40 || true

# Run tests
npm test

Step 7: Verify API Compatibility

// Quick smoke test after upgrade
import { LokaliseApi } from '@lokalise/node-api';

const lok = new LokaliseApi({ apiKey: process.env.LOKALISE_API_TOKEN! });

// Test basic operations still work
const projects = await lok.projects().list({ limit: 1 });
console.log('API connection OK:', projects.items[0]?.name ?? 'no projects');

const keys = await lok.keys().list({
  project_id: projects.items[0].project_id,
  limit: 5,
  pagination: 'cursor',
});
console.log('Cursor pagination OK:', keys.items.length, 'keys fetched');

Output

  • Updated @lokalise/node-api to target version
  • All require() calls converted to ESM import (if upgrading to v9)
  • package.json and tsconfig.json updated for ESM compatibility
  • Pagination code migrated to cursor-based pattern
  • Tests passing against the new SDK version
  • Git branch with all changes for review

Error Handling

IssueCauseSolution
ERR_REQUIRE_ESMUsing require() with v9 SDKConvert to import syntax and set "type": "module" in package.json
SyntaxError: Cannot use importNode.js file not recognized as ESMRename .js to .mjs or add "type": "module"
TypeError: lok.keys is not a functionAPI changed between major versionsCheck SDK changelog for renamed methods
ERR_UNKNOWN_FILE_EXTENSION .tsTypeScript not configured for ESMUse tsx runner or configure ts-node with "esm": true
Tests fail after upgradeBreaking API changesCheck test against the version-specific migration notes above

Examples

Rollback Procedure

set -euo pipefail
# If the upgrade causes issues, revert immediately
git stash  # Save any work in progress
npm install @lokalise/node-api@8  # Last CJS version
git checkout HEAD -- tsconfig.json package.json
npm test
echo "Rolled back to v8. Investigate failures before retrying."

CLI Upgrade (Separate from SDK)

set -euo pipefail
# macOS
brew upgrade lokalise2

# Linux — download latest release binary
LATEST_CLI=$(curl -s https://api.github.com/repos/lokalise/lokalise-cli-2-go/releases/latest | grep -oP '"tag_name": "\K[^"]+')
curl -sL "https://github.com/lokalise/lokalise-cli-2-go/releases/download/${LATEST_CLI}/lokalise2_linux_x86_64.tar.gz" | tar xz
sudo mv lokalise2 /usr/local/bin/

# Verify
lokalise2 --version

Check for Deprecated API Usage

set -euo pipefail
# Patterns that indicate outdated SDK usage
echo "=== Deprecated Patterns ==="
grep -rn "\.page\s*:" --include="*.ts" --include="*.js" . && echo "^ Offset pagination — migrate to cursor" || echo "No offset pagination found"
grep -rn "require.*lokalise" --include="*.ts" --include="*.js" . && echo "^ CommonJS require — migrate to ESM import" || echo "No CJS requires found"
grep -rn "new LokaliseApi.*token:" --include="*.ts" --include="*.js" . && echo "^ Old constructor — use apiKey instead of token" || echo "No old constructor pattern found"

Resources

Next Steps

  • For CI pipeline changes needed after ESM migration, see lokalise-ci-integration.
  • For performance improvements with the new cursor pagination, see lokalise-performance-tuning.
  • Run lokalise-debug-bundle if the upgrade causes unexpected API errors.

Prerequisites

Existing project using @lokalise/node-apiNode.js 18+ for SDK v9 (Node.js 14+ for v8 and below)Git repository with clean working treeTest suite that exercises Lokalise API calls

How it compares

This skill offers a structured approach to upgrading Lokalise SDK versions with automated detection of breaking changes, unlike manual review of changelogs.

Compared to similar skills

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

SkillInstallsUpdatedSafetyDifficulty
lokalise-upgrade-migration (this skill)127dCautionAdvanced
codex-skill125moReviewAdvanced
windsurf-linting-config12moReviewIntermediate
customaize-agent:create-hook05moReviewIntermediate

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

You might also like

codex-skill

feiskyer

Use when user asks to leverage codex, gpt-5, or gpt-5.1 to implement something (usually implement a plan or feature designed by Claude). Provides non-interactive automation mode for hands-off task execution without approval prompts.

12110

windsurf-linting-config

jeremylongshore

Configure and enforce code quality with AI-assisted linting. Activate when users mention "configure linting", "eslint setup", "code quality rules", "linting configuration", or "code standards". Handles linting tool configuration. Use when configuring systems or services. Trigger with phrases like "windsurf linting config", "windsurf config", "windsurf".

12

customaize-agent:create-hook

LAI-YEN-CHUN

Create and configure git hooks with intelligent project analysis, suggestions, and automated testing

00

fix-dependabot-alerts

microsoft

Fix Dependabot security alerts by updating vulnerable npm dependencies. Use when the user mentions "dependabot", "security alerts", "vulnerability", "CVE", or wants to update packages with security issues.

1872

dependency-upgrade

wshobson

Manage major dependency version upgrades with compatibility analysis, staged rollout, and comprehensive testing. Use when upgrading framework versions, updating major dependencies, or managing breaking changes in libraries.

26240

playwright-browser-automation

lackeyjb

Complete browser automation with Playwright. Auto-detects dev servers, writes clean test scripts to /tmp. Test pages, fill forms, take screenshots, check responsive design, validate UX, test login flows, check links, automate any browser task. Use when user wants to test websites, automate browser interactions, validate web functionality, or perform any browser-based testing.

29146

Search skills

Search the agent skills registry