본문으로 건너뛰기
cccskills
무료GitHub에 공개

test-guided-migration-assistant

Automatically updates a codebase to a new language version, framework version, or library update while ensuring all tests still pass. Use this skill when migrating Python 2→3, upgrading framework versions (React, Django, Angular), updating dependencies, or performing any version migration where tests define correct behavior. The skill analyzes failing tests caused by migration, categorizes errors (import errors, API changes, type errors, behavior changes), proposes systematic fixes, and verifies that test-observable behavior remains unchanged. Triggers when users ask to migrate code versions, upgrade dependencies while keeping tests passing, update framework versions, or perform test-guided version migrations.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

설치 방법 보기

포함된 파일(4)

  • SKILL.md7.1 KB
  • references/migration_scenarios.md5.7 KB
  • references/migration_strategy.md8.1 KB
  • scripts/analyze_test_failures.py9.0 KB

SKILL.md(원문)

설치하기 전에 에이전트에게 전달되는 지시 내용을 확인할 수 있습니다.

Test-Guided Migration Assistant

Automatically update a codebase to a new language version, framework version, or library update while ensuring all tests continue to pass.

Workflow

1. Establish Baseline

Before starting migration, establish the current state:

# Run full test suite
<test_command>

# Record baseline
# - Total tests: X
# - Passing: Y
# - Failing: Z (should be 0 or known failures)
# - Coverage: N%

Document current state:

  • Current versions (language, framework, dependencies)
  • Test results
  • Any known issues

2. Understand Migration Context

Gather information:

  • Target version (e.g., Python 3.12, React 18, Django 4.2)
  • Migration scope (single library vs. full stack)
  • Breaking changes expected

Consult migration guides:

  • Official migration documentation
  • Changelog/release notes
  • Community migration guides
  • See migration_scenarios.md for common patterns

Identify risks:

  • Deprecated API usage
  • Known breaking changes
  • Custom integrations affected
  • Performance implications

3. Perform Migration

Update dependencies:

Incremental approach (recommended):

# Update one dependency at a time
npm install package@new-version
# or
pip install package==new-version

# Run tests immediately
<test_command>

Batch approach (for experienced migrations):

# Update all dependencies
npm update
# or
pip install -U -r requirements.txt

# Run tests
<test_command>

Update configuration:

  • Update build configuration
  • Update CI/CD configuration
  • Update environment files
  • Update Docker images

4. Analyze Test Failures

Run tests and capture output:

# Pytest
pytest -v > test_output.txt 2>&1

# Jest
npm test > test_output.txt 2>&1

# Other frameworks
<test_command> > test_output.txt 2>&1

Use analysis script:

python scripts/analyze_test_failures.py test_output.txt

The script categorizes failures into:

  • 🔴 Import/Module Errors (CRITICAL - fix first)
  • 🟠 API Signature Errors (HIGH priority)
  • 🟡 Type Errors (MEDIUM priority)
  • 🟡 Configuration Errors (MEDIUM priority)
  • 🟢 Behavior Changes (review carefully)
  • 🔵 Deprecation Warnings (fix when possible)

5. Fix Issues Systematically

Follow priority order from analysis. See migration_strategy.md for detailed strategies.

Fix import errors first:

# Example: Module moved
# Old
from collections import Mapping

# New
from collections.abc import Mapping

Fix API signature errors:

# Example: Parameter renamed
# Old
result = function(arg1, old_param=value)

# New
result = function(arg1, new_param=value)

Fix type errors:

// Example: Stricter types
// Old
function process(value: string) { }

// New (handle undefined)
function process(value: string | undefined) {
  if (value === undefined) return;
  // ...
}

Handle behavior changes:

# Example: Changed defaults
# Old behavior: returns None on error
# New behavior: raises exception

# Add error handling
try:
    result = function()
except NewException:
    result = None  # Preserve old behavior

After each fix category:

# Run tests
<test_command>

# Commit if tests pass
git add .
git commit -m "Fix: migration import errors"

6. Verify Behavior Preservation

Run full test suite multiple times:

# Catch flaky tests
for i in {1..3}; do
  echo "Run $i"
  <test_command>
done

Verify coverage unchanged:

# Generate coverage report
<coverage_command>

# Compare to baseline
# Should be same or better

Check for warnings:

# Python
python -W all -m pytest

# Node.js
node --trace-warnings test

# Look for deprecation warnings

Success criteria:

  • All tests pass
  • Same number of passing tests as baseline
  • No new test failures
  • Coverage maintained or improved
  • Build succeeds
  • No critical warnings

7. Document Migration

Create migration summary:

MIGRATION SUMMARY
=================

Migration: Python 3.8 → Python 3.12

Changes Made:
- Updated collections imports (Mapping → collections.abc.Mapping)
- Fixed asyncio.coroutine → async def
- Updated type hints for stricter checking
- Removed distutils usage

Test Results:
- Before: 156/156 passing
- After: 156/156 passing
- Coverage: 87% (unchanged)

