Agent Skills: Facebook/Meta jscodeshift Best Practices

jscodeshift codemod development best practices from Facebook/Meta. This skill should be used when writing, reviewing, or debugging jscodeshift codemods. Triggers on tasks involving AST transformation, code migration, automated refactoring, or codemod development.

UncategorizedID: pproenca/dot-skills/jscodeshift

Install this agent skill to your local

pnpm dlx add-skill https://github.com/pproenca/dot-skills/tree/HEAD/skills/.experimental/jscodeshift

Skill Files

Browse the full folder contents for jscodeshift.

Download Skill

Loading file tree…

skills/.experimental/jscodeshift/SKILL.md

Skill Metadata

Name
jscodeshift
Description
jscodeshift codemod development best practices from Facebook/Meta. This skill should be used when writing, reviewing, or debugging jscodeshift codemods. Triggers on tasks involving AST transformation, code migration, automated refactoring, or codemod development.

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

| Priority | Category | Impact | Prefix | |----------|----------|--------|--------| | 1 | Parser Configuration | CRITICAL | parser- | | 2 | AST Traversal Patterns | CRITICAL | traverse- | | 3 | Node Filtering | HIGH | filter- | | 4 | AST Transformation | HIGH | transform- | | 5 | Code Generation | MEDIUM | codegen- | | 6 | Testing Strategies | MEDIUM | test- | | 7 | Runner Optimization | LOW-MEDIUM | runner- | | 8 | Advanced Patterns | LOW | advanced- |

Quick Reference

1. Parser Configuration (CRITICAL)

2. AST Traversal Patterns (CRITICAL)

3. Node Filtering (HIGH)

4. AST Transformation (HIGH)

5. Code Generation (MEDIUM)

6. Testing Strategies (MEDIUM)

7. Runner Optimization (LOW-MEDIUM)

8. Advanced Patterns (LOW)

How to Use

Read individual reference files for detailed explanations and code examples:

Full Compiled Document

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

Reference Files

| File | Description | |------|-------------| | AGENTS.md | Complete compiled guide with all rules | | references/_sections.md | Category definitions and ordering | | assets/templates/_template.md | Template for new rules | | metadata.json | Version and reference information |