chore: add write-codemod skill for create-plugin codemods - #2782
Merged
Conversation
jackw
requested review from
Ukochka,
ashharrison90,
joshhunt,
leventebalogh and
toddtreece
and removed request for
a team
July 15, 2026 10:36
leventebalogh
previously approved these changes
Jul 15, 2026
| Use the `yaml` npm package for structured manipulation of `.yml` / `.yaml` files. Never use string replacement on YAML — it breaks on formatting and comment differences. | ||
|
|
||
| ```ts | ||
| import { parseDocument, stringify, visit, YAMLMap, YAMLSeq, Scalar, Pair, type Document } from 'yaml'; |
Collaborator
There was a problem hiding this comment.
Maybe I am wrong here, but looks like type Document is not used in the examples below? Maybe import type visitorFn instead (line 47)?
Collaborator
Author
There was a problem hiding this comment.
You are correct as ever @leventebalogh . Fixed in d417541
leventebalogh
approved these changes
Jul 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does
Adds a
write-codemodClaude Code skill at.claude/skills/write-codemod/, alongside the existingbump-plugin-e2eanddiagnose-plugin-e2e-incompatibilityskills, so every contributor working with an AI agent gets it automatically. It originated as a private skill that has been producing good results; this version is restructured and expanded for shared use.The skill teaches an agent how to author codemods for
packages/create-plugin/src/codemods/:.config/.cprc.json, next-patch versioning)runner.tsexecution pipeline and the reasoning behind the core rules (Context-only file access, graceful degradation, idempotency)schemaexports, debug logging, andrenderTemplatefor scaffolding files from the templatestemplates/(path mapping, Handlebars rendering, divergent user files)toBeIdempotentmatcher, and local verification stepsDetailed per-format manipulation patterns (JSON/JSONC, TypeScript AST via recast, YAML) live in
references/files that agents load only when relevant, keeping the main skill lean.All API signatures and behaviours described in the skill were verified against the current source.
🤖 Generated with Claude Code