Breaking Changes Addressed:
1. Collections ABC moved
2. asyncio.coroutine removed
3. Type checking stricter

Deprecation Warnings:
- None remaining

Key Principles

Tests Define Correctness: If tests pass, behavior is preserved.

Fix by Priority: Import errors block everything - fix first. Then API errors, then types, then behavior.

Incremental Changes: Fix one category, test, commit. Don't accumulate many changes.

Never Modify Tests: Fix the code to make tests pass. Don't change tests to match new behavior (unless behavior change is intentional and documented).

Fail Fast: Run tests immediately after migration attempt. Don't wait.

Common Migration Patterns

Python 2 → 3

  • print statement → print() function
  • xrange() → range()
  • .iteritems() → .items()
  • except Exception, e: → except Exception as e:

React 16 → 18

  • ReactDOM.render() → ReactDOM.createRoot().render()
  • Update for concurrent rendering
  • Fix useEffect timing issues

Django 2.2 → 4.2

  • django.conf.urls.url() → django.urls.re_path()
  • Update ugettext → gettext
  • Remove USE_L10N setting

Node.js 14 → 20

  • Update deprecated APIs
  • Fix OpenSSL changes
  • Update crypto usage

Helper Script

The analyze_test_failures.py script automates failure categorization:

# Analyze pytest output
python scripts/analyze_test_failures.py test_output.txt

# Analyze Jest output
python scripts/analyze_test_failures.py test_output.txt --format jest

# Auto-detect format
python scripts/analyze_test_failures.py test_output.txt --format auto

Output provides:

  • Categorized failure list
  • Priority order for fixes
  • Example errors from each category
  • Recommended fix strategies

Rollback Strategy

If migration has too many failures (>20% of tests):

# Revert dependency changes
git checkout HEAD -- package.json package-lock.json
npm install

# Or revert commits
git revert <commit-hash>

# Verify tests pass
<test_command>

Then plan incremental migration or allocate more time.

리뷰

아직 리뷰가 없습니다. 사용해 본 소감을 남겨 주세요.

댓글

로그인 없이 쓸 수 있습니다. 사용 후기, 질문, 작동하지 않은 환경 등을 편하게 남겨 주세요.

아직 댓글이 없습니다. 첫 댓글을 남겨 보세요.

보내면 바로 공개됩니다. 이메일 주소나 전화번호 같은 개인 정보는 쓰지 마세요. URL은 2개까지입니다.

0 / 1,000자

이 양식은 reCAPTCHA로 보호되며 Google 개인정보처리방침 및 서비스 약관이 적용됩니다.

같은 저장소의 스킬

Applies abstract interpretation using different abstract domains (intervals, octagons, polyhedra, sign, congruence) to statically analyze program variables and infer invariants, value ranges, and relationships. Use when analyzing program properties, inferring loop invariants, detecting potential errors, or understanding variable relationships through static analysis.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ArabelaTso/Skills-4-SE2572026년 8월 21일 업데이트

Uses abstract interpretation to automatically infer loop invariants, function preconditions, and postconditions for formal verification. Generates invariants that capture program behavior and support correctness proofs in Dafny, Isabelle, Coq, and other verification systems. Use when adding formal specifications to code, generating verification conditions, inferring contracts for functions, or discovering loop invariants for proofs.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ArabelaTso/Skills-4-SE2572026년 8월 21일 업데이트

Performs abstract interpretation over source code to infer possible program states, variable ranges, and data properties without executing the program. Reports potential runtime errors including out-of-bounds accesses, null dereferences, type inconsistencies, division by zero, and integer overflows. Use when analyzing code for potential runtime errors, performing static analysis, checking safety properties, or verifying program behavior without execution.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ArabelaTso/Skills-4-SE2572026년 8월 21일 업데이트

Performs abstract interpretation to produce summarized execution traces and high-level program behavior representations. Highlights key control flow paths, variable relationships, loop invariants, function summaries, and potential runtime states using abstract domains (intervals, signs, nullness, etc.). Use when analyzing program behavior, understanding execution paths, computing loop invariants, tracking variable ranges, detecting potential runtime errors, or generating program summaries without concrete execution.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ArabelaTso/Skills-4-SE2572026년 8월 21일 업데이트

Create ACSL (ANSI/ISO C Specification Language) formal annotations for C/C++ programs. Use this skill when working with formal verification, adding function contracts (requires/ensures), loop invariants, assertions, memory safety annotations, or any ACSL specifications. Supports Frama-C verification and generates comprehensive formal specifications for C/C++ code.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ArabelaTso/Skills-4-SE2572026년 8월 21일 업데이트

CLI-based browser automation with persistent page state using ref-based element interaction. Use when users ask to navigate websites, interact with web pages, fill forms, take screenshots, test web applications, or extract information from web pages.

한국어 요약은 준비 중입니다. 원문 설명을 표시하고 있습니다.

ArabelaTso/Skills-4-SE2572026년 8월 21일 업데이트

ArabelaTso의 스킬 모두 보기

이 스킬의 문제 신고