kevinzai/commander/batch-migration
Claude Code and agent skill by kevinzai/commander
- community
Checking that the SKILL.md file is still in the repository.
/batch recipes for large-scale code changes across many files. Patterns for CJS-to-ESM migration, React class-to-hooks, multi-file refactoring, dependency upgrades, API schema changes, and linter rule enforcement. Includes agent distribution, conflict resolution, and per-batch verification.
Install
npx vskill@latest install kevinzai/commander/batch-migrationSKILL.md
Batch Migration
Recipes for large-scale code changes that touch tens or hundreds of files. Each recipe distributes work across agents, handles conflicts, and verifies changes after each batch.
How /batch Works
Architecture
Safety: The Batch Contract
Every batch migration follows these rules:
- Discovery before execution -- always know the full scope first
- Dry run first -- preview every change before writing
- Batch size limit -- max 20 files per batch (prevents context overflow)
- Verify after each batch -- typecheck + lint + test
- Rollback ready -- each batch is a separate commit (easy to revert)
- Conflict resolution -- stop on conflict, don't guess
Recipe 1: CJS to ESM
Convert CommonJS require() / module.exports to ES module import / export.
Command
Discovery
Transforms
| From | To | |
|---|---|---|
const x = require('x') | import x from 'x' | |
const { a, b } = require('x') | import { a, b } from 'x' | |
module.exports = X | export default X | |
module.exports = { a, b } | export { a, b } | |
exports.a = X | export const a = X | |
require.resolve('x') | import.meta.resolve('x') | |
__dirname | import.meta.dirname (Node 21+) or dirname(fileURLToPath(import.meta.url)) | |
__filename | import.meta.filename (Node 21+) or fileURLToPath(import.meta.url) |
Post-Migration
- Update
package.json: add"type": "module" - Update
tsconfig.json: set"module": "ESNext","moduleResolution": "bundler" - Fix dynamic imports:
require(var)becomesawait import(var)
Verification
Recipe 2: React Class to Hooks
Convert React class components to function components with hooks.
Command
Discovery
Transforms
| From | To | |
|---|---|---|
class X extends Component | function X(props) / const X: FC<Props> = | |
this.state = { ... } | const [x, setX] = useState(...) | |
this.setState({ x }) | setX(x) | |
componentDidMount() | useEffect(() => { ... }, []) | |
componentDidUpdate(prevProps) | useEffect(() => { ... }, [deps]) | |
componentWillUnmount() | useEffect(() => { return () => cleanup }, []) | |
this.props.x | props.x (or destructured) | |
this.handleClick = this.handleClick.bind(this) | Remove (arrow functions) | |
static defaultProps | Default parameter values | |
shouldComponentUpdate | React.memo() wrapper |
Edge Cases (Human Gate)
These require manual review and are flagged, not auto-converted:
- Components using
getSnapshotBeforeUpdate - Components using
componentDidCatch/ error boundaries - Components with complex
thisreferences beyond props/state - Higher-order components wrapping class components
Verification
Recipe 3: Multi-File Rename
Rename a symbol (function, class, type, variable) across the entire codebase.
Command
Discovery
Transforms
- Rename in import/export statements
- Rename in usage sites
- Rename in type annotations
- Rename in string literals (only if clearly a reference, e.g., route paths)
- Rename corresponding test files (e.g.,
UserProfile.test.tsxtoAccountProfile.test.tsx) - Rename file if it matches the symbol name
Conflict Resolution
If the new name already exists in a file's scope:
- Stop the batch
- Report the conflict with file path and line number
- Wait for human decision
Recipe 4: Dependency Upgrade (Major Version)
Upgrade a dependency across a monorepo with breaking changes.
Command
Steps
- Discovery: Find all
package.jsonfiles referencing the dependency - Changelog review: Read the upgrade guide / migration docs
- Update versions: Bump version in all package.json files
- Install: Run install in each package
- Apply codemods: Run official codemods if available (e.g.,
npx @next/codemod) - Fix breaking changes: Apply transforms from changelog
- Verify: Typecheck, lint, test per package
Example: React 18 to 19
Recipe 5: API Schema Change
Update all consumers when an API response shape changes.
Command
Steps
- Discovery: Find all files that reference the changed field
- Type update: Update the schema/type definition
- Server update: Update API handlers that produce the field
- Client update: Update all consumers that read the field
- Test update: Update fixtures, mocks, and assertions
- Migration: Generate database migration if field is persisted
Conflict Resolution
For ambiguous references (e.g., name is too generic):
- Use type-aware search (follow imports from the schema type)
- Flag ambiguous matches for human review
- Never rename unrelated
namefields
Recipe 6: Linter Rule Enforcement
Apply a new lint rule across the entire codebase.
Command
Steps
- Enable rule: Add rule to
.eslintrc/eslint.config.js - Discovery: Run linter to find all violations
- Autofix round: Apply
--fixfor auto-fixable violations - Manual round: Fix remaining violations in batches
- Verify: Run linter (zero violations), then run tests
Common Enforcement Patterns
| Rule | Auto-Fix Rate | Manual Work | |
|---|---|---|---|
prefer-const | 100% | None | |
no-var | 100% | None | |
no-explicit-any | 0% | Type every any | |
strict-boolean-expressions | 50% | Fix truthy checks | |
no-floating-promises | 0% | Add await or void | |
consistent-type-imports | 90% | Fix edge cases |
Batch Execution Strategy
Parallel Agents
For independent files (no cross-file dependencies):
Sequential Batches
For dependent changes (types used by other files):
Conflict Resolution
If two agents modify the same file:
- Both agents stop
- Merge the changes manually (or let the second agent rebase)
- Verify the merged result
- Resume
Checkpoint Schema
Anti-Patterns
- Never batch-migrate without a dry run first
- Never modify more than 20 files in a single agent context (context overflow)
- Never skip verification between batches (one bad batch cascades)
- Never force-push batch migration commits (makes rollback impossible)
- Never auto-resolve merge conflicts in batch mode (always stop and report)
Security
- Security scanPassed, 95 of 100Pattern checks on the skill's files.
- Model reviewPassed
Quality evaluation
- Task evaluationNot runNo evaluation yet. Run one in Skill Studio.
Source
- SKILL.md in the repositoryCheckingskills/batch-migration/SKILL.md
Popularity
- Repository stars
- 6
- Repository forks
- 1
- 7-day trend score
- 10
Stars and forks are for the whole GitHub repository, not this skill alone. Not refreshed yet.
Works with
Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.
- Claude Code
- Cursor
- GitHub Copilot
- Windsurf
- Codex
- Gemini CLI
- Cline
- Amp
- Roo Code
- Goose
- Continue
- Kilo Code
- Junie
- Trae
- OpenHands
- Qwen Code
- AI Agent
- Tabnine Chat
- Sourcegraph Cody
- Amazon Q
- Firebase Genkit
- Sweep
- Devin
- Phind
- Mentat
- Claude Desktop
- Aider
- GPT Pilot
- Plandex
- bolt.new
- v0
- Replit Agent
- Anse
- TypingMind
- BetterChatGPT
- LibreChat
- Warp AI
- Pieces
- Fig AI
Embed badge
[](https://verified-skill.com/skills/kevinzai/commander/batch-migration)