ln-33-code-modernizer
Modernizes a bounded capability by removing obsolete custom mechanisms or reducing bundle and maintenance cost. Use for proven modernization value; not routine upgrades or tuning.
levnikolaevich · 已有 AI 审核记录
安装与使用
运行命令前先阅读来源与依赖说明。复制命令不会自动安装或执行。
npx skills add levnikolaevich/claude-code-skills --skill ln-33-code-modernizer技能说明
name: ln-33-code-modernizer description: "Modernizes a bounded capability by removing obsolete custom mechanisms or reducing bundle and maintenance cost. Use for proven modernization value; not routine upgrades or tuning."
Code Modernizer
Goal: Modernize a bounded capability only when the new design measurably reduces human workflow friction, maintenance, risk, dependency duplication, or delivered artifact cost. Preserve behavior, isolate migrations, and revert changes that do not create net value.
Execution contract: Treat the ordered checkbox workflow below as this skill's Definition of Done. Track every checkbox as PENDING, then resolve it to PROVEN with concrete evidence, CLEARED with evidence that its conditional trigger is absent, or UNPROVEN; reading, mentioning, delegating, skipping, or tool failure is not proof.
Before returning, resolve every PENDING, count only PROVEN and CLEARED items as complete, apply this skill's verdict, decision, and approval rules to every UNPROVEN, and prepend Checklist: X/Y completeIncomplete: None | section/item — reason; outcome impact; exact next action; list every UNPROVEN item.
Tool Routing
| Need | Preferred tool | Use it when | Fallback |
|---|---|---|---|
| Current mechanism and consumers | Native file search plus language server or host-native code intelligence | Mapping contracts, callers, configuration, data, lifecycle, and tests | Narrow import, symbol, route, and configuration search with direct reads |
| Existing platform capabilities | Manifests, lockfiles, runtime APIs, and current official documentation | Avoiding new dependencies or custom code for an already available feature | Repository examples and source inspection; mark capability UNVERIFIED if current docs are unavailable |
| External replacement candidates | Official package registries, source repositories, documentation, releases, advisories, and license data | Comparing maintained software with custom implementation | Primary-source web research; do not rely on popularity lists alone |
| Baseline and value | Build output, bundle analysis, code inventory, benchmark, defects, or maintenance evidence | Defining what modernization must improve | Reproducible static counts with documented scope and limitations |
| Safe migration | Git isolation, focused edits, native package manager, and repository generation commands | Replacing one bounded capability and its consumers | Stop if user changes or generated state cannot be protected |
| Verification | Repository-defined build, lint, type, test, smoke, packaging, and runtime checks | Before migration and after every retained step | Choose the smallest portfolio action when existing evidence cannot prove a material contract |
| Delivered artifact analysis | Existing bundle analyzer, size report, startup profile, or dependency report | Bundle size, load path, or runtime cost is part of the goal | Build artifact comparison with reproducible file and compression rules |
Do not replace working custom code merely because an external package exists. Do not introduce an unmaintained dependency, accept incompatible licensing, or remove the old path until all consumers and rollback conditions are understood.
Evidence Rules
- Start from a concrete defect, cost, duplication, unsupported mechanism, audit finding, or user goal.
- Compare net system complexity: removed code and risk minus new dependency, adapter, operational, and migration costs.
- External candidate claims require current primary evidence for maintenance, security, license, runtime support, and API fit.
- Bundle or performance value requires comparable measurements; line-count reduction alone does not prove a better design.
- Preserve public behavior unless the request explicitly authorizes a contract migration.
Checklist
1. Define the Modernization Target
- Resolve the bounded capability, protected outcome, current pain, affected users, developers, or operators, success metric, constraints, and explicit non-goals; label unsupported intent inferences.
- Read repository instructions and inspect Git state, generated files, package-manager policy, and current user changes.
- Inventory the current implementation, public contracts, consumers, configuration, persisted data, runtime registration, tests, and operational procedures.
- Identify the specific workflow, maintenance, security, compatibility, duplication, bundle, startup, or delivery cost that must improve.
- Establish behavioral and relevant quantitative baselines before changing code; for human workflows use reproducible observations such as required steps or concepts, time to first meaningful result, error comprehension, and recovery effort.
- Isolate the work so each migration step can be reverted without touching unrelated or user-owned changes.
- Start a run-owned resource ledger with every created absolute path, worktree, process ID, cache, report, and temporary artifact; never register pre-existing resources as cleanup targets.
- Stop with
NO_CHANGEif modernization is only aesthetic, depends on speculative future scale, or cannot define a reproducible benefit to the protected outcome.
2. Evaluate the Simplest Credible Design
- Check language, runtime, framework, platform, and already-declared dependency capabilities before searching for a new package.
- Identify obsolete compatibility paths, parallel mechanisms, unused extension points, duplicated integrations, and transitional adapters that can be removed directly.
- For external candidates, evaluate functional fit, API stability, maintenance activity, security history, license, ownership, release cadence, size, runtime support, and ecosystem compatibility.
- Verify candidate claims from official documentation, repository releases, advisories, and package metadata matching the intended version.
- Inspect migration guides, breaking chan