Intelligent code refactoring using IDE-level tools (rename, find-references, go-to-definition), AST-aware pattern matching, and TDD verification. Use for safe, large-scale refactoring with precision.
91%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
Refactoring workflow that combines language server capabilities with code search and test-driven verification for safe, precise code transformations.
# Find all usages of a function
grep -rn "getUserData" src/ --include="*.ts"
# Find pattern across codebase with AST-aware tools (if available)
# e.g., ast-grep, semgrep, or comby
ast-grep --pattern 'console.log($MSG)' --lang typescriptFor renames (use IDE/editor capabilities when available):
# Using sed for simple renames
find src/ -name "*.ts" -exec sed -i '' 's/getUserData/fetchUserProfile/g' {} +
# Or use language-specific tools
# TypeScript: ts-morph, jscodeshift
# Python: rope, bowler
# Go: gorenameFor pattern-based transformations:
# Using ast-grep (if installed)
ast-grep --pattern 'console.log($MSG)' --rewrite 'logger.info($MSG)' --lang typescript
# Using comby
comby 'console.log(:[msg])' 'logger.info(:[msg])' .tsFor structural changes (extract/move):
npx tsc --noEmit # TypeScript
mypy src/ # Python
go vet ./... # Gogit diff to review the complete changes for unintended modificationsIf any check fails:
git checkout -- .| Language | Rename Tool | Pattern Search | Type Check |
|---|---|---|---|
| TypeScript | ts-morph, jscodeshift | ast-grep, semgrep | tsc --noEmit |
| Python | rope, bowler | ast-grep, semgrep | mypy, pyright |
| Go | gorename, gopls | ast-grep, semgrep | go vet |
| Java | IntelliJ refactor, openrewrite | semgrep | javac |
| Rust | rust-analyzer | ast-grep | cargo check |
User: "Rename getUserData to fetchUserProfile across the project"
Output:
grep -rn finds 23 usages across 8 filestsc --noEmit passes with no errorsnpm test — 47 tests passgit diff shows clean, focused changesInspired by: oh-my-opencode /refactor command
ArabelaTso/Skills-4-SE
4f38503
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.