npx skills add https://github.com/pproenca/dot-skills --skill codemod适用于 Codemod(JSSG、ast-grep、工作流)的全面最佳实践指南,专为 AI 代理和 LLM 设计。包含 11 个类别共 48 条规则,按影响优先级排序,以指导自动化重构和代码生成。
在以下情况下参考本指南:
| 优先级 | 类别 | 影响 | 前缀 |
|---|---|---|---|
| 1 | AST 理解 | 关键 | ast- |
| 2 | 模式效率 | 关键 | pattern- |
| 3 | 解析策略 | 关键 |
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
parse-| 4 | 节点遍历 | 高 | traverse- |
| 5 | 语义分析 | 高 | semantic- |
| 6 | 编辑操作 | 中高 | edit- |
| 7 | 工作流设计 | 中高 | workflow- |
| 8 | 测试策略 | 中 | test- |
| 9 | 状态管理 | 中 | state- |
| 10 | 安全性与能力 | 低中 | security- |
| 11 | 包结构 | 低 | pkg- |
ast-explore-before-writing - 编写模式前先使用 AST Explorerast-understand-named-vs-anonymous - 理解命名节点与匿名节点ast-use-kind-for-precision - 使用 kind 约束以提高精确度ast-field-access-for-structure - 使用字段访问进行结构查询ast-check-null-before-access - 访问属性前检查 nullpattern-use-meta-variables - 使用元变量进行灵活匹配pattern-avoid-overly-generic - 避免过于通用的模式pattern-combine-with-rules - 使用规则运算符组合模式pattern-use-constraints - 使用约束实现可复用的匹配逻辑pattern-use-relational-patterns - 使用关系模式获取上下文pattern-ensure-idempotency - 确保模式具有幂等性parse-select-correct-parser - 为文件类型选择正确的解析器parse-handle-embedded-languages - 使用 parseAsync 处理嵌入式语言parse-provide-pattern-context - 为模糊模式提供上下文parse-early-return-non-applicable - 对不适用文件提前返回traverse-use-find-vs-findall - 单次匹配用 find(),多次匹配用 findAll()traverse-single-pass-collection - 在单次遍历中收集多个模式traverse-use-stopby-for-depth - 使用 stopBy 控制遍历深度traverse-use-siblings-efficiently - 高效使用兄弟节点导航traverse-cache-repeated-lookups - 缓存重复的节点查找semantic-use-file-scope-first - 优先使用文件范围的语义分析semantic-check-null-results - 处理语义分析结果为 null 的情况semantic-verify-file-ownership - 跨文件编辑前验证文件所有权semantic-cache-cross-file-results - 缓存语义分析结果edit-batch-before-commit - 提交前批量编辑edit-preserve-formatting - 编辑时保留周围的格式edit-handle-overlapping-ranges - 处理重叠的编辑范围edit-use-flatmap-for-conditional - 使用 flatMap 进行条件编辑edit-add-imports-correctly - 在正确位置添加导入workflow-order-nodes-by-dependency - 按依赖关系排序节点workflow-use-matrix-for-parallelism - 使用矩阵策略实现并行workflow-use-manual-gates - 对关键步骤使用手动门控workflow-validate-before-run - 运行前验证工作流workflow-use-conditional-steps - 使用条件步骤实现动态工作流test-use-fixture-pairs - 使用输入/预期夹具对test-cover-edge-cases - 在测试夹具中覆盖边界情况test-use-strictness-levels - 选择合适的测试严格级别test-update-fixtures-intentionally - 有意识地更新测试夹具test-run-on-subset-first - 完整运行前先在文件子集上测试state-use-for-resumability - 使用状态实现可恢复的迁移state-make-transforms-idempotent - 使转换具有幂等性以确保安全重试state-log-progress-for-observability - 记录长时迁移的进度以便观察security-minimize-capabilities - 最小化请求的能力security-validate-external-inputs - 使用前验证外部输入security-review-before-running-third-party - 运行第三方 codemod 前进行审查pkg-use-semantic-versioning - 对包使用语义化版本控制pkg-write-descriptive-metadata - 编写描述性的包元数据pkg-organize-by-convention - 按约定组织包结构阅读各个参考文件以获取详细解释和代码示例:
要查看包含所有规则详情的完整指南,请参阅 AGENTS.md。
每周安装数
94
代码仓库
GitHub 星标数
86
首次出现
2026年1月22日
安全审计
安装于
codex80
gemini-cli77
opencode75
cursor74
claude-code73
github-copilot72
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.
Reference these guidelines when:
| 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- |
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 accesspattern-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 contextparse-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 filestraverse-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 lookupssemantic-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 resultsedit-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 positionworkflow-order-nodes-by-dependency - Order nodes by dependencyworkflow-use-matrix-for-parallelism - Use matrix strategy for parallelismworkflow-use-manual-gates - Use manual gates for critical stepsworkflow-validate-before-run - Validate workflows before runningworkflow-use-conditional-steps - Use conditional steps for dynamic workflowstest-use-fixture-pairs - Use input/expected fixture pairstest-cover-edge-cases - Cover edge cases in test fixturestest-use-strictness-levels - Choose appropriate test strictness leveltest-update-fixtures-intentionally - Update test fixtures intentionallytest-run-on-subset-first - Test on file subset before full runstate-use-for-resumability - Use state for resumable migrationsstate-make-transforms-idempotent - Make transforms idempotent for safe rerunsstate-log-progress-for-observability - Log progress for long-running migrationssecurity-minimize-capabilities - Minimize requested capabilitiessecurity-validate-external-inputs - Validate external inputs before usesecurity-review-before-running-third-party - Review third-party codemods before runningpkg-use-semantic-versioning - Use semantic versioning for packagespkg-write-descriptive-metadata - Write descriptive package metadatapkg-organize-by-convention - Organize package by conventionRead individual reference files for detailed explanations and code examples:
For a complete guide with all rules expanded, see AGENTS.md.
Weekly Installs
94
Repository
GitHub Stars
86
First Seen
Jan 22, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
codex80
gemini-cli77
opencode75
cursor74
claude-code73
github-copilot72
通过 LiteLLM 代理让 Claude Code 对接 GitHub Copilot 运行 | 高级变通方案指南
43,100 周安装
pattern-ensure-idempotency