Claude-skill-registry codemod

Codemod (JSSG, ast-grep, workflows) best practices for writing efficient, safe, and maintainable code transformations. This skill should be used when writing, reviewing, or debugging codemods, AST transformations, or automated refactoring tools. Triggers on tasks involving codemod, ast-grep, JSSG, code transformation, or automated migration.

install
source · Clone the upstream repo
git clone https://github.com/majiayu000/claude-skill-registry
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/codemod" ~/.claude/skills/majiayu000-claude-skill-registry-codemod && rm -rf "$T"
manifest: skills/data/codemod/SKILL.md
source content

Codemod Best Practices

Comprehensive best practices guide for Codemod (JSSG, ast-grep, workflows), designed for AI agents and LLMs. Contains 48 rules across 11 categories, prioritized by impact to guide automated refactoring and code generation.

When to Apply

Reference these guidelines when:

  • Writing new codemods with JSSG or ast-grep
  • Designing workflow configurations for migrations
  • Debugging pattern matching or AST traversal issues
  • Reviewing codemod code for performance and safety
  • Setting up test fixtures for transform validation

Rule Categories by Priority

PriorityCategoryImpactPrefix
1AST UnderstandingCRITICAL
ast-
2Pattern EfficiencyCRITICAL
pattern-
3Parsing StrategyCRITICAL
parse-
4Node TraversalHIGH
traverse-
5Semantic AnalysisHIGH
semantic-
6Edit OperationsMEDIUM-HIGH
edit-
7Workflow DesignMEDIUM-HIGH
workflow-
8Testing StrategyMEDIUM
test-
9State ManagementMEDIUM
state-
10Security and CapabilitiesLOW-MEDIUM
security-
11Package StructureLOW
pkg-

Quick Reference

1. AST Understanding (CRITICAL)

2. Pattern Efficiency (CRITICAL)

3. Parsing Strategy (CRITICAL)

4. Node Traversal (HIGH)

5. Semantic Analysis (HIGH)

6. Edit Operations (MEDIUM-HIGH)

7. Workflow Design (MEDIUM-HIGH)

8. Testing Strategy (MEDIUM)

9. State Management (MEDIUM)

10. Security and Capabilities (LOW-MEDIUM)

11. Package Structure (LOW)

How to Use

Read individual reference files for detailed explanations and code examples:

Full Compiled Document

For a complete guide with all rules expanded, see AGENTS.md.