用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/fabioc-aloha/Alex_Skill_Mall --skill test-rename-drift命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
基于 SOC 职业分类
正在显示 SKILL.md
| name | test-rename-drift |
| description | When renaming a function, test files have references that survive find-and-replace: |
| lastReviewed | 2026-04-30T00:00:00.000Z |
When renaming a function, test files have references that survive find-and-replace:
// Old function: calculateTotal()
// New function: computeTotal()
// Find-and-replace catches: calculateTotal(
// But misses:
describe('calculateTotal', () => { // Describe block
// tests for calculateTotal // Comment
it('calculateTotal returns sum', () => { // It block text
Grep for BOTH the old AND new name after renaming.
# After renaming calculateTotal → computeTotal
# Find remaining old references
grep -rn "calculateTotal" . --include="*.test.*" --include="*.spec.*"
# Verify new references exist
grep -rn "computeTotal" . --include="*.test.*" --include="*.spec.*"
| Location | Find Pattern | Replace? |
|---|---|---|
| Function calls | oldName( | ✅ Auto |
| Import statements | import { oldName } | ✅ Auto |
| Describe blocks | describe('oldName' | ❌ Manual |
| It block text | it('oldName should' | ❌ Manual |
| Comments | // oldName does X | ❌ Manual |
| Variable names | const oldNameResult | Depends |
| Mock names | jest.mock('oldName') | ❌ Manual |
| Snapshot files | Contains "oldName" | ❌ Manual |
// scripts/check-rename-drift.cjs
const oldName = process.argv[2];
const newName = process.argv[3];
const { execSync } = require('child_process');
const oldRefs = execSync(
`grep -rn "${oldName}" . --include="*.test.*" --include="*.spec.*" || true`,
{ encoding: 'utf8' }
);
if (oldRefs.trim()) {
console.error(`Found ${oldRefs.split('\n').length - 1} remaining references to "${oldName}":`);
console.error(oldRefs);
process.exit(1);
}
console.log(`No remaining references to "${oldName}" in test files.`);
# Run after any rename
node scripts/check-rename-drift.cjs oldFunctionName newFunctionName
# Should report: "No remaining references"
quality testing refactoring rename