Legacy Code Translator logo

Legacy Code Translator

Community
roedyrustam
legacy-code-translator

Safely modernize legacy codebases (PHP, old React) into modern stacks / Modernisasi codebase legacy (PHP, React lama) ke stack modern.

Overview

Publisherroedyrustam
Repositoryvibes-plug
Skill namelegacy-code-translator
Stars
117
Forks
27
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by roedyrustam on GitHub. Read the source before you install it.

Installation

Install the Legacy Code Translator AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/roedyrustam/vibes-plug/tree/main/skills/legacy-code-translator
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/roedyrustam/vibes-plug.git /tmp/vibes-plug
mkdir -p .claude/skills
cp -r /tmp/vibes-plug/skills/legacy-code-translator .claude/skills/legacy-code-translator
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Legacy Code Translator in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Legacy Code Translator on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Legacy Code Translator is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

Legacy Code Translator (Strangler Fig & Refactoring Engine)

English | Bahasa Indonesia


English

Orchestration & Integration

  • Upstream & Reverse Engineering: prd-architect (document reverse-engineered business rules into PRD.md), brainstorming, session-memory-manager.
  • AST & Codebase Intelligence: living-codebase-ast-graph (module dependencies & blast radius), scalability-clean-code (Clean Architecture boundaries), typescript-expert (strict type contracts).
  • Backend & Database Migration: database-orm-expert (legacy SQL to Prisma/Drizzle schemas), mvc-expert (modernizing legacy PHP MVC codebases), js-backend-expert (Bun/Hono targets), go-programming-expert / rust-programming-expert.
  • Testing & Anti-Slop Gates: autonomous-tdd-debugger (shadow execution comparison suites), anti-slop (zero truncation, no stubbed mocks), zero-tech-debt-auditor.

Description

A systematic, risk-mitigated engineering methodology for migrating large, business-critical legacy codebases (PHP 5/7, Python 2, jQuery, old React Class Components, AngularJS) to modern 2026 enterprise stacks (Next.js 15, TypeScript 5.8+, Bun, Rust, Go) without business downtime or regression. Employs the Strangler Fig pattern, Shadow Execution Harnesses, and Golden Master Characterization Tests.

1. Legacy Modernization Strategy Matrix

