Codemod Executor Skill
Executes automated code transformations using AST-based tools for large-scale refactoring, framework migrations, and language version upgrades.
Purpose
Enable automated code transformations for:
- Framework migration (React, Angular, Vue)
- Language version upgrades
- API deprecation handling
- Pattern standardization
- Large-scale refactoring
Capabilities
1. AST-Based Transformations
- Parse source code to AST
- Apply transformation rules
- Generate modified source
- Preserve code style
2. Pattern Matching and Replacement
- Define source patterns
- Specify target patterns
- Handle edge cases
- Support wildcards and captures
3. Multi-File Transformations
- Apply across entire codebase
- Handle import updates
- Coordinate cross-file changes
- Manage side effects
4. Dry-Run Preview
- Preview changes before applying
- Generate diff reports
- Estimate impact scope
- Identify risky transformations
5. Rollback Support
- Create transformation checkpoints
- Enable selective rollback
- Track applied codemods
- Maintain change history
6. Custom Codemod Creation
- Define new transformation rules
- Test codemods in isolation
- Document transformation logic
- Share across teams
Tool Integrations
| Tool |
Language |
Integration Method |
| jscodeshift |
JavaScript/TypeScript |
CLI |
| ts-morph |
TypeScript |
Library |
| Rector |
PHP |
CLI |
| Scalafix |
Scala |
CLI |
| OpenRewrite |
Java |
CLI / Maven |
| Bowler |
Python |
CLI |
| ast-grep |
Multi-language |
CLI / MCP |
| gofmt -r |
Go |
CLI |
Output Schema
{
"executionId": "string",
"timestamp": "ISO8601",
"codemod": {
"name": "string",
"version": "string",
"description": "string"
},
"results": {
"filesProcessed": "number",
"filesModified": "number",
"filesSkipped": "number",
"transformations": "number"
},
"changes": [
{
"file": "string",
"transformations": [
{
"type": "string",
"line": "number",
"before": "string",
"after": "string"
}
]
}
],
"errors": [],
"warnings": []
}
Integration with Migration Processes
- code-refactoring: Large-scale refactoring
- framework-upgrade: Framework migrations
- language-version-migration: Syntax upgrades
- code-translation: Language conversion assist
Related Skills
refactoring-assistant: Suggests transformations
static-code-analyzer: Pre-transformation analysis
Related Agents
code-transformation-executor: Orchestrates codemods
framework-upgrade-specialist: Framework-specific codemods
1---
2name: codemod-executor
3description: Execute automated AST-based code transformations for large-scale refactoring and migration
4allowed-tools: ["Bash", "Read", "Write", "Grep", "Glob", "Edit"]
5graph:
6 domains: [domain:software-engineering]
7 specializations: [specialization:code-migration-modernization]
8 skillAreas: [skill-area:dead-code-elimination, skill-area:dependency-upgrade-strategies]
9 roles: [role:backend-engineer, role:refactor-bot]
10 workflows: [workflow:technical-debt-reduction]
11 topics: [topic:refactoring]
12metadata:
13 source: https://skillmd.com/skills/a5c-ai/codemod-executor
14---
15
16# Codemod Executor Skill
17
18Executes automated code transformations using AST-based tools for large-scale refactoring, framework migrations, and language version upgrades.
19
20## Purpose
21
22Enable automated code transformations for:
23- Framework migration (React, Angular, Vue)
24- Language version upgrades
25- API deprecation handling
26- Pattern standardization
27- Large-scale refactoring
28
29## Capabilities
30
31### 1. AST-Based Transformations
32- Parse source code to AST
33- Apply transformation rules
34- Generate modified source
35- Preserve code style
36
37### 2. Pattern Matching and Replacement
38- Define source patterns
39- Specify target patterns
40- Handle edge cases
41- Support wildcards and captures
42
43### 3. Multi-File Transformations
44- Apply across entire codebase
45- Handle import updates
46- Coordinate cross-file changes
47- Manage side effects
48
49### 4. Dry-Run Preview
50- Preview changes before applying
51- Generate diff reports
52- Estimate impact scope
53- Identify risky transformations
54
55### 5. Rollback Support
56- Create transformation checkpoints
57- Enable selective rollback
58- Track applied codemods
59- Maintain change history
60
61### 6. Custom Codemod Creation
62- Define new transformation rules
63- Test codemods in isolation
64- Document transformation logic
65- Share across teams
66
67## Tool Integrations
68
69| Tool | Language | Integration Method |
70|------|----------|-------------------|
71| jscodeshift | JavaScript/TypeScript | CLI |
72| ts-morph | TypeScript | Library |
73| Rector | PHP | CLI |
74| Scalafix | Scala | CLI |
75| OpenRewrite | Java | CLI / Maven |
76| Bowler | Python | CLI |
77| ast-grep | Multi-language | CLI / MCP |
78| gofmt -r | Go | CLI |
79
80## Output Schema
81
82```json
83{
84 "executionId": "string",
85 "timestamp": "ISO8601",
86 "codemod": {
87 "name": "string",
88 "version": "string",
89 "description": "string"
90 },
91 "results": {
92 "filesProcessed": "number",
93 "filesModified": "number",
94 "filesSkipped": "number",
95 "transformations": "number"
96 },
97 "changes": [
98 {
99 "file": "string",
100 "transformations": [
101 {
102 "type": "string",
103 "line": "number",
104 "before": "string",
105 "after": "string"
106 }
107 ]
108 }
109 ],
110 "errors": [],
111 "warnings": []
112}
113```
114
115## Integration with Migration Processes
116
117- **code-refactoring**: Large-scale refactoring
118- **framework-upgrade**: Framework migrations
119- **language-version-migration**: Syntax upgrades
120- **code-translation**: Language conversion assist
121
122## Related Skills
123
124- `refactoring-assistant`: Suggests transformations
125- `static-code-analyzer`: Pre-transformation analysis
126
127## Related Agents
128
129- `code-transformation-executor`: Orchestrates codemods
130- `framework-upgrade-specialist`: Framework-specific codemods