Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
pproenca avatar

Jscodeshift

  • 307 installs
  • 191 repo stars
  • Updated July 24, 2026
  • pproenca/dot-skills

jscodeshift is an agent skill that guides developers through writing and running JavaScript/TypeScript codemods using Meta's jscodeshift AST toolkit for automated large-scale refactors.

About

jscodeshift is a developer skill for applying Meta's jscodeshift codemod toolkit to JavaScript and TypeScript codebases. The skill walks through parsing source into an AST with recast, navigating nodes via the jscodeshift collection API, and emitting transformed files from transform modules executed by the jscodeshift CLI. Developers reach for jscodeshift when grep-and-replace is unsafe—library migrations, API renames, import path updates, or pattern replacements across hundreds of files. The toolkit supports multiple parsers including babel, flow, ts, and tsx, and transform modules can be authored in TypeScript. Use it during build when a mechanical refactor must preserve formatting and run reproducibly across an entire repo.

  • jscodeshift

Jscodeshift by the numbers

  • 307 all-time installs (skills.sh)
  • +18 installs in the week ending Aug 4, 2026 (Skillselion tracking)
  • Ranked #1,296 of 4,347 Backend & APIs skills by installs in the Skillselion catalog
  • Data as of Aug 4, 2026 (Skillselion catalog sync)
npx skills add https://github.com/pproenca/dot-skills --skill jscodeshift

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs307
repo stars191
Last updatedJuly 24, 2026
Repositorypproenca/dot-skills

How do you automate large-scale JavaScript refactors safely?

Use jscodeshift for development tasks

Who is it for?

Developers maintaining large JavaScript or TypeScript monorepos who need repeatable, AST-aware batch refactors instead of fragile regex replacements.

Skip if: Developers making one-off edits to a handful of files where IDE rename-refactor or manual changes are faster and sufficient.

When should I use this skill?

A developer asks to write a codemod, migrate a library API across many files, or batch-transform JavaScript/TypeScript AST patterns.

What you get

Transform modules, CLI execution logs, and refactored .js/.ts/.tsx source files with preserved formatting.

  • transform modules
  • refactored source files

By the numbers

  • Supports 5 parsers: babel, babylon, flow, ts, and tsx

Files

SKILL.mdMarkdownGitHub ↗

Facebook/Meta jscodeshift Best Practices

Comprehensive best practices guide for jscodeshift codemod development, designed for AI agents and LLMs. Contains 40 rules across 8 categories, prioritized by impact from critical (parser configuration, AST traversal) to incremental (advanced patterns). Each rule includes detailed explanations, real-world examples, and specific impact metrics.

When to Apply

Reference these guidelines when:

  • Writing new jscodeshift codemods for code migrations
  • Debugging transform failures or unexpected behavior
  • Optimizing codemod performance on large codebases
  • Reviewing codemod code for correctness
  • Testing codemods for edge cases and regressions

Rule Categories by Priority

PriorityCategoryImpactPrefix
1Parser ConfigurationCRITICALparser-
2AST Traversal PatternsCRITICALtraverse-
3Node FilteringHIGHfilter-
4AST TransformationHIGHtransform-
5Code GenerationMEDIUMcodegen-
6Testing StrategiesMEDIUMtest-
7Runner OptimizationLOW-MEDIUMrunner-
8Advanced PatternsLOWadvanced-

Quick Reference

1. Parser Configuration (CRITICAL)

  • `parser-typescript-config` - Use correct parser for TypeScript files
  • `parser-flow-annotation` - Use Flow parser for Flow-typed code
  • `parser-babel5-compat` - Avoid default babel5compat for modern syntax
  • `parser-export-declaration` - Export parser from transform module
  • `parser-astexplorer-match` - Match AST Explorer parser to jscodeshift parser

2. AST Traversal Patterns (CRITICAL)

  • `traverse-find-specific-type` - Use specific node types in find() calls
  • `traverse-two-pass-pattern` - Use two-pass pattern for complex transforms
  • `traverse-early-return` - Return early when no transformation needed
  • `traverse-find-filter-pattern` - Use find() with filter object over filter() chain
  • `traverse-closest-scope` - Use closestScope() for scope-aware transforms
  • `traverse-avoid-repeated-find` - Avoid repeated find() calls for same node type

3. Node Filtering (HIGH)

  • `filter-path-parent-check` - Check parent path before transformation
  • `filter-import-binding` - Track import bindings for accurate usage detection
  • `filter-nullish-checks` - Add nullish checks before property access
  • `filter-jsx-context` - Distinguish JSX context from regular JavaScript
  • `filter-computed-properties` - Handle computed property keys in filters

4. AST Transformation (HIGH)

  • `transform-builder-api` - Use builder API for creating AST nodes
  • `transform-replacewith-callback` - Use replaceWith callback for context-aware transforms
  • `transform-insert-import` - Insert imports at correct position
  • `transform-preserve-comments` - Preserve comments when replacing nodes
  • `transform-renameto` - Use renameTo for variable renaming
  • `transform-remove-unused-imports` - Remove unused imports after transformation

5. Code Generation (MEDIUM)

  • `codegen-tosource-options` - Configure toSource() for consistent formatting
  • `codegen-preserve-style` - Preserve original code style with recast
  • `codegen-template-literals` - Use template literals for complex node creation
  • `codegen-print-width` - Set appropriate print width for long lines

6. Testing Strategies (MEDIUM)

  • `test-inline-snapshots` - Use defineInlineTest for input/output verification
  • `test-negative-cases` - Write negative test cases first
  • `test-dry-run-exploration` - Use dry run mode for codebase exploration
  • `test-fixture-files` - Use fixture files for complex test cases
  • `test-parse-errors` - Test for parse error handling

7. Runner Optimization (LOW-MEDIUM)

  • `runner-parallel-workers` - Configure worker count for optimal parallelization
  • `runner-ignore-patterns` - Use ignore patterns to skip non-source files
  • `runner-extensions-filter` - Filter files by extension
  • `runner-batch-processing` - Process large codebases in batches
  • `runner-verbose-output` - Use verbose output for debugging transforms

8. Advanced Patterns (LOW)

  • `advanced-compose-transforms` - Compose multiple transforms into pipelines
  • `advanced-scope-analysis` - Use scope analysis for safe variable transforms
  • `advanced-multi-file-state` - Share state across files with options
  • `advanced-custom-collections` - Create custom collection methods

How to Use

Read individual reference files for detailed explanations and code examples:

  • Section definitions - Category structure and impact levels
  • Rule template - Template for adding new rules

Full Compiled Document

For a single comprehensive document containing all rules, see AGENTS.md.

Reference Files

FileDescription
AGENTS.mdComplete compiled guide with all rules
references/_sections.mdCategory definitions and ordering
assets/templates/_template.mdTemplate for new rules
metadata.jsonVersion and reference information

Related skills

How it compares

Choose jscodeshift over manual refactors when changes must scale across many files with AST precision and reproducible transform scripts.

FAQ

What is jscodeshift used for?

jscodeshift is Meta's toolkit for running codemods over JavaScript and TypeScript files. Developers write transform modules that parse source into an AST, modify nodes programmatically, and regenerate code while preserving formatting via recast.

When should developers use codemods instead of find-and-replace?

jscodeshift codemods suit structural refactors—renaming exports, updating import paths, or migrating library APIs—where string replacement would miss edge cases. AST transforms understand syntax, not just text patterns.

Backend & APIsbackendintegrations

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.