技能创建器
skill-creator
创建、改进和评估自定义技能,把专业流程转化为可重复使用的 AI 能力。
audit-codemod-safety【数据与研究】Read-only check that a codemod or bulk transform preserved behavior — compiling is not proof. Use when "did this codemod break anything", "audit this bulk refactor", or before merging a mass find-replace. SQL → plan-data-integrity.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
Degree of freedom: MIXED — Phases 0–2 [HIGH freedom]; Phase 3
high-risk hand-trace [LOW freedom — run exactly]. Do not re-run the
transform.
Read-only. A codemod's danger is scale plus plausibility: it touches hundreds of files and each diff looks trivially correct, so review fatigue waves it through. A mechanical transform proves syntax, not semantics.
Present findings. Do not re-run the transform or edit the diffs. Hand fixes to a follow-up session.
| Skill | Owns |
|---|---|
| audit-codemod-safety (this) | Source-transform correctness at scale — behavior, completeness, consistency |
audit-code-review | General PR / diff quality on a named change set |
plan-data-integrity | Data / SQL / destructive migrations — not JS/TS source mods |
audit-code-quality | Repo-wide anti-patterns, not one mechanical pass |
burndown-full | Drive a leftover MATCH pattern to zero — this audits whether the pass was safe |
audit-gate-logic | If size defeated review and syntax defeated linters, that is also a gate-logic finding |
Observe: codemod rewrote
value || fallback→value ?? fallbackinpricing.ts. Tests still pass. Interpret:0and''now keep the left side; price0no longer falls back. Syntax-clean; semantics changed. Classify: silent behavior change (truthiness vs nullish). Severity: critical if money path; else major. Finding:pricing.ts:41|||→??| critical |0no longer defaults
Establish what was done and how:
sed / AI bulk editGet the diff and the codemod script if it exists. Auditing the rule often finds the gap faster than reading 300 diffs.
Semantic-equivalence traps — syntactic swap, different runtime meaning:
|| → ?? or reverse changes 0 / '' / false).then that drop error propagation or change orderingenum → const, interface →
type where declaration merging mattered)Comment / string / dynamic false hits (regex sweeps especially) — pattern matched inside strings, comments, template literals, or dynamic property access. Text mods cannot tell code from a string that looks like code.
Formatting-masked logic — a reformat (Prettier bump, quote style) bundled into the same commit as the codemod, so a real behavior change hides inside thousands of whitespace diffs. Flag if logic and formatting were not separated.
Missed cases — matched the common shape, not the variants: alias,
re-export, dynamic import, HOC-wrapped, JSX vs call expression, tests,
.vue / .svelte / .mdx the parser never reached. Grep the old
pattern's semantic footprint — not just the exact string. Survivors mean a
half-done migration (two conventions live at once), which is worse than none.
Inconsistent application — same construct transformed one way here,
another way there (passes drifted, or the AI drifted). Cross-check
audit-code-quality.
Generated / vendored / ignored — touched generated code that will be overwritten, or skipped files the runtime still loads because the ignore list the codemod respected is not the runtime's.
Orphans — old helpers / imports / types the transform was supposed to remove but left dangling; or new ones it referenced but never created.
plan-test-coverage. A codemod over untested code is unverified — say so.test-visual-regression). Mechanical JSX / style mods are prime
silent-break territory.audit-gate-logic.audit-gate-logic if the mod hid a bug past CIaudit-gate-logictest-visual-regression, plan-test-coverage, audit-gate-logic, a fix session. Present and stop.