← Asztali alkalmazás fejlesztők adatlapja
Nézd meg, miben segít
Codemodok és elavult API-k cseréje
Áttekinthető automatikus migrációt végez, majd ellenőrzi a mechanikus átírás által eltéveszthető eseteket.
codemods-deprecation-cleanup
Ezt a skillt használó csapattagok
Mikor hasznos?
Akkor használd, ha frissítéskor sok fájlban kell lecserélned egy API-t.
Miben segít neked?
- Elkülöníti a gépi változtatást a más munkáktól és kézi javításoktól.
- Hivatalos vagy szintaxisérzékeny átalakítást választ a tényleges mintákhoz.
- Vizsgálja az aliasokat, aszinkron változásokat és megmaradt elavult hívásokat.
Például ezt kérheted
Készíts célzott API-migrációt, mutasd meg a gépi diffet és a kézi ellenőrzést igénylő híváshelyeket. Legyen átnevezett import és megváltozott jelentésű visszahívás is. Csak a támogatott eseteket alakítsd automatikusan, a kézi javításokat sorold fel.
Részletes dokumentáció
Itt a skill eredeti útmutatóját, példáit és ellenőrzési szempontjait olvashatod az eredeti nyelven.
Összecsukás
Codemods & Deprecation Cleanup
When to Use
Use when a package or framework upgrade deprecates or removes APIs across many call sites, or when upstream provides official migration schematics/codemods (@next/codemod, ng update, rector, django-upgrade, pyupgrade, cargo fix --edition).
Codemod Execution Discipline
1. Run Codemods on a Clean Tree & Separate Commits/Steps
- Never run an automated codemod on a dirty working tree mixed with manual edits.
- Run the codemod in an isolated step so its mechanical diff can be inspected line by line before applying manual edge-case fixes.
2. Vet Official vs. Custom AST Transformations
- JavaScript / TypeScript:
- Official framework codemods (
npx @next/codemod@latest <transform>,npx @tanstack/react-query-codemod,npx prisma,ng update). - For custom multi-file API migrations, prefer AST-aware tools (
jscodeshift,ts-morph,ast-grep) over fragile regex search-and-replace when call sites span multiple lines, aliased imports, or overloaded method names.
- Official framework codemods (
- PHP:
rector/rector(vendor/bin/rector process --dry-run) with targeted rule sets (LevelSetList,LaravelSetList,SymfonySetList,PHPUnitSetList).
- Python:
pyupgrade,django-upgrade,ruff check --select UP,bump-pydantic, orLibCSTtransforms.
- Rust:
cargo fixandcargo clippy --fixfor compiler-verified edition and deprecation migrations.
3. Mandatory Post-Codemod Audit ("Never Trust Codemod Output Blindly")
Automated codemods operate on syntax trees and often miss dynamic patterns, type nuances, or comments. After running any codemod, inspect git diff for:
- Broken Semantics & Edge Cases:
- Aliased or re-exported imports that the codemod skipped.
async/awaitadditions where the enclosing function was not markedasyncor callers were not updated to handle a returnedPromise.- Complex dynamic expressions wrapped in
/* TODO */or fallback casts (as any) inserted by the codemod.
- Formatting & Comment Preservation:
- Ensure the codemod did not strip important domain comments, license headers, or reformat untouched lines across the file. Run the project's formatter/linter only on the modified lines/files if needed.
- Complete Deprecation Removal:
- Grep for the deprecated symbol, import path, configuration key, or CLI flag across the entire repository (including test helpers, Storybook stories, seed scripts, and docs) to confirm zero stragglers remain.
Systematic Deprecation Replacement Without Codemods
When replacing deprecated APIs manually:
- Map the old contract vs. new contract (arguments, return values, error behavior, side effects, default options).
- Migrate call sites directly to the new canonical API rather than wrapping the new API in a permanent legacy-imitating helper—unless a temporary adapter is needed to stage a huge change, in which case mark it
@deprecatedwith a clear removal condition. - Run tests with deprecation warnings elevated to errors (e.g.,
node --throw-deprecation,pytest -W error::DeprecationWarning,PHPUnit failOnDeprecation="true",RUSTFLAGS="-D warnings") to prove the deprecated code path is no longer triggered at runtime.
Csomagban lévő fájlok 1
SKILL.md
