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

Codemod

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

codemod is an agent skill that teaches JSSG, ast-grep, and workflow best practices for writing, reviewing, and debugging safe AST-based code transformations and automated migrations.

About

codemod is an agent skill from pproenca/dot-skills that distills best practices for writing, reviewing, and debugging automated code transformations with Codemod, JSSG, ast-grep, and YAML-driven workflows. It packages 48 prioritized rules across 11 categories spanning AST understanding, pattern efficiency, parsing strategy, node traversal, semantic analysis, edit operations, workflow design, testing, state management, security, and package structure. Developers reach for codemod when authoring new migrations, debugging pattern matching failures, designing CI bulk-refactor pipelines, or auditing transforms for idempotency and cross-file semantic safety. The skill acts as a checklist emphasizing parser selection, batched edits, resumable workflow state, and test fixtures before running transformations on production repositories.

  • codemod

Codemod by the numbers

  • 274 all-time installs (skills.sh)
  • +6 installs in the week ending Aug 4, 2026 (Skillselion tracking)
  • Ranked #1,406 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 codemod

Add your badge

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

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

How do you write safe AST codemod migrations?

Use codemod for development tasks

Who is it for?

Developers building JSSG or ast-grep codemods for large-scale refactors who need safety and performance guardrails.

Skip if: One-off manual edits, runtime application debugging, or OpenAPI client generation tasks covered by Orval skills.

When should I use this skill?

The user writes, reviews, or debugs codemods, ast-grep rules, JSSG transforms, or automated migration workflows.

What you get

Reviewed codemod source, workflow YAML configuration, test fixtures, and validated AST transformation rules.

  • codemod rule set
  • workflow configuration
  • transform test fixtures

By the numbers

  • Contains 48 rules across 11 categories
  • Covers JSSG, ast-grep, and YAML workflow transformations

Files

SKILL.mdMarkdownGitHub ↗

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)

  • `ast-explore-before-writing` - Use AST Explorer before writing patterns
  • `ast-understand-named-vs-anonymous` - Understand named vs anonymous nodes
  • `ast-use-kind-for-precision` - Use kind constraint for precision
  • `ast-field-access-for-structure` - Use field access for structural queries
  • `ast-check-null-before-access` - Check null before property access

2. Pattern Efficiency (CRITICAL)

  • `pattern-use-meta-variables` - Use meta variables for flexible matching
  • `pattern-avoid-overly-generic` - Avoid overly generic patterns
  • `pattern-combine-with-rules` - Combine patterns with rule operators
  • `pattern-use-constraints` - Use constraints for reusable matching logic
  • `pattern-use-relational-patterns` - Use relational patterns for context
  • `pattern-ensure-idempotency` - Ensure patterns are idempotent

3. Parsing Strategy (CRITICAL)

  • `parse-select-correct-parser` - Select the correct parser for file type
  • `parse-handle-embedded-languages` - Handle embedded languages with parseAsync
  • `parse-provide-pattern-context` - Provide context for ambiguous patterns
  • `parse-early-return-non-applicable` - Early return for non-applicable files

4. Node Traversal (HIGH)

  • `traverse-use-find-vs-findall` - Use find() for single match, findAll() for multiple
  • `traverse-single-pass-collection` - Collect multiple patterns in single traversal
  • `traverse-use-stopby-for-depth` - Use stopBy to control traversal depth
  • `traverse-use-siblings-efficiently` - Use sibling navigation efficiently
  • `traverse-cache-repeated-lookups` - Cache repeated node lookups

5. Semantic Analysis (HIGH)

  • `semantic-use-file-scope-first` - Use file scope semantic analysis first
  • `semantic-check-null-results` - Handle null semantic analysis results
  • `semantic-verify-file-ownership` - Verify file ownership before cross-file edits
  • `semantic-cache-cross-file-results` - Cache semantic analysis results

6. Edit Operations (MEDIUM-HIGH)

  • `edit-batch-before-commit` - Batch edits before committing
  • `edit-preserve-formatting` - Preserve surrounding formatting in edits
  • `edit-handle-overlapping-ranges` - Handle overlapping edit ranges
  • `edit-use-flatmap-for-conditional` - Use flatMap for conditional edits
  • `edit-add-imports-correctly` - Add imports at correct position

7. Workflow Design (MEDIUM-HIGH)

  • `workflow-order-nodes-by-dependency` - Order nodes by dependency
  • `workflow-use-matrix-for-parallelism` - Use matrix strategy for parallelism
  • `workflow-use-manual-gates` - Use manual gates for critical steps
  • `workflow-validate-before-run` - Validate workflows before running
  • `workflow-use-conditional-steps` - Use conditional steps for dynamic workflows

8. Testing Strategy (MEDIUM)

  • `test-use-fixture-pairs` - Use input/expected fixture pairs
  • `test-cover-edge-cases` - Cover edge cases in test fixtures
  • `test-use-strictness-levels` - Choose appropriate test strictness level
  • `test-update-fixtures-intentionally` - Update test fixtures intentionally
  • `test-run-on-subset-first` - Test on file subset before full run

9. State Management (MEDIUM)

  • `state-use-for-resumability` - Use state for resumable migrations
  • `state-make-transforms-idempotent` - Make transforms idempotent for safe reruns
  • `state-log-progress-for-observability` - Log progress for long-running migrations

10. Security and Capabilities (LOW-MEDIUM)

  • `security-minimize-capabilities` - Minimize requested capabilities
  • `security-validate-external-inputs` - Validate external inputs before use
  • `security-review-before-running-third-party` - Review third-party codemods before running

11. Package Structure (LOW)

  • `pkg-use-semantic-versioning` - Use semantic versioning for packages
  • `pkg-write-descriptive-metadata` - Write descriptive package metadata
  • `pkg-organize-by-convention` - Organize package by convention

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 complete guide with all rules expanded, see AGENTS.md.

Related skills

How it compares

Pick codemod for AST migration authoring rather than Orval, which focuses on OpenAPI TypeScript client generation.

FAQ

How many rules does the codemod skill include?

The codemod skill includes 48 rules across 11 categories prioritized from CRITICAL AST understanding through LOW package structure. Categories cover pattern efficiency, parsing, traversal, semantics, edits, workflows, testing, state, and security.

What tools does the codemod skill target?

The codemod skill targets Codemod workflows with JSSG and ast-grep for AST-based transformations. It guides parser selection, idempotent edit patterns, YAML workflow orchestration, and test fixture validation for automated migrations.

Backend & APIsbackendintegrations

This week in AI coding

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

unsubscribe anytime.