ln-831-oss-replacer

Replaces custom modules with OSS packages using ln-645 migration plans, atomic keep/discard

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "ln-831-oss-replacer" with this command: npx skills add levnikolaevich/claude-code-skills/levnikolaevich-claude-code-skills-ln-831-oss-replacer

Paths: File paths (shared/, references/, ../ln-*) are relative to skills repo root. If not found at CWD, locate this SKILL.md directory and go up one level for repo root.

ln-831-oss-replacer

Type: L3 Worker Category: 8XX Optimization Parent: ln-830-code-modernization-coordinator

Executes OSS replacement plans from ln-645-open-source-replacer auditor. For each custom module with an OSS alternative: install package, rewrite imports, run tests, keep or discard atomically.


Overview

AspectDetails
InputMigration plan from docs/project/codebase_audit.md (ln-645 section) OR target module
OutputReplaced modules, migration report
Companionln-645-open-source-replacer (finds candidates) → ln-831 (executes replacement)

Workflow

Phases: Pre-flight → Load Plan → Prioritize → Replace Loop → Report


Phase 0: Pre-flight Checks

CheckRequiredAction if Missing
Migration plan OR target moduleYesBlock replacement
Test infrastructureYesBlock (need tests for verification)
Package manager availableYesBlock (need to install OSS packages)
Git clean stateYesBlock (need clean baseline for revert)

MANDATORY READ: Load shared/references/ci_tool_detection.md — use Test Frameworks section for test detection.

Worktree & Branch Isolation

MANDATORY READ: Load shared/references/git_worktree_fallback.md — use ln-831 row.


Phase 1: Load Migration Plan

From Audit Report

Read docs/project/codebase_audit.md, extract ln-645 findings:

FieldDescription
custom_modulePath to custom implementation
locLines of code in custom module
oss_packageRecommended OSS replacement
confidenceHow well OSS covers functionality (HIGH/MEDIUM/LOW)
api_mappingCustom function → OSS equivalent

From Target Module

If no audit report: analyze target module, search Context7/Ref for OSS alternatives.

MANDATORY READ: Load shared/references/research_tool_fallback.md for MCP tool chain.


Phase 2: Prioritize Replacements

PriorityCriteria
1 (highest)HIGH confidence + >200 LOC (max code reduction)
2HIGH confidence + 100-200 LOC
3MEDIUM confidence + >200 LOC
4MEDIUM confidence + 100-200 LOC
SkipLOW confidence (too risky for automated replacement)

Phase 3: Replace Loop (Keep/Discard)

Per-Module Cycle

FOR each replacement candidate (R1..RN):
  1. INSTALL: Add OSS package
     npm install {package} / dotnet add package / pip install
  2. REWRITE: Update imports + call sites using api_mapping
  3. VERIFY: Run tests
     IF tests FAIL → DISCARD (revert ALL: uninstall package, restore files) → next
  4. TESTS PASS → KEEP
  5. DELETE: Remove old custom module (only after keep)
  6. LOG: Record replacement for report

Atomic Revert on Discard

StepRevert Action
Package installedUninstall: npm uninstall / dotnet remove package / pip uninstall
Files modifiedgit checkout -- {modified_files}
Lock file changedgit checkout -- {lock_file}

Safety Rules

RuleDescription
One module at a timeNever replace multiple modules simultaneously
No API signature changesPublic API of replaced module must stay compatible
Tests requiredSkip module if no tests cover it (too risky)
Confidence gateSkip LOW confidence replacements

Phase 4: Report Results

Report Schema

FieldDescription
sourceAudit report path or target module
candidates_totalTotal replacement candidates
replacements_appliedSuccessfully replaced modules
replacements_discardedFailed replacements with reasons
replacements_skippedLOW confidence / no test coverage
loc_removedTotal lines of custom code removed
packages_addedNew OSS packages installed
details[]Per-replacement: module, package, LOC removed

Configuration

Options:
  # Source
  audit_report: "docs/project/codebase_audit.md"
  target_module: ""

  # Confidence
  min_confidence: "MEDIUM"      # MEDIUM | HIGH

  # Verification
  run_tests: true

  # Safety
  require_test_coverage: true   # Skip modules with no tests
  delete_old_module: true       # Delete custom module after successful replacement

Error Handling

ErrorCauseSolution
Package not foundOSS package name changedSearch Context7/Ref for current name
API mismatchOSS API differs from mappingQuery docs for correct API, attempt fix
Circular dependencyNew package conflictsSkip replacement, log as manual
No test coverageCustom module untestedSkip (too risky for automated replacement)

References

  • ../ln-645-open-source-replacer/SKILL.md (companion: finds candidates)
  • shared/references/ci_tool_detection.md (test detection)
  • shared/references/research_tool_fallback.md (MCP tool chain)

Definition of Done

  • Migration plan loaded from audit report or target module analyzed
  • Candidates prioritized by confidence + LOC
  • Each replacement applied atomically: install → rewrite → test → keep/discard
  • Discarded replacements fully reverted (package + files + lock)
  • Kept replacements: old custom module deleted
  • Report returned with candidates total, applied, discarded, LOC removed

Version: 1.0.0 Last Updated: 2026-03-08

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

ln-782-test-runner

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

ln-140-test-docs-creator

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

ln-150-presentation-creator

No summary provided by upstream source.

Repository SourceNeeds Review