codemod
БесплатноБез исполняемых скриптовНе проверенCodemod (JSSG, ast-grep, workflows) best practices for writing efficient, safe, and maintainable code transformations. This skill should be used when writing…
от pproenca★ 231 звезда на GitHubОб этом скилле
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
| Priority | Category | Impact | Prefix |
|---|---|---|---|
| 1 | AST Understanding | CRITICAL | ast- |
| 2 | Pattern Efficiency | CRITICAL | pattern- |
| 3 | Parsing Strategy | CRITICAL | parse- |
| 4 | Node Traversal | HIGH | traverse- |
| 5 | Semantic Analysis | HIGH | semantic- |
| 6 | Edit Operations | MEDIUM-HIGH | edit- |
| 7 | Workflow Design | MEDIUM-HIGH | workflow- |
| 8 | Testing Strategy | MEDIUM | test- |
| 9 | State Management | MEDIUM | state- |
| 10 | Security and Capabilities | LOW-MEDIUM | security- |
| 11 | Package Structure | LOW | pkg- |
Quick Reference
1. AST Understanding (CRITICAL)
ast-explore-before-writing- Use AST Explorer before writing patternsast-understand-named-vs-anonymous- Understand named vs anonymous nodesast-use-kind-for-precision- Use kind constraint for precisionast-field-access-for-structure- Use field access for structural queriesast-check-null-before-access- Check null before property access
2. Pattern Efficiency (CRITICAL)
pattern-use-meta-variables- Use meta variables for flexible matchingpattern-avoid-overly-generic- Avoid overly generic patternspattern-combine-with-rules- Combine patterns with rule operatorspattern-use-constraints- Use constraints for reusable matching logicpattern-use-relational-patterns- Use relational patterns for contextpattern-ensure-idempotency- Ensure patterns are idempotent
3. Parsing Strategy (CRITICAL)
parse-select-correct-parser- Select the correct parser for file typeparse-handle-embedded-languages- Handle embedded languages with parseAsyncparse-provide-pattern-context- Provide context for ambiguous patternsparse-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 multipletraverse-single-pass-collection- Collect multiple patterns in single traversaltraverse-use-stopby-for-depth- Use stopBy to control traversal depthtraverse-use-siblings-efficiently- Use sibling navigation efficientlytraverse-cache-repeated-lookups- Cache repeated node lookups
5. Semantic Analysis (HIGH)
semantic-use-file-scope-first- Use file scope semantic analysis firstsemantic-check-null-results- Handle null semantic analysis resultssemantic-verify-file-ownership- Verify file ownership before cross-file editssemantic-cache-cross-file-results- Cache semantic analysis results
6. Edit Operations (MEDIUM-HIGH)
edit-batch-before-commit- Batch edits before committingedit-preserve-formatting- Preserve surrounding formatting in editsedit-handle-overlapping-ranges- Handle overlapping edit rangesedit-use-flatmap-for-conditional- Use flatMap for conditional editsedit-add-imports-correctly- Add imports at correct position
7. Workflow Design (MEDIUM-HIGH)
- [
workflow-order-nodes-by-dependency](references/wo
Установить codemod в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл 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.
Как установить скилл codemod?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл codemod запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic