Individual skill
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.
skills/.experimental/codemod/SKILL.md
Source commit cf93c57cac89d6fc3e4194686000411567f5caf3
What was checked
- Matches the observed repository HEAD
- Yes
- Scanner rules are current
- No
- Repository scan complete
- No
- Skill scan complete
- No
- Observed behavior
- Not checked yet
- Last checked
- Nov 5, 2026
These are observations at the recorded commit, not a guarantee of safety. Review the source before running it.
Install this skill
Choose an agent in your Stack or copy a command below. Commands fetch the pinned commit and copy only this skill directory. Existing destinations are refused. Copying a command does not install anything.
An install command is unavailable: current rules, complete repository and skill scans, an eligible behavior level and a permitted license are required.
Repository context
- Repository stars (not skill ratings)
- 222
- Repository last updated
- Aug 15, 2026
- License
- MIT
Observed agent integration: codex
Files and excerpt
File metadata and permitted, redacted excerpts come from the recorded scan. Source links are pinned to that commit.
Browse files
AGENTS.mddoc · 10,194 bytesREADME.mddoc · 4,536 bytesSKILL.mdcore · 8,129 bytesSKILL.mdcore · 8,129 bytesassets/templates/_template.mddoc · 871 bytesmetadata.jsonasset · 943 bytesreferences/_sections.mddoc · 2,519 bytesreferences/ast-check-null-before-access.mddoc · 1,808 bytesreferences/ast-explore-before-writing.mddoc · 1,499 bytesreferences/ast-field-access-for-structure.mddoc · 1,709 bytesreferences/ast-understand-named-vs-anonymous.mddoc · 1,509 bytesreferences/ast-use-kind-for-precision.mddoc · 1,441 bytesreferences/edit-add-imports-correctly.mddoc · 2,185 bytesreferences/edit-batch-before-commit.mddoc · 1,738 bytesreferences/edit-handle-overlapping-ranges.mddoc · 2,153 bytesreferences/edit-preserve-formatting.mddoc · 2,226 bytesreferences/edit-use-flatmap-for-conditional.mddoc · 2,039 bytesreferences/parse-early-return-non-applicable.mddoc · 2,056 bytesreferences/parse-handle-embedded-languages.mddoc · 2,236 bytesreferences/parse-provide-pattern-context.mddoc · 1,920 bytesreferences/parse-select-correct-parser.mddoc · 1,886 bytesreferences/pattern-avoid-overly-generic.mddoc · 1,518 bytesreferences/pattern-combine-with-rules.mddoc · 1,825 bytesreferences/pattern-ensure-idempotency.mddoc · 2,009 bytesreferences/pattern-use-constraints.mddoc · 1,749 bytesreferences/pattern-use-meta-variables.mddoc · 1,607 bytesreferences/pattern-use-relational-patterns.mddoc · 1,729 bytesreferences/pkg-organize-by-convention.mddoc · 1,904 bytesreferences/pkg-use-semantic-versioning.mddoc · 1,718 bytesreferences/pkg-write-descriptive-metadata.mddoc · 1,735 bytesreferences/security-minimize-capabilities.mddoc · 1,723 bytesreferences/security-review-before-running-third-party.mddoc · 1,756 bytesreferences/security-validate-external-inputs.mddoc · 1,876 bytesreferences/semantic-cache-cross-file-results.mddoc · 2,370 bytesreferences/semantic-check-null-results.mddoc · 2,094 bytesreferences/semantic-use-file-scope-first.mddoc · 2,158 bytesreferences/semantic-verify-file-ownership.mddoc · 2,314 bytesreferences/state-log-progress-for-observability.mddoc · 1,998 bytesreferences/state-make-transforms-idempotent.mddoc · 1,891 bytesreferences/state-use-for-resumability.mddoc · 1,742 bytesreferences/test-cover-edge-cases.mddoc · 1,873 bytesreferences/test-run-on-subset-first.mddoc · 1,618 bytesreferences/test-update-fixtures-intentionally.mddoc · 1,663 bytesreferences/test-use-fixture-pairs.mddoc · 1,680 bytesreferences/test-use-strictness-levels.mddoc · 1,808 bytesreferences/traverse-cache-repeated-lookups.mddoc · 1,893 bytesreferences/traverse-single-pass-collection.mddoc · 1,988 bytesreferences/traverse-use-find-vs-findall.mddoc · 1,513 bytesreferences/traverse-use-siblings-efficiently.mddoc · 1,803 bytesreferences/traverse-use-stopby-for-depth.mddoc · 1,792 bytesreferences/workflow-order-nodes-by-dependency.mddoc · 1,819 bytesreferences/workflow-use-conditional-steps.mddoc · 2,014 bytesreferences/workflow-use-manual-gates.mddoc · 1,840 bytesreferences/workflow-use-matrix-for-parallelism.mddoc · 2,015 bytesreferences/workflow-validate-before-run.mddoc · 1,547 bytes
Read excerpt
# 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