Skip to content

feat: add validate-codemod-recipe agent skill#94

Merged
schultzp2020 merged 2 commits into
mainfrom
feat/validate-codemod-recipe-skill
Jun 3, 2026
Merged

feat: add validate-codemod-recipe agent skill#94
schultzp2020 merged 2 commits into
mainfrom
feat/validate-codemod-recipe-skill

Conversation

@schultzp2020

Copy link
Copy Markdown
Contributor

What

Adds the validate-codemod-recipe agent skill to .agents/skills/. This skill captures the iterative workflow for validating codemod migration recipes by running them against a real codebase and fixing issues found in the output.

Why

Running codemods against a real monorepo like backstage/backstage surfaces bugs that unit tests miss — false positives, broken references, type/value mismatches, and redundant transforms. This workflow was developed while QA-ing the v1.51.0 migration recipe (see #93) and is now codified as a reusable skill.

The workflow

run codemod → lint → inspect diffs → identify issues → fix AST transform
→ add test fixtures → run codemod tests → reset target & re-run → iterate

What the skill covers

  • Inputs: codemod path + target directory
  • Issue taxonomy: false positives, redundant transforms, broken references, type/value mismatch, formatting damage, dangling artifacts
  • Fix patterns: parent-kind guards, type-annotation checks, empty destructuring cleanup, declaration preservation
  • Test conventions: positive + negative fixtures, metrics.json format
  • Pitfalls: yarn dlx usage, registry vs local sources, --target semantics, metrics trailing newlines, lint-staged interference

Adds an agent skill that captures the iterative workflow for validating
codemod migration recipes against a real codebase:

  run codemod → lint → inspect diffs → identify issues → fix AST
  transform → add test fixtures → run codemod tests → reset & re-run

Includes a taxonomy of common codemod bugs (false positives, redundant
transforms, broken references, type/value mismatch, formatting damage,
dangling artifacts) and concrete fix patterns for each.
- Add decision framework for when to fix vs skip: generic fixes that
  improve the codemod for any consumer vs repo-specific patches
- Add diagnostic signals section: using metrics output to detect false
  positives, verifying modified files actually reference the target type,
  tracking diff count between runs

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new agent skill, validate-codemod-recipe, under .agents/skills/ to document a repeatable QA workflow for running codemod migration recipes against a real target repo, inspecting diffs, and iterating on fixes + fixtures until output is clean.

Changes:

  • Introduces the validate-codemod-recipe skill with an end-to-end validation loop (run → lint → diff review → fix transform → add fixtures → re-run).
  • Documents a concrete issue taxonomy (false positives, broken references, type/value mismatches, formatting damage, dangling artifacts) plus common remediation patterns.
  • Defines fixture/test expectations (positive/negative fixtures, optional metrics.json rules) and operational pitfalls (registry vs local sources, --target semantics, lint-staged/prettier interference).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +22 to +26
| Input | Example | Required |
| ---------------- | ----------------------------------------------- | -------- |
| Codemod path | `../codemods/codemods/v1.51.0/migration-recipe` | Yes |
| Target directory | `packages`, `plugins`, or `.` | Yes |

@schultzp2020 schultzp2020 merged commit 6d650da into main Jun 3, 2026
3 checks passed
@schultzp2020 schultzp2020 deleted the feat/validate-codemod-recipe-skill branch June 3, 2026 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants