Agent skill
retype
Refactors TypeScript codebases with AST-aware rename, extract, and reference finding. Use for moving functions between files, renaming across codebase, or finding all usages of a symbol.
Install this agent skill to your Project
npx add-skill https://github.com/knoopx/pi/tree/main/agent/skills/retype
SKILL.md
retype-cli
TypeScript refactoring CLI built on ts-morph. AST-aware, safe refactoring.
Commands
| Command | Purpose |
|---|---|
search |
Find entities (functions, classes, types) |
rename |
Rename entity across all files |
extract |
Move entity to different file |
references |
Find all usages of an entity |
unused |
Find unused exports |
fix-imports |
Fix missing imports |
Search
# Find function by name
bunx retype-cli search linearGraphQL -p ./src --list
# Find exported functions only
bunx retype-cli search --kind function --exported -p ./src --list
# Find by regex pattern
bunx retype-cli search "create.*Component" --regex -p ./src --list
# Show code body
bunx retype-cli search myFunction --body -p ./src
References
# Find all usages of a function
bunx retype-cli references linearGraphQL -p ./src --list
# Show all references (not truncated)
bunx retype-cli references linearGraphQL -p ./src --list --all
Rename
# Rename with preview (dry run)
bunx retype-cli rename oldName newName -p ./src --preview
# Rename without confirmation
bunx retype-cli rename oldName newName -p ./src --yes
# Exact match only
bunx retype-cli rename oldName newName -p ./src --exact --yes
Extract
Move entity to a different file, updating all imports automatically.
# Extract function to new file
bunx retype-cli extract linearGraphQL ./src/api/linear.ts -p ./src --yes
# Interactive extraction
bunx retype-cli extract myHelper ./src/utils/helpers.ts -p ./src
Fix Imports
# Find and fix missing imports
bunx retype-cli fix-imports -p ./src
Unused Exports
# Find unused exported entities
bunx retype-cli unused -p ./src --list
Common Workflows
Extract API to separate module
# 1. Find the function
bunx retype-cli search linearGraphQL -p ./src --list
# 2. Check current references
bunx retype-cli references linearGraphQL -p ./src --list
# 3. Extract to new file (updates all imports)
bunx retype-cli extract linearGraphQL ./src/api/linear.ts -p ./src --yes
# 4. Verify
bun run typecheck
Rename across codebase
# 1. Preview changes
bunx retype-cli rename createComponent createWidget -p ./src --preview
# 2. Apply changes
bunx retype-cli rename createComponent createWidget -p ./src --yes
Clean up unused exports
# 1. Find unused
bunx retype-cli unused -p ./src --list
# 2. Review and remove manually
Options
| Option | Description |
|---|---|
-p, --path |
Project root path |
-c, --config |
Path to tsconfig.json |
--list |
Output as simple list |
--yes |
Skip confirmation |
--preview |
Dry run (rename only) |
--exact |
Exact match (rename only) |
--all |
Show all results (references) |
Recommended Agent Skills
Expand your agent's capabilities with these related and highly-rated skills.
conventional-commits
Writes and reviews Conventional Commits commit messages (v1.0.0) to support semantic versioning and automated changelogs. Use when drafting git commit messages, PR titles, release notes, or when enforcing a conventional commit format (type(scope): subject, BREAKING CHANGE, footers, revert).
nix-flakes
Creates reproducible builds, manages flake inputs, defines devShells, and builds packages with flake.nix. Use when initializing Nix projects, locking dependencies, or running nix build/develop commands.
skill-authoring
Writes effective pi skills with proper structure, concise content, and progressive disclosure. Use when creating new skills, improving existing skills, or reviewing skill quality.
gtkx
Build GTK4 desktop applications with GTKX React framework. Use when creating React components that render as native GTK widgets, working with GTK4/Libadwaita UI, handling signals, virtual lists, menus, or building Linux desktop UIs.
nu-shell
Processes structured data through pipelines, filters tables, transforms JSON/CSV/YAML, and defines custom commands. Use when scripting with typed parameters or working with tabular data.
nix
Runs packages temporarily, creates isolated shell environments, and evaluates Nix expressions. Use when executing tools without installing, debugging derivations, or working with nixpkgs.
Didn't find tool you were looking for?