mcpField
C
codemod

codemod

github.com/pproencaDevelopment218330 installsUpdated 11w ago
Repository

About codemod

A best-practices skill for AI agents and LLMs working with Codemod, JSSG, ast-grep, and migration workflows. Its 48 rules cover the full process, from AST matching and edits to testing and package structure.

Key features

  1. 0148 prioritized rules across 11 categories
  2. 02Guidance for JSSG and ast-grep
  3. 03AST parsing, traversal, and edits
  4. 04Workflow design and validation
  5. 05Testing, state, and security guidance

Use cases

  1. 01Writing or reviewing codemods
  2. 02Debugging pattern matching and AST traversal
  3. 03Designing migration workflows
  4. 04Testing code transforms before full runs

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/pproenca/dot-skills --skill codemod

After installing, type/codemodin Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

AGENTS.md
metadata.json
README.md
assets/templates/
_template.md
references/
_sections.md
ast-check-null-before-access.md
ast-explore-before-writing.md
ast-field-access-for-structure.md
ast-understand-named-vs-anonymous.md
ast-use-kind-for-precision.md
edit-add-imports-correctly.md
edit-batch-before-commit.md
edit-handle-overlapping-ranges.md
edit-preserve-formatting.md
edit-use-flatmap-for-conditional.md
parse-early-return-non-applicable.md
parse-handle-embedded-languages.md
parse-provide-pattern-context.md
parse-select-correct-parser.md
pattern-avoid-overly-generic.md
pattern-combine-with-rules.md
pattern-ensure-idempotency.md
pattern-use-constraints.md
pattern-use-meta-variables.md
pattern-use-relational-patterns.md
pkg-organize-by-convention.md
pkg-use-semantic-versioning.md
pkg-write-descriptive-metadata.md
security-minimize-capabilities.md
security-review-before-running-third-party.md

Details

From the project README

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 UnderstandingCRITICALast-
2Pattern EfficiencyCRITICALpattern-
3Parsing StrategyCRITICALparse-
4Node TraversalHIGHtraverse-
5Semantic AnalysisHIGHsemantic-
6Edit OperationsMEDIUM-HIGHedit-
7Workflow DesignMEDIUM-HIGHworkflow-
8Testing StrategyMEDIUMtest-
9State ManagementMEDIUMstate-
10Security and CapabilitiesLOW-MEDIUMsecurity-
11Package StructureLOWpkg-

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.

Comments

Markdown supported