codemod

Automate cross-file TypeScript refactors with ts-morph and dry-run verification.

409|75|Updated Dec 12, 2023
One-click install
npx skills add https://github.com/breadboard-ai/breadboard --skill codemod
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: codemod
Source: https://github.com/breadboard-ai/breadboard/tree/main/.agent/skills/codemod
Command: npx skills add https://github.com/breadboard-ai/breadboard --skill codemod

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Automates scalable, type-safe refactors across many TypeScript files, replacing fragile single-file edits with structured transformations.

Core Features & Use Cases

  • Deterministic multi-file refactors powered by ts-morph to improve correctness across a codebase.
  • Cross-package type migrations and safe, auditable transforms with dry-run support.
  • Easy extension by adding codemod transforms under codemods/transforms and validating with the runner.

Quick Start

Create a codemods/transforms/<name>.ts exporting description and include, plus a transform function, and run the codemods runner to preview or apply changes.

Frequently Asked Questions about codemod

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I automate multi-file TypeScript refactors safely?

Multi-file TypeScript refactors are automated using ts-morph to apply deterministic, type-aware transformations across a project. You can preview changes with a safe dry-run before applying them to ensure correctness.

What is a codemod and when do I need it for a TypeScript project?

A codemod is a structured transformation script used to automate scalable code changes. You need it for cross-package migrations or repeated pattern refactors across many TypeScript files where single-file edits are fragile.

How do I create a custom transform for a TypeScript codemod?

Create a TypeScript file under codemods/transforms exporting a description, an include pattern, and a transform function. Run the codemods runner to preview or apply the resulting changes.

Can I run cross-package type migrations with ts-morph?

Yes, ts-morph powers cross-package type migrations by applying type-aware transformations across multiple files. The codemod runner supports dry-run verification to audit changes before applying them.

Does this codemod runner support dry-run verification before applying changes?

Yes, the codemod runner provides dry-run verification to safely preview transformations before applying them. This ensures auditable and safe refactors across your TypeScript project.

What are the limitations of ts-morph for cross-file refactors?

ts-morph refactors require transforms to be structured within codemods/transforms and expect a specific export format. Complex transformations outside of TypeScript type-awareness may need manual validation beyond the dry-run preview.