Legacy SourceTarget 2026 StackStrangler Seam / ProxyCritical Edge Case to Preserve
PHP 5/7 Spaghetti / Old MVCTypeScript (Hono / Next.js) or GoReverse Proxy route-by-route split (/api/v2/* $\rightarrow$ new)PHP implicit float/string coercion & round() half-up behavior in billing
Python 2 / Untyped MonolithPython 3.13+ (FastAPI + Pydantic v2) or RustMessage Queue consumer shadow forkInteger division / vs // semantics and timezone-naive timestamps
jQuery / React 15 Class ComponentsReact 19 RSC + Tailwind v4Micro-Frontend Island mount or route-level cutoverURL query parameter state and keyboard tab-order workflows

2. Shadow Testing & Parity Verification Harness (TypeScript)

Run the legacy implementation (ground truth) and modern implementation concurrently on live traffic, logging structural discrepancies without impacting customer responses until 100% parity is proven:

typescript
// src/migration/shadow-harness.ts
export interface ShadowComparison<TOutput> {
  legacyOutput: TOutput;
  modernOutput: TOutput | null;
  isMatch: boolean;
  latencyDeltaMs: number;
}

export async function executeWithShadowTesting<TInput, TOutput>(
  input: TInput,
  legacyFn: (data: TInput) => Promise<TOutput>,
  modernFn: (data: TInput) => Promise<TOutput>,
  onDiscrepancy?: (diff: ShadowComparison<TOutput>) => void
): Promise<TOutput> {
  const t0 = performance.now();
  const legacyPromise = legacyFn(input).then((res) => ({
    res,
    ms: performance.now() - t0,
  }));

  const modernStart = performance.now();
  const modernPromise = modernFn(input)
    .then((res) => ({ ok: true as const, res, ms: performance.now() - modernStart }))
    .catch((err: unknown) => {
      console.error('[Shadow-Harness] Modern candidate threw error:', err);
      return { ok: false as const, res: null, ms: performance.now() - modernStart };
    });

  const [legacy, modern] = await Promise.all([legacyPromise, modernPromise]);
  const isMatch =
    modern.ok && JSON.stringify(legacy.res) === JSON.stringify(modern.res);

  if (!isMatch && onDiscrepancy) {
    onDiscrepancy({
      legacyOutput: legacy.res,
      modernOutput: modern.res,
      isMatch: false,
      latencyDeltaMs: Math.round(modern.ms - legacy.ms),
    });
  }

  return legacy.res;
}

3. Production Verification Checklist

  • Golden Master Characterization Tests: Capture 50+ real input/output fixtures from the legacy code before writing a single line of replacement code.
  • Never Overwrite In-Place: Build the modernized module side-by-side (order-calc.legacy.php $\rightarrow$ order-calc.service.ts) so the original remains intact for diffing and rollback.
  • Token Slicing (<= 400 lines/turn): Decompose giant legacy files by AST function boundaries to guarantee 100% complete translations with zero // TODO or // ... truncations.
  • Shadow Parity Gate: Require 0 discrepancies across at least 1,000 shadow executions before flipping primary traffic to the modern service.

Golden Master Fixture Regression Verifier (TypeScript)
typescript
export interface GoldenFixture<TIn, TOut> {
  fixtureId: string;
  input: TIn;
  expectedOutput: TOut;
}

export async function verifyGoldenMasterParity<TIn, TOut>(
  fixtures: readonly GoldenFixture<TIn, TOut>[],
  modernCandidate: (input: TIn) => Promise<TOut>
): Promise<{ passed: boolean; failedFixtureIds: string[] }> {
  const failedFixtureIds: string[] = [];
  for (const item of fixtures) {
    const actual = await modernCandidate(item.input);
    if (JSON.stringify(actual) !== JSON.stringify(item.expectedOutput)) {
      failedFixtureIds.push(item.fixtureId);
    }
  }
  return {
    passed: failedFixtureIds.length === 0,
    failedFixtureIds
  };
}
Strangler Fig Route-by-Route Canary Proxy (TypeScript)
typescript
export interface StranglerRoutePolicy {
  readonly pathPrefix: string;
  readonly modernRolloutPercent: number;
  readonly legacyOrigin: string;
  readonly modernOrigin: string;
}

export function resolveStranglerTargetOrigin(
  requestUrl: string,
  tenantHashBucket: number,
  policies: readonly StranglerRoutePolicy[],
  defaultLegacyOrigin: string
): { targetUrl: string; routedTo: 'modern' | 'legacy' } {
  const parsed = new URL(requestUrl);
  const matched = policies.find((p) => parsed.pathname.startsWith(p.pathPrefix));

  if (!matched) {
    return {
      targetUrl: new URL(parsed.pathname + parsed.search, defaultLegacyOrigin).toString(),
      routedTo: 'legacy'
    };
  }

  const normalizedBucket = Math.abs(tenantHashBucket) % 100;
  const useModern = normalizedBucket < matched.modernRolloutPercent;
  const baseOrigin = useModern ? matched.modernOrigin : matched.legacyOrigin;

  return {
    targetUrl: new URL(parsed.pathname + parsed.search, baseOrigin).toString(),
    routedTo: useModern ? 'modern' : 'legacy'
  };
}
Idempotent Dual-Write Database Migration Adapter (TypeScript)
typescript
export interface DualWriteResult<TRecord> {
  readonly primaryRecord: TRecord;
  readonly secondarySynced: boolean;
  readonly discrepancyError: string | null;
}

export async function executeDualWriteMutation<TPayload, TRecord>(
  payload: TPayload,
  writePrimaryLegacyDb: (data: TPayload) => Promise<TRecord>,
  writeSecondaryModernDb: (data: TPayload, primary: TRecord) => Promise<void>
): Promise<DualWriteResult<TRecord>> {
  const primaryRecord = await writePrimaryLegacyDb(payload);
  try {
    await writeSecondaryModernDb(payload, primaryRecord);
    return { primaryRecord, secondarySynced: true, discrepancyError: null };
  } catch (err) {
    const message = err instanceof Error ? err.message : String(err);
    return { primaryRecord, secondarySynced: false, discrepancyError: message };
  }
}

Sovereign Execution, Token Efficiency & Invariants

DimensionSovereign Mandate & Deterministic Contract
Frontier Model CascadeMedium / High (GPT-5.6 Sol Medium, Gemini 4 Argon, Claude Sonnet 5.5 High, Grok 4.7 High Fast)
Availability FallbackGemini 4 Argon/Pro -> Gemini 3.8 Flash; Claude Opus 5.5 -> Claude Opus 4.6 (Zero unhandled missing-model errors)
KV-Cache & Token ProtocolPin static instructions & schemas at prompt prefix (kv-cache-prefix-optimizer); pass surgical CONTEXT_MAP.md slices (<250 tokens/call) during Swarm Fan-Out
SaaT CLI & MCP DispatchCLI: vibes skill exec legacy-code-translator <audit|eval|verify|generate|blueprint> / MCP: vibes_skill_dispatch, vibes_ast_query, vibes_compile_cache, vibes_optimize_budget, vibes_verify_gate
NFR & Anti-Slop InvariantsP99 API Gateway Latency < 85ms, OpenAPI 3.1 / TypeSpec strict schema parity, RFC 9457 Problem Details error contracts, Idempotency-Key enforcement; 100% complete zero-placeholder output verified via node scripts/check-anti-slop.js --strict


Bahasa Indonesia

Integrasi Orkestrasi

  • Hulu & Rekayasa Balik: prd-architect (dokumentasi aturan bisnis ke PRD.md), brainstorming, session-memory-manager.
  • AST & Inteligensi Basis Kode: living-codebase-ast-graph (dependensi modul & radius dampak), scalability-clean-code (batas Clean Architecture), typescript-expert (kontrak tipe ketat).
  • Migrasi Backend & Database: database-orm-expert (SQL lama ke skema Prisma/Drizzle), mvc-expert (modernisasi codebase PHP MVC), js-backend-expert (target Bun/Hono), go-programming-expert / rust-programming-expert.
  • Pengujian & Gerbang Anti-Slop: autonomous-tdd-debugger (suite komparasi shadow execution), anti-slop (nol pemotongan kode, tanpa stub pura-pura), zero-tech-debt-auditor.

Deskripsi

Metodologi rekayasa sistematis bagi agen AI untuk memigrasikan basis kode warisan (legacy codebase) skala besar (PHP 5/7, Python 2, jQuery, React Class Component lawas) ke stack modern 2026 (Next.js 15, TypeScript 5.8+, Bun, Rust, Go) tanpa gangguan operasional (zero downtime) menggunakan pola Strangler Fig, Shadow Execution, dan Golden Master Testing.

Checklist Verifikasi Produksi

  • Golden Master Fixtures: Rekam minimal 50 pasang input/output asli dari sistem lama sebagai pengujian regresi sebelum menulis kode baru.
  • Dilarang Menimpa File Asli Secara Langsung: Bangun modul baru secara berdampingan agar kode lama tetap menjadi acuan kebenaran selama masa transisi.
  • Pecah File Raksasa (Token Slicing): Terjemahkan per fungsi/subrutin (<= 400 baris per giliran) untuk menghindari pemotongan kode.
  • Verifikasi Shadow Testing: Pastikan hasil keluaran fungsi baru 100% identik dengan fungsi lama sebelum memindahkan trafik utama.

Matriks Eksekusi Berdaulat, Efisiensi Token & Invarian

DimensiMandat Berdaulat & Kontrak Deterministik
Kaskade Model FrontierMedium / High (GPT-5.6 Sol Medium, Gemini 4 Argon, Claude Sonnet 5.5 High, Grok 4.7 High Fast)
Invarian Fallback KetersediaanGemini 4 Argon/Pro -> Gemini 3.8 Flash; Claude Opus 5.5 -> Claude Opus 4.6 (Bebas gagal saat model belum tersedia/kuota penuh)
Protokol Hemat Token & KV-CacheKunci instruksi & skema statis di prefix awal (kv-cache-prefix-optimizer); kirim potongan CONTEXT_MAP.md (<250 token/panggilan) saat Fan-Out
Eksekusi SaaT CLI & MCPCLI: vibes skill exec legacy-code-translator <audit|eval|verify|generate|blueprint> / MCP: vibes_skill_dispatch, vibes_ast_query, vibes_compile_cache, vibes_optimize_budget, vibes_verify_gate
Invarian NFR & Anti-SlopLatensi P99 API < 85ms, paritas skema ketat OpenAPI 3.1 / TypeSpec, kontrak error RFC 9457 Problem Details, penegakan Idempotency-Key; kode 100% tuntas tanpa placeholder diverifikasi melalui node scripts/check-anti-slop.js --strict

Frequently asked questions

What does the Legacy Code Translator AI skill do?

Safely modernize legacy codebases (PHP, old React) into modern stacks / Modernisasi codebase legacy (PHP, React lama) ke stack modern.

Why use Legacy Code Translator on TypingMind?

Because you install it once and use it with any model. Legacy Code Translator is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Legacy Code Translator in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/roedyrustam/vibes-plug/tree/main/skills/legacy-code-translator. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Legacy Code Translator?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Legacy Code Translator?

As many as you like. As long as a model supports skills, you can use Legacy Code Translator with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Legacy Code Translator AI skill free?

Yes. It is published on GitHub by roedyrustam under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