rdd

Automate systematic TypeScript refactoring with ts-morph codemods and oxlint lint rules.

2|Updated Oct 16, 2021
One-click install
npx skills add https://github.com/pattobrien/dotfiles --skill rdd-pattobrien
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: rdd
Source: https://github.com/pattobrien/dotfiles/tree/main/claude/skills/rdd
Command: npx skills add https://github.com/pattobrien/dotfiles --skill rdd-pattobrien

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires ts-morph, tsx, oxlint, @oxlint/plugins.

What problem does it solve? Making structural changes across a large TypeScript monorepo by hand is slow, error-prone, and hard to review. This Skill provides a methodology for defining systematic transformations and constraints, then using automation to apply and enforce them. ## Core Features & Use Cases - ts-morph Codemods: Write resettable, reviewable transformation scripts for one-time changes like renaming symbols, migrating APIs, moving declarations, and rewriting imports across many files. - Lint Rule Enforcement: Enforce permanent architectural conventions using existing oxlint/eslint rules or custom oxlint JS plugins with domain-specific error messages. - Hybrid Workflow: Combine a codemod to fix existing violations with a lint rule to prevent regressions, with a decision checklist for choosing the right approach. - Use Case: Rename all getFoo functions to fetchFoo across a monorepo, then add a lint rule preventing direct sentry imports outside the service layer. ## Quick Start Ask the AI to refactor all tRPC procedures in the monorepo to include explicit input and output schemas using a ts-morph codemod.

Frequently Asked Questions about rdd

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

FAQPage Schema
How do I write a codemod to rename functions across a TypeScript monorepo?▼

Use ts-morph to load source files into a Project, collect all matching function declarations in an analysis phase, then batch mutations with node.rename() which updates all references automatically. Process each package with its own tsconfig when type-aware resolution is needed.

When should I use a codemod versus a lint rule for refactoring?▼

Use a ts-morph codemod for one-time mechanical transformations across many files, and a lint rule when the convention must be enforced permanently. For both needs, start with the lint rule to define the constraint, then write a codemod to fix existing violations.

How do I write a custom oxlint plugin rule in JavaScript?▼

Create an ESLint v9-compatible plugin object with rules defining meta messages and a create function returning AST visitors like JSXOpeningElement. Register it via jsPlugins in .oxlintrc.json or oxlint.config.ts, then enable the rule and test it against a fixture file.

Does oxlint support type-aware linting in custom JS plugins?▼

No, oxlint JS plugins do not expose TypeScript type information to rules, and the plugin system is in alpha so the API may change. Custom parser support for Vue or Svelte single-file components is also unavailable.

Why is my ts-morph codemod slow on large codebases?▼

ts-morph resets the TypeScript type checker between mutations, so interleaving type queries with edits causes heavy recomputation. Collect all analysis results first, then batch mutations, and use skipFileDependencyResolution and forgetDescendants for better performance.