返回 Skill 列表
extension
分类: 开发与工程无需 API Key

jscodeshift

来自Facebook/Meta的jscodeshift代码修改开发最佳实践。在编写、审查或调试jscodeshift代码修改时应使用此技能。触发于涉及AST转换、代码迁移、自动化重构或代码修改开发的任务。

person作者: jakexiaohubgithub

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 |